当前位置: 首页>>代码示例>>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;未经允许,请勿转载。