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 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 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';
     }
 }
 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';
     }
 }