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_MenuCategory(); } 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 editOrderProductsAction() { $hotelssummaryModel = Application_Model_HotelDetails::getInstance(); $deliverystatusmodal = Application_Model_DeliveryStatusLog::getInstance(); $productsummaryModel = Application_Model_Products::getInstance(); $categorysModel = Application_Model_MenuCategory::getInstance(); $orderproductsModel = Application_Model_OrderProducts::getInstance(); $ordersModels = Application_Model_Orders::getInstance(); $response = new stdClass(); if ($this->getRequest()->isPost()) { $order_id = $this->getRequest()->getPost('order_id'); } $orderproductsdetails = $ordersModels->GetAgentProduct($order_id); if ($orderproductsdetails) { $response->message = 'Successfull'; $response->code = 200; $response->data = $orderproductsdetails; } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); }
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); } }