public function getRestoInitData()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $rid = $_GET['id_restaurant'];
     if (!isset($rid) || $rid == null) {
         Generic::errorMsg("Restaurant ID Not Found");
     }
     $resto = new MasterRestaurantModel();
     $resto->getByID($rid);
     $r["id_restaurant"] = $resto->id_restaurant;
     $r["name"] = $resto->name;
     $r["address"] = $resto->address;
     $r["district"] = $resto->district;
     $r["city"] = $resto->city;
     $r["email"] = $resto->email;
     $r["phone_no"] = $resto->phone_no;
     $r["time_open"] = date("H:i", strtotime($resto->time_open));
     $r["time_close"] = date("H:i", strtotime($resto->time_close));
     $r["image_logo"] = trim($resto->image_logo) != "" ? _BPATH . "uploads/" . $resto->image_logo : "";
     $r["restaurant_type"] = $resto->restaurant_type;
     $r["id_cuisine"] = $resto->id_cuisine;
     $r["halal"] = $resto->halal;
     $r["latitude"] = $resto->latitude;
     $r["longitude"] = $resto->longitude;
     $rawTags = array();
     $tagsIds = explode(",", $resto->restaurant_tags);
     if (count($tagsIds) != 0) {
         foreach ($tagsIds as $tagsId) {
             if ($tagsId == null || $tagsId == "") {
                 continue;
             }
             $restoTag = new MasterRestaurantTagModel();
             $restoTag->getByID($tagsId);
             $b["id_tag"] = $restoTag->id_tag;
             $b["name"] = $restoTag->tag_name;
             $rawTags[] = $b;
         }
     }
     $r["raw_tags"] = $rawTags;
     $this->jsonResults["restaurant"] = $r;
     $cuisine = new CuisineModel();
     $cs = array();
     foreach ($cuisine->getAll() as $cu) {
         $c["id_cuisine"] = $cu->id_cuisine;
         $c["name_cuisine"] = $cu->name_cuisine;
         $cs[] = $c;
     }
     if (count($cs) > 0) {
         $this->jsonResults["cuisine"] = $cs;
     }
     $rType = new MasterRestaurantTypeModel();
     $rts = array();
     foreach ($rType->getAll() as $ty) {
         $rt["id_restaurant_type"] = $ty->id_restaurant_type;
         $rt["name"] = $ty->name;
         $rts[] = $rt;
     }
     if (count($rts) > 0) {
         $this->jsonResults["restaurant_type"] = $rts;
     }
     $this->finish();
     die;
 }
 public function getRestoDetail()
 {
     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) {
         $json['status_code'] = 0;
         $json['status_message'] = "No ID Found";
         echo json_encode($json);
         die;
     }
     $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;
     }
     $objCuisine = new CuisineModel();
     $arrCuisine = $objCuisine->getAll();
     $objRestaurantType = new MasterRestaurantTypeModel();
     $arrObjRestaurantTyp = $objRestaurantType->getAll();
     //        pr($arrObjRestaurantTyp);
     $exp = explode(",", str_replace(" ", "", $objRestaurant->crud_webservice_allowed));
     //tmbh untuk add photo url
     $arrPicsToAddPhotoUrl = $objRestaurant->crud_add_photourl;
     foreach ($arrResto as $restobyId) {
         $sem = array();
         foreach ($exp as $attr) {
             if (in_array($attr, $arrPicsToAddPhotoUrl)) {
                 $sem[$attr] = _BPATH . _PHOTOURL . $restobyId->{$attr};
             } else {
                 $sem[$attr] = $restobyId->{$attr};
             }
         }
         $json['results']['restaurant'] = $sem;
     }
     $expCuisine = explode(",", str_replace(" ", "", $objCuisine->crud_webservice_allowed));
     //tmbh untuk add photo url
     $arrPicsCuisineToAddPhotoUrl = $objCuisine->crud_add_photourl;
     foreach ($arrCuisine as $cuisinebyId) {
         $sem = array();
         foreach ($expCuisine as $attr) {
             if (in_array($attr, $arrPicsCuisineToAddPhotoUrl)) {
                 $sem[$attr] = _BPATH . _PHOTOURL . $cuisinebyId->{$attr};
             } else {
                 $sem[$attr] = $cuisinebyId->{$attr};
             }
         }
         $json['results']['Cuisine'][] = $sem;
     }
     $expRestoType = explode(",", str_replace(" ", "", $objRestaurantType->crud_webservice_allowed));
     //tmbh untuk add photo url
     $arrPicsRestoTypeToAddPhotoUrl = $objRestaurantType->crud_add_photourl;
     foreach ($arrObjRestaurantTyp as $restoType) {
         $sem = array();
         foreach ($expRestoType as $attr) {
             if (in_array($attr, $arrPicsRestoTypeToAddPhotoUrl)) {
                 $sem[$attr] = _BPATH . _PHOTOURL . $restoType->{$attr};
             } else {
                 $sem[$attr] = $restoType->{$attr};
             }
         }
         $json['results']['RestoType'][] = $sem;
     }
     echo json_encode($json);
     die;
 }