示例#1
0
 public function editAction()
 {
     $this->view->title = "City - Edit";
     $this->view->headTitle(" -  " . $this->view->title);
     $id = $this->_getParam('id');
     $model1 = new Application_Model_City();
     $model = $model1->find($id);
     $options['name'] = $model->getName();
     $options['regionId'] = $model->getRegionId();
     $options['countryId'] = $model->getCountryId();
     $options['continentId'] = $model->getContinentId();
     $request = $this->getRequest();
     $form = new Admin_Form_City();
     $form->populate($options);
     $options = $request->getPost();
     if ($request->isPost()) {
         if ($form->isValid($options)) {
             $model->setOptions($options);
             $model->save($model);
             $this->view->successMsg = "City Id : {$model->getId()}' has been updated successfully!";
         } else {
             $form->reset();
             $form->populate($options);
         }
     }
     $this->view->form = $form;
 }
示例#2
0
 public function GenerateMeta_Static_List(Application_Model_City $city, $pageType)
 {
     switch ($pageType) {
         case Application_Model_Page::PAGE_TYPE_NEWS:
             $title = $this->view->translate->_('Новости ресторанов в ') . $city->getName();
             break;
         case Application_Model_Page::PAGE_TYPE_INTERVIEW:
             $title = $this->view->translate->_('Список интервью');
             break;
         case Application_Model_Page::PAGE_TYPE_MASTER_CLASS:
             $title = $this->view->translate->_('Список мастер классов');
             break;
         case Application_Model_Page::PAGE_TYPE_REVIEW:
             $title = $this->view->translate->_('Обзоры ресторанов');
             break;
         case Application_Model_Page::PAGE_TYPE_GOURMET_NOTE:
             $title = $this->view->translate->_('Заметки гурмана');
             break;
         case Application_Model_Page::PAGE_TYPE_ACTION:
             $title = $this->view->translate->_('Список всех акций');
             break;
         case Application_Model_Page::PAGE_TYPE_VACANCY:
             $title = $this->view->translate->_('Список всех вакансии ') . $city->getContent()->getGenitiveCase();
             break;
         case Application_Model_Page::PAGE_TYPE_AFFICHE:
             $title = $this->view->translate->_('Список всех афиш');
             break;
         default:
             throw new Exception('Unexpected page type given');
     }
     $this->view->headTitle($title);
     $this->view->headMeta()->appendName('description', '');
 }
示例#3
0
 public function init()
 {
     // Dojo-enable the form:
     //Zend_Dojo::enableForm($this);
     $cityM = new Application_Model_City();
     $citiesArr = $cityM->getCities(array("" => "--Select City--"));
     $countryM = new Application_Model_Country();
     $countryArr = $countryM->getCountry();
     /*
     $this->addElement('select', 'featured_top',array(
                 'label'      => 'Top Featured Place:',
             	'style'=>'width: 350px;',
             	'required'   => true,
             	'validators' => array(
                     	array('NotEmpty', true, array('messages'=>array('isEmpty'=>'Please select top featured place.')))
                 	),
             	'decorators' => $this->elementDecorators,
                 'filters'    => array('StringTrim'),
             	'MultiOptions'=>$citiesArr        	
             ));
     */
     $this->addElement('Multiselect', 'featured_other', array('label' => 'Featured Places/Cities:', 'style' => 'width: 350px;', 'size' => 10, 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select featured places/cities.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $citiesArr));
     $this->addElement('Multiselect', 'featured_country', array('label' => 'Featured Countries:', 'style' => 'width: 350px;', 'size' => 10, 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select featured countries.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $countryArr));
     $this->addElement('submit', 'cmdSubmit', array('required' => false, 'ignore' => true, 'label' => 'Save', 'decorators' => $this->buttonDecorators));
 }
 public function getcitiesbycountryAction()
 {
     $request = $this->getRequest();
     $countryId = $request->getParam('id');
     $mdlCity = new Application_Model_City();
     $cityList = $mdlCity->listAllByCountry($countryId);
     $this->view->result = $cityList->toArray();
 }
示例#5
0
 private function _setData(stdClass $data)
 {
     $this->__setContentFields();
     $search = new Application_Model_Geocoder_Location_Search_Location();
     $address = $search->findLocationByLatLng($data->city_location['lat'], $data->city_location['lng'], Application_Model_Geocoder_Location::TYPE_LOCALITY);
     if (!$address instanceof Application_Model_Geocoder_Location_Address) {
         throw new Exception('Location not found');
     }
     $this->_entity->setLocation($address->getCity());
     $this->_entity->setLocationLat($data->city_location['lat']);
     $this->_entity->setLocationLng($data->city_location['lng']);
     $this->_entity->setLocationZoom($data->city_location['zoom']);
 }
示例#6
0
 /**
  * 添加相关资料到控制器中,方便Action中直接读取
  */
 protected function initAddDataToController()
 {
     //设置当前或之前访问的地区资料
     $cookie = new XF_Cookie('local');
     $province_id = $cookie->read();
     $mod = new Application_Model_City();
     $row = $mod->get($province_id);
     if ($row != false && $row->parent == '0') {
         $obj = (object) array('id' => $province_id, 'name' => $row->name, 'pinyin' => $row->pinyin);
         XF_Controller_Front::getInstance()->addHandleData('nowCity', $obj);
         XF_View::getInstance()->assign('nowCity', $obj);
     }
     //添加静态资源URL
     XF_Controller_Front::getInstance()->addHandleData('static_url', 'http://static.' . XF_Config::getInstance()->getDomain());
 }
