當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Generic::homeSearchType方法代碼示例

本文整理匯總了PHP中Generic::homeSearchType方法的典型用法代碼示例。如果您正苦於以下問題:PHP Generic::homeSearchType方法的具體用法?PHP Generic::homeSearchType怎麽用?PHP Generic::homeSearchType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Generic的用法示例。


在下文中一共展示了Generic::homeSearchType方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDynamicHomeResults

 public function getDynamicHomeResults()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $searchType = Generic::mustCheck($_GET['search_type'], "No Search Type");
     $searchTerm = Generic::mustCheck($_GET['search_term'], "No Search Term");
     if ($searchType == "4" || $searchType == "6") {
         $query = Generic::mustCheck($_GET['query'], "Query Required");
     } else {
         $query = isset($_GET['query']) ? $_GET['query'] : "";
     }
     $page = addslashes($_GET['page']);
     if ($page == "" || $page < 1) {
         Generic::errorMsg("No Page Found");
     }
     $limit = addslashes($_GET['limit']);
     if ($limit == "" || $limit < 1) {
         Generic::errorMsg("Limit Error");
     }
     $begin = ($page - 1) * $limit;
     $extraQ = " LIMIT {$begin},{$limit}";
     $key = "key";
     $results = array();
     switch ($searchType) {
         case "0":
             break;
         case "1":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("restaurant_type='{$searchTerm}' ORDER BY id_restaurant DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "2":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("'{$searchTerm}' IN (restaurant_tags) id_restaurant DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "3":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("id_cuisine='{$searchTerm}' id_restaurant DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "4":
             $resto = new MasterRestaurantModel();
             $results = $resto->getWhere("name LIKE '%{$query}%' id_restaurant DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $resto->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $resto->crud_add_photourl;
             $key = "restaurant";
             break;
         case "5":
             $dish = new MasterDishModel();
             $results = $dish->getWhere("'{$searchTerm}' IN (dish_tags) id_dish DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $dish->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $dish->crud_add_photourl;
             $key = "dish";
             break;
         case "6":
             $dish = new MasterDishModel();
             $results = $dish->getWhere("name LIKE '%{$query}%' id_dish DESC {$extraQ}");
             $exp = explode(",", str_replace(" ", "", $dish->crud_webservice_allowed));
             $arrPicsToAddPhotoUrl = $dish->crud_add_photourl;
             $key = "dish";
             break;
         case "8888":
             break;
         default:
             break;
     }
     $json["results"][$key] = array();
     foreach ($results as $o) {
         $sem = array();
         foreach ($exp as $attr) {
             if (in_array($attr, $arrPicsToAddPhotoUrl)) {
                 $sem[$attr] = Generic::insertImageUrl($o->{$attr});
             } else {
                 $sem[$attr] = stripslashes($o->{$attr});
             }
         }
         //            $sem["jarak"] = $jarak = $this->getDistance($lat, $long, $o->latitude, $o->longitude, "K");
         $json["results"]["search_type"] = Generic::homeSearchType($searchType);
         $json["results"][$key][] = $sem;
     }
     echo json_encode($json);
     die;
 }
開發者ID:CapsuleCorpIndonesia,項目名稱:martabak_revolution,代碼行數:91,代碼來源:MasterRestaurant.php


注:本文中的Generic::homeSearchType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。