예제 #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
 /**
  * @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
 }