本文整理汇总了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;
}