public function getCategoriesByResto()
 {
     if (Efiwebsetting::getData('checkOAuth') == 'yes') {
         IMBAuth::checkOAuth();
     }
     $idRestaurant = Generic::mustCheck($_GET['id_restaurant'], Keys::$ERR_NOT_FOUND_ID_RESTAURANT);
     $objResto = new MasterRestaurantModel();
     $objResto->getByID($idRestaurant);
     if (!Generic::IsNullOrEmptyString($objResto->id_categories)) {
         $arrCategories = explode(",", $objResto->id_categories);
     } else {
         $arrCategories = array();
     }
     $categories = array();
     foreach ($arrCategories as $idCat) {
         $c = new MasterCategoryModel();
         $c->getByID($idCat);
         if ($c->id_category) {
             $categories[] = $c->name;
         }
     }
     //        pr($arrCategories);
     //        pr($categories);
     $results['categories'] = $categories;
     $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;
             }
         }
     }
     $results['raw_tags'] = $rawTags;
     Generic::finish($results);
 }
 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;
 }