示例#7
0
 public function init()
 {
     $this->addElement('text', 'name', array('label' => 'State Name :', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter the state name')))), 'decorators' => $this->elementDecorators));
     $region = new Application_Model_City();
     $arrRegion = $region->getCity("---select---");
     $this->addElement('select', 'cityId', array('label' => 'City :', 'style' => 'width: 100%;', 'TABINDEX' => '6', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select city')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrRegion));
     $region = new Application_Model_Region();
     $arrRegion = $region->getRegion("--select---");
     $this->addElement('select', 'regionId', array('label' => 'Region :', 'style' => 'width: 100%;', 'TABINDEX' => '6', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select region')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrRegion));
     $region = new Application_Model_Country();
     $arrRegion = $region->getCountry("--select---");
     $this->addElement('select', 'countryId', array('label' => 'Country :', 'style' => 'width: 100%;', 'TABINDEX' => '6', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select country')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrRegion));
     $region = new Application_Model_Continent();
     $arrRegion = $region->getContinent("--select---");
     $this->addElement('select', 'continentId', array('label' => 'Continent :', 'style' => 'width: 100%;', 'TABINDEX' => '6', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select continent')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrRegion));
     $this->addElement('submit', 'cmdSubmit', array('required' => false, 'ignore' => true, 'label' => 'Save', 'decorators' => $this->buttonDecorators));
 }
 /**
  * 获取城市列表
  * @param int $pid 省份id
  */
 public function cityAction()
 {
     if ($pid = $this->getParamNumber('pid')) {
         if (in_array($pid, array(1, 20, 76, 96))) {
             $this->responseOK();
         }
         $tmp = '';
         $mod = new Application_Model_City();
         $rows = $mod->getsByCity($pid);
         if ($rows != false) {
             foreach ($rows as $row) {
                 $tmp[] = array('id' => $row->city_id, 'name' => $row->name, 'py' => $row->pinyin);
             }
         }
         $this->responseOK($tmp);
     }
     $this->responseArgumentMessageError();
 }
示例#9
0
 /**
  * 添加IP到库中
  * @param string $ip ip地址
  * @return int 当前ip所在地区(省份)ID
  */
 public function add($ip)
 {
     if ($ip == '127.0.0.1') {
         return '1';
     }
     $province_id = 1;
     $city_id = 35;
     $url = 'http://ip.taobao.com/service/getIpInfo.php?ip=' . $ip;
     $url = str_replace('&', '&', $url);
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $url);
     curl_setopt($curl, CURLOPT_HEADER, false);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
     $string = curl_exec($curl);
     curl_close($curl);
     $json = json_decode($string);
     //如果无法正常解析到JSON,则返回 北京的id
     if ($json == false) {
         return $province_id;
     }
     if (!is_object($json->data)) {
         return $province_id;
     }
     $provinceName = str_replace('省', '', $json->data->region);
     $provinceName = str_replace('市', '', $provinceName);
     $cityName = str_replace('市', '', $json->data->city);
     $mod = new Application_Model_City();
     $row = $mod->getCityByName($cityName);
     if ($row != false) {
         $province_id = $row->parent;
         $city_id = $row->id;
     }
     $tb = $this->NewTable();
     $tb->ip = $ip;
     $tb->province_id = $province_id;
     $tb->city_id = $city_id;
     $tb->address = '';
     try {
         $tb->insert();
     } catch (XF_Exception $e) {
     }
     return $province_id;
 }
示例#10
0
 private function switchCity()
 {
     $isSpider = false;
     $spiders = array('sogou spider', 'Sosospider', '360Spider', 'googlebot', 'mediapartners-google', 'baiduspider', 'msnbot', 'yodaobot', 'yahoo! slurp;', 'yahoo! slurp china;', 'iaskspider', 'sogou web spider', 'sogou push spider');
     foreach ($spiders as $s) {
         if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), strtolower($s)) !== false) {
             $isSpider = true;
             break;
         }
     }
     //如果来源是本站则不自动跳转
     if ((!isset($_SERVER['HTTP_REFERER']) || strpos($_SERVER['HTTP_REFERER'], XF_Config::getInstance()->getDomain()) == false) && $isSpider == false) {
         $domain_url = XF_Config::getInstance()->getDomain();
         //是否存在cookie
         $cookie = new XF_Cookie('local');
         if ($cookie->isEmpty() == false) {
             $mod = new Application_Model_City();
             $row = $mod->get($cookie->read());
             if ($row != false) {
                 die('<script>window.location.href="http://' . $row->pinyin . '.' . $domain_url . '";</script>');
             }
         }
         /////IP
         $ip = XF_Controller_Request_Http::getInstance()->getClientIp();
         $mod = new Application_Model_IP();
         $row = $mod->getByIP($ip);
         $province_id = 1;
         //如果用户ip不存在则添加到库中
         if ($row == false) {
             $province_id = $mod->add($ip);
         } else {
             $province_id = $row->province_id;
         }
         XF_Config::getInstance()->load('cityDomain');
         $cityDomains = (array) XF_Config::getInstance()->cityDomain;
         foreach ($cityDomains as $domain => $val) {
             if ($val['id'] == $province_id) {
                 die('<script>window.location.href="http://' . $domain . '.' . $domain_url . '";</script>');
             }
         }
         //默认为北京
         die('<script>window.location.href="http://beijing.' . $domain_url . '";</script>');
     }
 }
示例#11
0
 private function setModel($row)
 {
     $model = new Application_Model_City();
     $model->setId($row->id)->setName($row->name)->setRegionId($row->region_id)->setCountryId($row->country_id)->setContinentId($row->continent_id)->setFeaturedTop($row->featured_top)->setFeaturedOther($row->featured_other)->setLatitude($row->latitude)->setLongitude($row->longitude)->setAddress($row->address);
     return $model;
 }
示例#12
0
 public function GenerateMeta_Restaurant_Index(Application_Model_City $city, Application_Model_Restaurant $restaurant)
 {
     $this->view->headTitle(join(' ', array($this->view->translate->_('Ресторан ') . $restaurant->getName() . '.', $this->view->translate->_('AzRestoran, все рестораны, бары, кафе, клубы, пабы в ') . $city->getName())));
     $this->view->headMeta()->appendName('description', '');
 }
示例#13
0
 public function AddSubscribedRestaurant(array $data)
 {
     try {
         $form = $this->getAddSubscribedRestaurantForm();
         $stateid = null;
         $regionid = null;
         $cityid = null;
         $cityBd = array();
         $regionBd = array();
         $ngbhBd = array();
         $restService = new Application_Service_Firm();
         if ($data['cantfind'] == 1) {
             $form->cantfindneigh->setRequired(true);
             $form->resNeighbour->setRequired(false);
             if ($data['resState']) {
                 $stateid = $data['resState'];
                 $regionBd = $restService->GetRegionByStateId_($stateid);
                 $regionBd[] = array('key' => 'find', 'value' => "Can't Find Your Region");
             }
             if ($data['resRegion']) {
                 $regionid = $data['resRegion'];
                 $cityBd = $restService->GetCityByRegionId_($regionid);
                 $cityBd[] = array('key' => 'find', 'value' => "Can't Find Your City");
             }
             if ($data['resCity']) {
                 $cityid = $data['resCity'];
                 $ngbhBd = $restService->GetNeighborhodByCityId_($cityid);
                 $ngbhBd[] = array('key' => 'find', 'value' => "Can't Find Your Neighbourhood");
             }
         } else {
             if ($data['cantfind'] == 2) {
                 $form->cantfindcity->setRequired(true);
                 $form->resCity->setRequired(false);
                 $form->cantfindneigh->setRequired(true);
                 $form->resNeighbour->setRequired(false);
                 if ($data['resState']) {
                     $stateid = $data['resState'];
                     $regionBd = $restService->GetRegionByStateId_($stateid);
                     $regionBd[] = array('key' => 'find', 'value' => "Can't Find Your Region");
                 }
                 if ($data['resRegion']) {
                     $regionid = $data['resRegion'];
                     $cityBd = $restService->GetCityByRegionId_($regionid);
                     $cityBd[] = array('key' => 'find', 'value' => "Can't Find Your City");
                 }
             } else {
                 if ($data['cantfind'] == 3) {
                     $form->cantfindregion->setRequired(true);
                     $form->resRegion->setRequired(false);
                     $form->cantfindcity->setRequired(true);
                     $form->resCity->setRequired(false);
                     $form->cantfindneigh->setRequired(true);
                     $form->resNeighbour->setRequired(false);
                     if ($data['resState']) {
                         $stateid = $data['resState'];
                         $regionBd = $restService->GetRegionByStateId_($stateid);
                         $regionBd[] = array('key' => 'find', 'value' => "Can't Find Your Region");
                     }
                     $cityBd[] = array('key' => 'noCity', 'value' => "Can't Find Your City");
                 } else {
                     if ($data['cantfind'] == 4) {
                         $form->cantfindstate->setRequired(true);
                         $form->resState->setRequired(false);
                         $form->cantfindregion->setRequired(true);
                         $form->resRegion->setRequired(false);
                         $form->cantfindcity->setRequired(true);
                         $form->resCity->setRequired(false);
                         $form->cantfindneigh->setRequired(true);
                         $form->resNeighbour->setRequired(false);
                         $cityBd[] = array('key' => 'find', 'value' => "Can't Find Your City");
                         $regionBd[] = array('key' => 'find', 'value' => "Can't Find Your Region");
                     } else {
                         if ($data['cantfind'] == 0 || $data['cantfind'] == '') {
                             if ($data['resState']) {
                                 $stateid = $data['resState'];
                                 $regionBd = $restService->GetRegionByStateId_($stateid);
                                 $regionBd[] = array('key' => 'find', 'value' => "Can't Find Your Region");
                             }
                             if ($data['resRegion']) {
                                 $regionid = $data['resRegion'];
                                 $cityBd = $restService->GetCityByRegionId_($regionid);
                                 $cityBd[] = array('key' => 'find', 'value' => "Can't Find Your City");
                             }
                         }
                     }
                 }
             }
         }
         if ($form->isValid($data)) {
             $imageadapter = $form->resImage->getTransferAdapter();
             $logoadapter = $form->resLogo->getTransferAdapter();
             $restname = trim($data['restName']);
             $paths = $restService->UploadImages($imageadapter, $logoadapter, $restname);
             //				$imagepath = null;
             //				$logopath  = null;
             //				if($paths){
             //					$imagepath = $paths['imagepath'];
             //					$logopath  = $paths['logopath'];
             //				}
             $storage = new Zend_Auth_Storage_Session();
             $data = $storage->read();
             $formData = $form->getValues();
             $restaurant = new FirmManagement_Model_Firm();
             $cuisineTypes = $formData['restype'];
             //$resCusisneType = array();
             //foreach($cuisineTypes as $types){
             $cusisneTypeObj = new FirmManagement_Model_FirmCuisine();
             $cusisneTypeObj->setRestaurantTypeId($cuisineTypes);
             //$resCusisneType[] = $cusisneTypeObj;
             //}
             /*$reservSys = 'FALSE';
             	 if($formData['restSubResSys'] == 1)
             	 {
             	 $reservSys = 'TRUE';
             	 }*/
             $restaddress = $formData['resAddress'];
             $paymentModes = $formData['resPayment'];
             $resPaymentMode = array();
             foreach ($paymentModes as $types) {
                 $paymentModeObj = new FirmManagement_Model_FirmPaymentOptions();
                 $paymentModeObj->setRestaurantPaymentTypeId($types);
                 $resPaymentMode[] = $paymentModeObj;
             }
             $tagid = array();
             $tagidString = "";
             $tagidString = $formData['tagId'];
             if ($tagidString) {
                 $tagid = explode(',', $tagidString);
             }
             /*	Listed Restaurant
             				 $resByIdObj = new FirmManagement_Model_FirmById();
             				 $resByIdObj->setRestaurantId($formData['restId']);
             				 $restaurantMapper = new FirmManagement_Model_FirmDataMapper();
             				 $resDetails = $restaurantMapper->getRestaurantById($resByIdObj);
             
             				 $listedMapper = new FirmManagement_Model_ListedRestaurantsDataMapper();
             				 $listedRes = $listedMapper->addRestaurant($resDetails);
             				 */
             //			$paymentModel = new Application_Model_RestaurantPaymentMode();
             //			$paymentMapper = new Application_Model_RestaurantPaymentModeDataMapper();
             //			$paymentModel->setId($formData['resPayment']);
             //			$paymentObj = $paymentMapper->getPaymentModeById($paymentModel);
             if ($formData['restId']) {
                 $restaurant->setRestListedResId($formData['restId']);
             }
             $latlong = '';
             if ((int) $formData['cantfind'] < 2) {
                 /* Reterving City By Id */
                 $cityModel = new Application_Model_City();
                 $cityMapper = new Application_Model_CityDataMapper();
                 $cityModel->setId($formData['resCity']);
                 $cityObj = $cityMapper->getCityById($cityModel);
                 $restaddress .= ", " . $cityObj->getDescription();
                 $latlong = Rdine_Geocode_GeocodingAdapter::getGeocodedLatitudeAndLongitude($restaddress);
             }
             if (!$formData['restLatitude'] == NULL && !$formData['restLongitude'] == NULL) {
                 $googlemapstatus = 'TRUE';
             } else {
                 $googlemapstatus = 'FALSE';
             }
             if ($googlemapstatus == 'TRUE') {
                 $latitude = $formData['restLatitude'];
                 $longitude = $formData['restLongitude'];
             } else {
                 $latitude = NULL;
                 $longitude = NULL;
             }
             $resgoogleimage = Rdine_Geocode_GeocodingAdapter::getGoogleRestaurantImage($latitude, $longitude);
             $categoryModel = new Application_Model_RestaurantCategory();
             $categoryMapper = new Application_Model_RestaurantCategoryDataMapper();
             $categoryModel->setCode('SUB');
             $categoryObj = $categoryMapper->getIdByCode($categoryModel);
             if ($data['Usertype'] == "ADM" || $data['Usertype'] == "ADU") {
                 $restaurant->setRestaurantownerid($formData['restowner'])->setcompanyid($data['companyid']);
             } else {
                 $restaurant->setRestaurantownerid($formData['restowner'])->setcompanyid(1);
             }
             $restaurant->setRestaurantname($formData['restName'])->setRescapacity($formData['rescapacity'])->setRestemail($formData['emailAddress'])->setMaxpax($formData['maxpax'])->setRestaddress($formData['resAddress'])->setReststateid($formData['resState'])->setRestRegion($formData['resRegion'])->setRestCity($formData['resCity'])->setCantFindState($formData['cantfindstate'])->setCantFindRegion($formData['cantfindregion'])->setCantFindCity($formData['cantfindcity'])->setCantFindNeighbour($formData['cantfindneigh'])->setCantFind($formData['cantfind'])->setRestPaymentMode($resPaymentMode)->setResttypeid($cusisneTypeObj)->setResttimezone($formData['restimezone'])->setRestPrice($formData['resprice'])->setRestneighboorhood($formData['resNeighbour'])->setRestzipcode($formData['postalCode'])->setres_country_code($formData['countryCode'])->setRestphone($formData['resPhone'])->setRestfax($formData['resFax'])->setRestwebsite($formData['resWebsite'])->setRestmanagername($formData['resManager'])->setRestdesc($formData['resDescription'])->setRestDiningStyle($formData['restDiningStyle'])->setRestParking($formData['restParking'])->setRestParkDetails($formData['restParkDetails'])->setRestPrivParty($formData['restPrivParty'])->setRestPrivPartyContact($formData['restPrivPartyContact'])->setRestAdditDet($formData['restAdditDetails'])->setRestEntertainment($formData['restEntertainment'])->setRestsubforreservation('TRUE')->setReststatus(1)->setRestverifiedstatus(3)->setRestCreatedOn(date('Y-m-d H:i:s'))->setRestLatitude($latitude)->setRestLongtitude($longitude)->setRestGoogleMapStatus($googlemapstatus)->setRestGoogleImage($resgoogleimage)->setRestTimings($formData['restTimings'])->setRestCategory($categoryObj->getId())->setResCreatedDate(date('Y-m-d H:i:s'))->setRestCreatedBy($data['User_Id'])->setreslandmark($formData['restLandMark'])->setres_delevery($formData['restDelevery'])->setreslunch_buffet($formData['restLunchBuffet'])->setresdinner_buffet($formData['restDinnerBuffet'])->setres_wifi($formData['restWifi'])->setres_alcohol($formData['restAlcohol'])->setres_smoking($formData['restSmoke'])->setres_ac($formData['restAC'])->setres_catering($formData['restCatering'])->setres_kids_section($formData['restKidsSection'])->setres_party_allowed($formData['restPrivParty'])->setres_meal_category($formData['restMealType'])->setres_new_tag($formData['restnewtag'])->settag_id($tagid);
             if ($formData['restAvgMealPriceMax'] == '') {
                 $restaurant->setresavg_mealprice_max(0);
             } else {
                 $restaurant->setresavg_mealprice_max($formData['restAvgMealPriceMax']);
             }
             if ($formData['restAvgMealPriceMin'] == '') {
                 $restaurant->setresavg_mealprice_min(0);
             } else {
                 $restaurant->setresavg_mealprice_min($formData['restAvgMealPriceMin']);
             }
             $mapper = new FirmManagement_Model_FirmDataMapper();
             $status = $mapper->addRestaurant($restaurant);
             $restid = $status['resid'];
             $ownerid = $restaurant->getRestaurantaownerid();
             $mapper = new User_Model_ManagerDataMapper();
             $status = $mapper->addPresid($restid, $ownerid);
             $storage = new Zend_Auth_Storage_Session();
             $userdata = $storage->read();
             $userdata['RestId'] = $restid;
             if ($userdata['Usertype'] == 'RSO') {
                 $restNameByOwnObj = new FirmManagement_Model_FirmNamesByOwnerId();
                 $restNameByOwnObj->setRestOwnerId($userdata['User_Id']);
                 $restMapper = new FirmManagement_Model_FirmDataMapper();
                 $restList = $restMapper->getRestaurantNamesByOwnerId($restNameByOwnObj);
                 $userdata['restList'] = $restList;
             } else {
                 $restNameByOwnObj = new FirmManagement_Model_FirmNamesByOwnerId();
                 $restNameByOwnObj->setRestId($restid);
                 $restMapper = new FirmManagement_Model_FirmDataMapper();
                 $restList = $restMapper->getRestaurantNamesByOwnerId($restNameByOwnObj);
                 $userdata['restList'] = $restList;
             }
             $storage->write($userdata);
             $folderRename = rename("images/restaurant_images/{$restname}/", "images/restaurant_images/{$restid}/");
             $imagepath = null;
             $logopath = null;
             if ($paths) {
                 $imagepath = $paths['imagepath'];
                 $logopath = $paths['logopath'];
                 $imagelogoRename = '/' . $restname . '/';
                 $restid = $restid;
                 $imageRename = str_replace($imagelogoRename, '/' . $restid . '/', $imagepath);
                 $logoRename = str_replace($imagelogoRename, '/' . $restid . '/', $logopath);
                 $mapper1 = new FirmManagement_Model_FirmDataMapper();
                 $result = $mapper1->Updateimglogo($restid, $imageRename, $logoRename);
             }
             return $result;
         } else {
             $formData = $form->getValues();
             $form->populate($data);
             if ($regionBd) {
                 $form->resRegion->addMultiOptions($regionBd);
             }
             if ($cityBd) {
                 $form->resCity->addMultiOptions($cityBd);
             }
             if ($ngbhBd) {
                 $form->resNeighbour->addMultiOptions($ngbhBd);
             }
             return false;
         }
     } catch (Exception $ex) {
         Rdine_Logger_FileLogger::info($ex->getMessage());
         throw new Exception($ex->getMessage());
     }
 }
示例#14
0
 public function poiAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     echo "<pre>";
     $filename = "data/lonelyplanet-london-gapdaemon.xml";
     $xml_parser = new Base_Xml_Parser(null, $filename);
     $destinationName = $xml_parser->Data['destination_name'];
     //----insert into continent
     $continent_id = 0;
     $continentM = new Application_Model_Continent();
     $continent = $continentM->fetchRow("name='{$destinationName}'");
     if (false !== $continent) {
         $continent_id = $continent->getId();
     }
     //--------------------------
     //----insert into country
     $country_id = 0;
     $countryM = new Application_Model_Country();
     $country = $countryM->fetchRow("name='{$destinationName}'");
     if (false !== $country) {
         $country_id = $country->getId();
     }
     //-------------------------------
     ///------insert into city
     $city_id = 0;
     $cityM = new Application_Model_City();
     $city = $cityM->fetchRow("name='{$destinationName}'");
     if (false !== $city) {
         $city_id = $city->getId();
     }
     //------------------------
     if ($city_id > 0) {
         //it is city
         $locationType = "city";
         $locationId = $city_id;
     } else {
         if ($country_id > 0) {
             //it is country
             $locationType = "country";
             $locationId = $country_id;
         } else {
             if ($continent_id > 0) {
                 //it is continent
                 $locationType = "continent";
                 $locationId = $continent_id;
             } else {
                 //create a place/city and get the reference id/location id
                 ///------insert into city
                 $city_id = 0;
                 $cityM = new Application_Model_City();
                 $cityM->setName($destinationName);
                 $cityM->setCountryId(0);
                 $city_id = $cityM->save();
                 //------------------------
                 $locationType = "other";
                 $locationId = $city_id;
             }
         }
     }
     error_reporting(E_ALL & ~E_NOTICE);
     foreach ($xml_parser->Data['pois']['poi'] as $poi) {
         $poiM = new Application_Model_Poi();
         $poiM->setLocationId($locationId)->setLocationType($locationType)->setName($poi['poi_name'])->setAddress(serialize($poi['address_parts']['address_part']))->setPostcode($poi['address_postcode'])->setTelfaxs(serialize($poi['telfaxs']['telfax']))->setEmail($poi['poi_email'])->setWeb($poi['poi_web'])->setTransportModes(serialize($poi['transport_modes']['transport_mode']))->setPriceRange($poi['price_range'])->setReviewFull($poi['review_full']['p'])->setReviewSummary($poi['review_summary']['p'])->setBookable($poi['bookable']['value'])->setXCoordinate($poi['feature_x_coord'])->setYCoordinate($poi['feature_y_coord'])->setFeatureId($poi['feature_id'])->setKeywords(serialize($poi['keywords']['keyword']));
         $poiM->save();
     }
 }
示例#15
0
 public function buyReportAction()
 {
     $serialId = $this->getParam('serialId');
     $cityid = $this->getParam('city');
     $year = $this->getParam('year');
     $typeId = $this->getParam('typeId');
     $mileage = $this->getParam('mileage');
     if (!isset($serialId) || XF_Functions::isEmpty($serialId)) {
         throw new XF_Exception('车系参数不正确');
     }
     // 当前地区名称
     $name = $this->nowCity->name;
     $this->_view->serialId = $serialId;
     // 获取车型列表
     $mod = new Auto_Model_Type();
     $types = $mod->getsBySerialId($serialId);
     // print_r($types);
     $this->_view->types = $types;
     if ((!isset($serialId) || XF_Functions::isEmpty($typeId)) && !XF_Functions::isEmpty($types)) {
         $typeId = $types[0][1][0]->id;
         $type = $mod->getsByTypeId($typeId);
     } else {
         $type = $mod->getsByTypeId($typeId);
     }
     //        获得session,存车型id
     $gpj_session = new XF_Session("gpj_session");
     $sessionAry = array();
     $sessionAry["modelId"] = $typeId;
     $sessionAry["detail_model"] = $type->detail_model;
     $sessionAry["detail_price"] = $type->price_bn;
     $this->_view->type = $type;
     //        获取评估报告投票
     $vote = new Report_Model_Vote();
     $reportVote = $vote->getVoteByTypeId($typeId);
     if ($reportVote) {
         $this->_view->goodNum = $reportVote->right_vote;
         $this->_view->noGoodNum = $reportVote->noright_vote;
         $this->_view->totalNum = $reportVote->right_vote + $reportVote->noright_vote;
     } else {
         $this->_view->goodNum = 0;
         $this->_view->noGoodNum = 0;
         $this->_view->totalNum = 0;
     }
     $cityModel = new Application_Model_City();
     $cities = $cityModel->getsByCity($this->nowCity->id);
     if (!isset($cityid) || XF_Functions::isEmpty($cityid) || !is_numeric($cityid) || $cityid <= 0) {
         $cityid = $this->nowCity->id;
     }
     $cityObj = $cityModel->get($cityid);
     $this->_view->cities = $cities;
     $this->_view->cityName = $cityObj->name;
     $this->_view->cityId = $cityid;
     $this->_view->cityPinYin = $cityObj->pinyin;
     $sessionAry["province"] = $cityid;
     $d_model = $type->id;
     $year = $year > 0 ? $year : $type->listed_year;
     $mile = floatval($mileage) > 0 ? floatval($mileage) : date("Y") - $type->listed_year;
     $intent = 'buy';
     $this->_view->mileage = $mile;
     $this->_view->year = $year;
     $mod = new Report_Model_Valuation();
     $V = $mod->getValuation($cityid, $d_model, $year, '', $mile, $intent);
     $this->_view->V = $V;
     $sessionAry["detail_year"] = $year;
     $sessionAry["detail_mile"] = $mile;
     $sessionAry["serialId"] = $serialId;
     $gpj_session->write($sessionAry);
     // 随机抽取6辆车型
     $carTypeModel = new Auto_Model_Type();
     $serialCars = $carTypeModel->getsByCityAndSerialId($cityid, $typeId);
     foreach ($serialCars as $key => $val) {
         $val->mile = round($val->mile);
         if (!XF_Functions::isEmpty($val->year)) {
             $val->car_age = date("Y") - $val->year;
         }
         if (!XF_Functions::isEmpty($val->source_type)) {
             $val->source_val = $this->source_type[$val->source_type];
         }
         if (!XF_Functions::isEmpty($val->thumbnail)) {
             $val->thumbnail = $val->thumbnail . "?imageView2/1/w/296/h/193";
         } else {
         }
     }
     $this->_view->serialCars = $serialCars;
     $this->setLayout(new Layout_Default());
     $this->_view->headTitle("买二手车价格评估-买二手车估价-买二手车技巧流程-公平价");
     $this->_view->headMeta("买二手车车评估,买二手车估价,买二手车流程,买二手车技巧");
     $this->_view->headMeta("公平价-买车评估频道为您提供:二手车买车估值、二手车买车估价、二手车买车估价计算器,给您所选爱车一个精准、公平、公道的价格。二手车买车服务就上公平价!");
     // 设置页面资源
     $this->_view->headStylesheet('/css/report/report.css');
     $this->_view->headStylesheet('/css/valid.css');
     $this->_view->headScript('/js/pagejs/buyreport.js');
 }
示例#16
0
 public function GenerateMeta_RestaurantSearch(Application_Model_City $city)
 {
     $this->view->headTitle(join(' ', array($this->view->translate->_('Рейтинг ресторанов, баров и кафе в') . ' ' . $city->getName() . '.', $this->view->translate->_('Заказ столика в ресторанах') . ' ' . $city->getName() . ' |', $this->view->translate->_('AzRestoran – все рестораны'))));
     $this->view->headMeta()->appendName('description', join(' ', array($this->view->translate->_('Выбор ресторана, кафе или бара на AzRestoran.'), $this->view->translate->_('Рейтинг лучших заведений') . ' ' . $city->getName() . '.')));
 }
 /**
  * @Created By	: Mahipal Singh Adhikari
  * @Created On	: 7-Dec-2010
  * @Description	: Manage featured plasec/cities
  */
 public function indexAction()
 {
     $this->view->title = "Manage Featured Places";
     $this->view->headTitle(" - " . $this->view->title);
     $this->view->msg = base64_decode($this->_getParam('msg', ''));
     $form = new Admin_Form_Featuredcity();
     //clear form element decorators
     $elements = $form->getElements();
     $form->clearDecorators();
     foreach ($elements as $element) {
         $element->removeDecorator('label');
         $element->removeDecorator('td');
         $element->removeDecorator('tr');
         $element->removeDecorator('row');
         $element->removeDecorator('HtmlTag');
         $element->removeDecorator('class');
         $element->removeDecorator('placement');
         $element->removeDecorator('data');
     }
     $this->view->form = $form;
     //get featured Cities
     $cityM = new Application_Model_City();
     $cityArr = $cityM->fetchAll("featured_top=1 OR featured_other=1");
     //get existing records to populate filled/selected in form
     $featuredOther = array();
     foreach ($cityArr as $row) {
         if ($row->featuredTop == 1) {
             //$options['featured_top']	=	$row->id;
         } else {
             $featuredOther[$row->id] = $row->id;
         }
     }
     //$form->getElement('featured_other')->setMultiOptions($featuredOther);
     $options['featured_other'] = $featuredOther;
     //get existing featured countries
     $countryM = new Application_Model_Country();
     $countryArr = $countryM->fetchAll("featured=1");
     $featuredCountry = array();
     foreach ($countryArr as $country) {
         $featuredCountry[$country->id] = $country->id;
     }
     $options['featured_country'] = $featuredCountry;
     $form->populate($options);
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             //re-set all values of featured_top and featured_other fileds in city table
             $resetFeaturedCity = $cityM->resetUpdateFeatured();
             $resetFeaturedCountry = $countryM->resetUpdateFeatured();
             if ($resetFeaturedCity && $resetFeaturedCountry) {
                 //update top featued city
                 //$cityM->setUpdateFeaturedTop($formData['featured_top']);
                 //update other featured cities
                 $cityM->setUpdateFeaturedOther($formData['featured_other']);
                 //update featured countries
                 $countryM->setUpdateFeatured($formData['featured_country']);
                 //set update message and redirect user
                 $this->_redirect("/admin/featured-city/index/msg/" . base64_encode("Featured places information has been updated."));
             }
         } else {
             $form->populate($formData);
         }
     }
 }
示例#18
0
 public function GenerateMeta_Index(Application_Model_City $city)
 {
     $this->view->headTitle(join(' ', array($this->view->translate->_('Рестораны и бары ') . $city->getName() . '.', $this->view->translate->_('Ресторанный гид AzRestoran. Все рестораны, кафе и клубы в') . ' ' . $city->getName() . '.', $this->view->translate->_('Цены и отзывы, подробная информация о заведениях Азербайджана.'))));
     $this->view->headMeta()->appendName('description', join(' ', array($this->view->translate->_('AzRestoran – выбор ресторана, бара, паба или клуба в') . ' ' . $city->getName() . '.', $this->view->translate->_('Отзывы, меню ресторанов и кафе.'), $this->view->translate->_('Все заведения Азербайджана на одном сайте.'))));
 }
示例#19
0
 public function GenerateMeta_Comments(Application_Model_City $city)
 {
     $this->view->headTitle(join(' ', array($this->view->translate->_('Отзывы о ресторанах, барах и кафе в'), $city->getName() . '.', $this->view->translate->_('Рестораны'), $city->getName(), $this->view->translate->_('отзывы и обсуждения |'), $this->view->translate->_('AzRestoran – все рестораны'))));
     $this->view->headMeta()->appendName('description', join(' ', array($this->view->translate->_('Отзывы обо всех ресторанах, барах, пабах, клубах и кафе'), $city->getName() . '.', $this->view->translate->_('Комментарии и обсуждения заведений'), $city->getName() . '.')));
 }
示例#20
0
 public function xmlAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     echo "<pre>";
     $filename = "data/sample - Chiang Mai.xml";
     $xml_parser = new Base_Xml_Parser(null, $filename);
     $continentName = $xml_parser->Data['identification']['geoTag1'];
     $countryName = $xml_parser->Data['identification']['geoTag2'];
     $cityName = $xml_parser->Data['identification']['geoTag3'];
     //----insert into continent
     $continent_id = 0;
     $continentM = new Application_Model_Continent();
     $continent = $continentM->fetchRow("name='{$continentName}'");
     if (false === $continent) {
         $continentM->setName($continentName);
         $continent_id = $continentM->save();
     } else {
         $continent_id = $continent->getId();
     }
     //--------------------------
     //----insert into country
     $country_id = 0;
     $countryM = new Application_Model_Country();
     $country = $countryM->fetchRow("name='{$countryName}' and continent_id='{$continent_id}'");
     if (false === $country) {
         $countryM->setName($countryName);
         $countryM->setContinentId($continent_id);
         $country_id = $countryM->save();
     } else {
         $country_id = $country->getId();
     }
     //-------------------------------
     ///------insert into city
     $city_id = 0;
     $cityM = new Application_Model_City();
     $city = $cityM->fetchRow("name='{$cityName}' and country_id='{$country_id}'");
     if (false === $city) {
         $cityM->setName($cityName);
         $cityM->setCountryId($country_id);
         $city_id = $cityM->save();
     } else {
         $city_id = $city->getId();
     }
     //------------------------
     if ($continent_id > 0 && $country_id > 0 && $city_id > 0) {
         //it is city
         $locationType = "city";
         $locationId = $city_id;
     } else {
         if ($continent_id > 0 && $country_id > 0) {
             //it is country
             $locationType = "country";
             $locationId = $country_id;
         } else {
             if ($continent_id > 0) {
                 //it is continent
                 $locationType = "continent";
                 $locationId = $continent_id;
             }
         }
     }
     $title = $xml_parser->Data['content']['title'];
     $introduction = $xml_parser->Data['content']['introduction'];
     $destinationM = new Application_Model_Destination();
     $destinationM->setTitle($title);
     $destinationM->setIntroduction($introduction);
     $destinationM->setLocationId($locationId);
     $destinationM->setLocationType($locationType);
     $destination_id = $destinationM->save();
     foreach ($xml_parser->Data['content']['experiences'] as $experiences) {
         foreach ($experiences as $_item) {
             //print_r($_item);die();
             $experiencesM = new Application_Model_Experiences();
             $experiencesM->setTitle($_item['title']);
             $experiencesM->setDestinationId($destination_id);
             $experiencesM->setCopy($_item['copy']);
             $experiencesM->save();
         }
     }
     foreach ($xml_parser->Data['content']['practicalities'] as $practicalities) {
         foreach ($practicalities as $_item) {
             $practicalitiesM = new Application_Model_Practicalities();
             $practicalitiesM->setTitle($_item['title']);
             $practicalitiesM->setDestinationId($destination_id);
             $practicalitiesM->setCopy($_item['copy']);
             $practicalitiesM->save();
         }
     }
     foreach ($xml_parser->Data['content']['eatSleepDrink'] as $eatsleepdrink) {
         foreach ($eatsleepdrink as $_item) {
             //print_r($_item);die();
             $EatSleepDrinkM = new Application_Model_EatSleepDrink();
             $EatSleepDrinkM->setTitle($_item['title']);
             $EatSleepDrinkM->setDestinationId($destination_id);
             $EatSleepDrinkM->setBackPackerCopy($_item['backpackerCopy']);
             $EatSleepDrinkM->setLocalCopy($_item['localCopy']);
             $EatSleepDrinkM->save();
         }
     }
     //print_r($xml_parser->Data);
 }
示例#21
0
 /**
  * @Created By : Mahipal Singh Adhikari
  * @Created On : 6-Dec-2010
  * @Description: Get City/Place information and display city content
  */
 public function cityAction()
 {
     $id = $this->_getParam('id');
     $cityM = new Application_Model_City();
     $city = $cityM->find($id);
     $this->view->invalidCity = "0";
     if (false === $city) {
         $this->view->invalidCity = "1";
     } else {
         //set City and Country name to view
         $this->view->cityName = $cityName = $city->getName();
         $this->view->country_id = $city->getCountryId();
         //now get country in which this city exists
         $countryM = new Application_Model_Country();
         $country_id = $city->getCountryId();
         $countryM = $countryM->find($country_id);
         $this->view->countyName = $countryName = $countryM->getName();
         //set City Google map address
         $searchAddress = $cityName . " ," . $countryName;
         $latitude = "-34.397";
         $longitude = "150.644";
         //if Lat/Lon coordinates available
         if ($city->getLatitude() != "" && $city->getLongitude() != "") {
             $latitude = $city->getLatitude();
             $longitude = $city->getLongitude();
             $searchAddress = "(" . $latitude . ", " . $longitude . ")";
         }
         $this->view->searchAddress = $searchAddress;
         $this->view->latitude = $latitude;
         $this->view->longitude = $longitude;
         $destinationM = new Application_Model_Destination();
         $destination = $destinationM->fetchRow("location_id='{$id}' AND location_type='city'");
         if (false !== $destination) {
             $this->view->overview = $destination->getTitle();
             $this->view->nutshell = $destination->getIntroduction();
             $destination_id = $destination->getId();
             //Get Eat sleep Drink information of city
             $eatSleepDrink = $destinationM->destinationEatSleepDrink($destination_id);
             if (false !== $eatSleepDrink) {
                 if (count($eatSleepDrink) > 0) {
                     $this->view->eatSleepDrink = $eatSleepDrink;
                 }
             }
             //Get Expriences of city
             $exprienceArr = $destinationM->destinationExprience($destination_id);
             if (false !== $exprienceArr) {
                 if (count($exprienceArr) > 0) {
                     $this->view->exprience = $exprienceArr;
                 }
             }
             //Get Practicalities of city
             $practicalArr = $destinationM->destinationPractical($destination_id);
             if (false !== $practicalArr) {
                 if (count($practicalArr) > 0) {
                     $this->view->practical = $practicalArr;
                 }
             }
             //get city/place images
             $cityImagesArr = $destinationM->destinationImages($id, "city");
             if (false !== $cityImagesArr) {
                 if (count($cityImagesArr) > 0) {
                     $this->view->cityImagesArr = $cityImagesArr;
                 }
             }
         }
         //select country information to display in other tabs
         if (false === $countryM) {
             $this->view->countryInfo = "no_data";
         } else {
             $db = Zend_Registry::get("db");
             $sSQL = "SELECT * FROM lonely_planet_country WHERE country_id='{$country_id}'";
             $row = $db->fetchRow($sSQL);
             if (!empty($row)) {
                 $this->view->countryInfo = $row;
                 //$destinationM	=	new Application_Model_Destination();
                 $destination = $destinationM->fetchRow("location_id='{$country_id}' AND location_type='country'");
                 if (false !== $destination) {
                     $bank_breaker = unserialize($destination->getBankBreaker());
                     $this->view->bank_breaker = $bank_breaker;
                     $dontLeaveWithoutM = new Application_Model_DontLeaveWithout();
                     $this->view->dontLeaveWithout = $dontLeaveWithoutM->fetchAll("destination_id='{$destination->getId()}' ");
                 }
             } else {
                 $this->view->countryInfo = "no_data";
             }
         }
     }
     //end of else
 }
示例#22
0
 /**
  * @Created By	: Mahipal Singh Adhikari
  * @Created On	: 13-Jan-2011
  * @Description	: Get featured places
  * @Input		: none 
  * @Return		: array
  */
 public function selectFeaturedPlaces()
 {
     $cityM = new Application_Model_City();
     //get other featured cities
     $cityArr = array();
     $cityArr = $cityM->fetchAll("featured_top=1 OR featured_other=1", "name ASC");
     $featuredOther = array();
     $featuredOtherArr = array();
     if (count($cityArr) > 0) {
         foreach ($cityArr as $row) {
             $featuredOther['city_id'] = $row->id;
             $featuredOther['name'] = $row->name;
             //get City/place image
             $featuredOther['city_image'] = "no-image.jpg";
             $cityImagesArr = $this->destinationImages($row->id);
             if (false !== $cityImagesArr) {
                 if (count($cityImagesArr) > 0) {
                     $featuredOther['city_image'] = $cityImagesArr[0]['city_image'];
                 }
             }
             //now get country in which this city exists
             $countryM = new Application_Model_Country();
             $country_id = $row->countryId;
             $countryM = $countryM->find($country_id);
             if (false !== $countryM) {
                 $featuredOther['country'] = $countryM->getName();
             }
             $destination = $this->fetchRow("location_id='{$row->id}' AND location_type='city'");
             if (false !== $destination) {
                 $featuredOther['overview'] = $destination->getTitle();
                 $featuredOther['nutshell'] = $destination->getIntroduction();
             }
             $featuredOtherArr[] = $featuredOther;
         }
         //end of foreach
         return $featuredOtherArr;
     }
     //end if
 }