本文整理汇总了PHP中Generic::errorMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP Generic::errorMsg方法的具体用法?PHP Generic::errorMsg怎么用?PHP Generic::errorMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generic
的用法示例。
在下文中一共展示了Generic::errorMsg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: acceptInvitation
public function acceptInvitation()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$json = array();
$json['status_code'] = 1;
$id_invitation = Generic::mustCheck($_GET['id_invitation'], "NO ID User found!");
if (!$id_invitation) {
Generic::errorMsg("NO ID Invitation found!");
}
$objInvitation = new InvitationModel();
$objInvitation->getByID($id_invitation);
$objInvitation->status = 1;
$objInvitation->load = 1;
$id = $objInvitation->save();
if ($id != "") {
$json['status_code'] = 1;
$json['status_message'] = "Link is activate!";
} else {
$json['status_code'] = 0;
$json['status_message'] = "Link is expired!";
}
echo json_encode($json);
die;
}
示例2: recommendationRestoWS
public function recommendationRestoWS()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$lat = isset($_GET['latitude']) ? addslashes($_GET['latitude']) : "";
if ($lat == "" or !$lat) {
$lat = MenuRevoConstants::$latitude;
}
if (!Generic::checkLatitude($lat)) {
Generic::errorMsg("Latitude must be Numeric!");
}
$long = isset($_GET['longitude']) ? addslashes($_GET['longitude']) : "";
if ($long == "" or !$long) {
$long = MenuRevoConstants::$longitude;
}
if (!Generic::checklongitude($long)) {
Generic::errorMsg("Longitude must be Numeric!");
}
$distance = isset($_GET['distance']) ? addslashes($_GET['distance']) : 20;
if ($distance == '') {
$distance = 20;
}
$page = addslashes($_GET['page']);
if ($page == "" || $page < 1) {
$json['status_code'] = 0;
$json['status_message'] = "No Page Found";
echo json_encode($json);
die;
}
$limit = addslashes($_GET['limit']);
if ($limit == "" || $limit < 1) {
$json['status_code'] = 0;
$json['status_message'] = "Limit Error";
echo json_encode($json);
die;
}
$begin = ($page - 1) * $limit;
$json = array();
$json['status_code'] = 1;
global $db;
$objRecommendation = new RecommendationModel();
$objRestaurant = new MasterRestaurantModel();
$qdish = "SELECT recom.*, SQRT(POW(69.1 * (resto.latitude - {$lat}), 2) + POW(69.1 * ({$long} - resto.longitude) * COS(resto.latitude / 57.3), 2)) AS distance FROM {$objRecommendation->table_name} recom LEFT JOIN {$objRestaurant->table_name} resto ON resto.id_restaurant= recom.id_restaurant AND DATE(recom.end) >= DATE(NOW()) AND DATE(recom.start)<= DATE(NOW())HAVING distance < {$distance} ORDER BY distance LIMIT {$begin},{$limit}";
$arrRecom = $db->query($qdish, 2);
// if (count($arrRecom) == 0) {
// $json['status_code'] = 0;
// $json['status_message'] = "No ID Found";
// echo json_encode($json);
// die();
// }
$json['results']['restaurant'] = array();
foreach ($arrRecom as $recom) {
$resto = Generic::getRestaurant($recom->id_restaurant);
$resto['distance'] = $recom->distance;
$json['results']['restaurant'][] = $resto;
}
echo json_encode($json);
die;
}
示例3: changeStatusProgress
public function changeStatusProgress()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$json = array();
$json['status_code'] = 1;
$id_order_detail = isset($_GET['id_order_detail']) ? addslashes($_GET['id_order_detail']) : "";
if (!$id_order_detail) {
Generic::errorMsg("id order detail not found!");
}
$objOrderDetail = new OrderDetailModel();
$objOrderDetail->getByID($id_order_detail);
if ($objOrderDetail->id_order == "") {
Generic::errorMsg("id order detail not found!");
}
$statusProgress = intval($objOrderDetail->status_progress);
if ($statusProgress == 2) {
Generic::errorMsg("Status is " . $statusProgress);
}
$statusProgress = $statusProgress + 1;
$objOrderDetail->status_progress = strval($statusProgress);
$objOrderDetail->load = 1;
$objOrderDetail->save();
$json['results'] = $statusProgress;
echo json_encode($json);
die;
}
示例4: mustCheck
public static function mustCheck($what, $errorMsg)
{
if (!isset($what) || $what == null) {
Generic::errorMsg($errorMsg);
} else {
return addslashes($what);
}
}
示例5: extraMenu
public function extraMenu()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$objHS = new HomeSettingModel();
$json = array();
$json['status_code'] = 1;
$search_type = isset($_GET['search_type']) ? addslashes($_GET['search_type']) : "";
if (!$search_type) {
Generic::errorMsg("Search Type is blank!");
}
$search_term = isset($_GET['search_term']) ? addslashes($_GET['search_term']) : "";
if (!search_term) {
Generic::errorMsg("Search Term is blank!");
}
}
示例6: setCashOutPaid
public function setCashOutPaid()
{
$idRequest = Generic::mustCheck($_GET['id_request'], "Required ID Request");
$cashOutModel = new MasterCashOutRequestModel();
$cashOutModel->getByID($idRequest);
$restoTrans = new MasterRestoTransactionModel();
$arrRestoTrans = $restoTrans->getWhere("type_transaction = '2' AND id_request = '{$idRequest}'");
if (count($arrRestoTrans) <= 0) {
Generic::errorMsg("Transaction not found");
}
if ($cashOutModel->status == "1") {
Generic::errorMsg("This Request Already Paid");
}
$rt = new MasterRestoTransactionModel();
$rt->getByID($arrRestoTrans[0]->id_transaction);
$rt->approved = "1";
$rt->save();
$cashOutModel->status = "1";
$cashOutModel->save();
$json['status_code'] = 1;
$json['status_message'] = "Request status set to Paid";
echo json_encode($json);
die;
}
示例7: payViaCreditCard
public static function payViaCreditCard($idOrder, $idUser = "")
{
$restoInitiate = Generic::IsNullOrEmptyString($idUser);
$userInitiate = !$restoInitiate;
$order = new MasterOrderModel();
$order->getByID($idOrder);
//KALO USER INITIATE CEK APA DIA LEADER
if ($userInitiate) {
$user = new UserModel();
$user->getByID($idUser);
if (!Util::isLeader($idOrder, $idUser)) {
Generic::errorMsg(Keys::$ERR_PAYMENT_NOT_LEADER);
}
} else {
$idUser = $order->id_user;
$user = new UserModel();
$user->getByID($idUser);
}
//CEK APA PEMBAYARAN PAKE CREDIT CARD
if ($order->payment_method != Keys::$PAYMENT_TYPE_CREDIT_CARD) {
Generic::errorMsg("This Order Not Using Credit Card as Payment Method");
}
Doku_Initiate::$sharedKey = "iMdRs8Iz987Z";
Doku_Initiate::$mallId = "3199";
$invoice = new Invoice($idOrder, true);
$params = array('amount' => Generic::dokuMoneyValue($invoice->grandTotal), 'invoice' => $idOrder, 'currency' => '360');
$detailOrders = $invoice->orderDetails;
$basket = array();
foreach ($detailOrders as $detailOrder) {
$b = array();
$b['name'] = $detailOrder->name_dish;
$b['amount'] = Generic::dokuMoneyValue($detailOrder->single_price);
$b['quantity'] = $detailOrder->quantity;
$b['subtotal'] = Generic::dokuMoneyValue($detailOrder->price);
$basket[] = $b;
}
$words = Doku_Library::doCreateWords($params);
$customer = array('name' => $user->full_name, 'data_phone' => $user->phone_no, 'data_email' => $user->email, 'data_address' => $user->district . ',' . $user->city);
// $basket[] = array(
// 'name' => 'sayur',
// 'amount' => '10000.00',
// 'quantity' => '1',
// 'subtotal' => '10000.00'
// );
// $basket[] = array(
// 'name' => 'buah',
// 'amount' => '10000.00',
// 'quantity' => '1',
// 'subtotal' => '10000.00'
// );
$dataPayment = array('req_mall_id' => Doku_Initiate::$mallId, 'req_chain_merchant' => 'NA', 'req_amount' => $params['amount'], 'req_words' => $words, 'req_purchase_amount' => $params['amount'], 'req_trans_id_merchant' => $params['invoice'], 'req_request_date_time' => date('YmdHis'), 'req_currency' => '360', 'req_purchase_currency' => '360', 'req_session_id' => sha1(date('YmdHis')), 'req_name' => $customer['name'], 'req_payment_channel' => '15', 'req_email' => $customer['data_email'], 'req_basket' => $basket, 'req_address' => $customer['data_address'], 'req_token_payment' => $user->payment_token, 'req_customer_id' => $idUser);
$response = Doku_Api::doDirectPayment($dataPayment);
if ($response->res_response_code == '0000') {
$status = "SUCCESS";
$order->status_payment = Keys::$PAYMENT_STATUS_PAID;
$order->isPaid = Keys::$YES;
$order->load = 1;
$order->save();
//success
$trans = new MasterRestoTransactionModel();
$trans->id_restaurant = $order->id_restaurant;
$trans->id_request = $order->id_order;
$trans->gross_amount = $invoice->grandTotal;
$trans->type_transaction = "1";
$trans->datetime_transaction = leap_mysqldate();
$trans->approved = "1";
$trans->mr_fee = $invoice->valFeeMR;
//doubleval($order->mr_fee);//((double)($arrOrder[0]->grand_total * $resto->mr_fee)) / 100;
//TODO LATER CHANGE 3 (BANK FEE) INTO GLOBAL VAR
$trans->other_fee = 0;
//((double)($arrOrder[0]->grand_total * $resto->cc_fee)) / 100;
$trans->bank_disc = $invoice->valDiscBank;
//doubleval($order->disc_bank);//$objOrder->disc_bank;
$valNetAmount = doubleval($trans->gross_amount - $trans->mr_fee - $trans->other_fee + $trans->bank_disc);
$trans->net_amount = $valNetAmount;
$trans->save();
//reset user credit to 0
$user = new UserModel();
$user->getByID($idUser);
$user->credit = 0;
$user->save();
} else {
$status = "FAILED";
}
$results['status'] = $status;
$results['res_token_id'] = $user->payment_token;
$results['invoice_no'] = $idOrder;
$results['id_user'] = $idUser;
$results['res_response_code'] = $response->res_response_code;
$results['doku_results'] = $response;
// $results['data_payment'] = $dataPayment;
// pr($results);
if ($status == "SUCCESS") {
return array("success" => 1, $results);
} else {
return array("success" => 0, $results);
}
// Generic::finish($results);
}
示例8: setRestoCategories
public function setRestoCategories()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$json = array();
$json['status_code'] = 1;
$id_restaurant = isset($_POST['id_restaurant']) ? addslashes($_POST['id_restaurant']) : "";
if (!$id_restaurant) {
Generic::errorMsg("Restaurant ID not Found");
}
$category = isset($_POST['categories']) ? $_POST['categories'] : "";
if (!$category) {
Generic::errorMsg("Category ID not found!");
}
$resto = new MasterRestaurantModel();
$resto->getByID($id_restaurant);
$arrOldCategories = explode(",", $resto->id_categories);
$jsonCategories = json_decode($category);
$jsonCategorieshlp = array();
foreach ($jsonCategories as $cat) {
$jsonCategorieshlp[] = $cat->category_name;
}
if (!in_array("OTHERS", $jsonCategorieshlp)) {
$jsonCategorieshlp[] = "OTHERS";
}
$jsonCategorieshlp = array_unique($jsonCategorieshlp);
$objCategory = new MasterCategoryModel();
$idCategories = array();
foreach ($jsonCategorieshlp as $category) {
$arrCategory = $objCategory->getWhere("name = '{$category}'");
if (count($arrCategory) == 0 && !Generic::IsNullOrEmptyString($category)) {
$oc = new MasterCategoryModel();
$oc->name = strtoupper($category);
$oc->status = "1";
$oc->is_drink = "0";
$oc->save();
}
}
foreach ($jsonCategorieshlp as $category) {
$arrCategory = $objCategory->getWhere("name = '{$category}'");
foreach ($arrCategory as $val) {
$idCategories[] = $val->id_category;
}
}
//compare old categories to new categories
//cari yang dulu ada sekarang ga ada
//migrasi dish ke others
$missingCategories = array_diff($arrOldCategories, $idCategories);
foreach ($missingCategories as $category) {
$d = new MasterDishModel();
$arrDishes = $d->getWhere("id_category = '{$category}' AND id_restaurant = '{$id_restaurant}'");
foreach ($arrDishes as $dish) {
$dish->load = 1;
$dish->id_category = "0";
$dish->save();
}
}
$objRestaurant = new MasterRestaurantModel();
$arrResto = $objRestaurant->getWhere("id_restaurant = '{$id_restaurant}'");
if (count($arrResto) == 0) {
$json['status_code'] = 0;
$json['status_message'] = "No ID Found";
echo json_encode($json);
die;
}
$idCategories = implode(",", $idCategories);
$arrResto[0]->id_categories = $idCategories;
$arrResto[0]->load = 1;
$idSave = $arrResto[0]->save();
if (!$idSave) {
Generic::errorMsg(Lang::t('save failed'));
} else {
$json['status_code'] = 1;
$json['results'] = "Success";
}
echo json_encode($json);
die;
}
示例9: updateStatusProgress
public function updateStatusProgress()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$idDish = $_GET["id_dish"];
$idOrder = $_GET["id_order"];
$idResto = $_GET["id_restaurant"];
//TODO cek id_resto di order header apakah sama degan $Resto
$objOrder = new MasterOrderModel();
$arrOrder = $objOrder->getWhere("id_order='{$idOrder}' AND order_now='1' AND status_payment='0'");
// $objOrder->getByID($idOrder);
if ($arrOrder[0]->id_restaurant != $idResto) {
Generic::errorMsg("ID Resto in Order is not same as id resto!");
}
$resto = new MasterRestaurantModel();
$resto->getByID($idResto);
$od = new OrderDetailModel();
$arrOrDetails = $od->getWhere("id_order='{$idOrder}' AND id_dish='{$idDish}' AND status_progress > 3");
Generic::checkCountWithMsg($arrOrDetails, "Dish already out!");
//pr($arrOrDetails);
foreach ($arrOrDetails as $oDetails) {
if ($oDetails->status_progress < 2) {
pr($oDetails->status_progress);
$oDetails->status_progress = $oDetails->status_progress + 1;
$oDetails->load = 1;
$oDetails->save();
$sp = $oDetails->status_progress;
} else {
//TODO ERROR order already out
}
}
$order = $this->updateOrderHeaderStatusProgress($idOrder);
$ids = $order->user_guest_id + "," + $order->id_user;
$msg = "Your ";
if ($order->type_order == "0") {
$msg .= "Dine In ";
} elseif ($order->type_order == "3") {
$msg .= "Take Away ";
} else {
$json["status_code"] = 1;
$json["results"]["id_dish"] = $idDish;
$json["results"]["id_order"] = $idDish;
$json["results"]["id_restaurant"] = $idDish;
$json["results"]["status_progress"] = $sp;
$json["results"]["order_status_progress"] = $order->status_progress;
echo json_encode($json);
die;
}
$msg .= "order's status at {$resto->name} has been updated";
$j["id_order"] = $idOrder;
$json = json_encode($j);
$_POST["ids"] = $ids;
$_POST["msg"] = $msg;
$_POST["json"] = $json;
$_POST["type"] = 41;
$p = new PushTo();
$p->users();
echo json_encode($json);
die;
}
示例10: setRestoCategories
public function setRestoCategories()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$idRestaurant = Generic::mustCheck($_POST['id_restaurant'], Keys::$ERR_NOT_FOUND_ID_RESTAURANT);
$category = Generic::mustCheck($_POST['categories'], Keys::$ERR_NOT_FOUND_CATEGORIES);
//category yang di passing harus berupa JSON ARRAY
$arrNewCategory = json_decode($category);
foreach ($arrNewCategory as $newCategory) {
echo $newCategory->category_name . "<br>";
}
die;
$json = array();
$json['status_code'] = 1;
$id_restaurant = isset($_POST['id_restaurant']) ? addslashes($_POST['id_restaurant']) : "";
if (!$id_restaurant) {
Generic::errorMsg("Restaurant ID not Found");
}
$category = isset($_POST['categories']) ? $_POST['categories'] : "";
if (!$category) {
Generic::errorMsg("Category ID not found!");
}
$resto = new MasterRestaurantModel();
$resto->getByID($id_restaurant);
$arrOldCategories = explode(",", $resto->id_categories);
$other = '[{"category_name":"OTHERS"}]';
$other = json_decode($other);
$jsonCategories = json_decode($category);
foreach ($jsonCategories as $cat) {
$jsonCategorieshlp[] = $cat->category_name;
}
if (!in_array("OTHERS", $jsonCategorieshlp)) {
$jsonCategories[]['category_name'] = "OTHERS";
}
$objCategory = new MasterCategoryModel();
$idCategories = array();
foreach ($jsonCategories as $category) {
$arrCategory = $objCategory->getWhere("name = '{$category->category_name}'");
if (count($arrCategory) == 0) {
if (strtoupper($category->category_name) != strtoupper("OTHERS")) {
$objCategory->name = strtoupper($category->category_name);
// echo $objCategory->name;
$objCategory->status = "1";
$objCategory->is_drink = "0";
$objCategory->save();
}
}
}
foreach ($jsonCategories as $category) {
$arrCategory = $objCategory->getWhere("name = '{$category->category_name}'");
foreach ($arrCategory as $val) {
$idCategories[] = $val->id_category;
}
}
//compare old categories to new categories
//cari yang dulu ada sekarang ga ada
//migrasi dish ke others
$missingCategories = array_diff($arrOldCategories, $idCategories);
foreach ($missingCategories as $category) {
$d = new MasterDishModel();
$arrDishes = $d->getWhere("id_category = '{$category}' AND id_restaurant = '{$id_restaurant}'");
foreach ($arrDishes as $dish) {
$dish->load = 1;
$dish->id_category = "0";
$dish->save();
}
}
$objRestaurant = new MasterRestaurantModel();
$arrResto = $objRestaurant->getWhere("id_restaurant = '{$id_restaurant}'");
if (count($arrResto) == 0) {
$json['status_code'] = 0;
$json['status_message'] = "No ID Found";
echo json_encode($json);
die;
}
$idCategories = implode(",", $idCategories);
$arrResto[0]->id_categories = $idCategories;
$arrResto[0]->load = 1;
$idSave = $arrResto[0]->save();
if (!$idSave) {
Generic::errorMsg(Lang::t('save failed'));
} else {
$json['status_code'] = 1;
$json['results'] = "Success";
}
echo json_encode($json);
die;
}
示例11: updateRestoMRFee
public function updateRestoMRFee()
{
$idsResto = Generic::mustCheck($_POST['id_restaurant'], "No Restaurant IDs Found");
$fee = Generic::mustCheck($_POST['fee'], "No Fee Found");
if (!is_numeric($fee)) {
Generic::errorMsg("Fee Must Numbers");
}
if (doubleval($fee) > 100) {
Generic::errorMsg("Fee Max 100%");
}
$ids = explode(',', $idsResto);
if (count($ids) <= 0) {
Generic::errorMsg("Empty Id");
}
$updateAll = in_array('0', $ids);
if ($updateAll) {
$r = new MasterRestaurantModel();
$arrR = $r->getAll();
foreach ($arrR as $singleR) {
unset($resto);
$resto = new MasterRestaurantModel();
$resto->getByID($singleR->id_restaurant);
$log = new LogDiscFeeModel();
$log->id_reference = $singleR->id_restaurant;
$log->change_type = "Fee MR";
$log->change_from = Generic::IsNullOrEmptyString($resto->mr_fee) ? "0" : $resto->mr_fee;
$log->change_to = $fee;
$log->change_date_time = leap_mysqldate();
$log->save();
$resto->mr_fee = $fee;
$resto->save();
}
} else {
foreach ($ids as $id) {
unset($resto);
$resto = new MasterRestaurantModel();
$resto->getByID($id);
$log = new LogDiscFeeModel();
$log->id_reference = $id;
$log->change_type = "Fee MR";
$log->change_from = Generic::IsNullOrEmptyString($resto->mr_fee) ? "0" : $resto->mr_fee;
$log->change_to = $fee;
$log->change_date_time = leap_mysqldate();
$log->save();
$resto->mr_fee = $fee;
$resto->save();
}
}
$json['status_code'] = 1;
$json['status_message'] = "success";
echo json_encode($json);
die;
}
示例12: clearTable
public function clearTable()
{
$idTable = Generic::mustCheck($_GET['id_table']);
$d = Util::clearTable($idTable);
if ($d) {
Generic::finish($d);
} else {
Generic::errorMsg("Failed");
}
}
示例13: settlePayment
public function settlePayment()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$id_order = $_GET["id_order"];
$id_user = $_GET["id_user"];
$user = new UserModel();
$user->getByID($id_user);
$order = new MasterOrderModel();
$order->getByID($id_order);
$objResto = new MasterRestaurantModel();
$objResto->getByID($order->id_restaurant);
if ($user->payment_id == null || $user->payment_id == "0") {
Generic::errorMsg("No Payment Method");
}
try {
$result = Braintree_PaymentMethodNonce::create($user->braintree_id);
$nonce = $result->paymentMethodNonce->nonce;
$resultSale = Braintree_Transaction::sale(['amount' => $order->grand_total, 'paymentMethodNonce' => $nonce, 'options' => ['submitForSettlement' => True]]);
} catch (Exception $e) {
Generic::errorMsg($e->getMessage());
}
// $transaction = $resultSale->transaction;
// $order->transaction_id = $transaction->id;
// $order->load = 1;
// $order->status_payment = '1';
// $orderObj->nonce_cc = $nonce;
// $order->isPaid = '1';
// $order->save();
pr($resultSale);
// $json['results'] = "Your Payment was successful with ID Order " . $id_order;
// echo json_encode($json);
//,
// 'descriptor' => [
// 'name' => $objResto->name . " - " . $objResto->order_number
// ]
// die();
}
示例14: searchDish
public function searchDish()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$resto = "resto";
$json = array();
$json['status_code'] = 1;
$search = isset($_GET['name']) ? addslashes($_GET['name']) : "";
$lat = isset($_GET['latitude']) ? addslashes($_GET['latitude']) : "";
if ($lat == "" or !$lat) {
$lat = MenuRevoConstants::$latitude;
}
if (!Generic::checkLatitude($lat)) {
Generic::errorMsg("Latitude must be Numeric!");
}
$long = isset($_GET['longitude']) ? addslashes($_GET['longitude']) : "";
if ($long == "" or !$long) {
$long = MenuRevoConstants::$longitude;
}
if (!Generic::checklongitude($long)) {
Generic::errorMsg("Longitude must be Numeric!");
}
$nearby = isset($_GET['nearby']) ? addslashes($_GET['nearby']) : 20;
if ($nearby == '1') {
$nearby = 20;
} else {
$nearby = 100000;
}
$arrSort['distance'] = 1;
$nearby = " HAVING distance < " . $nearby;
$favorite = isset($_GET['fav']) ? addslashes($_GET['fav']) : "0";
if ($favorite == '1') {
$arrSort['fav'] = $favorite;
}
$houropen = isset($_GET['houropen']) ? addslashes($_GET['houropen']) : "0";
if ($houropen == '1') {
$whereOption = " CONVERT_TZ(NOW(),@@session.time_zone, '+00:00') >= (CONVERT_TZ(concat(CURRENT_DATE,' ',resto.time_open),@@session.time_zone, '+00:00' )) AND CONVERT_TZ(NOW(),@@session.time_zone, '+00:00') < (CONVERT_TZ(concat(CURRENT_DATE,' ',resto.time_close),@@session.time_zone, '+00:00' ))";
}
$cuisine = isset($_GET['id_cuisine']) ? addslashes($_GET['id_cuisine']) : "None";
if (Cuisine::checkCuisineID($cuisine) != 0) {
$arrWhere['id_cuisine'] = $cuisine;
}
$restotype = isset($_GET['id_restotype']) ? addslashes($_GET['id_restotype']) : "None";
if (MasterRestaurantType::isRestoTypeByIDAvailable($restotype) != 0) {
$arrWhere['restaurant_type'] = $restotype;
}
$disc_mr = isset($_GET['disc_mr']) ? addslashes($_GET['disc_mr']) : "None";
if ($disc_mr == 1) {
$arrWhereOr['disc_mr'] = $disc_mr;
}
$disc_cc = isset($_GET['disc_cc']) ? addslashes($_GET['disc_cc']) : "None";
if ($disc_cc == 1) {
$arrWhereOr['disc_cc'] = $disc_cc;
}
$disc_resto = isset($_GET['disc_resto']) ? addslashes($_GET['disc_resto']) : "None";
if ($disc_resto == 1) {
$arrWhereOr['disc_resto'] = $disc_resto;
}
$where = " WHERE dish.name LIKE '%{$search}%' ";
if ($whereOption != "") {
$where = $where . " AND " . $whereOption;
}
foreach ($arrWhere as $key => $val) {
$where = $where . " AND {$resto}" . ".{$key}= '{$val}'";
}
foreach ($arrWhereOr as $key => $val) {
$where = $where . " AND {$resto}" . ".{$key} != '0'";
}
$sort = $nearby . " ORDER BY ";
foreach ($arrSort as $key => $val) {
if ($key == "distance") {
$sort = $sort . " {$key} ASC,";
} elseif ($key == "fav") {
$sort = $sort . " {$resto}" . ".{$key} DESC,";
} elseif ($key == "houropen") {
$sort = $sort . " {$resto}" . ".{$key} ASC,";
}
}
$sort = substr($sort, 0, -1);
$page = addslashes($_GET['page']);
if ($page == "" || $page < 1) {
$json['status_code'] = 0;
$json['status_message'] = "No Page Found";
echo json_encode($json);
die;
}
$limit = addslashes($_GET['limit']);
if ($limit == "" || $limit < 1) {
$json['status_code'] = 0;
$json['status_message'] = "Limit Error";
echo json_encode($json);
die;
}
$begin = ($page - 1) * $limit;
global $db;
$objRestaurant = new MasterRestaurantModel();
$objDish = new MasterDishModel();
$qdish = "SELECT dish.*, resto.name as nama_restaurant, SQRT(POW(69.1 * (resto.latitude - {$lat}), 2) + POW(69.1 * ({$long} - resto.longitude) * COS(resto.latitude / 57.3), 2)) AS distance" . " FROM {$objDish->table_name} dish LEFT JOIN {$objRestaurant->table_name} resto ON dish.id_restaurant=resto.id_restaurant " . $where . $sort . " LIMIT {$begin},{$limit}";
// echo $qdish. "<br>";
//.........这里部分代码省略.........
示例15: getCategoriesByResto
public function getCategoriesByResto()
{
if (Efiwebsetting::getData('checkOAuth') == 'yes') {
IMBAuth::checkOAuth();
}
$json = array();
$json['status_code'] = 1;
$id_restaurant = isset($_GET['id_restaurant']) ? addslashes($_GET['id_restaurant']) : "";
if (!$id_restaurant) {
Generic::errorMsg("No Restaurant ID Found");
}
$objResto = new MasterRestaurantModel();
$objResto->getByID($id_restaurant);
$categories = $objResto->id_categories;
// if (Generic::IsNullOrEmptyString($categories)) ;
$json['results']['categories'] = array();
$arrCategories = explode(",", $categories);
foreach ($arrCategories as $idCat) {
$json['results']['categories'][] = self::getCategoryNameByID($idCat);
}
$rawTags = array();
$id_dish = isset($_GET['id_dish']) ? addslashes($_GET['id_dish']) : "";
if ($id_dish) {
$dish = new MasterDishModel();
$dish->getByID($id_dish);
$tagsIds = explode(",", $dish->dish_tags);
if (count($tagsIds) != 0) {
foreach ($tagsIds as $tagsId) {
if ($tagsId == null || $tagsId == "") {
continue;
}
$dishTag = new MasterDishTagModel();
$dishTag->getByID($tagsId);
$b["id_tag"] = $dishTag->id_tag;
$b["name"] = $dishTag->name;
$rawTags[] = $b;
}
}
}
$json['results']['raw_tags'] = $rawTags;
echo json_encode($json);
die;
}