コード例 #1
0
 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         //or if( is_null(self::$_instance) ) or if( self::$_instance == null )
         self::$_instance = new Application_Model_FamousCuisines();
     }
     return self::$_instance;
 }
コード例 #2
0
 public function profileSummaryAction()
 {
     $location = Application_Model_location::getInstance();
     $menu_category = Application_Model_MenuCategory::getInstance();
     $famouscuisines = Application_Model_FamousCuisines::getInstance();
     $hotelModel = Application_Model_HotelDetails::getInstance();
     $hotelCuisinesModel = Application_Model_HotelCuisines::getInstance();
     $response = new stdClass();
     $method = $this->getRequest()->getParam('method');
     if ($method) {
         switch ($method) {
             /*
              * DEV :sowmya
              * Desc : to add country
              * Date : 5/5/2016
              */
             case 'addcountry':
                 if ($this->getRequest()->isPost()) {
                     $data['name'] = $this->getRequest()->getPost('name');
                     $data['location_status'] = $this->getRequest()->getPost('location_status');
                     $data['location_type'] = $this->getRequest()->getPost('location_type');
                     $data['parent_id'] = $this->getRequest()->getPost('parent_id');
                     $addcountry = $location->addcountry($data);
                     if ($addcountry) {
                         $response->code = 200;
                         $response->message = "added Successful";
                         $response->data = $addcountry;
                     } else {
                         $response->code = 100;
                         $response->message = "Invalid Password format";
                         $response->data = null;
                     }
                     echo json_encode($response, true);
                 }
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to change location status
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to change location status
              * Date : 5/5/2016
              */
             case 'locationactive':
                 if ($this->getRequest()->isPost()) {
                     $locationid = $this->getRequest()->getPost('locationid');
                     $addcountry = $location->changeLocationStatus($locationid);
                     if ($addcountry) {
                         $response->code = 200;
                         $response->message = "added Successful";
                         $response->data = $locationid;
                     } else {
                         $response->code = 100;
                         $response->message = "Invalid Password format";
                         $response->data = null;
                     }
                     echo json_encode($response, true);
                 }
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to update country
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to update country
              * Date : 5/5/2016
              */
             case 'editcountry':
                 $data['name'] = $this->getRequest()->getPost('name');
                 $locationid = $this->getRequest()->getPost('location_id');
                 $result = $location->updateLocation($data, $locationid);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['code'] = 198;
                     $arr['data'] = null;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to delete country 
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to delete country 
              * Date : 5/5/2016
              */
             case 'countrydelete':
                 $locationid = $this->getRequest()->getPost('locationid');
                 $result = $location->countryDelete($locationid);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     echo "error";
                 }
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to get location details
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to get location details
              * Date : 5/5/2016
              */
             case 'getlocation':
                 $locationid = $this->getRequest()->getParam('locationid');
                 $result = $location->getLocationsByLocationId($locationid);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['code'] = 198;
                     $arr['data'] = null;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to get hotel category details
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to get hotel category details
              * Date : 5/5/2016
              */
             case 'getCategories':
                 $result = $menu_category->selectAllCategory();
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['code'] = 198;
                     $arr['data'] = null;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
                 //Dev:sreekanth
                 //Date: 4-may-16
                 //get hotel categories By CategoryId
             //Dev:sreekanth
             //Date: 4-may-16
             //get hotel categories By CategoryId
             case 'getcategoriesByCategoryId':
                 $categoryid = $this->getRequest()->getParam('categoryid');
                 $result = $menu_category->getcategoriesByCategoryId($categoryid);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['code'] = 198;
                     $arr['data'] = null;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
                 //Dev:sreekanth
                 //Date: 5-may-16
                 //edit hotel category
             //Dev:sreekanth
             //Date: 5-may-16
             //edit hotel category
             case 'editcategory':
                 $data['cat_name'] = $this->getRequest()->getPost('categoryname');
                 $data['cat_desc'] = $this->getRequest()->getPost('cat_desc');
                 $categoryid = $this->getRequest()->getPost('category_id');
                 $result = $menu_category->updateCategory($data, $categoryid);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['code'] = 198;
                     $arr['data'] = null;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
                 //Dev:sreekanth
                 //Date: 5-may-16
                 // to delete hotel category
             //Dev:sreekanth
             //Date: 5-may-16
             // to delete hotel category
             case 'hotelcategorydelete':
                 $categoryid = $this->getRequest()->getPost('categoryid');
                 $result = $menu_category->hotelcategorydelete($categoryid);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     echo "error";
                 }
                 break;
                 //Dev:sreekanth
                 //Date: 5-may-16
                 // to add hotel category
             //Dev:sreekanth
             //Date: 5-may-16
             // to add hotel category
             case 'addhotelcategory':
                 $data['cat_name'] = $this->getRequest()->getPost('categoryname');
                 $data['cat_desc'] = $this->getRequest()->getPost('cat_desc');
                 $data['cat_status'] = $this->getRequest()->getPost('cat_status');
                 $result = $menu_category->addhotelcategory($data);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['code'] = 198;
                     $arr['data'] = null;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
                 //Dev:sreekanth
                 //Date: 5-may-16
                 // desc :to get hotel cuisines
             //Dev:sreekanth
             //Date: 5-may-16
             // desc :to get hotel cuisines
             case 'getCuisines':
                 $cuisines = $famouscuisines->selectAllCuisines();
                 $hotel = $hotelModel->selectAllHotels();
                 if ($cuisines) {
                     $data[0] = $cuisines;
                     $data[1] = $hotel;
                     $arr['code'] = 200;
                     $arr['data'] = $data;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['cuisines'] = $cuisines;
                     $arr['hotel'] = $hotel;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
                 //Dev:sreekanth
                 //Date: 6-may-16
                 // to delete hotel cuisines
             //Dev:sreekanth
             //Date: 6-may-16
             // to delete hotel cuisines
             case 'hotelcuisinedelete':
                 $cuisine_id = $this->getRequest()->getPost('cuisine_id');
                 $result = $famouscuisines->hotelcuisinedelete($cuisine_id);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     echo "error";
                 }
                 break;
                 //Dev:sreekanth
                 //Date: 5-may-16
                 // add  cuisines details
             //Dev:sreekanth
             //Date: 5-may-16
             // add  cuisines details
             case 'addCuisinesDetails':
                 $data['Cuisine_name'] = $this->getRequest()->getPost('Cuisine_name');
                 $data['cuisine_status'] = $this->getRequest()->getPost('cuisine_status');
                 $result = $famouscuisines->addCuisinesDetails($data);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['code'] = 198;
                     $arr['data'] = null;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
                 //Dev:sreekanth
                 //Date: 5-may-16
                 // to add hotel cuisines
             //Dev:sreekanth
             //Date: 5-may-16
             // to add hotel cuisines
             case 'addhotelcuisines':
                 $data['cuisine_id'] = $this->getRequest()->getPost('cuisine_id');
                 $data['hotel_id'] = $this->getRequest()->getPost('hotel_id');
                 $result = $hotelCuisinesModel->addhotelcuisines($data);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['code'] = 198;
                     $arr['data'] = null;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
                 //Dev:sreekanth
                 //Date: 5-may-16
                 //edit hotel cuisines
             //Dev:sreekanth
             //Date: 5-may-16
             //edit hotel cuisines
             case 'edithotelcuisines':
                 $data['Cuisine_name'] = $this->getRequest()->getPost('Cuisine_name');
                 $cuisineid = $this->getRequest()->getPost('cuisine_id');
                 $result = $famouscuisines->updateHotelCuisines($data, $cuisineid);
                 if ($result) {
                     $arr['code'] = 200;
                     $arr['data'] = $result;
                     echo json_encode($arr, true);
                     die;
                 } else {
                     $arr['code'] = 198;
                     $arr['data'] = null;
                     echo json_encode($arr, true);
                     die;
                 }
                 break;
         }
     }
 }
