Example #1
0
 public function init()
 {
     $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate');
     $this->setName('product_create');
     $this->addElement('select', 'caseFormat', array('label' => 'Case Format:', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => array('BlackOutBug' => "BlackOutBug", 'JulianDateOnly' => "JulianDateOnly", 'Packed+Julian' => "Packed+Julian", 'Packed Date Only' => "Packed Date Only", 'pork' => "pork"), 'value' => "BlackOutBug"));
     // add Label/Case
     $this->addElement('text', 'labelCase', array('label' => 'Label/Case:', 'class' => 'required', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Label/Case')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an Product Identifier
     $this->addElement('text', 'productIdentifier', array('label' => 'Product Identifier:', 'class' => 'required', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Product Identifier')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     //Pack location multiple dropdown
     $model = new Admin_Model_Location();
     $arrGroup = $model->getLocationArray();
     //       $this->addElement('select', 'packLocation', array(
     //        'label'=>'Pack Location:',
     //            'class' =>'s1',
     //            'multiple' =>'multiple',
     //         'required'   => true,
     //         'decorators' => $this->elementDecorators,
     //    	'MultiOptions'=>$arrGroup,
     //        'value'=>"Bone"
     //  		));
     $this->addElement('multiselect', 'packLocation', array('label' => 'Pack Location:', 'class' => 's1', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => $arrGroup));
     // Add an Part Numebr
     $this->addElement('text', 'partNumber', array('label' => 'Part Number:', 'class' => 'required', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Part number')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an Sell by days
     $this->addElement('text', 'sellByDays', array('label' => 'Sell By Days:', 'class' => 'required', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter sell by days')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an Price/lb ($)
     $this->addElement('text', 'priceLb', array('label' => 'Price/Lb ($):', 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Price/lb($)')))), 'filters' => array('StringTrim')));
     // Add an Pallet ID
     $this->addElement('text', 'palletId', array('label' => 'Pallet ID:', 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Pallet ID')))), 'filters' => array('StringTrim')));
     // Add an Des Line 4
     $this->addElement('text', 'desLine1', array('label' => 'Des. Line #1:', 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Des Line 1')))), 'filters' => array('StringTrim')));
     // Add an Des Line 2
     $this->addElement('text', 'desLine2', array('label' => 'Des. Line #2:', 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Des Line 2')))), 'filters' => array('StringTrim')));
     // Add an Des Line 3
     $this->addElement('text', 'desLine3', array('label' => 'Des. Line #3:', 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Des Line 3')))), 'filters' => array('StringTrim')));
     // Add an Des Line 4
     $this->addElement('text', 'desLine4', array('label' => 'Des. Line #4:', 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Des Line 4')))), 'filters' => array('StringTrim')));
     // Add an Lower Weight
     $this->addElement('text', 'lowerWeight', array('label' => 'Lower Weight:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Lower Weight')))), 'filters' => array('StringTrim')));
     // Add an Fixed Weight
     $this->addElement('text', 'fixedWeight', array('label' => 'Fized Weight:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Fixed Weight')))), 'filters' => array('StringTrim')));
     // Add an Heigh Weight
     $this->addElement('text', 'heighWeight', array('label' => 'Heigh Weight:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Heigh weight')))), 'filters' => array('StringTrim')));
     // Add an Tare Weight element
     $this->addElement('text', 'tareWeight', array('label' => 'Tare Weight:', 'class' => 'required', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter Tare Weight')))), 'filters' => array('StringTrim')));
     // Add an Radio Required Application
     $this->addElement('radio', 'requiredApp', array('label' => 'Required Application:', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => array("Print all Random Weight" => "Print all Random Weight", "Print Random Wts.within limits" => "Print Random Wts.within limits"), 'value' => 'Print all Random Weight'));
 }
Example #2
0
 public function init()
 {
     $priceid = new Zend_Form_Element_Hidden("price_id");
     $locationModel = new Admin_Model_Location();
     $locations = $locationModel->getAllLocation();
     $fromLocation = new Zend_Form_Element_Select("from_location_id");
     $fromLocation->setLabel("From Location")->addMultiOptions($locations)->setAttribs(array('class' => 'form-select'))->setRequired(true);
     $toLocation = new Zend_Form_Element_Select('to_location_id');
     $toLocation->setLabel('To Location')->addMultiOptions($locations)->setAttribs(array('class' => 'form-select'))->setRequired(true);
     $price = new Zend_Form_Element_Text("price");
     $price->setLabel("Price ")->setAttribs(array('size' => 30, 'class' => 'form-text'))->setRequired(true);
     $submit = new Zend_Form_Element_Submit("submit");
     $submit->setLabel("Submit");
     $this->addElements(array($priceid, $fromLocation, $toLocation, $price, $submit));
 }
 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         self::$_instance = new Admin_Model_Location();
     }
     return self::$_instance;
 }
 public function editStoreDeliveryguyDetailsAction()
 {
     $adminModel = Admin_Model_Users::getInstance();
     $result = $adminModel->getAdminDetails();
     // showing image
     if ($result) {
         $this->view->admindetails = $result;
     }
     $locationsModel = Admin_Model_Location::getInstance();
     $locations = $locationsModel->getLocations();
     if ($locations) {
         $this->view->locationdetails = $locations;
     }
     $deliveryGuysModel = Admin_Model_DeliveryGuys::getInstance();
     $delguyid = $this->getRequest()->getParam('delguyid');
     if ($this->_request->isPost()) {
         $delguyid = $delguyid;
         $deliverydata['login_name'] = $this->getRequest()->getPost('login_name');
         $deliverydata['firstname'] = $this->getRequest()->getPost('firstname');
         $deliverydata['lastname'] = $this->getRequest()->getPost('lastname');
         $deliverydata['email'] = $this->getRequest()->getPost('email');
         $deliverydata['password'] = md5($this->getRequest()->getPost('password'));
         $deliverydata['phone'] = $this->getRequest()->getPost('phone');
         $deliverydata['city'] = $this->getRequest()->getPost('city');
         $deliverydata['state'] = $this->getRequest()->getPost('state');
         $deliverydata['hotel_store'] = 2;
         $deliverydata['country'] = $this->getRequest()->getPost('country');
         $deliverydata['address'] = $this->getRequest()->getPost('address');
         $deliverydata['status'] = $this->getRequest()->getPost('status');
         $deliverydata['location'] = $this->getRequest()->getPost('location');
         $deliverydata['store_id'] = json_encode($this->getRequest()->getPost('store_id'));
         if ($delguyid) {
             $result = $deliveryGuysModel->updateDeliveryGuydetails($delguyid, $deliverydata);
             if ($result) {
                 $this->redirect('/admin/store-delivery-guys-details');
             }
         }
     }
     if ($delguyid) {
         $deliveryguydetails = $deliveryGuysModel->getDeliveryGuyById($delguyid);
         if ($deliveryguydetails) {
             $this->view->deliveryguydetails = $deliveryguydetails;
         }
     }
 }
 public function dashboardAction()
 {
     $adminModel = Admin_Model_Users::getInstance();
     $result = $adminModel->getAdminDetails();
     // showing image
     if ($result) {
         $this->view->admindetails = $result;
     }
     $userModel = Admin_Model_Users::getInstance();
     $result = $userModel->getUserdetails();
     if ($result) {
         $this->view->userdetails = count($result);
     }
     $usertransactionModel = Admin_Model_UserTransactions::getInstance();
     $result1 = $usertransactionModel->getAllUsertransaction();
     if ($result1) {
         $this->view->usertransaction = count($result1);
     }
     $ordersModel = Admin_Model_Orders::getInstance();
     $result2 = $ordersModel->getAllHotelOrder();
     if ($result2) {
         $this->view->orderdetails = count($result2);
     }
     $ordersModel1 = Admin_Model_Orders::getInstance();
     $result21 = $ordersModel->getAllStoreOrder();
     if ($result21) {
         $this->view->storeorderdetails = count($result21);
     }
     $productsModel = Admin_Model_Products::getInstance();
     $result3 = $productsModel->getProductsdetails();
     if ($result3) {
         $this->view->productsdetails = count($result3);
     }
     $productsModel1 = Admin_Model_Products::getInstance();
     $result31 = $productsModel1->getAllStoreProductdetails();
     if ($result31) {
         $this->view->productsdetails = count($result31);
     }
     $agentsModel = Admin_Model_Agents::getInstance();
     $result4 = $agentsModel->getAgentsDetails();
     if ($result4) {
         $this->view->agentsdetails = count($result4);
     }
     $storeDetailsModel = Admin_Model_StoreDetails::getInstance();
     $result5 = $storeDetailsModel->getAllStore();
     if ($result5) {
         $this->view->storedetails = count($result5);
     }
     $hotelDetailsModel = Admin_Model_HotelDetails::getInstance();
     $result6 = $hotelDetailsModel->getAllHotels();
     if ($result6) {
         $this->view->hoteldetails = count($result6);
     }
     $agenttransactionModel = Admin_Model_AgentTransactions::getInstance();
     $result7 = $agenttransactionModel->getAllAgenttransaction();
     if ($result7) {
         $this->view->agenttransaction = count($result7);
     }
     $producttransactionModel = Admin_Model_ProductTransactions::getInstance();
     $result8 = $producttransactionModel->getAllProducttransaction();
     if ($result8) {
         $this->view->producttransaction = count($result8);
     }
     $storeCategoryDetailsModel = Admin_Model_StoreCategory::getInstance();
     $result9 = $storeCategoryDetailsModel->selectAllCategorys();
     if ($result9) {
         $this->view->storecategorydetails = count($result9);
     }
     $DeliveryGuysModel = Admin_Model_DeliveryGuys::getInstance();
     $result10 = $DeliveryGuysModel->getAllDeliveryGuys();
     if ($result10) {
         $this->view->DeliveryGuys = count($result10);
     }
     $NotificationModel = Admin_Model_Notification::getInstance();
     $result11 = $NotificationModel->getNotificationDetail();
     if ($result11) {
         $this->view->Notification = count($result11);
     }
     $ReviewsModel = Admin_Model_Reviews::getInstance();
     $result12 = $ReviewsModel->getAllHotelReviews();
     if ($result12) {
         $this->view->HotelReviews = count($result12);
     }
     $ReviewModel = Admin_Model_Reviews::getInstance();
     $result13 = $ReviewModel->getAllStoreReviews();
     if ($result13) {
         $this->view->StoreReviews = count($result13);
     }
     $locationsModel1 = Admin_Model_Location::getInstance();
     $result14 = $locationsModel1->getCountrys();
     if ($result14) {
         $this->view->CountryDetails = count($result14);
     }
     $locationsModel2 = Admin_Model_Location::getInstance();
     $result15 = $locationsModel2->getStates();
     if ($result15) {
         $this->view->StateDetails = count($result15);
     }
     $locationsModel3 = Admin_Model_Location::getInstance();
     $result16 = $locationsModel3->getCitys();
     if ($result16) {
         $this->view->CityDetails = count($result16);
     }
     $locationsModel4 = Admin_Model_Location::getInstance();
     $result17 = $locationsModel4->getLocations();
     if ($result17) {
         $this->view->LocationDetails = count($result17);
     }
     $cuisinesModel = Admin_Model_FamousCuisines::getInstance();
     $result18 = $cuisinesModel->getCuisines();
     if ($result18) {
         $this->view->CuisineDetails = count($result18);
     }
     $categoryModel = Admin_Model_MenuCategory::getInstance();
     $result19 = $categoryModel->selectAllCategorys();
     if ($result19) {
         $this->view->CategoryDetails = count($result19);
     }
     $objModelCoupons = Admin_Model_Coupons::getInstance();
     $allCoupons = $objModelCoupons->getCoupons();
     if ($allCoupons) {
         $this->view->allcoupons = count($allCoupons);
     }
     $objModelCouponUsers = Admin_Model_CouponUsers::getInstance();
     $couponsLog = $objModelCouponUsers->getCouponsLog();
     if ($couponsLog) {
         $this->view->couponsLog = count($couponsLog);
     }
 }
 public function changeStatusAction()
 {
     $this->view->layout()->disableLayout();
     $search = trim($this->_getParam('title'));
     $this->view->assign('searchText', $search);
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->_getParam('id');
     $model1 = new Admin_Model_Location();
     $model = $model1->fetchRow("id='{$id}'");
     $status = $this->_getParam('status');
     if ($status == 0) {
         $status = 1;
     } else {
         $status = 0;
     }
     $model->setStatus($status);
     //$model = new Base_Security_Menu();
     //$res=$model->changeStatus($id, $status);
     $res = $model->save();
     if (false === $res) {
         $arrResult = array("result" => 0);
     } else {
         $arrResult = array("result" => 1);
     }
     echo Zend_Json::encode($arrResult);
 }
 public function editStoreDetailsAction()
 {
     $objCurlHandler = Engine_Utilities_CurlRequestHandler::getInstance();
     $objCore = Engine_Core_Core::getInstance();
     $objSecurity = Engine_Vault_Security::getInstance();
     $this->_appSetting = $objCore->getAppSetting();
     $adminModel = Admin_Model_Users::getInstance();
     $locationsModel = Admin_Model_Location::getInstance();
     $result = $adminModel->getAdminDetails();
     // showing image
     if ($result) {
         $this->view->admindetails = $result;
     }
     $storeDetailsModel = Admin_Model_StoreDetails::getInstance();
     $agentid = $this->view->session->storage->user_id;
     $store_id = $this->getRequest()->getParam('storeId');
     $dt['store_id'] = $store_id;
     if ($this->getRequest()->isPost()) {
         $data['store_id'] = $store_id;
         $data['store_contact_number'] = $this->getRequest()->getPost('primary_phone');
         $data['secondary_phone'] = $this->getRequest()->getPost('secondary_phone');
         $data['Store_name'] = $this->getRequest()->getPost('store_name');
         $data['Open_time'] = $this->getRequest()->getPost('open_time');
         $data['Closing_time'] = $this->getRequest()->getPost('closing_time');
         $data['Notice'] = $this->getRequest()->getPost('notice');
         $data['store_status'] = $this->getRequest()->getPost('store_status');
         $data['store_address'] = $this->getRequest()->getPost('address');
         $data['Deliverycharge'] = $this->getRequest()->getPost('deliverycharge');
         $data['store_location'] = $this->getRequest()->getPost('selectlocation');
         $data['category_id'] = json_encode($this->getRequest()->getPost('category_id'));
         //            $data['Minorder'] = $this->getRequest()->getPost('minorder');
         $storelocation = $this->getRequest()->getPost('selectlocation');
         //to add new location while editing hotel details
         if (empty($storelocation)) {
             $data1['select_city'] = $this->getRequest()->getPost('selectcity');
             $location['name'] = $this->getRequest()->getPost('location_name');
             if ($data1['select_city']) {
                 $location['parent_id'] = $data1['select_city'];
                 $location['location_status'] = 1;
                 $location['location_type'] = 3;
                 $countryid = $this->getRequest()->getPost('selectcountry');
                 $stateid = $this->getRequest()->getPost('selectstate');
                 if ($countryid && $stateid && $location['parent_id']) {
                     $storelocation = $locationsModel->addLocationByParentIds($location, $stateid, $countryid);
                     //                            print_r($location_id);die;
                     if ($storelocation) {
                         $this->view->errormessage = 'Successfull';
                     } else {
                         $this->view->errormessage = 'Could not Serve the Response1';
                     }
                 } else {
                     $this->view->errormessage = 'Parametre missing';
                 }
             } else {
                 $this->view->errormessage = 'Could not Serve the Response';
             }
         }
         if (!empty($storelocation)) {
             $data['store_location'] = $storelocation;
             $coverphoto = $_FILES["fileToUpload"]["name"];
             $dirpath = getcwd() . "/themes/agent/skin/groceryimages/{$agentid}/{$store_id}/";
             if (!file_exists($dirpath)) {
                 mkdir($dirpath, 0777, true);
             }
             if (!empty($coverphoto)) {
                 $imagepath = $dirpath . $coverphoto;
                 $savepath = "/themes/agent/skin/groceryimages/{$agentid}/{$store_id}/{$coverphoto}";
                 $imageTmpLoc = $_FILES["fileToUpload"]["tmp_name"];
                 $ext = pathinfo($coverphoto, PATHINFO_EXTENSION);
                 if ($ext != "jpg" && $ext != "png" && $ext != "jpeg" && $ext != "gif") {
                     echo json_encode("Something went wrong image upload");
                     print_r("Something went wrong image upload");
                     die;
                 } else {
                     $imagemoveResult = move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $imagepath);
                     if ($imagemoveResult) {
                         $link = $this->_appSetting->hostLink;
                         $data['store_image'] = $link . $savepath;
                         $result1 = $storeDetailsModel->updateStoreDetails($store_id, $data);
                         if ($result1) {
                             $this->redirect('/admin/store-details');
                         }
                     } else {
                         $this->view->errormessage = 'store details not updated properly';
                         print_r("Something went wrong image upload");
                         die;
                     }
                 }
             } else {
                 $result1 = $storeDetailsModel->updateStoreDetails($store_id, $data);
                 if ($result1) {
                     $this->redirect('/admin/store-details');
                 }
             }
         }
     }
     $result = $storeDetailsModel->getStoreDetailsByID($store_id);
     $storecategoryModel = Admin_Model_StoreCategory::getInstance();
     $store_id = $this->getRequest()->getParam('storeId');
     $dt['store_id'] = $store_id;
     $result = $storeDetailsModel->getStoreDetailsByID($store_id);
     $categoryID = json_decode($result['category_id'], true);
     $i = 0;
     foreach ($categoryID as $categoryid) {
         $cat_id[$i] = $categoryid;
         $categoryname = $storecategoryModel->getCategoryById($categoryid);
         $categorynames[$i] = $categoryname['cat_name'];
         $i++;
     }
     $countrys = $locationsModel->getCountrys();
     if ($result) {
         $this->view->allstoredetails = $result;
         $this->view->countrylist = $countrys;
         $this->view->allStoreCategorynames = $categorynames;
         $this->view->categoryid = $cat_id;
     } else {
         echo 'controller error occured';
     }
 }
Example #8
0
 public function getids()
 {
     $obj = new Admin_Model_Location();
     $entries = $obj->fetchAll();
     $arrUser = array();
     foreach ($entries as $entry) {
         $arrUser[$entry->getId()] = $entry->getUsername();
     }
     return $arrUser;
 }
 public function editLocationAction()
 {
     $this->_helper->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $locationsModel = Admin_Model_Location::getInstance();
     if ($this->getRequest()->isPost()) {
         $data['name'] = $this->getRequest()->getPost('location');
         $location_id = $this->getRequest()->getPost('location_id');
         $locationname = $this->getRequest()->getPost('locationbtn');
         if ($location_id) {
             $result = $locationsModel->updateLocation($data, $location_id);
             if ($locationname == 'country') {
                 if ($result) {
                     $this->redirect('/admin/countries-details');
                 } else {
                     $this->redirect('/admin/countries-details');
                 }
             } else {
                 if ($locationname == 'state') {
                     if ($result) {
                         $this->redirect('/admin/states-details');
                     } else {
                         $this->redirect('/admin/states-details');
                     }
                 } else {
                     if ($locationname == 'city') {
                         if ($result) {
                             $this->redirect('/admin/city-details');
                         } else {
                             $this->redirect('/admin/city-details');
                         }
                     } else {
                         if ($locationname == 'location') {
                             if ($result) {
                                 $this->redirect('/admin/location-details');
                             } else {
                                 $this->redirect('/admin/location-details');
                             }
                         } else {
                             $this->redirect('/admin/countries-details');
                         }
                     }
                 }
             }
         } else {
             $this->redirect('/admin/countries-details');
         }
     } else {
         $this->redirect('/admin/countries-details');
     }
 }
 public function editHotelDetailsAction()
 {
     $locationsModel = Admin_Model_Location::getInstance();
     $adminModel = Admin_Model_Users::getInstance();
     $result = $adminModel->getAdminDetails();
     // showing image
     if ($result) {
         $this->view->admindetails = $result;
     }
     $hotelDetailsModel = Admin_Model_HotelDetails::getInstance();
     $hotelCuisinesModel = Admin_Model_HotelCuisines::getInstance();
     $agentid = $this->view->session->storage->user_id;
     $hotel_id = $this->getRequest()->getParam('id');
     $dt['hotel_id'] = $hotel_id;
     $cuisinesdDetails = $hotelCuisinesModel->getCuisinesByHotelId($hotel_id);
     $i = 0;
     if ($cuisinesdDetails) {
         foreach ($cuisinesdDetails as $value) {
             $array[$i] = $value['Cuisine_name'];
         }
         $i++;
         $this->view->cuisinesdDetails = $cuisinesdDetails;
     }
     if ($this->getRequest()->isPost()) {
         $response = "";
         $data['id'] = $hotel_id;
         $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['hotel_status'] = $this->getRequest()->getPost('hotel_status');
         $data['address'] = $this->getRequest()->getPost('address');
         $data['deliverycharge'] = $this->getRequest()->getPost('deliverycharge');
         $data['minorder'] = $this->getRequest()->getPost('minorder');
         $hotellocation = $this->getRequest()->getPost('selectlocation');
         //to add new location while editing hotel details
         if (empty($hotellocation)) {
             $data1['select_city'] = $this->getRequest()->getPost('selectcity');
             $location['name'] = $this->getRequest()->getPost('location_name');
             if ($data1['select_city']) {
                 $location['parent_id'] = $data1['select_city'];
                 $location['location_status'] = 1;
                 $location['location_type'] = 3;
                 $countryid = $this->getRequest()->getPost('selectcountry');
                 $stateid = $this->getRequest()->getPost('selectstate');
                 if ($countryid && $stateid && $location['parent_id']) {
                     $hotellocation = $locationsModel->addLocationByParentIds($location, $stateid, $countryid);
                     if ($hotellocation) {
                         $this->view->errormessage = 'Successfull';
                     } else {
                         $this->view->errormessage = 'Could not Serve the Response1';
                     }
                 } else {
                     $this->view->errormessage = 'Parametre missing';
                 }
             } else {
                 $this->view->errormessage = 'Could not Serve the Response';
             }
         }
         if (!empty($hotellocation)) {
             $data['hotel_location'] = $hotellocation;
             $coverphoto = $_FILES["fileToUpload"]["name"];
             $dirpath = getcwd() . "/themes/agent/skin/hotelimages/{$agentid}/{$hotel_id}/";
             if (!file_exists($dirpath)) {
                 mkdir($dirpath, 0777, true);
             }
             if (!empty($coverphoto)) {
                 $imagepath = $dirpath . $coverphoto;
                 $savepath = "/themes/agent/skin/hotelimages/{$agentid}/{$hotel_id}/{$coverphoto}";
                 $imageTmpLoc = $_FILES["fileToUpload"]["tmp_name"];
                 $ext = pathinfo($coverphoto, PATHINFO_EXTENSION);
                 if ($ext != "jpg" && $ext != "png" && $ext != "jpeg" && $ext != "gif") {
                     echo json_encode("Something went wrong image upload");
                 } else {
                     $imagemoveResult = move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $imagepath);
                     if ($imagemoveResult) {
                         //                        $link = "http://" . $_SERVER["HTTP_HOST"];
                         $link = $this->_appSetting->hostLink;
                         $data['hotel_image'] = $link . $savepath;
                         $result1 = $hotelDetailsModel->updateHotelDetails($hotel_id, $data);
                         if ($result1) {
                             $this->redirect('/admin/hotel-details');
                         }
                     } else {
                         $this->view->errormessage = 'hotel details not updated properly';
                     }
                 }
             } else {
                 $result1 = $hotelDetailsModel->updateHotelDetails($hotel_id, $data);
                 if ($result1) {
                     $this->redirect('/admin/hotel-details');
                 }
             }
         }
     }
     $result = $hotelDetailsModel->getHotelDetailsByID($hotel_id);
     $countrys = $locationsModel->getCountrys();
     if ($result) {
         $this->view->allhoteldetails = $result;
         $this->view->countrylist = $countrys;
     } else {
         echo 'controller error occured';
     }
 }