Ejemplo n.º 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']);
         }
     }
 }
Ejemplo n.º 2
0
 public function __construct($options = null)
 {
     $landuses = new Landuses();
     $landuse_opts = $landuses->getUsesValid();
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     parent::__construct($options);
     $this->setName('Landuse');
     $term = new Zend_Form_Element_Text('term');
     $term->setLabel('Landuse term name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this landuse!')->setDecorators($decorators);
     $oldID = new Zend_Form_Element_Text('oldID');
     $oldID->setLabel('Old landuse type code: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this landuse!')->setDecorators($decorators);
     $termdesc = new Pas_Form_Element_RTE('termdesc');
     $termdesc->setLabel('Description of landuse type: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $belongsto = new Zend_Form_Element_Select('belongsto');
     $belongsto->setLabel('Belongs to landuse type: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL, 'Choose period:' => $landuse_opts))->addValidator('InArray', false, array(array_keys($landuse_opts)))->setDecorators($decorators);
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->setLabel('Landuse type is currently in use: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag');
     $this->addElements(array($term, $termdesc, $oldID, $valid, $belongsto, $submit));
     $this->addDisplayGroup(array('term', 'termdesc', 'oldID', 'belongsto', 'valid'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
 }
Ejemplo n.º 3
0
 public function landusecodesAction()
 {
     if ($this->_getParam('term', false)) {
         $landcodes = new Landuses();
         $response = $landcodes->getLandusesChildAjax2($this->_getParam('term'));
     } else {
         $response = array('id' => NULL, 'term' => 'No Landuse specified');
     }
     echo Zend_Json::encode($response);
 }
Ejemplo n.º 4
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $landuses = new Landuses();
     $landuse_opts = $landuses->getUsesValid();
     parent::__construct($options);
     $this->setName('Landuse');
     $term = new Zend_Form_Element_Text('term');
     $term->setLabel('Landuse term name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this landuse!');
     $oldID = new Zend_Form_Element_Text('oldID');
     $oldID->setLabel('Old landuse type code: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this landuse!');
     $termdesc = new Pas_Form_Element_CKEditor('termdesc');
     $termdesc->setLabel('Description of landuse type: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $belongsto = new Zend_Form_Element_Select('belongsto');
     $belongsto->setLabel('Belongs to landuse type: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose a landuse', 'Available landuses:' => $landuse_opts))->addValidator('InArray', false, array(array_keys($landuse_opts)));
     $valid = new Zend_Form_Element_Checkbox('valid');
     $valid->setLabel('Landuse type is currently in use: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits');
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($term, $termdesc, $oldID, $valid, $belongsto, $submit));
     $this->addDisplayGroup(array('term', 'termdesc', 'oldID', 'belongsto', 'valid'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
Ejemplo n.º 5
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']);
         }
     }
 }
 /** Delete a landuse
  */
 public function deletelanduseAction()
 {
     $this->_flashMessenger->addMessage($this->_noChange);
     if ($this->_request->isPost()) {
         $id = (int) $this->_request->getPost('id');
         $del = $this->_request->getPost('del');
         if ($del == 'Yes' && $id > 0) {
             $landuses = new Landuses();
             $where = 'id = ' . $id;
             $landuses->delete($where);
         }
         $this->_flashMessenger->addMessage(self::DELETED);
         $this->_redirect($this->_redirectUrl . 'landuses');
     } else {
         $id = (int) $this->_request->getParam('id');
         if ($id > 0) {
             $landuses = new Landuses();
             $this->view->landuse = $landuses->fetchRow('id=' . $id);
         }
     }
 }
Ejemplo n.º 7
0
 public function __construct($options = null)
 {
     // Construct the select menu data
     $counties = new Counties();
     $county_options = $counties->getCountyName2();
     $origins = new MapOrigins();
     $origin_options = $origins->getValidOrigins();
     $landusevalues = new Landuses();
     $landuse_options = $landusevalues->getUsesValid();
     $landusecodes = new Landuses();
     $landcodes_options = $landusecodes->getCodesValid();
     parent::__construct($options);
     $this->addPrefixPath('Pas_Form_Decorator', 'Pas/Form/Decorator/', 'decorator');
     $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element');
     $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate');
     $decorator = array('SimpleInput');
     $decoratorButton = array('NormalDecButton');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li')));
     $this->setName('findspots');
     // Object specifics
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose county', 'Valid counties' => $county_options))->addValidator('InArray', false, array(array_keys($county_options)))->setDecorators($decorators);
     $district = new Zend_Form_Element_Select('district');
     $district->setLabel('District: ')->setRequired(false)->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose district after county'));
     $parish = new Zend_Form_Element_Select('parish');
     $parish->setLabel('Parish: ')->setRequired(false)->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose parish after district'));
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('European region: ')->setRegisterInArrayValidator(false)->setDecorators($decorators)->addValidator('Digits')->addMultiOptions(array(NULL => 'Choose region after county'));
     $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $gridref = new Zend_Form_Element_Text('gridref');
     $gridref->setLabel('Grid reference: ')->addValidators(array('NotEmpty', 'ValidGridRef'))->addValidator('Alnum', array('allowWhiteSpace' => true))->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'));
     $gridrefsrc = new Zend_Form_Element_Select('gridrefsrc');
     $gridrefsrc->setLabel('Grid reference source: ')->addMultioptions(array(NULL => NULL, 'Choose source' => $origin_options))->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($origin_options)))->addValidator('Int');
     $gridrefcert = new Zend_Form_Element_Radio('gridrefcert');
     $gridrefcert->setLabel('Grid reference certainty: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->setValue(1)->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => ''))->addDecorator('HtmlTag', array('placement' => 'prepend', 'tag' => 'div', 'id' => 'radios'))->setDecorators($decorators);
     if ($action == 'edit') {
         $fourFigure = new Zend_Form_Element_Text('fourFigure');
         $fourFigure->setLabel('Four figure grid reference: ')->addValidator('NotEmpty', 'ValidGridRef')->addValidator('Alnum')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->disabled = true;
         $easting = new Zend_Form_Element_Text('easting');
         $easting->setLabel('Easting: ')->addValidator('NotEmpty', 'Digits')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->disabled = true;
         $northing = new Zend_Form_Element_Text('northing');
         $northing->setLabel('Northing: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->setDecorators($decorators)->disabled = true;
         $map10k = new Zend_Form_Element_Text('map10k');
         $map10k->setLabel('10 km map: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Alnum')->setDecorators($decorators)->disabled = true;
         $map25k = new Zend_Form_Element_Text('map25k');
         $map25k->setLabel('25 km map: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Alnum')->setDecorators($decorators)->disabled = true;
         $declong = new Zend_Form_Element_Text('declong');
         $declong->setLabel('Longitude: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Float')->setDecorators($decorators)->disabled = true;
         $declat = new Zend_Form_Element_Text('declat');
         $declat->setLabel('Latitude: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Float')->setDecorators($decorators)->disabled = true;
         $woeid = new Zend_Form_Element_Text('woeid');
         $woeid->setLabel('Where on Earth ID: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->setDecorators($decorators)->disabled = true;
         $elevation = new Zend_Form_Element_Text('elevation');
         $elevation->setLabel('Elevation: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->setDecorators($decorators)->disabled = true;
     }
     $depthdiscovery = new Zend_Form_Element_Select('depthdiscovery');
     $depthdiscovery->setLabel('Depth of discovery')->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->addMultiOptions(array(NULL => NULL, 'Approximate depth' => array('10' => '0 - 10cm', '20' => '10 - 20cm', '30' => '20 - 30cm', '40' => '30 - 40cm', '50' => '40 - 50cm', '60' => 'Over 60 cm')));
     $soiltype = new Zend_Form_Element_Select('soiltype');
     $soiltype->setLabel('Type of soil around findspot: ')->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->addMultiOptions(array(NULL => NULL));
     $landusevalue = new Zend_Form_Element_Select('landusevalue');
     $landusevalue->setLabel('Landuse type: ')->addValidators(array('NotEmpty'))->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose landuse', 'Valid landuses' => $landuse_options));
     $landusecode = new Zend_Form_Element_Select('landusecode');
     $landusecode->setLabel('Specific landuse: ')->setRegisterInArrayValidator(false)->addValidators(array('NotEmpty'))->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Specific landuse will be enabled after type'));
     $address = new Zend_Form_Element_Textarea('address');
     $address->setLabel('Address: ')->addValidators(array('NotEmpty'))->setAttrib('rows', 5)->setAttrib('cols', 40)->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'))->setAttrib('class', 'expanding')->setAttrib('class', 'privatedata');
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->setLabel('Postcode: ')->addValidators(array('NotEmpty', 'ValidPostcode'))->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim', 'StringToUpper'));
     $knownas = new Zend_Form_Element_Text('knownas');
     $knownas->setLabel('Findspot to be known as: ')->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators)->setAttrib('class', 'privatedata')->addFilters(array('StripTags', 'StringTrim'));
     $landownername = new Zend_Form_Element_Text('landownername');
     $landownername->setLabel('Landowner: ')->addValidators(array('NotEmpty'))->setDecorators($decorators)->setAttrib('class', 'privatedata')->addFilters(array('StripTags', 'StringTrim'));
     $landowner = new Zend_Form_Element_Hidden('landowner');
     $landowner->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->addFilters(array('StripTags', 'StringTrim'));
     $description = new Pas_Form_Element_RTE('description');
     $description->setLabel('Findspot description: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $comments = new Pas_Form_Element_RTE('comments');
     $comments->setLabel('Findspot comments: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(600);
     $this->addElement($hash);
     if ($action == 'edit') {
         $this->addElements(array($county, $district, $parish, $knownas, $description, $comments, $regionID, $gridref, $fourFigure, $easting, $northing, $map10k, $map25k, $declong, $declat, $woeid, $elevation, $address, $gridrefsrc, $gridrefcert, $depthdiscovery, $postcode, $landusevalue, $landusecode, $landownername, $landowner, $submit, $hash));
     } else {
         $this->addElements(array($county, $district, $parish, $knownas, $depthdiscovery, $description, $comments, $regionID, $gridref, $findsecuid, $gridrefsrc, $gridrefcert, $address, $postcode, $landusevalue, $landusecode, $landownername, $landowner, $submit, $hash));
     }
     $this->addDisplayGroup(array('county', 'regionID', 'district', 'parish', 'knownas', 'address', 'postcode', 'landownername', 'landowner'), 'details');
     $this->details->setLegend('Findspot information');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     if ($action == 'edit') {
         $this->addDisplayGroup(array('gridref', 'gridrefcert', 'gridrefsrc', 'fourFigure', 'easting', 'northing', 'map25k', 'map10k', 'declat', 'declong', 'woeid', 'elevation', 'landusevalue', 'landusecode', 'depthdiscovery'), 'spatial');
     } else {
         $this->addDisplayGroup(array('gridref', 'gridrefcert', 'gridrefsrc', 'landusevalue', 'landusecode', 'depthdiscovery', 'soiltype'), 'spatial');
     }
     $this->spatial->setLegend('Spatial information');
     $this->spatial->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->spatial->removeDecorator('DtDdWrapper');
     $this->addDisplayGroup(array('description', 'comments'), 'commentary');
     $this->commentary->setLegend('Findspot comments');
     $this->commentary->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->commentary->removeDecorator('DtDdWrapper');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
Ejemplo n.º 8
0
 /** 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;
 }
Ejemplo n.º 9
0
 /** Get the landuse codes
  * @access public
  */
 public function landusecodesAction()
 {
     if ($this->getParam('term', false)) {
         $landcodes = new Landuses();
         $json = $landcodes->getLandusesChildAjax2($this->getParam('term'));
     } else {
         $json = array(null => 'You must choose a landuse first');
     }
     echo Zend_Json::encode($json);
 }
Ejemplo n.º 10
0
 /** Display list of landuses
  */
 public function landusesAction()
 {
     $landuses = new Landuses();
     $this->view->landuses = $landuses->getLanduses();
 }
Ejemplo n.º 11
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  *
  */
 public function __construct(array $options = null)
 {
     $counties = new OsCounties();
     $county_options = $counties->getCountiesID();
     $regionModel = new OsRegions();
     $regions = $regionModel->getRegionsID();
     $origins = new MapOrigins();
     $origin_options = $origins->getValidOrigins();
     $landusevalues = new Landuses();
     $landuse_options = $landusevalues->getUsesValid();
     $landusecodes = new Landuses();
     $landcodes_options = $landusecodes->getCodesValid();
     //Get findspot data quality ratings for select menu
     $qualityrating = new DataQuality();
     $qualityrating_options = $qualityrating->getRatings();
     $this->addElementPrefixPath('Pas_Filter', 'Pas/Filter/', 'filter');
     parent::__construct($options);
     $this->setName('findspots');
     // Object specifics
     $countyID = new Zend_Form_Element_Select('countyID');
     $countyID->setLabel('County/Unitary Authority or Metropolitan District: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose county', 'Available counties' => $county_options))->addValidator('InArray', false, array(array_keys($county_options)))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $districtID = new Zend_Form_Element_Select('districtID');
     $districtID->setLabel('District: ')->setRegisterInArrayValidator(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose district after county'))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $parishID = new Zend_Form_Element_Select('parishID');
     $parishID->setLabel('Parish: ')->setRegisterInArrayValidator(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose parish after district'))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('European region: ')->setRegisterInArrayValidator(false)->addValidator('Digits')->addMultiOptions(array(null => 'Choose region', 'Available regions' => $regions))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     $gridref = new Zend_Form_Element_Text('gridref');
     $gridref->setLabel('Grid reference: ')->setRequired(false)->addValidators(array('NotEmpty', 'ValidGridRef'))->addFilters(array('StripTags', 'StringTrim', 'StringToUpper', 'StripSpaces'))->setAttribs(array('placeholder' => 'In the format of SU123123', 'class' => 'span4'));
     $gridrefsrc = new Zend_Form_Element_Select('gridrefsrc');
     $gridrefsrc->setLabel('Grid reference source: ')->addMultioptions(array(null => 'Choose a grid reference source', 'Choose source' => $origin_options))->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($origin_options)))->addValidator('Int')->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow');
     $gridrefcert = new Zend_Form_Element_Radio('gridrefcert');
     $gridrefcert->setLabel('Grid reference certainty: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->setValue(1)->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => ''));
     if ($action === 'edit') {
         $fourFigure = new Zend_Form_Element_Text('fourFigure');
         $fourFigure->setLabel('Four figure grid reference: ')->addValidator('NotEmpty', 'ValidGridRef')->addValidator('Alnum')->addFilters(array('StripTags', 'StringTrim'))->disabled = true;
         $easting = new Zend_Form_Element_Text('easting');
         $easting->setLabel('Easting: ')->addValidator('NotEmpty', 'Digits')->addFilters(array('StripTags', 'StringTrim'))->disabled = true;
         $northing = new Zend_Form_Element_Text('northing');
         $northing->setLabel('Northing: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->disabled = true;
         $map10k = new Zend_Form_Element_Text('map10k');
         $map10k->setLabel('10 km map: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Alnum')->disabled = true;
         $map25k = new Zend_Form_Element_Text('map25k');
         $map25k->setLabel('25 km map: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Alnum')->disabled = true;
         $declong = new Zend_Form_Element_Text('declong');
         $declong->setLabel('Longitude: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Float')->disabled = true;
         $declat = new Zend_Form_Element_Text('declat');
         $declat->setLabel('Latitude: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Float')->disabled = true;
         $declong4 = new Zend_Form_Element_Text('fourFigureLon');
         $declong4->setLabel('Four figure longitude: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Float')->disabled = true;
         $declat4 = new Zend_Form_Element_Text('fourFigureLat');
         $declat4->setLabel('Four figure latitude: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Float')->disabled = true;
         $woeid = new Zend_Form_Element_Text('woeid');
         $woeid->setLabel('Where on Earth ID: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->disabled = true;
         $elevation = new Zend_Form_Element_Text('elevation');
         $elevation->setLabel('Elevation: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->disabled = true;
         $gridLen = new Zend_Form_Element_Text('gridlen');
         $gridLen->setLabel('Grid reference length: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->disabled = true;
         $what3words = new Zend_Form_Element_Text('what3words');
         $what3words->setLabel('What3words identifier: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->disabled = true;
     }
     $depthdiscovery = new Zend_Form_Element_Select('depthdiscovery');
     $depthdiscovery->setLabel('Depth of discovery')->setRegisterInArrayValidator(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->addMultiOptions(array(null => 'Depth levels', 'Approximate depth' => array('10' => '0 - 10cm', '20' => '10 - 20cm', '30' => '20 - 30cm', '40' => '30 - 40cm', '50' => '40 - 50cm', '60' => 'Over 60 cm')))->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow');
     $soiltype = new Zend_Form_Element_Select('soiltype');
     $soiltype->setLabel('Type of soil around findspot: ')->setRegisterInArrayValidator(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->addMultiOptions(array(null => null));
     $landusevalue = new Zend_Form_Element_Select('landusevalue');
     $landusevalue->setLabel('Landuse type: ')->addValidators(array('NotEmpty'))->setRegisterInArrayValidator(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose landuse', 'Valid landuses' => $landuse_options))->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow');
     $landusecode = new Zend_Form_Element_Select('landusecode');
     $landusecode->setLabel('Specific landuse: ')->setRegisterInArrayValidator(false)->addValidators(array('NotEmpty'))->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Specific landuse will be enabled after type'))->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow');
     $address = new Zend_Form_Element_Textarea('address');
     $address->setLabel('Address: ')->addValidators(array('NotEmpty'))->setAttrib('rows', 5)->setAttrib('cols', 40)->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'))->setAttribs(array('placeholder' => 'This data is not shown to the public'))->setAttrib('class', 'privatedata span6');
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->setLabel('Postcode: ')->addValidators(array('NotEmpty', 'ValidPostCode'))->addFilters(array('StripTags', 'StringTrim', 'StringToUpper'));
     $knownas = new Zend_Form_Element_Text('knownas');
     $knownas->setLabel('Findspot to be known as: ')->setAttribs(array('placeholder' => 'If you fill in this, it will hide the grid references and parish', 'class' => 'span6 privatedata'))->addFilters(array('StripTags', 'StringTrim', 'Purifier'));
     $alsoknownas = new Zend_Form_Element_Text('alsoknownas');
     $alsoknownas->setLabel('Also known as: ')->setAttribs(array('placeholder' => 'Use this for old names the findspot used to be known by', 'class' => 'span6'))->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setDescription('Separate different names with semi-colons, e.g. Near Westbury; Gloucestershire; Severn');
     $landownername = new Zend_Form_Element_Text('landownername');
     $landownername->setLabel('Landowner: ')->addValidators(array('NotEmpty'))->setAttribs(array('placeholder' => 'This data is not shown to the public', 'data-provide' => 'typeahead', 'class' => 'privatedata span6'))->addFilters(array('StripTags', 'StringTrim'));
     $landowner = new Zend_Form_Element_Hidden('landowner');
     $landowner->addFilters(array('StripTags', 'StringTrim'));
     $description = new Pas_Form_Element_CKEditor('description');
     $description->setLabel('Findspot description: ')->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400, 'class' => 'privatedata span6'))->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $comments = new Pas_Form_Element_CKEditor('comments');
     $comments->setLabel('Findspot comments: ')->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400, 'class' => 'privatedata span6'))->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     //Findspot data quality rating
     $findspotdataquality = new Zend_Form_Element_Select('qualityrating');
     $findspotdataquality->setLabel('Findspot data quality rating: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose a rating', 'Available ratings' => $qualityrating_options))->addValidator('InArray', false, array(array_keys($qualityrating_options)))->setAttrib('class', 'input-large selectpicker show-menu-arrow')->setDescription('This data quality field can only be completed by hoards project staff')->addValidator('Int');
     $submit = new Zend_Form_Element_Submit('submit');
     if ($action === 'edit') {
         $this->addElements(array($countyID, $districtID, $parishID, $knownas, $alsoknownas, $description, $comments, $findspotdataquality, $regionID, $gridref, $fourFigure, $easting, $northing, $map10k, $map25k, $declong, $declat, $declong4, $declat4, $gridLen, $woeid, $elevation, $what3words, $address, $gridrefsrc, $gridrefcert, $depthdiscovery, $postcode, $landusevalue, $landusecode, $landownername, $landowner, $submit));
     } else {
         $this->addElements(array($countyID, $districtID, $parishID, $knownas, $alsoknownas, $depthdiscovery, $description, $findspotdataquality, $comments, $regionID, $gridref, $gridrefsrc, $gridrefcert, $address, $postcode, $landusevalue, $landusecode, $landownername, $landowner, $submit));
     }
     $this->addDisplayGroup(array('countyID', 'regionID', 'districtID', 'parishID', 'knownas', 'alsoknownas', 'address', 'postcode', 'landownername', 'landowner'), 'details');
     $this->details->setLegend('Findspot information');
     if ($action == 'edit') {
         $this->addDisplayGroup(array('gridref', 'gridrefcert', 'gridrefsrc', 'fourFigure', 'easting', 'northing', 'map25k', 'map10k', 'declat', 'declong', 'fourFigureLat', 'fourFigureLon', 'woeid', 'what3words', 'elevation', 'gridlen', 'landusevalue', 'landusecode', 'depthdiscovery'), 'spatial');
     } else {
         $this->addDisplayGroup(array('gridref', 'gridrefcert', 'gridrefsrc', 'landusevalue', 'landusecode', 'depthdiscovery', 'soiltype'), 'spatial');
     }
     $this->spatial->setLegend('Spatial information');
     $this->addDisplayGroup(array('description', 'comments', 'qualityrating'), 'commentary');
     $this->commentary->setLegend('Findspot comments');
     $this->addDisplayGroup(array('submit'), 'buttons');
     $person = new Pas_User_Details();
     $role = $person->getRole();
     $projectTeam = array('hoard', 'admin');
     if (!in_array($role, $projectTeam)) {
         $findspotdataquality->disabled = true;
     }
     parent::init();
 }