コード例 #3
0
 public function restaurentMenuCardAction()
 {
     $hotelssummaryModel = Application_Model_HotelDetails::getInstance();
     $deliverystatusmodal = Application_Model_DeliveryStatusLog::getInstance();
     $productsummaryModel = Application_Model_Products::getInstance();
     $categorysModel = Application_Model_MenuCategory::getInstance();
     $famouscuisinesModel = Application_Model_FamousCuisines::getInstance();
     $hotelcuisinesModel = Application_Model_HotelCuisines::getInstance();
     $response = new stdClass();
     $method = $this->getRequest()->getParam('method');
     if ($method) {
         switch ($method) {
             /*
              * Modyfied By : Nitin Kumar Gupta
              * Modyfied Date : 15 FEB 2016
              */
             case 'GetMenu':
                 if ($this->getRequest()->isPost()) {
                     $hotel_id = $this->getRequest()->getPost('hotel_id');
                     if ($hotel_id) {
                         $cats = $hotelssummaryModel->getcategoriesByHotelId($hotel_id);
                         if ($cats) {
                             $response->message = 'Successfull';
                             $response->code = 200;
                             $response->data = $cats;
                         } else {
                             $response->message = 'Could not Serve the Response';
                             $response->code = 197;
                             $response->data = NUll;
                         }
                     }
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'getproductbyproductId':
                 if ($this->getRequest()->isPost()) {
                     $product_id = $this->getRequest()->getPost('product_id');
                     if ($product_id) {
                         $proddetails = $productsummaryModel->getProductByProductId($product_id);
                         if ($proddetails) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $proddetails;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 // added by sowmya 12/4/2016
             // added by sowmya 12/4/2016
             case 'updateproductdetails':
                 if ($this->getRequest()->isPost()) {
                     $product_id = $this->getRequest()->getPost('product_id');
                     $name = $this->getRequest()->getPost('name');
                     if (!empty($name)) {
                         $data['name'] = $name;
                     }
                     $prod_desc = $this->getRequest()->getPost('prod_desc');
                     if (!empty($prod_desc)) {
                         $data['prod_desc'] = $prod_desc;
                     }
                     $item_type = 1;
                     if ($data['item_type'] == 1) {
                         $data['prod_type'] = $this->getRequest()->getPost('prod_type');
                         if ($data['prod_type'] == 1) {
                             $data['category_id'] = $this->getRequest()->getPost('category_id');
                             $data['Subcategory_id'] = $this->getRequest()->getPost('Subcategory_id');
                         } else {
                             if ($data['prod_type'] == 2) {
                                 $data['cuisine_id'] = $this->getRequest()->getPost('cuisine_id');
                             }
                         }
                     }
                     $stock_quantity = $this->getRequest()->getPost('stock_quantity');
                     if (!empty($stock_quantity)) {
                         $data['stock_quantity'] = $stock_quantity;
                     }
                     $cost = $this->getRequest()->getPost('cost');
                     if (!empty($cost)) {
                         $data['cost'] = $cost;
                     }
                     $prod_status = $this->getRequest()->getPost('prod_status');
                     if (!empty($prod_status)) {
                         $data['prod_status'] = $prod_status;
                     }
                     $imagelink = $this->getRequest()->getPost('imagelink');
                     if (!empty($imagelink)) {
                         $data['imagelink'] = $imagelink;
                     }
                     $delivery_time = $this->getRequest()->getPost('delivery_time');
                     if (!empty($delivery_time)) {
                         $data['delivery_time'] = $delivery_time;
                     }
                     $product_discount = $this->getRequest()->getPost('product_discount');
                     if (!empty($product_discount)) {
                         $data['product_discount'] = $product_discount;
                     }
                     $product_discount_type = $this->getRequest()->getPost('product_discount_type');
                     if (!empty($product_discount_type)) {
                         $data['product_discount_type'] = $product_discount_type;
                     }
                     $servicetax = $this->getRequest()->getPost('servicetax');
                     if (!empty($servicetax)) {
                         $data['servicetax'] = $servicetax;
                     }
                     if ($product_id) {
                         $updatestatus = $productsummaryModel->updateProductDetails($product_id, $data);
                         if ($updatestatus) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $updatestatus;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'GetCategorys':
                 $categorydetails = $categorysModel->selectAllCategorys();
                 if ($categorydetails) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $categorydetails;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 // added by sowmya 12/4/2016
             // added by sowmya 12/4/2016
             case 'addproductdetails':
                 if ($this->getRequest()->isPost()) {
                     $productdata['name'] = $this->getRequest()->getPost('name');
                     $productdata['hotel_id'] = $this->getRequest()->getPost('hotel_id');
                     $productdata['prod_desc'] = $this->getRequest()->getPost('prod_desc');
                     $productdata['item_type'] = $this->getRequest()->getPost('item_type');
                     $productdata['cost'] = $this->getRequest()->getPost('cost');
                     $productdata['prod_status'] = $this->getRequest()->getPost('prod_status');
                     $productdata['delivery_time'] = $this->getRequest()->getPost('delivery_time');
                     $productdata['product_discount'] = $this->getRequest()->getPost('product_discount');
                     $productdata['product_discount_type'] = $this->getRequest()->getPost('product_discount_type');
                     $productdata['agent_id'] = $this->getRequest()->getPost('agent_id');
                     $productdata['prod_type'] = $this->getRequest()->getPost('prod_type');
                     $productdata['stock_quantity'] = $this->getRequest()->getPost('stock_quantity');
                     $productdata['servicetax'] = $this->getRequest()->getPost('servicetax');
                     if ($productdata['item_type'] == 1) {
                         $productdata['hotel_id'] = $this->getRequest()->getPost('hotel_id');
                         $productdata['prod_type'] = $this->getRequest()->getPost('prod_type');
                         if ($productdata['prod_type'] == 1) {
                             $productdata['category_id'] = $this->getRequest()->getPost('category_id');
                             $productdata['Subcategory_id'] = $this->getRequest()->getPost('Subcategory_id');
                         } else {
                             if ($productdata['prod_type'] == 2) {
                                 $productdata['cuisine_id'] = $this->getRequest()->getPost('cuisine_id');
                             }
                         }
                     } else {
                         if ($productdata['item_type'] == 2) {
                             $productdata['store_id'] = $this->getRequest()->getPost('store_id');
                             $productdata['store_category_id'] = $this->getRequest()->getPost('store_category_id');
                         }
                     }
                     $insertproductid = $productsummaryModel->AddProductDetails($productdata);
                     if ($insertproductid) {
                         $response->message = 'successfull';
                         $response->code = 200;
                         $response->data['product_id'] = $insertproductid;
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 197;
                         $response->data = null;
                     }
                 } else {
                     $response->message = 'Could Not Serve The Request';
                     $response->code = 401;
                     $response->data = NULL;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 // dev :sowmya
                 // to get store product by product id
                 //date 7/5/2016
             // dev :sowmya
             // to get store product by product id
             //date 7/5/2016
             case 'getstoreproductbyproductId':
                 if ($this->getRequest()->isPost()) {
                     $product_id = $this->getRequest()->getPost('product_id');
                     if ($product_id) {
                         $proddetails = $productsummaryModel->getStoreProductByProductId($product_id);
                         if ($proddetails) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $proddetails;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * Modyfied By : Nitin Kumar Gupta
                  * Modyfied Date : 16 FEB 2016
                  */
             /*
              * Modyfied By : Nitin Kumar Gupta
              * Modyfied Date : 16 FEB 2016
              */
             case 'getproductbycategoryId':
                 if ($this->getRequest()->isPost()) {
                     $category_id = $this->getRequest()->getPost('category_id');
                     $category_type = $this->getRequest()->getPost('category_type');
                     if ($category_id && $category_type) {
                         $proddetails = $productsummaryModel->getProductBycategoryID($category_id, $category_type);
                         if ($proddetails) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $proddetails;
                         } else {
                             $response->message = 'There are no product available inside this category.';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'You should be send all parameters.';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Request should be through post method';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'getproductsByCookie':
                 if ($this->getRequest()->isPost()) {
                     $cookies_values = $this->getRequest()->getPost('cookies_values');
                     $hotel_id = $this->getRequest()->getPost('hotel_id');
                     $cookies_values = (array) json_decode($cookies_values, true);
                     if ($cookies_values) {
                         $proddetails = $productsummaryModel->getProductsByCookies($cookies_values, $hotel_id);
                         if ($proddetails) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $proddetails;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'getproductsForAllHotels':
                 if ($this->getRequest()->isPost()) {
                     $cookies_values = $this->getRequest()->getPost('cookies_values');
                     $cookies_values = (array) json_decode($cookies_values, true);
                     if ($cookies_values) {
                         $proddetails = $productsummaryModel->getProductsFromCookiesOfAllHotels($cookies_values);
                         if ($proddetails) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $proddetails;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * Modyfied By : Sibani Mishra
                  * Modyfied Date :  4/1/2016
                  * Desc:cuisines based on location.
                  */
             /*
              * Modyfied By : Sibani Mishra
              * Modyfied Date :  4/1/2016
              * Desc:cuisines based on location.
              */
             case 'getcuisines':
                 if ($this->getRequest()->isPost()) {
                     $hotel_location = $this->getRequest()->getPost('hotel_location');
                     if ($hotel_location) {
                         $cuisinesdetails = $hotelssummaryModel->getCuisines($hotel_location);
                         foreach ($cuisinesdetails as $key => $val) {
                             unset($val['id']);
                             unset($val['agent_id']);
                             unset($val['hotel_location']);
                             unset($val['address']);
                             unset($val['hotel_contact_number']);
                             unset($val['hotel_name']);
                             unset($val['hotel_image']);
                             unset($val['open_time']);
                             unset($val['closing_time']);
                             unset($val['hotel_status']);
                             unset($val['notice']);
                             unset($val['minorder']);
                             unset($val['deliverycharge']);
                             //                                unset($val['cuisine_id']);
                             unset($val['secondary_phone']);
                             $cuisinesdetails[$key] = $val;
                         }
                         //                            print_r($cuisinesdetails);die;
                         if (!empty($cuisinesdetails)) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $cuisinesdetails;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     }
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'getcuisinesofHotel':
                 if ($this->getRequest()->isPost()) {
                     $hotel_id = $this->getRequest()->getPost('hotel_id');
                     $cuisinesdetails = $hotelcuisinesModel->getCuisinesByHotelId($hotel_id);
                     if ($cuisinesdetails) {
                         $response->message = 'successfull';
                         $response->code = 200;
                         $response->data = $cuisinesdetails;
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 197;
                         $response->data = null;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
         }
     } else {
         $response->message = 'Invalid Request';
         $response->code = 401;
         $response->data = 'No Method';
         echo json_encode($response);
     }
 }
コード例 #4
0
 public function hotelsSummaryAction()
 {
     $hotelssummaryModel = Application_Model_HotelDetails::getInstance();
     $deliverystatusmodal = Application_Model_DeliveryStatusLog::getInstance();
     $hotelmenucategorymodel = Application_Model_MenuCategory::getInstance();
     $famouscuisinemodel = Application_Model_FamousCuisines::getInstance();
     $response = new stdClass();
     $method = $this->getRequest()->getParam('method');
     if ($method) {
         switch ($method) {
             ///////////////////////////////// hotel details module////////////////////////////
             /*
              * DEV :sowmya
              * Desc : to get hotel details
              * Date : 5/5/2016
              */
             case 'allhotels':
                 $hoteldetails = $hotelssummaryModel->selectAllHotelsLocations();
                 if ($hoteldetails) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $hoteldetails;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to get order status
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to get order status
              * Date : 5/5/2016
              */
             case 'getorderstatus':
                 if ($this->getRequest()->isPost()) {
                     $order_id = $this->getRequest()->getPost('order_id');
                     if ($order_id) {
                         $statusdetails = $deliverystatusmodal->getOrderStatus($order_id);
                         if ($statusdetails) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $statusdetails;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to get hotel details by agent id
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to get hotel details by agent id
              * Date : 5/5/2016
              */
             case 'getHotelDetailsByAgentId':
                 if ($this->getRequest()->isPost()) {
                     $agent_id = $this->getRequest()->getPost('agent_id');
                     if ($agent_id) {
                         $agenthoteldetails = $hotelssummaryModel->getHoteldetails($agent_id);
                         if ($agenthoteldetails) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $agenthoteldetails;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to cahnge hotel status
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to cahnge hotel status
              * Date : 5/5/2016
              */
             case 'changehotelstatus':
                 if ($this->getRequest()->isPost()) {
                     $hotel_id = $this->getRequest()->getPost('hotel_id');
                     if ($hotel_id) {
                         $updatestatus = $hotelssummaryModel->getstatusChangeOfHotel($hotel_id);
                         if ($updatestatus) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data['hotel_id'] = $hotel_id;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to delete hotel
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to delete hotel
              * Date : 5/5/2016
              */
             case 'hoteldelete':
                 if ($this->getRequest()->isPost()) {
                     $hotel_id = $this->getRequest()->getPost('hotel_id');
                     if ($hotel_id) {
                         $updatestatus = $hotelssummaryModel->hotelDelete($hotel_id);
                         if ($updatestatus) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data['hotel_id'] = $hotel_id;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to get hotel by hotel id
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to get hotel by hotel id
              * Date : 5/5/2016
              */
             case 'getHotelDetailsByHotelId':
                 if ($this->getRequest()->isPost()) {
                     $hotel_id = $this->getRequest()->getPost('hotel_id');
                     if ($hotel_id) {
                         $hoteldetails = $hotelssummaryModel->getHoteldetailsByHotelId($hotel_id);
                         if ($hoteldetails) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $hoteldetails;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to update hotel details
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to update hotel details
              * Date : 5/5/2016
              */
             case 'updatehoteldetails':
                 if ($this->getRequest()->isPost()) {
                     $hotel_id = $this->getRequest()->getPost('id');
                     $selectlocation = $this->getRequest()->getPost('selectlocation');
                     if (!empty($selectlocation)) {
                         $data['hotel_location'] = $selectlocation;
                     }
                     $primary_phone = $this->getRequest()->getPost('primary_phone');
                     if (!empty($primary_phone)) {
                         $data['hotel_contact_number'] = $primary_phone;
                     }
                     $secondary_phone = $this->getRequest()->getPost('secondary_phone');
                     if (!empty($secondary_phone)) {
                         $data['secondary_phone'] = $secondary_phone;
                     }
                     $hotel_name = $this->getRequest()->getPost('hotel_name');
                     if (!empty($hotel_name)) {
                         $data['hotel_name'] = $hotel_name;
                     }
                     $open_time = $this->getRequest()->getPost('open_time');
                     if (!empty($open_time)) {
                         $data['open_time'] = $open_time;
                     }
                     $hotel_status = $this->getRequest()->getPost('hotel_status');
                     if (!empty($hotel_status)) {
                         $data['hotel_status'] = $hotel_status;
                     }
                     $closing_time = $this->getRequest()->getPost('closing_time');
                     if (!empty($closing_time)) {
                         $data['closing_time'] = $closing_time;
                     }
                     $notice = $this->getRequest()->getPost('notice');
                     if (!empty($notice)) {
                         $data['notice'] = $notice;
                     }
                     $hotel_image = $this->getRequest()->getPost('hotel_image');
                     if (!empty($hotel_image)) {
                         $data['hotel_image'] = $hotel_image;
                     }
                     $deliverycharge = $this->getRequest()->getPost('deliverycharge');
                     if (!empty($deliverycharge)) {
                         $data['deliverycharge'] = $deliverycharge;
                     }
                     $minorder = $this->getRequest()->getPost('minorder');
                     if (!empty($minorder)) {
                         $data['minorder'] = $minorder;
                     }
                     $address = $this->getRequest()->getPost('address');
                     if (!empty($address)) {
                         $data['address'] = $address;
                     }
                     if ($hotel_id) {
                         $updatestatus = $hotelssummaryModel->updateHotelDetails($hotel_id, $data);
                         if ($updatestatus) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data = $updatestatus;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to add hotel details
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to add hotel details
              * Date : 5/5/2016
              */
             case 'addhoteldetails':
                 if ($this->getRequest()->isPost()) {
                     $data['hotel_contact_number'] = $this->getRequest()->getPost('primary_phone');
                     $data['secondary_phone'] = $this->getRequest()->getPost('secondary_phone');
                     $data['hotel_name'] = $this->getRequest()->getPost('hotel_name');
                     $data['open_time'] = $this->getRequest()->getPost('open_time');
                     $data['closing_time'] = $this->getRequest()->getPost('closing_time');
                     $data['notice'] = $this->getRequest()->getPost('notice');
                     $data['address'] = $this->getRequest()->getPost('address');
                     $data['minorder'] = $this->getRequest()->getPost('minorder');
                     $data['deliverycharge'] = $this->getRequest()->getPost('deliverycharge');
                     $data['hotel_status'] = $this->getRequest()->getPost('hotel_status');
                     $data['hotel_location'] = $this->getRequest()->getPost('hotel_location');
                     $data['agent_id'] = $this->getRequest()->getPost('agent_id');
                     if ($data['agent_id']) {
                         $updatestatus = $hotelssummaryModel->insertHotelDetails($data);
                         if ($updatestatus) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data['hotel_id'] = $updatestatus;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 ///////////////////////////// hotel module end here //////////////////////
                 ///////////////////// hotel category   & hotel cuisines///////////////////////
                 /*
                  * DEV :sowmya
                  * Desc : to change  hotel category status
                  * Date : 5/5/2016
                  */
             ///////////////////////////// hotel module end here //////////////////////
             ///////////////////// hotel category   & hotel cuisines///////////////////////
             /*
              * DEV :sowmya
              * Desc : to change  hotel category status
              * Date : 5/5/2016
              */
             case 'changehotelcategorystatus':
                 if ($this->getRequest()->isPost()) {
                     $hotel_id = $this->getRequest()->getPost('hotel_id');
                     if ($hotel_id) {
                         $updatestatus = $hotelmenucategorymodel->getstatusChangeOfHotel($hotel_id);
                         if ($updatestatus) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data['hotel_id'] = $hotel_id;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 /*
                  * DEV :sowmya
                  * Desc : to change hotel cuisines status
                  * Date : 5/5/2016
                  */
             /*
              * DEV :sowmya
              * Desc : to change hotel cuisines status
              * Date : 5/5/2016
              */
             case 'changeHotelCuisineStatus':
                 if ($this->getRequest()->isPost()) {
                     $cuisineid = $this->getRequest()->getPost('cuisineid');
                     if ($cuisineid) {
                         $updatestatus = $famouscuisinemodel->getstatusChangeOfHotelcuisine($cuisineid);
                         if ($updatestatus) {
                             $response->message = 'successfull';
                             $response->code = 200;
                             $response->data['cuisineid'] = $cuisineid;
                         } else {
                             $response->message = 'Could Not Serve The Request';
                             $response->code = 197;
                             $response->data = null;
                         }
                     } else {
                         $response->message = 'Could Not Serve The Request';
                         $response->code = 401;
                         $response->data = NULL;
                     }
                 } else {
                     $response->message = 'Invalid Request';
                     $response->code = 401;
                     $response->data = Null;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 ///////////////////// hotel category   & hotel cuisines end here///////////////////////
         }
     } else {
         $response->message = 'Invalid Request';
         $response->code = 401;
         $response->data = "No Method Passed";
         echo json_encode($response, true);
     }
 }