Exemplo n.º 1
0
 public function init()
 {
     $this->setMethod('post');
     $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate');
     $this->addElement('password', 'currentPassword', array('label' => 'Current Password:'******'required' => false, 'autocomplete' => 'off', 'TABINDEX' => '2', 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('password', 'password', array('label' => 'New Password:'******'required' => false, 'autocomplete' => 'off', 'TABINDEX' => '2', 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter the new password'))), array('validator' => 'StringLength', 'options' => array(6, 20)))))->getElement('password')->addValidator('IdenticalField', false, array('confirmPassword', 'Confirm Password'));
     $this->addElement('password', 'confirmPassword', array('label' => 'Confirm Password:'******'required' => false, 'autocomplete' => 'off', 'TABINDEX' => '3', 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(6, 20)))));
     // Add an first name element
     $this->addElement('text', 'firstName', array('label' => 'First Name:', 'class' => 'form', 'TABINDEX' => '4', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter first name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an last name element
     $this->addElement('text', 'lastName', array('label' => 'Surname:', 'class' => 'form', 'TABINDEX' => '5', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim')));
     $this->addElement('text', 'email', array('label' => 'Your Email Address:', 'TABINDEX' => '1', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter email')))), 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $language = new Application_Model_Language();
     $arrLang = $language->getLanguage("--select--");
     $this->addElement('select', 'preferredLanguage', array('label' => 'Preferred Language:', 'class' => 'form', 'TABINDEX' => '7', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select language')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrLang));
     $this->addElement('text', 'otherLanguages', array('label' => 'Other Languages:', 'class' => 'form', 'TABINDEX' => '8', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $country = new Application_Model_Country();
     //$arrCountry=$country->getCountry("--select---");
     $nationalitiesArr = $country->getNationalities("---Select Nationality---");
     $this->addElement('select', 'countryPassport', array('label' => 'Nationality:', 'class' => 'form', 'TABINDEX' => '6', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select nationality.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $nationalitiesArr));
     $this->addElement('hidden', 'cityId', array('label' => 'Home Town/City:', 'TABINDEX' => '9', 'class' => 'form', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('text', 'cityName', array('label' => 'Home Town/City:', 'TABINDEX' => '10', 'class' => 'form', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $day[''] = "Day";
     for ($i = 1; $i < 32; $i++) {
         $day[$i] = $i;
     }
     $this->addElement('select', 'day', array('label' => 'Date of Birth:', 'TABINDEX' => '11', 'class' => "select-box", 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $day));
     $month[""] = "Month";
     for ($i = 1; $i < 13; $i++) {
         $month[$i] = $i;
     }
     $this->addElement('select', 'month', array('class' => "select-box", 'TABINDEX' => '12', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $month));
     $year[''] = "Year";
     for ($i = date("Y"); $i > 1900; $i--) {
         $year[$i] = $i;
     }
     $this->addElement('select', 'year', array('class' => "select-box", 'TABINDEX' => '13', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $year));
     $this->addElement('radio', 'sex', array('label' => 'Gender:', 'required' => true, 'TABINDEX' => '14', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must select the gender.')))), 'multiOptions' => array('male' => "Male", 'female' => "Female"), 'separator' => "", 'decorators' => $this->elementDecorators));
     $this->addElement('radio', 'firstTimeTraveller', array('TABINDEX' => '16', 'label' => 'First time traveller? ', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select option.')))), 'multiOptions' => array('yes' => "Yes", 'no' => "No"), 'separator' => "", 'decorators' => $this->elementDecorators));
     $this->addElement('text', 'mobileCountryCode', array('label' => 'Mobil No. Country Code:', 'validators' => array('Digits'), 'TABINDEX' => '18', 'class' => 'form', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('text', 'mobile', array('label' => 'Mobile Number:', 'validators' => array('Digits'), 'TABINDEX' => '19', 'class' => 'form', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('file', 'image', array('class' => "input-browse", 'label' => 'Add/Edit (Up to 5MB)', 'required' => false, 'decorators' => $this->fileDecorators));
     $this->getElement('image')->addValidator('Size', false, 1024 * 1024 * 5);
     //5 MB file is allowed
     $this->getElement('image')->getValidator('Size')->setMessages(array("fileSizeTooBig" => "Maximum allowed file size is 5 MB.", "fileSizeTooSmall" => ""));
     $this->getElement('image')->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $this->getElement('image')->getValidator('Extension')->setMessages(array("fileExtensionFalse" => "Please upload jpg,jpeg,png,gif file.", "fileExtensionNotFound" => ""));
     $this->addElement('textarea', 'dreamDestination', array('label' => 'What is your dream destination?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'wayToTravel', array('label' => 'Favourite way to travel?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'travelGear', array('label' => 'Best bit of travel gear?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'yearGoal', array('label' => 'Gap Year goal?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'leaveHomeWithout', array('label' => 'Never leave home without …?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'interests', array('label' => 'Interests?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'evenTakenGapYear', array('label' => 'Ever taken a gap year?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'nextTravelToDoList', array('label' => 'Next on your travel To Do list?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'favouriteTravelExperience', array('label' => 'Your favourite travel experience so far?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'signup', 'TABINDEX' => '20', 'ignore' => true, 'label' => 'Save Update Settings', 'decorators' => $this->buttonDecorators));
     //$this->getElement('firstName')->addValidator('Badwords', true);
     //$this->getElement('firstName')->getValidator('Badwords')->setMessages(array("badWords"=>"Bad words are not allowed."));
 }
Exemplo n.º 2
0
 public function editAction()
 {
     $this->view->title = "Country - Edit";
     $this->view->headTitle($this->view->title);
     $id = $this->_getParam('id');
     $model1 = new Application_Model_Country();
     $model = $model1->find($id);
     $options['name'] = $model->getName();
     $options['continentId'] = $model->getContinentId();
     $request = $this->getRequest();
     $form = new Admin_Form_Country();
     $form->populate($options);
     $options = $request->getPost();
     if ($request->isPost()) {
         if ($form->isValid($options)) {
             $model->setOptions($options);
             $model->save($model);
             $this->view->successMsg = "Country Id : {$model->getId()}' has been updated successfully!";
         } else {
             $form->reset();
             $form->populate($options);
         }
     }
     $this->view->form = $form;
 }
Exemplo n.º 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));
 }
Exemplo n.º 4
0
 public function init()
 {
     $this->addElement('text', 'name', array('label' => 'City Name:', 'class' => '', 'decorators' => $this->elementDecorators));
     $countryM = new Application_Model_Country();
     $countryArr = $countryM->getCountry("--- Select Country ---");
     $this->addElement('select', 'country_id', array('label' => 'Country:', 'style' => 'width: 250px;', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $countryArr));
     $this->addElement('submit', 'submit', array('required' => false, 'ignore' => true, 'label' => 'Search', 'decorators' => $this->buttonDecorators));
 }
Exemplo n.º 5
0
 public function init()
 {
     $this->addElement('text', 'name', array('label' => 'Region Name :', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter the region name')))), 'decorators' => $this->elementDecorators));
     $country = new Application_Model_Country();
     $arrCountry = $country->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' => $arrCountry));
     $continent = new Application_Model_Continent();
     $arrContinent = $continent->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' => $arrContinent));
     $this->addElement('submit', 'cmdSubmit', array('required' => false, 'ignore' => true, 'label' => 'Save', 'decorators' => $this->buttonDecorators));
 }
Exemplo n.º 6
0
 public static function getInstance()
 {
     if (!is_object(self::$_instance)) {
         //or if( is_null(self::$_instance) ) or if( self::$_instance == null )
         self::$_instance = new Application_Model_Country();
     }
     return self::$_instance;
 }
Exemplo n.º 7
0
 /**
  * Get country list
  * 
  * @return array
  */
 public function getList($lang = null)
 {
     if (!$lang) {
         $lang = CURR_LANG;
     }
     $settings = $this->_settings;
     $countries = Application_Model_CountryMapper::getInstance()->getAllCountries($lang);
     if (isset($settings['selected_only']) && $settings['selected_only']) {
         $result = array();
         foreach ($countries as $country) {
             if (in_array($country->get_code2(), $settings['selected_countries'])) {
                 $result[] = $country;
             }
         }
         return $result;
     } else {
         if (isset($settings['selected_countries']) && count($settings['selected_countries'])) {
             $rest_countries = array();
             $selected_countries = array();
             foreach ($countries as $country) {
                 if (!in_array($country->get_code2(), $settings['selected_countries'])) {
                     $rest_countries[$country->get_code2()] = $country;
                 }
                 if (in_array($country->get_code2(), $settings['selected_countries'])) {
                     $selected_countries[$country->get_code2()] = $country;
                 }
             }
             $selected_countries = $this->sortSelected($selected_countries, $settings['selected_countries']);
             $spacer = new Application_Model_Country();
             $spacer->set_code2('')->set_name("--------------------");
             $selected_countries[] = $spacer;
             return array_merge($selected_countries, $rest_countries);
         } else {
             return $countries;
         }
     }
 }
 public function init()
 {
     $this->setMethod(Zend_Form::METHOD_POST);
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel('Country');
     $country->setRequired(true);
     $mdlCountry = new Application_Model_Country();
     $countries = $mdlCountry->listAll();
     $country->addMultiOption(0, 'Select Country');
     foreach ($countries as $countryItem) {
         $country->addMultiOption($countryItem->id, $countryItem->name);
     }
     $country->addValidators(array(new Zend_Validate_Db_RecordExists(array('table' => 'country', 'field' => 'id'))));
     $this->addElement($country);
     $city = new Zend_Form_Element_Select('city');
     $city->setLabel('City');
     $city->setRequired(true);
     $city->setRegisterInArrayValidator(false);
     $city->addValidators(array(new Zend_Validate_Db_RecordExists(array('table' => 'city', 'field' => 'id'))));
     $this->addElement($city);
     $btnSubmit = new Zend_Form_Element_Submit("btnSubmit");
     $btnSubmit->setLabel("Save");
     $this->addElement($btnSubmit);
 }
Exemplo n.º 9
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();
     }
 }
Exemplo n.º 10
0
 /**
  * @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);
         }
     }
 }
 public function getLocationsAction()
 {
     $locationsmodal = Application_Model_Location::getInstance();
     $countrymodal = Application_Model_Country::getInstance();
     $response = new stdClass();
     $method = $this->getRequest()->getParam('method');
     if ($method) {
         switch ($method) {
             case 'getcitys':
                 $cityslist = $locationsmodal->getCitys();
                 if ($cityslist) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $cityslist;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'getcountrys':
                 $countrieslist = $locationsmodal->getCountrys();
                 if ($countrieslist) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $countrieslist;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 //   =================================== get states &cities action===== by sreekanth-===============================
             //   =================================== get states &cities action===== by sreekanth-===============================
             case 'getstates':
                 $countrieslist = $locationsmodal->getallStates();
                 if ($countrieslist) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $countrieslist;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'getcities':
                 $countrieslist = $locationsmodal->getallcities();
                 if ($countrieslist) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $countrieslist;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'getlocations':
                 $countrieslist = $locationsmodal->getAllLocations();
                 if ($countrieslist) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $countrieslist;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 //   =================================== get states &cities action===== by sreekanth-=======END========================
             //   =================================== get states &cities action===== by sreekanth-=======END========================
             case 'getStatesByCountrys':
                 if ($this->getRequest()->isPost()) {
                     $location_id = $this->getRequest()->getPost('country_id');
                     if ($location_id) {
                         $locationslist = $locationsmodal->getStatesByCountrys($location_id);
                         if ($locationslist) {
                             $response->message = 'Successfull';
                             $response->code = 200;
                             $response->data = $locationslist;
                         } else {
                             $response->message = 'Could not Serve the Response';
                             $response->code = 197;
                             $response->data = NUll;
                         }
                     }
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'getcitysbystates':
                 if ($this->getRequest()->isPost()) {
                     $location_id = $this->getRequest()->getPost('state_id');
                     if ($location_id) {
                         $locationslist = $locationsmodal->getCitysByStates($location_id);
                         if ($locationslist) {
                             $response->message = 'Successfull';
                             $response->code = 200;
                             $response->data = $locationslist;
                         } else {
                             $response->message = 'Could not Serve the Response';
                             $response->code = 197;
                             $response->data = NUll;
                         }
                     }
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
             case 'getlocation':
                 if ($this->getRequest()->isPost()) {
                     $location_id = $this->getRequest()->getPost('location_id');
                     if ($location_id) {
                         $locationslist = $locationsmodal->getLocationsByCitys($location_id);
                         if ($locationslist) {
                             $response->message = 'Successfull';
                             $response->code = 200;
                             $response->data = $locationslist;
                         } else {
                             $response->message = 'Could not Serve the Response';
                             $response->code = 197;
                             $response->data = NUll;
                         }
                     }
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 //added by sowmya 12/4/2016
             //added by sowmya 12/4/2016
             case 'getHotelLocation':
                 if ($this->getRequest()->isPost()) {
                     $hotelid = $this->getRequest()->getPost('hotel_id');
                     if ($hotelid) {
                         $locationslist = $locationsmodal->getLocationByParentIds($hotelid);
                         if ($locationslist) {
                             $response->message = 'Successfull';
                             $response->code = 200;
                             $response->data = $locationslist;
                         } else {
                             $response->message = 'Could not Serve the Response';
                             $response->code = 197;
                             $response->data = NUll;
                         }
                     }
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 //added by sowmya 27/4/2016
             //added by sowmya 27/4/2016
             case 'countryCodeDetails':
                 $countrieslist = $countrymodal->getAllCountryCode();
                 if ($countrieslist) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $countrieslist;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 //added by sowmya 29/4/2016
             //added by sowmya 29/4/2016
             case 'getcity':
                 $cityslist = $locationsmodal->getCity();
                 if ($cityslist) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $cityslist;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
                 //added by sowmya 29/4/2016
             //added by sowmya 29/4/2016
             case 'getcountry':
                 $countrieslist = $locationsmodal->getCountry();
                 if ($countrieslist) {
                     $response->message = 'Successfull';
                     $response->code = 200;
                     $response->data = $countrieslist;
                 } else {
                     $response->message = 'Could not Serve the Response';
                     $response->code = 197;
                     $response->data = NUll;
                 }
                 echo json_encode($response, true);
                 die;
                 break;
         }
     } else {
         $response->message = 'Could not Serve the Response';
         $response->code = 197;
         $response->data = NUll;
     }
     echo json_encode($response, true);
     die;
 }
Exemplo n.º 12
0
 /**
  * Get all countries where dial code is not null
  * @param string $language language code
  * @return array
  */
 public function getAllCountries($language = null)
 {
     if (!isset($language)) {
         $language = 'en';
     }
     $query = "  SELECT c.*,ct.value AS country_tr\n                    FROM country AS c\n                        LEFT JOIN country_translate AS ct ON c.code2 = ct.code2 AND ct.language = '" . addslashes($language) . "'\n                    WHERE c.dial_code is not NULL ORDER BY ct.value ASC";
     $resultSet = $this->_dbTable->getAdapter()->fetchAll($query);
     $countries = array();
     foreach ($resultSet as $row) {
         $country = new Application_Model_Country();
         if ($row['country_tr']) {
             $row['name'] = $row['country_tr'];
         }
         $country->setOptions($row);
         $countries[] = $country;
     }
     return $countries;
 }
Exemplo n.º 13
0
 /**
  * @Created By	: Mahipal Singh Adhikari
  * @Created On	: 14-Dec-2010
  * @Description	: Get Nationality name by ID (here country_passport is nationality)
  * @Input		: none
  * @Return		: string
  */
 public function getNationality()
 {
     $country = new Application_Model_Country();
     $nationality = $country->getNationalityName($this->getCountryPassport());
     return $nationality;
 }
Exemplo n.º 14
0
 /**
  * @Created By : Mahipal Singh Adhikari
  * @Created On : 7-Dec-2010
  * @Description: Display Country information under Travel guides section
  */
 public function countryAction()
 {
     $id = $this->_getParam('id');
     $countryM = new Application_Model_Country();
     $country = $countryM->find($id);
     $this->view->country_id = $id;
     //get in block
     $this->view->invalidCountry = "0";
     if (false === $country) {
         $this->view->invalidCountry = "1";
     } else {
         $this->view->countyName = $countryName = $country->getName();
         //set City Google map address
         $searchAddress = $countryName;
         $latitude = "-34.397";
         $longitude = "150.644";
         //if Lat/Lon coordinates available
         if ($country->getLatitude() != "" && $country->getLongitude() != "") {
             $latitude = $country->getLatitude();
             $longitude = $country->getLongitude();
             $searchAddress = "(" . $latitude . ", " . $longitude . ")";
         }
         $this->view->latitude = $latitude;
         $this->view->longitude = $longitude;
         $this->view->searchAddress = $searchAddress;
         $db = Zend_Registry::get("db");
         $sSQL = "SELECT * FROM lonely_planet_country WHERE country_id='{$id}'";
         $row = $db->fetchRow($sSQL);
         if (!empty($row)) {
             $this->view->countryInfo = $row;
             //get information from destination table
             $destinationM = new Application_Model_Destination();
             $destination = $destinationM->fetchRow("location_id='{$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()}'", "id ASC");
             }
             //get country images
             $countryImagesArr = $destinationM->destinationImages($id, "country");
             if (false !== $countryImagesArr) {
                 if (count($countryImagesArr) > 0) {
                     $this->view->countryImagesArr = $countryImagesArr;
                 }
             }
         } else {
             $this->view->invalidCountry = "2";
         }
     }
 }
Exemplo n.º 15
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);
 }
Exemplo n.º 16
0
 /**
  * @Created By	: Mahipal Singh Adhikari
  * @Created On	: 2-Dec-2010
  * @Description	: Used to parse Lonely Planet Country XML and save data to database table
  */
 public function lonelyXmlAction()
 {
     //disable layout and view
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     //create Db and Sanitize class objects
     $db = Zend_Registry::get("db");
     $sanitizeM = new Base_Sanitize();
     //Truncate or Empty table first
     $db->query("TRUNCATE TABLE lonely_planet_country");
     //$directory="data/1615/xml/20110119/";
     $directory = "data/1615/xml/20110304/";
     //$directory="data/1615/xml/test/";
     if (!($dp = opendir($directory))) {
         die("Cannot open {$directory}.");
     }
     $countFiles = 1;
     while ($filename = readdir($dp)) {
         $file_path = "";
         if (is_dir($filename)) {
             continue;
         } else {
             if ($filename != '.' && $filename != '..') {
                 $fileExtension = explode(".", $filename);
                 $fileExtension = strtolower($fileExtension[count($fileExtension) - 1]);
                 if ($fileExtension == "xml") {
                     $file_path = $directory . $filename;
                     //open and replace HTMl tags from XML file and rewrite
                     $fileContent = "";
                     $fh = "";
                     $fileContent = file_get_contents($file_path);
                     $fileContent = $this->replaceText($fileContent);
                     $fh = fopen($file_path, 'w+') or die("can't open file");
                     fwrite($fh, $fileContent);
                     fclose($fh);
                     //now load XML files and parse XMLs
                     $data = array();
                     echo "<br><br>Strart processing file==><b>" . $file_path . "</b> counter=>" . $countFiles;
                     $destination = simplexml_load_file($file_path);
                     $data["node_id"] = (string) $destination["node_id"];
                     $data["destination_name"] = (string) $sanitizeM->clearInputs($destination->destination_name);
                     $data["full_destination_name"] = (string) $destination->general->full_destination_name;
                     $data["intro_mini"] = (string) $this->replaceText($destination->general->intro_mini, true);
                     $data["intro_short"] = (string) $this->replaceText($destination->general->intro_short, true);
                     $data["warning_title"] = (string) $destination->general->warning_title;
                     $data["warning_text"] = (string) $this->replaceText($destination->general->warning_text, true);
                     $data["warning_position"] = (string) $destination->general->warning_position;
                     $data["warning_severity"] = (string) $destination->general->warning_severity;
                     //timezones
                     if ($destination->general->timezones) {
                         $tz = 0;
                         $arrayTimezone = array();
                         foreach ($destination->general->timezones->children() as $timezone) {
                             $arrayTimezone[$tz]['gmt_utc'] = (string) $timezone->gmt_utc;
                             $tz++;
                         }
                         $data["timezones"] = serialize($arrayTimezone);
                     }
                     $data["weights_measures_system"] = (string) $destination->general->weights_measures_system;
                     $data["capital_city"] = (string) $destination->general->capital_city;
                     //government leaders
                     if ($destination->government->leaders) {
                         $ld = 0;
                         $arrayLeaders = array();
                         foreach ($destination->government->leaders->children() as $leader) {
                             $arrayLeaders[$ld]['leader_name'] = (string) $leader->leader_name;
                             $arrayLeaders[$ld]['leader_type'] = (string) $leader->leader_type;
                             $arrayLeaders[$ld]['leader_title'] = (string) $leader->leader_title;
                             $ld++;
                         }
                         $data["leaders"] = serialize($arrayLeaders);
                     }
                     $data["government_type"] = (string) $destination->government->government_type;
                     $data["area_sqkm"] = (string) $destination->environment->area_sqkm;
                     $data["population"] = (string) $destination->environment->population;
                     //languages
                     $i = 0;
                     if ($destination->society->language_spokens) {
                         $arrayLanguage = array();
                         foreach ($destination->society->language_spokens->children() as $language_spoken) {
                             $arrayLanguage[$i]['language_spoken_type'] = (string) $language_spoken->language_spoken_type;
                             $arrayLanguage[$i]['language_spoken_name'] = (string) $language_spoken->language_spoken_name;
                             if ($language_spoken->language_spoken_description) {
                                 $arrayLanguage[$i]['language_spoken_description'] = (string) $this->replaceText($language_spoken->language_spoken_description, true);
                             }
                             $i++;
                         }
                         $data["language_spokens"] = serialize($arrayLanguage);
                     }
                     $data["religion"] = (string) $this->replaceText($destination->society->religion, true);
                     $data["currency_code"] = (string) $destination->economy->currency_code;
                     $data["currency_name"] = (string) $destination->economy->currency_name;
                     $data["currency_symbol"] = (string) $destination->economy->currency_symbol;
                     $data["currency_unit"] = (string) $destination->economy->currency_unit;
                     //$data["relative_cost_rooms"]=serialize($destination->money->relative_cost_rooms);
                     //$data["relative_cost_meals"]=serialize($destination->money->relative_cost_meals);
                     $pre = 'pre-departure';
                     $when_to_go = $destination->{$pre}->when_to_go;
                     $data["when_to_go"] = (string) $this->replaceText($destination->{$pre}->when_to_go, true);
                     $data["visas_overview"] = (string) $this->replaceText($destination->{$pre}->visas_overview, true);
                     //electrical plugs
                     if ($destination->{$pre}->electrical_plugs) {
                         $ep = 0;
                         $arrayElectricalPlugs = array();
                         foreach ($destination->{$pre}->electrical_plugs->children() as $electrical_plugs) {
                             $arrayElectricalPlugs[$ep]['image_filename'] = (string) $electrical_plugs->image_filename;
                             $arrayElectricalPlugs[$ep]['electrical_plug_description'] = (string) $this->replaceText($electrical_plugs->electrical_plug_description, true);
                             $ep++;
                         }
                         $data["electrical_plugs"] = serialize($arrayElectricalPlugs);
                     }
                     $data["electricity_voltage"] = (string) $destination->{$pre}->electricity_voltage;
                     $data["electricity_hz"] = (string) $destination->{$pre}->electricity_hz;
                     $data["dangers_and_annoyances"] = (string) $this->replaceText($destination->health->dangers_and_annoyances, true);
                     //health conditions
                     if ($destination->health->health_conditions) {
                         $arrHealthCondition = array();
                         foreach ($destination->health->health_conditions->children() as $healthCondition) {
                             $type = "";
                             $type = (string) $healthCondition->health_condition_type;
                             $arrHealthCondition[$type] = (string) $this->replaceText($healthCondition->health_condition_description, true);
                         }
                         $data["health_conditions"] = serialize($arrHealthCondition);
                     }
                     $data["weather_overview"] = (string) $this->replaceText($destination->weather->weather_overview, true);
                     $data["country_dialling_code"] = (string) $destination->communication->country_dialling_code;
                     //transports
                     if ($destination->transport) {
                         $arrTransport = array();
                         foreach ($destination->transport->destination_transport_topics->children() as $transport) {
                             $transport_type = "";
                             $transport_type = (string) $transport->transport_type;
                             $arrTransport[$transport_type] = (string) $this->replaceText($transport->transport_description, true);
                         }
                         $data["transport"] = serialize($arrTransport);
                     }
                     $data["history_pre_20c"] = (string) $this->replaceText($destination->culture->history_pre_20c, true);
                     $data["history_modern"] = (string) $this->replaceText($destination->culture->history_modern, true);
                     $data["history_recent"] = (string) $this->replaceText($destination->culture->history_recent, true);
                     //$data["product_info"]=serialize($destination->product_info);
                     //get images
                     if ($destination->images) {
                         $img = 0;
                         $arrayImages = array();
                         foreach ($destination->images->children() as $image) {
                             $arrayImages[$img]['image_caption'] = (string) $image->image_caption;
                             $arrayImages[$img]['image_photographer'] = (string) $image->image_photographer;
                             $arrayImages[$img]['image_filename'] = (string) $image->image_filename;
                             $arrayImages[$img]['image_thumbnail_filename'] = (string) $image->image_thumbnail_filename;
                             $img++;
                         }
                         $data["images"] = serialize($arrayImages);
                     }
                     //get maps
                     if ($destination->map) {
                         $arrayMaps = array();
                         $arrayMaps['map_name'] = (string) $destination->map->map_name;
                         $arrayMaps['map_filename'] = (string) $destination->map->map_filename;
                         $arrayMaps['map_thumbnail_filename'] = (string) $destination->map->map_thumbnail_filename;
                         $data["map"] = serialize($arrayMaps);
                     }
                     $i = 0;
                     foreach ($destination->pois->children() as $poi) {
                         $arrayPoi[$i]['poi_name'] = (string) $poi->poi_name;
                         $address_parts = (array) $poi->address_parts;
                         $addressPart = array();
                         if (isset($address_parts['address_part']) && count($address_parts['address_part']) > 0) {
                             foreach ($address_parts['address_part'] as $address_part) {
                                 $addressPart[] = (array) $address_part;
                             }
                             $arrayPoi[$i]['address_parts'] = $addressPart;
                         }
                         $arrayPoi[$i]['address_postcode'] = (string) $poi->address_postcode;
                         $arrayPoi[$i]['poi_web'] = (string) $poi->poi_web;
                         $arrayPoi[$i]['review_summary'] = (string) $this->replaceText($poi->review_summary, true);
                         $arrayPoi[$i]['review_full'] = (string) $this->replaceText($poi->review_full, true);
                         $arrayPoi[$i]['keywords'] = (array) $poi->keywords;
                         $i++;
                     }
                     $data["pois"] = serialize($arrayPoi);
                     //attrations
                     if ($destination->attractions) {
                         $attr = 0;
                         $arrayAttr = array();
                         foreach ($destination->attractions->children() as $attraction) {
                             $arrayAttr[$attr]['destination_name'] = (string) $attraction->destination_name;
                             $arrayAttr[$attr]['full_destination_name'] = (string) $attraction->general->full_destination_name;
                             $arrayAttr[$attr]['intro_short'] = (string) $this->replaceText($attraction->general->intro_short, true);
                             $arrayAttr[$attr]['intro_medium'] = (string) $this->replaceText($attraction->general->intro_medium, true);
                             $attr++;
                         }
                         $data["attractions"] = serialize($arrayAttr);
                     }
                     $data["copyright"] = (string) $destination->copyright;
                     $data["addedon"] = time();
                     /*----Country Info----*/
                     $countryM = new Application_Model_Country();
                     $countryName = $sanitizeM->clearInputs($data["destination_name"]);
                     if (!get_magic_quotes_gpc()) {
                         $countryName = addslashes($countryName);
                     }
                     //$countryName=@mb_convert_encoding($countryName, 'UTssssF8', 'auto');
                     $country = $countryM->fetchRow("name like '{$countryName}'");
                     if (false === $country) {
                         //get country continent
                         $continent_id = "";
                         $continent_id = $countryM->countryContinent($countryName);
                         $countryName = $sanitizeM->clearInputs($data["destination_name"]);
                         //if doesn't exists
                         if (!$this->duplicateCountries($countryName)) {
                             $countryM->setName($countryName);
                             $countryM->setContinentId($continent_id);
                             $country_id = $countryM->save();
                         }
                     } else {
                         $country_id = $country->getId();
                     }
                     $data['country_id'] = $country_id;
                     /*---------------*/
                     //check existing country record in lonely_planet_country table
                     $lonelyM = new Application_Model_LonelyPlanetCountry();
                     $lonelyM = $lonelyM->fetchRow("country_id={$country_id}");
                     if (false !== $lonelyM) {
                         $res = $db->update("lonely_planet_country", $data, "country_id={$country_id}");
                     } else {
                         $res = $db->insert("lonely_planet_country", $data);
                     }
                     echo "<br>END File==><b>" . $file_path . "</b> has been processed, counter=>" . $countFiles;
                     $countFiles++;
                 }
                 //end of if
             }
         }
         //end of else if
     }
     //end of while
     closedir($dp);
     //rename countries name
     $db->query("UPDATE country SET name='Bosnia and Herzogovina' WHERE name='Bosnia-Hercegovina'");
     $db->query("UPDATE country SET name='Vatican City' WHERE name='Holy See'");
     $db->query("UPDATE country SET name='Ivory Coast' WHERE name='Cote dIvoire'");
     //delete countries for which no planet feeds data available
     //$sSQlQuery = "DELETE FROM country WHERE id IN(select t.id FROM (SELECT id FROM `country` WHERE id NOT IN (SELECT country_id FROM lonely_planet_country WHERE country_id IS NOT NULL)) AS t)";
     //$db->query($sSQlQuery);
 }
Exemplo n.º 17
0
 public function getCountry($option = null, $continent_id = null)
 {
     $where = null;
     if (!is_null($continent_id)) {
         $where = "continent_id='{$continent_id}'";
     }
     $obj = new Application_Model_Country();
     $entries = $obj->fetchAll($where, 'name asc');
     $arrCountry = array();
     if (!is_null($option)) {
         $arrCountry[''] = $option;
     }
     foreach ($entries as $entry) {
         //$arrCountry[$entry->getId()] = ucfirst( strtolower($entry->getName()));
         $arrCountry[$entry->getId()] = ucwords(strtolower($entry->getName()));
     }
     return $arrCountry;
 }
Exemplo n.º 18
0
 public function init()
 {
     $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate');
     $this->setName('frmRegistration');
     /*
     $FName		=	new Zend_Form_Element_Text('firstName');
             $FName		->	setLabel('First Name')
             			
                     	->	setRequired(true)
                     	->	addFilter('StripTags')
                     	->	addFilter('StringTrim')
                     	->	addValidator('NotEmpty')
                     	-> clearDecorators()
                     	->	addDecorators($this->elementDecorators);
     
             $LName		=	new Zend_Form_Element_Text('lastName');
             $LName 		-> setLabel('Last Name')
             			
                    		->	setRequired(true)
                    		->	addFilter('StripTags')
                    		->	addFilter('StringTrim')
                    		->	addValidator('NotEmpty')
                    		-> clearDecorators()
                    		->	addDecorators($this->elementDecorators);
                    		
     $Country	=	new Zend_Form_Element_Text('countryId');
             $Country	->	setLabel('CountryName')
             			
                   		->	setRequired(true)
                   		->	addFilter('StripTags')
                   		->	addFilter('StringTrim')
                   		->	addValidator('NotEmpty')
                   		-> clearDecorators()
                   		->	addDecorators($this->elementDecorators);              
                           
             $City		=	new Zend_Form_Element_Text('cityName');
             $City		->	setLabel('City')
             			
                   		->	setRequired(true)
                   		->	addFilter('StripTags')
                   		->	addFilter('StringTrim')
                   		->	addValidator('NotEmpty')
                   		-> clearDecorators()
                   		->	addDecorators($this->elementDecorators);
                   		
             
     $model=new Application_Model_UserLevel();
             $arrUserLevel=$model->getUserLevel();
     
         	$userlevel=new	Zend_Form_Element_Select('userLevelId');
         	$userlevel	->setAttrib('id','userLevelId')
         				->setAttrib('style', 'width:100%')
         				->setLabel('User Level')
         				->setRequired(true)
         				->addMultiOptions($arrUserLevel)	
     			->clearDecorators()
                   		->addDecorators($this->elementDecorators)
                   		
                   		;
                   		
             $submit		=	new Zend_Form_Element_Submit('submitbutton');
             $submit		->	setAttrib('id', 'submitbutton')        
             			
             			->	setLabel('Submit')
             			-> clearDecorators()
             			->	addDecorators($this->buttonDecorators)
             			;
            
     
             
     
             $this->addElements(array($FName, $LName, $Country, $City,  $userlevel,$submit));
     */
     $this->addElement('text', 'username', array('label' => 'Username:'******'autocomplete' => "off", 'class' => 'form', 'TABINDEX' => '2', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter username'))), array('Db_NoRecordExists', true, array('table' => 'user', 'field' => 'username', 'messages' => 'username already exists'))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('password', 'password', array('label' => 'Password:'******'autocomplete' => "off", 'required' => true, 'TABINDEX' => '3', 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter password'))), array('validator' => 'StringLength', 'options' => array(6, 20)))))->getElement('password')->addValidator('IdenticalField', false, array('confirmPassword', 'Confirm Password'));
     // Add an password element
     $this->addElement('password', 'confirmPassword', array('label' => 'Confirm Password:'******'required' => true, 'TABINDEX' => '3', 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(6, 20)))));
     // Add an password element
     // Add an first name element
     $this->addElement('text', 'firstName', array('label' => 'First Name:', 'class' => 'form', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter first name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an last name element
     $this->addElement('text', 'lastName', array('label' => 'Surame:', 'class' => 'form', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim')));
     $this->addElement('text', 'email', array('label' => 'Email Address:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter email')))), 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $language = new Application_Model_Language();
     $arrLang = $language->getLanguage("--select--");
     $this->addElement('select', 'preferredLanguage', array('label' => 'Preferred Language:', 'class' => 'form', 'style' => 'width:193px', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select language')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrLang));
     $this->addElement('text', 'otherLanguages', array('label' => 'Other Languages:', 'class' => 'form', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $country = new Application_Model_Country();
     //$arrCountry=$country->getCountry("--select---");
     $nationalitiesArr = $country->getNationalities("---Select Nationality---");
     $this->addElement('select', 'countryPassport', array('label' => 'Nationality:', 'class' => 'form', 'style' => 'width:193px', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select nationality.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $nationalitiesArr));
     $this->addElement('hidden', 'cityId', array('label' => '', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('text', 'cityName', array('label' => 'Home Town/City:', 'class' => 'form', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $day[''] = "Day";
     for ($i = 1; $i < 32; $i++) {
         $day[$i] = $i;
     }
     $this->addElement('select', 'day', array('label' => 'Date of Birth:', 'class' => "select-box", 'style' => 'width:193px', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $day));
     $month[""] = "Month";
     for ($i = 1; $i < 13; $i++) {
         $month[$i] = $i;
     }
     $this->addElement('select', 'month', array('class' => "select-box", 'style' => 'width:193px', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $month));
     $year[''] = "Year";
     for ($i = date("Y"); $i > 1900; $i--) {
         $year[$i] = $i;
     }
     $this->addElement('select', 'year', array('class' => "select-box", 'style' => 'width:193px', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $year));
     $this->addElement('radio', 'sex', array('label' => 'Gender: ', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must select the gender.')))), 'multiOptions' => array('male' => "Male", 'female' => "Female"), 'value' => "male", 'separator' => "", 'decorators' => $this->elementDecorators));
     $this->addElement('radio', 'firstTimeTraveller', array('label' => 'First time traveller? ', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select option.')))), 'multiOptions' => array('yes' => "Yes", 'no' => "No"), 'value' => "no", 'separator' => "", 'decorators' => $this->elementDecorators));
     /*
             $this->addElement('text', 'mobileCountryCode', array(
                 'label'      => 'Mobil No. Country Code:',
             	'validators'=>array('Digits'),
             	'class' =>'form',
             	'decorators' => $this->elementDecorators,	
                 'required'   => false,
                 'filters'    => array('StringTrim'),
             ));*/
     $this->addElement('text', 'mobile', array('label' => 'Mobile Number:', 'validators' => array('Digits'), 'class' => 'form', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('file', 'image', array('class' => "input-browse", 'label' => 'Profile Photo:', 'required' => false, 'decorators' => $this->fileDecorators));
     $this->getElement('image')->addValidator('Size', false, 1024 * 1024 * 5);
     //2 MB file is allowed
     $this->getElement('image')->getValidator('Size')->setMessages(array("fileSizeTooBig" => "Maximum allowed file size is 5 MB.", "fileSizeTooSmall" => ""));
     $this->getElement('image')->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $this->getElement('image')->getValidator('Extension')->setMessages(array("fileExtensionFalse" => "Please upload jpg,jpeg,png,gif file.", "fileExtensionNotFound" => ""));
     /*$this->addElement('textarea', 'dreamDestination', array(
                 'label'      => 'What is your dream destination?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
             	
             $this->addElement('textarea', 'wayToTravel', array(
                 'label'      => 'Favourite way to travel?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
             $this->addElement('textarea', 'travelGear', array(
                 'label'      => 'Best bit of travel gear?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
             $this->addElement('textarea', 'yearGoal', array(
                 'label'      => 'Gap Year goal?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
             	
             $this->addElement('textarea', 'leaveHomeWithout', array(
                 'label'      => 'Never leave home without …?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
     
            $this->addElement('textarea', 'interests', array(
                 'label'      => 'Interests?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));*/
     $this->addElement('textarea', 'evenTakenGapYear', array('label' => 'Ever taken a gap year?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'nextTravelToDoList', array('label' => 'Next on your travel To Do list?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'favouriteTravelExperience', array('label' => 'Your favourite travel experience so far?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $model = new Application_Model_UserLevel();
     $arrUserLevel = $model->getUserLevel();
     $this->addElement('select', 'userLevelId', array('label' => 'User Level:', 'id' => 'userLevelId', 'style' => 'width:193px', 'class' => 'form', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select user level.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrUserLevel));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'signup', 'ignore' => true, 'label' => 'Submit', 'decorators' => $this->buttonDecorators));
 }