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_HotelCuisines(); } return self::$_instance; }
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; } } }
public function searchHotelsByAction() { $hotelssummaryModel = Application_Model_HotelDetails::getInstance(); $hotelcuisinesModel = Application_Model_HotelCuisines::getInstance(); $response = new stdClass(); $method = $this->getRequest()->getParam('method'); if ($method) { switch ($method) { case 'hotelname': if ($this->getRequest()->isPost()) { $name = $this->getRequest()->getPost('name'); if ($name) { $hotelslist = $hotelssummaryModel->searchByNames($name); if ($hotelslist) { $response->message = 'successfull'; $response->code = 200; $response->data = $hotelslist; } else { $response->message = 'No Data Found'; $response->code = 197; $response->data = Null; } } else { $response->message = 'parameter doesnot pass'; $response->code = 198; $response->data = Null; } } else { $response->message = 'Could Not Serve The Request'; $response->code = 401; $response->data = NULL; } echo json_encode($response, true); die; break; case 'insertCuisines': if ($this->getRequest()->isPost()) { $cuisines = $this->getRequest()->getPost('cuisines'); $cuisinesarray = (array) json_decode($cuisines, true); if ($cuisinesarray) { $result = $hotelcuisinesModel->insertHotelCuisines($cuisinesarray); if ($result) { $response->message = 'successfull'; $response->code = 200; $response->data = $result; } else { $response->message = 'No Data Found'; $response->code = 197; $response->data = Null; } } else { $response->message = 'parameter doesnot pass'; $response->code = 198; $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 :Sibani Mishra * Desc : service used for search functionality of hotels based on cuisines * Date : 4/1/2016 */ /* * DEV :Sibani Mishra * Desc : service used for search functionality of hotels based on cuisines * Date : 4/1/2016 */ case 'selectcuisines': if ($this->getRequest()->isPost()) { $hotel_locations = $this->getRequest()->getPost('hotel_locations'); $cuisine_id = $this->getRequest()->getPost('cuisine_id'); $cuisine_id = json_decode($cuisine_id); if (!empty($hotel_locations) && !empty($cuisine_id)) { $hotelnames = $hotelssummaryModel->gethotalsname($hotel_locations, $cuisine_id); if ($hotelnames) { $response->message = 'successfull'; $response->code = 200; $response->data = $hotelnames; } else { $response->message = 'No Data Found'; $response->code = 197; $response->data = Null; } } else { $response->message = 'parameter Shouldnot be blank'; $response->code = 198; $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 :Sibani Mishra * Desc : service used for search functionality of hotels based on cuisines * Date : 4/1/2016 */ /* * DEV :Sibani Mishra * Desc : service used for search functionality of hotels based on cuisines * Date : 4/1/2016 */ case 'selectReviewsAndRatings': if ($this->getRequest()->isPost()) { $hotel_locations = $this->getRequest()->getPost('hotel_locations'); if (!empty($hotel_locations)) { $hotelnames = $hotelssummaryModel->gethotalsnamebasedReviewandratings($hotel_locations); if ($hotelnames) { $response->message = 'successfull'; $response->code = 200; $response->data = $hotelnames; } else { $response->message = 'No Data Found'; $response->code = 197; $response->data = Null; } } else { $response->message = 'HotelLocation Shouldnot be blank'; $response->code = 198; $response->data = Null; } } else { $response->message = 'Could Not Serve The 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 Passed"; echo json_encode($response, true); die; } }
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); } }