public function getLocationsAction() { $locationsmodal = Application_Model_Location::getInstance(); $countrymodal = Application_Model_Country::getInstance(); $response = new stdClass(); $method = $this->getRequest()->getParam('method'); if ($method) { switch ($method) { case 'getcitys': $cityslist = $locationsmodal->getCitys(); if ($cityslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $cityslist; } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); die; break; case 'getcountrys': $countrieslist = $locationsmodal->getCountrys(); if ($countrieslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $countrieslist; } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); die; break; // =================================== get states &cities action===== by sreekanth-=============================== // =================================== get states &cities action===== by sreekanth-=============================== case 'getstates': $countrieslist = $locationsmodal->getallStates(); if ($countrieslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $countrieslist; } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); die; break; case 'getcities': $countrieslist = $locationsmodal->getallcities(); if ($countrieslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $countrieslist; } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); die; break; case 'getlocations': $countrieslist = $locationsmodal->getAllLocations(); if ($countrieslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $countrieslist; } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); die; break; // =================================== get states &cities action===== by sreekanth-=======END======================== // =================================== get states &cities action===== by sreekanth-=======END======================== case 'getStatesByCountrys': if ($this->getRequest()->isPost()) { $location_id = $this->getRequest()->getPost('country_id'); if ($location_id) { $locationslist = $locationsmodal->getStatesByCountrys($location_id); if ($locationslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $locationslist; } 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 'getcitysbystates': if ($this->getRequest()->isPost()) { $location_id = $this->getRequest()->getPost('state_id'); if ($location_id) { $locationslist = $locationsmodal->getCitysByStates($location_id); if ($locationslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $locationslist; } 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 'getlocation': if ($this->getRequest()->isPost()) { $location_id = $this->getRequest()->getPost('location_id'); if ($location_id) { $locationslist = $locationsmodal->getLocationsByCitys($location_id); if ($locationslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $locationslist; } 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; //added by sowmya 12/4/2016 //added by sowmya 12/4/2016 case 'getHotelLocation': if ($this->getRequest()->isPost()) { $hotelid = $this->getRequest()->getPost('hotel_id'); if ($hotelid) { $locationslist = $locationsmodal->getLocationByParentIds($hotelid); if ($locationslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $locationslist; } 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; //added by sowmya 27/4/2016 //added by sowmya 27/4/2016 case 'countryCodeDetails': $countrieslist = $countrymodal->getAllCountryCode(); if ($countrieslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $countrieslist; } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); die; break; //added by sowmya 29/4/2016 //added by sowmya 29/4/2016 case 'getcity': $cityslist = $locationsmodal->getCity(); if ($cityslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $cityslist; } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); die; break; //added by sowmya 29/4/2016 //added by sowmya 29/4/2016 case 'getcountry': $countrieslist = $locationsmodal->getCountry(); if ($countrieslist) { $response->message = 'Successfull'; $response->code = 200; $response->data = $countrieslist; } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); die; break; } } else { $response->message = 'Could not Serve the Response'; $response->code = 197; $response->data = NUll; } echo json_encode($response, true); die; }