Пример #1
0
 /** Populate the form with the array of data
  * @access public
  * @param array $data
  */
 public function populate(array $data)
 {
     $this->_view->form->populate($data);
     if (array_key_exists('countyID', $data)) {
         $districts = new OsDistricts();
         $district = $districts->getDistrictsToCountyList($data['countyID']);
         if ($district) {
             $this->_view->form->districtID->addMultiOptions(array(null => 'Choose a district', 'Available districts' => $district));
         }
         if (array_key_exists('districtID', $data)) {
             $parishModel = new OsParishes();
             $parishes = $parishModel->getParishesToDistrictList($data['districtID']);
             $this->_view->form->parishID->addMultiOptions(array(null => 'Choose a parish', 'Available parishes' => $parishes));
         }
         if (array_key_exists('countyID', $data)) {
             $countyModel = new OsCounties();
             $regions = $countyModel->getCountyToRegionList($data['countyID']);
             $this->_view->form->regionID->addMultiOptions(array(null => 'Choose a region', 'Available regions' => $regions));
         }
     }
     if (array_key_exists('landusevalue', $data)) {
         $landcodes = new Landuses();
         $landusecode_options = $landcodes->getLandusesChildList($data['landusevalue']);
         $this->_view->form->landusecode->addMultiOptions(array(null => 'Choose code', 'Available landuses' => $landusecode_options));
     }
     if (array_key_exists('landowner', $data)) {
         $finders = new People();
         $finders = $finders->getName($data['landowner']);
         foreach ($finders as $finder) {
             $this->_view->form->landownername->setValue($finder['term']);
         }
     }
 }
Пример #2
0
 public function optionsAddClone()
 {
     $findspots = new Findspots();
     $findspot = $findspots->getLastRecord($this->_getIdentity());
     $data = $findspot[0];
     $this->_view->form->populate($data);
     Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->addMessage('Your last record data has been cloned');
     if (!is_null($data['county'])) {
         $districts = new Places();
         $district = $districts->getDistrictList($data['county']);
         if ($district) {
             $this->_view->form->district->addMultiOptions(array(NULL => 'Choose district', 'Available districts' => $district));
         }
         if (!is_null($data['district'])) {
             $parishes = $districts->getParishList($data['district']);
             $this->_view->form->parish->addMultiOptions(array(NULL => 'Choose parish', 'Available parishes' => $parishes));
         }
         if (!is_null($data['county'])) {
             $cnts = new Counties();
             $region_list = $cnts->getRegionsList($data['county']);
             $this->_view->form->regionID->addMultiOptions(array(NULL => 'Choose region', 'Available regions' => $region_list));
         }
     }
     if (!is_null($data['landusevalue'])) {
         $landcodes = new Landuses();
         $landusecode_options = $landcodes->getLandusesChildList($data['landusevalue']);
         $this->_view->form->landusecode->addMultiOptions(array(NULL => 'Choose code', 'Available landuses' => $landusecode_options));
     }
     if (!is_null($findspot['landowner'])) {
         $finders = new Peoples();
         $finders = $finders->getName($findspot['landowner']);
         foreach ($finders as $finder) {
             $form->landownername->setValue($finder['term']);
         }
     }
 }
 /** Clone the options and add to form
  * @access public
  * @return \Pas_Controller_Action_Helper_FindspotFormOptions
  */
 public function optionsAddClone($data)
 {
     $this->_view->form->populate($data);
     Zend_Controller_Action_HelperBroker::getStaticHelper('FlashMessenger')->addMessage('Your last record data has been cloned');
     if (array_key_exists('countyID', $data) && !is_null($data['countyID'])) {
         $districts = new OsDistricts();
         $district = $districts->getDistrictsToCountyList($data['countyID']);
         if ($district) {
             $this->_view->form->districtID->addMultiOptions(array(null => 'Choose district', 'Available districts' => $district));
         }
         if (array_key_exists('districtID', $data) && !is_null($data['districtID'])) {
             $parishes = new OsParishes();
             $parishes = $parishes->getParishesToDistrictList($data['districtID']);
             $this->_view->form->parishID->addMultiOptions(array(null => 'Choose parish', 'Available parishes' => $parishes));
         }
         if (array_key_exists('countyID', $data) && !is_null($data['countyID'])) {
             $cnts = new OsCounties();
             $region_list = $cnts->getCountyToRegionList($data['countyID']);
             $this->_view->form->regionID->addMultiOptions(array(null => 'Choose region', 'Available regions' => $region_list));
         }
     }
     if (array_key_exists('landusevalue', $data)) {
         $landcodes = new Landuses();
         $landusecode_options = $landcodes->getLandusesChildList($data['landusevalue']);
         $this->_view->form->landusecode->addMultiOptions(array(null => 'Choose code', 'Available landuses' => $landusecode_options));
     }
     return $this;
 }