/** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $institutions = new Institutions();
     $inst_options = $institutions->getInsts();
     $rallies = new Rallies();
     $rally_options = $rallies->getRallies();
     $counties = new OsCounties();
     $county_options = $counties->getCountiesID();
     $rulers = new Rulers();
     $ruler_options = $rulers->getEarlyMedRulers();
     $denominations = new Denominations();
     $denomination_options = $denominations->getOptionsEarlyMedieval();
     $mints = new Mints();
     $mint_options = $mints->getEarlyMedievalMints();
     $axis = new Dieaxes();
     $axis_options = $axis->getAxes();
     $types = new MedievalTypes();
     $type_options = $types->getMedievalTypesForm(47);
     $cats = new CategoriesCoins();
     $cat_options = $cats->getPeriodEarlyMed();
     $regions = new OsRegions();
     $region_options = $regions->getRegionsID();
     parent::__construct($options);
     $this->setName('earlymedsearch');
     $old_findID = new Zend_Form_Element_Text('old_findID');
     $old_findID->setLabel('Find number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid number!');
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Object description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     $workflow = new Zend_Form_Element_Select('workflow');
     $workflow->setLabel('Workflow stage: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Int');
     if (in_array($this->_role, $this->_higherlevel)) {
         $workflow->addMultiOptions(array(null => 'Available Workflow stages', 'Choose Worklow stage' => array('1' => 'Quarantine', '2' => 'On review', '4' => 'Awaiting validation', '3' => 'Published')));
     }
     if (in_array($this->_role, $this->_restricted)) {
         $workflow->addMultiOptions(array(null => 'Available Workflow stages', 'Choose Worklow stage' => array('4' => 'Awaiting validation', '3' => 'Published')));
     }
     //Rally details
     $rally = new Zend_Form_Element_Checkbox('rally');
     $rally->setLabel('Rally find: ')->setRequired(false)->addValidator('Int')->addFilters(array('StringTrim', 'StripTags'))->setUncheckedValue(null);
     $rallyID = new Zend_Form_Element_Select('rallyID');
     $rallyID->setLabel('Found at this rally: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose a rally', 'Available rallies' => $rally_options));
     $county = new Zend_Form_Element_Select('countyID');
     $county->setLabel('County: ')->addValidators(array('NotEmpty'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose county', 'Available counties' => $county_options));
     $district = new Zend_Form_Element_Select('districtID');
     $district->setLabel('District: ')->addMultiOptions(array(null => 'Choose district after county'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRegisterInArrayValidator(false)->addFilters(array('StringTrim', 'StripTags'))->setDisableTranslator(true);
     $parish = new Zend_Form_Element_Select('parishID');
     $parish->setLabel('Parish: ')->setRegisterInArrayValidator(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose parish after county'))->setDisableTranslator(true);
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('European region: ')->setRegisterInArrayValidator(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Int')->addMultiOptions(array(null => 'Choose a region for a wide result', 'Choose region' => $region_options));
     $gridref = new Zend_Form_Element_Text('gridref');
     $gridref->setLabel('Grid reference: ')->addValidators(array('NotEmpty', 'ValidGridRef'))->addFilters(array('StringTrim', 'StripTags'));
     $fourFigure = new Zend_Form_Element_Text('fourFigure');
     $fourFigure->setLabel('Four figure grid reference: ')->addValidators(array('NotEmpty'))->addFilters(array('StringTrim', 'StripTags'));
     $denomination = new Zend_Form_Element_Select('denomination');
     $denomination->setLabel('Denomination: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Int')->addMultiOptions(array(null => 'Choose denomination type', 'Available denominations' => $denomination_options));
     $cat = new Zend_Form_Element_Select('category');
     $cat->setLabel('Category: ')->setRequired(false)->addValidator('Int')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose an Early Medieval category', 'Available categories' => $cat_options));
     $type = new Zend_Form_Element_Select('type');
     $type->setLabel('Coin type: ')->setRequired(false)->addValidator('Int')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose type after choosing ruler', 'Available types' => $type_options))->addValidator('InArray', false, array(array_keys($type_options)));
     //Primary ruler
     $ruler = new Zend_Form_Element_Select('ruler');
     $ruler->setLabel('Ruler / issuer: ')->setRequired(false)->addValidator('Int')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose primary ruler', 'Available options' => $ruler_options))->addValidator('InArray', false, array(array_keys($ruler_options)));
     //Mint
     $mint = new Zend_Form_Element_Select('mint');
     $mint->setLabel('Issuing mint: ')->setRequired(false)->addValidator('Int')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose issuing mint', 'Available mints' => $mint_options));
     //Obverse inscription
     $obverseinsc = new Zend_Form_Element_Text('obverseLegend');
     $obverseinsc->setLabel('Obverse inscription contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     //Obverse description
     $obversedesc = new Zend_Form_Element_Text('obverseDescription');
     $obversedesc->setLabel('Obverse description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     //reverse inscription
     $reverseinsc = new Zend_Form_Element_Text('reverseLegend');
     $reverseinsc->setLabel('Reverse inscription contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     //reverse description
     $reversedesc = new Zend_Form_Element_Text('reverseDescription');
     $reversedesc->setLabel('Reverse description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     //Die axis
     $axis = new Zend_Form_Element_Select('axis');
     $axis->setLabel('Die axis measurement: ')->setRegisterInArrayValidator(false)->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addMultiOptions(array(null => 'Choose a die axis measurement', 'Available options' => $axis_options));
     $objecttype = new Zend_Form_Element_Hidden('objecttype');
     $objecttype->setValue('coin')->addFilter('StringToUpper');
     $broadperiod = new Zend_Form_Element_Hidden('broadperiod');
     $broadperiod->setValue('Early Medieval')->addFilter('StringToUpper');
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $institution = new Zend_Form_Element_Select('institution');
     $institution->setLabel('Recording institution: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Alpha', true)->addMultiOptions(array(null => 'Choose an institution', 'Available institutions' => $inst_options));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $this->addElements(array($old_findID, $type, $description, $workflow, $rally, $rallyID, $county, $regionID, $district, $parish, $fourFigure, $gridref, $denomination, $ruler, $mint, $axis, $obverseinsc, $obversedesc, $reverseinsc, $reversedesc, $objecttype, $broadperiod, $cat, $submit, $institution, $hash));
     $this->addDisplayGroup(array('category', 'ruler', 'type', 'denomination', 'mint', 'moneyer', 'axis', 'obverseLegend', 'obverseDescription', 'reverseLegend', 'reverseDescription'), 'numismatics');
     $this->numismatics->setLegend('Numismatic details: ');
     $this->addDisplayGroup(array('old_findID', 'description', 'rally', 'rallyID', 'workflow'), 'details');
     $this->details->setLegend('Object details: ');
     $this->addDisplayGroup(array('countyID', 'regionID', 'districtID', 'parishID', 'gridref', 'fourFigure', 'institution'), 'spatial');
     $this->spatial->setLegend('Spatial details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $institutions = new Institutions();
     $inst_options = $institutions->getInsts();
     $discs = new DiscoMethods();
     $disc_options = $discs->getOptions();
     $mans = new Manufactures();
     $man_options = $mans->getOptions();
     $primaries = new Materials();
     $primary_options = $primaries->getPrimaries();
     $periods = new Periods();
     $period_options = $periods->getPeriodFrom();
     $primaries = new Materials();
     $primary_options = $primaries->getPrimaries();
     $periods = new Periods();
     $periodword_options = $periods->getPeriodFromWords();
     $cultures = new Cultures();
     $culture_options = $cultures->getCultures();
     $surfaces = new SurfaceTreatments();
     $surface_options = $surfaces->getSurfaces();
     $decorations = new DecStyles();
     $decoration_options = $decorations->getStyles();
     $decmeths = new DecMethods();
     $decmeth_options = $decmeths->getDecmethods();
     $reasons = new Findofnotereasons();
     $reason_options = $reasons->getReasons();
     $preserves = new Preservations();
     $preserve_options = $preserves->getPreserves();
     $rallies = new Rallies();
     $rally_options = $rallies->getRallies();
     $counties = new OsCounties();
     $county_options = $counties->getCountiesID();
     $regions = new OsRegions();
     $region_options = $regions->getRegionsID();
     $current_year = date('Y');
     $years = range(1850, $current_year);
     $years_list = array_combine($years, $years);
     parent::__construct($options);
     $this->setName('Advanced');
     $old_findID = new Zend_Form_Element_Text('old_findID');
     $old_findID->setLabel('Find number: ')->addFilters(array('StringTrim', 'StripTags'))->addValidator('StringLength', false, array(3, 20))->addErrorMessage('Please enter a valid number!');
     $objecttype = new Zend_Form_Element_Text('objecttype');
     $objecttype->setLabel('Object type: ')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Please enter a valid object type!');
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Object description contains: ')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Please enter a valid term');
     //Find of note
     $findofnote = new Zend_Form_Element_Checkbox('note');
     $findofnote->setLabel('Find of Note: ')->addFilters(array('StringTrim', 'StripTags'))->setUncheckedValue(null);
     //Reason for find of note
     $findofnotereason = new Zend_Form_Element_Select('reason');
     $findofnotereason->setLabel('Reason for noteworthy status: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose reason', 'Available reasons' => $reason_options))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     //Institution
     $institution = new Zend_Form_Element_Select('institution');
     $institution->setLabel('Recording institution: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose institution', 'Available institutions' => $inst_options))->setAttribs(array('class' => 'input-medium selectpicker show-menu-arrow'));
     $notes = new Zend_Form_Element_Text('notes');
     $notes->setLabel('Notes: ')->addFilters(array('StringTrim', 'StripTags'));
     $broadperiod = new Zend_Form_Element_Select('broadperiod');
     $broadperiod->setLabel('Broad period: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose period from', 'Available periods' => $periodword_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $objdate1subperiod = new Zend_Form_Element_Select('fromsubperiod');
     $objdate1subperiod->setLabel('Sub period from: ')->addMultiOptions(array(null => 'Choose sub-period from', 'Available sub period from' => array('1' => 'Early', '2' => 'Middle', '3' => 'Late')))->addFilters(array('StringTrim', 'StripTags'))->setOptions(array('separator' => ''))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Period from: Assigned via dropdown
     $objdate1period = new Zend_Form_Element_Select('periodFrom');
     $objdate1period->setLabel('Period from: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose period from', 'Available periods' => $period_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $objdate2subperiod = new Zend_Form_Element_Select('tosubperiod');
     $objdate2subperiod->setLabel('Sub period to: ')->addMultiOptions(array(null => 'Choose sub-period from', 'Available subperiods' => array('1' => 'Early', '2' => 'Middle', '3' => 'Late')))->setDisableTranslator(true)->addFilters(array('StringTrim', 'StripTags'))->setOptions(array('separator' => ''))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Period to: Assigned via dropdown
     $objdate2period = new Zend_Form_Element_Select('periodTo');
     $objdate2period->setLabel('Period to: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose period to', 'Available periods' => $period_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $culture = new Zend_Form_Element_Select('culture');
     $culture->setLabel('Ascribed culture: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose ascribed culture', 'Available cultures' => $culture_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $from = new Zend_Form_Element_Text('fromdate');
     $from->setLabel('Start date: ')->addFilters(array('StringTrim', 'StripTags'))->addValidators(array('NotEmpty', 'Int'))->addErrorMessage('Please enter a valid date')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'))->setDescription('If you want to search for a date range, ' . 'enter a start date in this box and and end in the ' . 'box below. You do not need to add AD or BC');
     $to = new Zend_Form_Element_Text('todate');
     $to->setLabel('End date: ')->addFilters(array('StringTrim', 'StripTags'))->addValidators(array('NotEmpty', 'Int'))->addErrorMessage('Please enter a valid date')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $workflow = new Zend_Form_Element_Select('workflow');
     $workflow->setLabel('Workflow stage: ')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Int')->setAttribs(array('class' => 'input-medium selectpicker show-menu-arrow'));
     if (in_array($this->_role, $this->_higherlevel)) {
         $workflow->addMultiOptions(array(null => 'Available Workflow stages', 'Choose Worklow stage' => array('1' => 'Quarantine', '2' => 'On review', '4' => 'Awaiting validation', '3' => 'Published')));
     }
     if (in_array($this->_role, $this->_restricted)) {
         $workflow->addMultiOptions(array(null => 'Available Workflow stages', 'Choose Worklow stage' => array('4' => 'Awaiting validation', '3' => 'Published')));
     }
     $treasure = new Zend_Form_Element_Checkbox('treasure');
     $treasure->setLabel('Treasure find: ')->addFilters(array('StringTrim', 'StripTags'))->setUncheckedValue(null);
     $treasureID = new Zend_Form_Element_Text('TID');
     $treasureID->setLabel('Treasure ID number: ')->addFilters(array('StringTrim', 'StripTags'));
     //Rally details
     $rally = new Zend_Form_Element_Checkbox('rally');
     $rally->setLabel('Rally find: ')->addValidator('Int')->addFilters(array('StringTrim', 'StripTags'))->setUncheckedValue(null);
     $rallyID = new Zend_Form_Element_Select('rallyID');
     $rallyID->setLabel('Found at this rally: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose a rally', 'Available rallies' => $rally_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $other_ref = new Zend_Form_Element_Text('otherRef');
     $other_ref->setLabel('Other reference: ')->addFilters(array('StringTrim', 'StripTags'));
     $smrRef = new Zend_Form_Element_Text('smrRef');
     $smrRef->setLabel('SMR reference: ')->addFilters(array('StringTrim', 'StripTags'));
     //Manufacture method
     $manmethod = new Zend_Form_Element_Select('manufacture');
     $manmethod->setLabel('Manufacture method: ')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Int')->addMultiOptions(array(null => 'Choose method of manufacture', 'Available methods' => $man_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Decoration method
     $decmethod = new Zend_Form_Element_Select('decoration');
     $decmethod->setLabel('Decoration method: ')->addValidator('Int')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose decoration method', 'Available decorative methods' => $decmeth_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Surface treatment
     $surftreat = new Zend_Form_Element_Select('surface');
     $surftreat->setLabel('Surface Treatment: ')->addValidator('Int')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose surface treatment', 'Available surface treatments' => $surface_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //decoration style
     $decstyle = new Zend_Form_Element_Select('decstyle');
     $decstyle->setLabel('Decorative style: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose decorative style', 'Available decorative options' => $decoration_options))->addValidator('Int')->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Preservation of object
     $preservation = new Zend_Form_Element_Select('preservation');
     $preservation->setLabel('Preservation: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addMultiOptions(array(null => 'Choose level of preservation', 'Available options' => $preserve_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $county = new Zend_Form_Element_Select('countyID');
     $county->setLabel('County: ')->addValidators(array('NotEmpty'))->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose county', 'Available counties' => $county_options))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $district = new Zend_Form_Element_Select('districtID');
     $district->setLabel('District: ')->addMultiOptions(array(null => 'Choose district after county'))->setRegisterInArrayValidator(false)->addFilters(array('StringTrim', 'StripTags'))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $parish = new Zend_Form_Element_Select('parishID');
     $parish->setLabel('Parish: ')->setRegisterInArrayValidator(false)->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose parish after county'))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('European region: ')->setRegisterInArrayValidator(false)->addValidator('Int')->addMultiOptions(array(null => 'Choose a region for a wide result', 'Choose region' => $region_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $gridref = new Zend_Form_Element_Text('gridref');
     $gridref->setLabel('Grid reference: ')->addValidators(array('NotEmpty', 'ValidGridRef'))->addFilters(array('StringTrim', 'StripTags'));
     $fourFigure = new Zend_Form_Element_Text('fourFigure');
     $fourFigure->setLabel('Four figure grid reference: ')->addValidators(array('NotEmpty'))->addFilters(array('StringTrim', 'StripTags'));
     $idBy = new Zend_Form_Element_Text('idBy');
     $idBy->setLabel('Primary identifier: ')->addValidators(array('NotEmpty'))->addFilters(array('StringTrim', 'StripTags'));
     $identifierID = new Zend_Form_Element_Hidden('identifierID');
     $identifierID->addFilters(array('StringTrim', 'StripTags'));
     $created = new Zend_Form_Element_Text('createdBefore');
     $created->setLabel('Date record created on or before: ')->addFilters(array('StringTrim', 'StripTags'));
     $created2 = new Zend_Form_Element_Text('createdAfter');
     $created2->setLabel('Date record created on or after: ')->addFilters(array('StringTrim', 'StripTags'));
     $updated = new Zend_Form_Element_Text('updatedBefore');
     $updated->setLabel('Date record updated on or before: ')->addFilters(array('StringTrim', 'StripTags'));
     $updated2 = new Zend_Form_Element_Text('updatedAfter');
     $updated2->setLabel('Date record updated on or after: ')->addFilters(array('StringTrim', 'StripTags'));
     $finder = new Zend_Form_Element_Text('finder');
     $finder->setLabel('Found by: ')->addFilters(array('StringTrim', 'StripTags'));
     $finderID = new Zend_Form_Element_Hidden('finderID');
     $finderID->addFilters(array('StringTrim', 'StripTags'));
     $recordby = new Zend_Form_Element_Text('recordername');
     $recordby->setLabel('Recorded by: ')->addValidators(array('NotEmpty'))->addFilters(array('StringTrim', 'StripTags'))->setAttrib('autoComplete', 'true');
     $recorderID = new Zend_Form_Element_Hidden('recorderID');
     $recorderID->addFilters(array('StringTrim', 'StripTags'));
     $discoverydate = new Zend_Form_Element_Select('discovered');
     $discoverydate->setLabel('Year of discovery')->setMultiOptions(array(null => 'Choose a year of discovery', 'Date range' => $years_list))->addValidator('Int')->addFilters(array('StringTrim', 'StripTags'))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit your search');
     $material1 = new Zend_Form_Element_Select('material');
     $material1->setLabel('Primary material: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose primary material', 'Available options' => $primary_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $woeid = new Zend_Form_Element_Text('woeid');
     $woeid->setLabel('Where on earth ID: ')->addValidator('Int')->addFilters(array('StripTags', 'StringTrim'));
     $elevation = new Zend_Form_Element_Text('elevation');
     $elevation->setLabel('Elevation: ')->addValidator('Int')->addFilters(array('StripTags', 'StringTrim'));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     if (in_array($this->_role, $this->_restricted)) {
         $this->addElements(array($old_findID, $objecttype, $broadperiod, $description, $from, $to, $workflow, $findofnote, $findofnotereason, $rally, $rallyID, $other_ref, $manmethod, $notes, $objdate1period, $objdate2period, $county, $regionID, $district, $parish, $fourFigure, $objdate1subperiod, $objdate2subperiod, $treasure, $treasureID, $discoverydate, $created, $created2, $updated, $updated2, $culture, $surftreat, $submit, $material1, $elevation, $woeid, $institution, $hash, $smrRef));
     } else {
         $this->addElements(array($old_findID, $objecttype, $broadperiod, $description, $from, $to, $workflow, $findofnote, $findofnotereason, $rally, $rallyID, $other_ref, $manmethod, $notes, $objdate1period, $objdate2period, $county, $regionID, $district, $parish, $fourFigure, $elevation, $woeid, $objdate1subperiod, $objdate2subperiod, $treasure, $treasureID, $discoverydate, $created, $created2, $updated, $updated2, $idBy, $finder, $finderID, $recordby, $recorderID, $identifierID, $culture, $surftreat, $submit, $material1, $institution, $smrRef, $hash));
     }
     $this->addDisplayGroup(array('old_findID', 'objecttype', 'description', 'notes', 'note', 'reason', 'treasure', 'TID', 'rally', 'rallyID', 'workflow', 'otherRef', 'smrRef', 'material', 'manufacture', 'surface'), 'details');
     $this->details->setLegend('Main details: ');
     $this->addDisplayGroup(array('broadperiod', 'fromsubperiod', 'periodFrom', 'tosubperiod', 'periodTo', 'culture', 'fromdate', 'todate'), 'Temporaldetails');
     $this->Temporaldetails->setLegend('Dates and periods: ');
     $this->addDisplayGroup(array('countyID', 'regionID', 'districtID', 'parishID', 'fourFigure', 'elevation', 'woeid'), 'Spatial');
     $this->Spatial->setLegend('Spatial details: ');
     if (in_array($this->_role, $this->_restricted)) {
         $this->addDisplayGroup(array('institution', 'createdAfter', 'createdBefore', 'updatedAfter', 'updatedBefore', 'discovered'), 'Discovery');
     } else {
         $this->addDisplayGroup(array('institution', 'finder', 'idBy', 'identifierID', 'recordername', 'recorderID', 'createdAfter', 'createdBefore', 'updatedAfter', 'updatedBefore', 'discovered'), 'Discovery');
     }
     $this->Discovery->setLegend('Discovery details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $institutions = new Institutions();
     $inst_options = $institutions->getInsts();
     $rulers = new Rulers();
     $ruler_options = $rulers->getRomanRulers();
     $discs = new DiscoMethods();
     $disc_options = $discs->getOptions();
     $periods = new Periods();
     $period_options = $periods->getPeriodFrom();
     $periods = new Periods();
     $periodword_options = $periods->getPeriodFromWords();
     $reasons = new Findofnotereasons();
     $reason_options = $reasons->getReasons();
     $rallies = new Rallies();
     $rally_options = $rallies->getRallies();
     $counties = new OsCounties();
     $county_options = $counties->getCountiesID();
     $regions = new OsRegions();
     $region_options = $regions->getRegionsID();
     $terminalDates = new TerminalReasons();
     $termOptions = $terminalDates->getReasons();
     $qualityRatings = new DataQuality();
     $qualityStreet = $qualityRatings->getRatings();
     $current_year = date('Y');
     $years = range(1650, $current_year);
     $years_list = array_combine($years, $years);
     $reeces = new Reeces();
     $reece_options = $reeces->getReeces();
     $siteclasses = new ArchaeologicalSiteClass();
     $siteclass_options = $siteclasses->getOptions();
     $contexts = new ArchaeologicalContexts();
     $context_options = $contexts->getOptions();
     $features = new ArchaeologicalFeatures();
     $feature_options = $features->getOptions();
     parent::__construct($options);
     $this->setName('AdvancedHoards');
     $old_findID = new Zend_Form_Element_Text('old_findID');
     $old_findID->setLabel('Find number: ')->addFilters(array('StringTrim', 'StripTags'))->addValidator('StringLength', false, array(3, 20))->addErrorMessage('Please enter a valid number!');
     $objecttype = new Zend_Form_Element_Hidden('objecttype');
     $objecttype->setValue('HOARD')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Please enter a valid object type!');
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Hoard description contains: ')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Please enter a valid term');
     //Find of note
     $findofnote = new Zend_Form_Element_Checkbox('note');
     $findofnote->setLabel('Find of Note: ')->addFilters(array('StringTrim', 'StripTags'))->setUncheckedValue(null);
     //Reason for find of note
     $findofnotereason = new Zend_Form_Element_Select('reason');
     $findofnotereason->setLabel('Reason for noteworthy status: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose reason', 'Available reasons' => $reason_options))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     //Institution
     $institution = new Zend_Form_Element_Select('institution');
     $institution->setLabel('Recording institution: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose institution', 'Available institutions' => $inst_options))->setAttribs(array('class' => 'input-medium selectpicker show-menu-arrow'));
     $notes = new Zend_Form_Element_Text('notes');
     $notes->setLabel('Notes: ')->addFilters(array('StringTrim', 'StripTags'));
     $broadperiod = new Zend_Form_Element_Select('broadperiod');
     $broadperiod->setLabel('Broad period: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose period from', 'Available periods' => $periodword_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $objdate1subperiod = new Zend_Form_Element_Select('fromsubperiod');
     $objdate1subperiod->setLabel('Sub period from: ')->addMultiOptions(array(null => 'Choose sub-period from', 'Available sub period from' => array('1' => 'Early', '2' => 'Middle', '3' => 'Late')))->addFilters(array('StringTrim', 'StripTags'))->setOptions(array('separator' => ''))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Period from: Assigned via dropdown
     $objdate1period = new Zend_Form_Element_Select('periodFrom');
     $objdate1period->setLabel('Period from: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose period from', 'Available periods' => $period_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $objdate2subperiod = new Zend_Form_Element_Select('tosubperiod');
     $objdate2subperiod->setLabel('Sub period to: ')->addMultiOptions(array(null => 'Choose sub-period from', 'Available subperiods' => array('1' => 'Early', '2' => 'Middle', '3' => 'Late')))->setDisableTranslator(true)->addFilters(array('StringTrim', 'StripTags'))->setOptions(array('separator' => ''))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Period to: Assigned via dropdown
     $objdate2period = new Zend_Form_Element_Select('periodTo');
     $objdate2period->setLabel('Period to: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose period to', 'Available periods' => $period_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $from = new Zend_Form_Element_Text('fromdate');
     $from->setLabel('Start date: ')->addFilters(array('StringTrim', 'StripTags'))->addValidators(array('NotEmpty', 'Int'))->addErrorMessage('Please enter a valid date')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'))->setDescription('If you want to search for a date range, ' . 'enter a start date in this box and and end in the ' . 'box below. You do not need to add AD or BC');
     $to = new Zend_Form_Element_Text('todate');
     $to->setLabel('End date: ')->addFilters(array('StringTrim', 'StripTags'))->addValidators(array('NotEmpty', 'Int'))->addErrorMessage('Please enter a valid date')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $workflow = new Zend_Form_Element_Select('workflow');
     $workflow->setLabel('Workflow stage: ')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Int')->setAttribs(array('class' => 'input-medium selectpicker show-menu-arrow'));
     if (in_array($this->_role, $this->_higherlevel)) {
         $workflow->addMultiOptions(array(null => 'Available Workflow stages', 'Choose Worklow stage' => array('1' => 'Quarantine', '2' => 'On review', '4' => 'Awaiting validation', '3' => 'Published')));
     }
     if (in_array($this->_role, $this->_restricted)) {
         $workflow->addMultiOptions(array(null => 'Available Workflow stages', 'Choose Worklow stage' => array('4' => 'Awaiting validation', '3' => 'Published')));
     }
     $treasure = new Zend_Form_Element_Checkbox('treasure');
     $treasure->setLabel('Treasure find: ')->addFilters(array('StringTrim', 'StripTags'))->setUncheckedValue(null);
     $treasureID = new Zend_Form_Element_Text('TID');
     $treasureID->setLabel('Treasure ID number: ')->addFilters(array('StringTrim', 'StripTags'));
     //Rally details
     $rally = new Zend_Form_Element_Checkbox('rally');
     $rally->setLabel('Rally find: ')->addValidator('Int')->addFilters(array('StringTrim', 'StripTags'))->setUncheckedValue(null);
     $rallyID = new Zend_Form_Element_Select('rallyID');
     $rallyID->setLabel('Found at this rally: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose a rally', 'Available rallies' => $rally_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $other_ref = new Zend_Form_Element_Text('otherRef');
     $other_ref->setLabel('Other reference: ')->addFilters(array('StringTrim', 'StripTags'));
     $smrRef = new Zend_Form_Element_Text('smrRef');
     $smrRef->setLabel('SMR reference: ')->addFilters(array('StringTrim', 'StripTags'));
     $county = new Zend_Form_Element_Select('countyID');
     $county->setLabel('County: ')->addValidators(array('NotEmpty'))->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose county', 'Available counties' => $county_options))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $district = new Zend_Form_Element_Select('districtID');
     $district->setLabel('District: ')->addMultiOptions(array(null => 'Choose district after county'))->setRegisterInArrayValidator(false)->addFilters(array('StringTrim', 'StripTags'))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $parish = new Zend_Form_Element_Select('parishID');
     $parish->setLabel('Parish: ')->setRegisterInArrayValidator(false)->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose parish after county'))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'));
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('European region: ')->setRegisterInArrayValidator(false)->addValidator('Int')->addMultiOptions(array(null => 'Choose a region for a wide result', 'Choose region' => $region_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $gridref = new Zend_Form_Element_Text('gridref');
     $gridref->setLabel('Grid reference: ')->addValidators(array('NotEmpty', 'ValidGridRef'))->addFilters(array('StringTrim', 'StripTags'));
     $fourFigure = new Zend_Form_Element_Text('fourFigure');
     $fourFigure->setLabel('Four figure grid reference: ')->addValidators(array('NotEmpty'))->addFilters(array('StringTrim', 'StripTags'));
     $idBy = new Zend_Form_Element_Text('idBy');
     $idBy->setLabel('Primary identifier: ')->addValidators(array('NotEmpty'))->addFilters(array('StringTrim', 'StripTags'));
     $identifierID = new Zend_Form_Element_Hidden('identifierID');
     $identifierID->addFilters(array('StringTrim', 'StripTags'));
     $created = new Zend_Form_Element_Text('createdBefore');
     $created->setLabel('Date record created on or before: ')->addFilters(array('StringTrim', 'StripTags'));
     $created2 = new Zend_Form_Element_Text('createdAfter');
     $created2->setLabel('Date record created on or after: ')->addFilters(array('StringTrim', 'StripTags'));
     $updated = new Zend_Form_Element_Text('updatedBefore');
     $updated->setLabel('Date record updated on or before: ')->addFilters(array('StringTrim', 'StripTags'));
     $updated2 = new Zend_Form_Element_Text('updatedAfter');
     $updated2->setLabel('Date record updated on or after: ')->addFilters(array('StringTrim', 'StripTags'));
     $finder = new Zend_Form_Element_Text('finder');
     $finder->setLabel('Found by: ')->addFilters(array('StringTrim', 'StripTags'));
     $finderID = new Zend_Form_Element_Hidden('finderID');
     $finderID->addFilters(array('StringTrim', 'StripTags'));
     $recordby = new Zend_Form_Element_Text('recordername');
     $recordby->setLabel('Recorded by: ')->addValidators(array('NotEmpty'))->addFilters(array('StringTrim', 'StripTags'))->setAttrib('autoComplete', 'true');
     $recorderID = new Zend_Form_Element_Hidden('recorderID');
     $recorderID->addFilters(array('StringTrim', 'StripTags'));
     $discoverydate = new Zend_Form_Element_Select('discovered');
     $discoverydate->setLabel('Year of discovery')->setMultiOptions(array(null => 'Choose a year of discovery', 'Date range' => $years_list))->addValidator('Int')->addFilters(array('StringTrim', 'StripTags'))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit your search');
     $woeid = new Zend_Form_Element_Text('woeid');
     $woeid->setLabel('Where on earth ID: ')->addValidator('Int')->addFilters(array('StripTags', 'StringTrim'));
     $elevation = new Zend_Form_Element_Text('elevation');
     $elevation->setLabel('Elevation: ')->addValidator('Int')->addFilters(array('StripTags', 'StringTrim'));
     $lastRulerID = new Zend_Form_Element_Select('lastRulerID');
     $lastRulerID->setLabel('Last Ruler: ')->addValidator('Int')->addMultiOptions(array(null => 'Choose primary ruler', 'Available rulers' => $ruler_options))->addFilters(array('StringTrim', 'StripTags'))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'))->setDescription('You need to pick a broad period first')->setRegisterInArrayValidator(false);
     $termDate1 = new Zend_Form_Element_Text('fromTerminalYear');
     $termDate1->setLabel('Terminal year from: ')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $termDate2 = new Zend_Form_Element_Text('toTerminalYear');
     $termDate2->setLabel('Terminal year to: ')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $qualityRatingNum = new Zend_Form_Element_Select('qualityRatingNumismatic');
     $qualityRatingNum->setLabel('Coin data quality rating: ')->addMultiOptions(array(null => 'Choose quality rating', 'Available options' => $qualityStreet))->addValidator('Int')->addValidator('InArray', false, array(array_keys($qualityStreet)))->addFilters(array('StringTrim', 'StripTags'))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $qualityRatingArch = new Zend_Form_Element_Select('qualityRatingArchaeological');
     $qualityRatingArch->setLabel('Archaeology data quality rating: ')->addMultiOptions(array(null => 'Choose quality rating', 'Available options' => $qualityStreet))->addValidator('Int')->addValidator('InArray', false, array(array_keys($qualityStreet)))->addFilters(array('StringTrim', 'StripTags'))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $qualityRatingFindspot = new Zend_Form_Element_Select('qualityRatingFindspot');
     $qualityRatingFindspot->setLabel('Findspot data quality rating: ')->addMultiOptions(array(null => 'Choose quality rating', 'Available options' => $qualityStreet))->addValidator('Int')->addValidator('InArray', false, array(array_keys($qualityStreet)))->addFilters(array('StringTrim', 'StripTags'))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $terminalReasonID = new Zend_Form_Element_Select('terminalReasonID');
     $terminalReasonID->setLabel('Terminal date reasoning: ')->addMultiOptions(array(null => 'Choose terminal reasoning', 'Available options' => $termOptions))->addValidator('Int')->addFilters(array('StringTrim', 'StripTags'))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $excavatedYear1 = new Zend_Form_Element_Text('excavatedYear1');
     $excavatedYear1->setLabel('Excavated year first date: ')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $excavatedYear2 = new Zend_Form_Element_Text('excavatedYear2');
     $excavatedYear2->setLabel('Excavated year end date: ')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $archaeologicalDescription = new Zend_Form_Element_Text('archaeologyDescription');
     $archaeologicalDescription->setLabel('Archaeological description contains: ');
     //Period from: Assigned via dropdown
     $archdate1period = new Zend_Form_Element_Select('archaeologyPeriodFrom');
     $archdate1period->setLabel('Period from: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose period from', 'Available periods' => $period_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     //Period to: Assigned via dropdown
     $archdate2period = new Zend_Form_Element_Select('archaeologyPeriodTo');
     $archdate2period->setLabel('Period to: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose period to', 'Available periods' => $period_options))->setAttribs(array('class' => 'input-xlarge selectpicker show-menu-arrow'));
     $siteDateYear1 = new Zend_Form_Element_Text('siteDateYear1');
     $siteDateYear1->setLabel('Site date from: ')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $siteDateYear2 = new Zend_Form_Element_Text('siteDateYear2');
     $siteDateYear2->setLabel('Site date to: ')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $featureDateYear1 = new Zend_Form_Element_Text('featureDateYear1');
     $featureDateYear1->setLabel('Feature date from: ')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $featureDateYear2 = new Zend_Form_Element_Text('featureDateYear2');
     $featureDateYear2->setLabel('Feature date to: ')->setAttribs(array('placeholder' => 'Positive for AD, negative for BC'));
     $knownSite = new Zend_Form_Element_Checkbox('knownSite');
     $knownSite->setLabel('Known site: ')->setUncheckedValue(null);
     $excavated = new Zend_Form_Element_Checkbox('excavated');
     $excavated->setLabel('Excavated: ')->setUncheckedValue(null);
     $siteclass = new Zend_Form_Element_Select('siteClassID');
     $siteclass->setLabel('Site class: ')->addMultioptions(array(null => 'Choose class of site', 'Available classes' => $siteclass_options))->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($siteclass_options)))->addValidator('Int')->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow');
     $arch_context = new Zend_Form_Element_Select('siteContextID');
     $arch_context->setLabel('Context: ')->addMultioptions(array(null => 'Choose a context', 'Available contexts' => $context_options))->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($context_options)))->addValidator('Int')->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow');
     $arch_feature = new Zend_Form_Element_Select('featureID');
     $arch_feature->setLabel('Feature: ')->addMultioptions(array(null => 'Choose a feature', 'Available features' => $feature_options))->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($feature_options)))->addValidator('Int')->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow');
     $quantityCoins = new Zend_Form_Element_Text('quantityCoins');
     $quantityCoins->setLabel('Quantity of coins in hoard: ');
     $quantityCoins->setDescription('This searches for an exact quantity. ' . 'To search for a range use advanced search syntax in the simple ' . 'search box');
     $quantityArtefacts = new Zend_Form_Element_Text('quantityArtefacts');
     $quantityArtefacts->setLabel('Quantity of artefacts in hoard: ');
     $quantityArtefacts->setDescription('This searches for an exact quantity. ' . 'To search for a range use advanced search syntax in the simple ' . 'search box');
     $quantityContainers = new Zend_Form_Element_Text('quantityContainers');
     $quantityContainers->setLabel('Quantity of containers in hoard: ');
     $quantityContainers->setDescription('This searches for an exact quantity. ' . 'To search for a range use advanced search syntax in the simple ' . 'search box');
     $legacyID = new Zend_Form_Element_Text('legacyID');
     $legacyID->setLabel('Legacy hoard database number: ');
     //Reece
     $reece = new Zend_Form_Element_Select('reeceID');
     $reece->setLabel('Reece period: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose Reece period', 'Available Reece periods' => $reece_options))->addValidator('InArray', false, array(array_keys($reece_options)))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     if (in_array($this->_role, $this->_restricted)) {
         $this->addElements(array($old_findID, $objecttype, $broadperiod, $description, $from, $to, $workflow, $findofnote, $findofnotereason, $rally, $rallyID, $other_ref, $notes, $objdate1period, $termDate1, $objdate2period, $county, $regionID, $district, $parish, $fourFigure, $treasure, $treasureID, $discoverydate, $created, $created2, $updated, $updated2, $submit, $elevation, $woeid, $institution, $hash, $smrRef, $lastRulerID, $termDate2, $terminalReasonID, $qualityRatingNum, $qualityRatingArch, $qualityRatingFindspot, $archaeologicalDescription, $excavatedYear1, $excavatedYear2, $featureDateYear1, $featureDateYear2, $knownSite, $excavated, $siteclass, $arch_context, $arch_feature, $quantityArtefacts, $quantityCoins, $quantityContainers, $legacyID, $reece, $archdate1period, $archdate2period));
     } else {
         $this->addElements(array($old_findID, $objecttype, $broadperiod, $description, $from, $to, $workflow, $findofnote, $findofnotereason, $rally, $rallyID, $other_ref, $notes, $objdate1period, $objdate2period, $county, $regionID, $district, $parish, $fourFigure, $elevation, $woeid, $treasure, $treasureID, $discoverydate, $created, $created2, $updated, $updated2, $idBy, $finder, $finderID, $recordby, $recorderID, $identifierID, $lastRulerID, $submit, $institution, $archaeologicalDescription, $smrRef, $hash, $termDate1, $termDate2, $terminalReasonID, $qualityRatingNum, $qualityRatingArch, $qualityRatingFindspot, $excavatedYear1, $excavatedYear2, $featureDateYear1, $featureDateYear2, $siteclass, $arch_context, $arch_feature, $knownSite, $excavated, $quantityArtefacts, $quantityCoins, $quantityContainers, $legacyID, $reece, $archdate1period, $archdate2period));
     }
     $this->addDisplayGroup(array('old_findID', 'objecttype', 'description', 'notes', 'note', 'reason', 'treasure', 'TID', 'rally', 'rallyID', 'workflow', 'otherRef', 'smrRef', 'quantityArtefacts', 'quantityCoins', 'quantityContainers'), 'details');
     $this->details->setLegend('Main details: ');
     $this->addDisplayGroup(array('broadperiod', 'periodFrom', 'periodTo', 'fromdate', 'todate'), 'temporaldetails');
     $this->temporaldetails->setLegend('Dates and periods: ');
     $this->addDisplayGroup(array('lastRulerID', 'reeceID', 'fromTerminalYear', 'toTerminalYear', 'terminalReasonID', 'legacyID', 'qualityRatingNumismatic'), 'numismatics');
     $this->numismatics->setLegend('Numismatic analysis: ');
     $this->addDisplayGroup(array('knownSite', 'excavated', 'archaeologyPeriodFrom', 'archaeologyPeriodTo', 'archaeologyDescription', 'excavatedYear1', 'excavatedYear2', 'siteClassID', 'siteContextID', 'featureID', 'featureDateYear1', 'featureDateYear2', 'qualityRatingArchaeological'), 'archaeology');
     $this->archaeology->setLegend('Archaeological context: ');
     $this->addDisplayGroup(array('countyID', 'regionID', 'districtID', 'parishID', 'fourFigure', 'elevation', 'woeid', 'qualityRatingFindspot'), 'Spatial');
     $this->Spatial->setLegend('Spatial details: ');
     if (in_array($this->_role, $this->_restricted)) {
         $this->addDisplayGroup(array('institution', 'createdAfter', 'createdBefore', 'updatedAfter', 'updatedBefore', 'discovered'), 'Discovery');
     } else {
         $this->addDisplayGroup(array('institution', 'finder', 'idBy', 'identifierID', 'recordername', 'recorderID', 'createdAfter', 'createdBefore', 'updatedAfter', 'updatedBefore', 'discovered'), 'Discovery');
     }
     $this->Discovery->setLegend('Discovery details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     //Get data to form select menu for periods
     //Get Rally data
     $rallies = new Rallies();
     $rally_options = $rallies->getRallies();
     $counties = new OsCounties();
     $county_options = $counties->getCountiesID();
     $denominations = new Denominations();
     $denom_options = $denominations->getOptionsIronAge();
     $rulers = new Rulers();
     $ruler_options = $rulers->getIronAgeRulers();
     $mints = new Mints();
     $mint_options = $mints->getIronAgeMints();
     $axis = new Dieaxes();
     $axis_options = $axis->getAxes();
     $geog = new Geography();
     $geog_options = $geog->getIronAgeGeographyDD();
     $regions = new OsRegions();
     $region_options = $regions->getRegionsID();
     $tribes = new Tribes();
     $tribe_options = $tribes->getTribes();
     $institutions = new Institutions();
     $inst_options = $institutions->getInsts();
     parent::__construct($options);
     $this->setName('IronAgeSearch');
     $old_findID = new Zend_Form_Element_Text('old_findID');
     $old_findID->setLabel('Find number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid number!');
     $cci = new Zend_Form_Element_Text('cciNumber');
     $cci->setLabel('CCI number:')->setDescription('This is a unique number')->setFilters(array('StringTrim', 'StripTags'));
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Object description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     $workflow = new Zend_Form_Element_Select('workflow');
     $workflow->setLabel('Workflow stage: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     if (in_array($this->_role, $this->_higherlevel)) {
         $workflow->addMultiOptions(array(null => 'Choose a workflow stage', 'Available workflow stages' => array('1' => 'Quarantine', '2' => 'On review', '4' => 'Awaiting validation', '3' => 'Published')));
     }
     if (in_array($this->_role, $this->_restricted)) {
         $workflow->addMultiOptions(array(null => 'Choose a workflow stage', 'Available workflow stages' => array('4' => 'Awaiting validation', '3' => 'Published')));
     }
     //Rally details
     $rally = new Zend_Form_Element_Checkbox('rally');
     $rally->setLabel('Rally find: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setUncheckedValue(null);
     $geographyID = new Zend_Form_Element_Select('geographyID');
     $geographyID->setLabel('Geographic area: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose a geography', 'Available geographies' => $geog_options))->addValidator('inArray', false, array(array_keys($geog_options)))->addValidator('Int');
     $rallyID = new Zend_Form_Element_Select('rallyID');
     $rallyID->setLabel('Found at this rally: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose a rally', 'Available rallies' => $rally_options))->addValidator('inArray', false, array(array_keys($rally_options)))->addValidator('Int');
     $county = new Zend_Form_Element_Select('countyID');
     $county->setLabel('County: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose a county', 'Available counties' => $county_options))->addValidator('inArray', false, array(array_keys($county_options)));
     $district = new Zend_Form_Element_Select('districtID');
     $district->setLabel('District: ')->setRegisterInArrayValidator(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose district after county'));
     $parish = new Zend_Form_Element_Select('parishID');
     $parish->setLabel('Parish: ')->setRegisterInArrayValidator(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose parish after county', 'Available districts' => null));
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('European region: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a region for a wide result', 'Available regions' => $region_options))->addValidator('Int');
     $gridref = new Zend_Form_Element_Text('gridref');
     $gridref->setLabel('Grid reference: ')->addValidator('ValidGridRef')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum');
     $fourFigure = new Zend_Form_Element_Text('fourFigure');
     $fourFigure->setLabel('Four figure grid reference: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('ValidGridRef')->addValidator('Alnum');
     ###
     ##Numismatic data
     ###
     //	Denomination
     $denomination = new Zend_Form_Element_Select('denomination');
     $denomination->setLabel('Denomination: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRegisterInArrayValidator(false)->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose denomination type', 'Available denominations' => $denom_options))->addValidator('inArray', false, array(array_keys($denom_options)));
     //Primary ruler
     $ruler = new Zend_Form_Element_Select('ruler');
     $ruler->setLabel('Ruler / issuer: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose primary ruler', 'Available rulers' => $ruler_options))->addValidator('inArray', false, array(array_keys($ruler_options)));
     //Mint
     $mint = new Zend_Form_Element_Select('mint');
     $mint->setLabel('Issuing mint: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose issuing mint', 'Available mints' => $mint_options))->addValidator('inArray', false, array(array_keys($mint_options)));
     //Secondary ruler
     $ruler2 = new Zend_Form_Element_Select('ruler2');
     $ruler2->setLabel('Secondary ruler / issuer: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose secondary ruler', 'Available rulers' => $ruler_options))->addValidator('inArray', false, array(array_keys($ruler_options)));
     //Obverse inscription
     $obverseinsc = new Zend_Form_Element_Text('obverseLegend');
     $obverseinsc->setLabel('Obverse inscription contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     //Obverse description
     $obversedesc = new Zend_Form_Element_Text('obverseDescription');
     $obversedesc->setLabel('Obverse description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     //reverse inscription
     $reverseinsc = new Zend_Form_Element_Text('reverseLegend');
     $reverseinsc->setLabel('Reverse inscription contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     //reverse description
     $reversedesc = new Zend_Form_Element_Text('reverseDescription');
     $reversedesc->setLabel('Reverse description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term');
     //Die axis
     $axis = new Zend_Form_Element_Select('axis');
     $axis->setLabel('Die axis measurement: ')->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose measurement', 'Available die axes' => $axis_options))->addValidator('inArray', false, array(array_keys($axis_options)))->addErrorMessage('That option is not a valid choice')->addValidator('Int');
     //Tribe
     $tribe = new Zend_Form_Element_Select('tribe');
     $tribe->setLabel('Iron Age tribe: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose a tribe', 'Available tribes' => $tribe_options))->addValidator('inArray', false, array(array_keys($tribe_options)))->addErrorMessage('That option is not a valid choice')->addValidator('Int');
     $objecttype = new Zend_Form_Element_Hidden('objecttype');
     $objecttype->setValue('COIN')->addFilters(array('StripTags', 'StringTrim', 'StringToUpper'))->addValidator('Alpha', false, array('allowWhiteSpace' => true));
     $broadperiod = new Zend_Form_Element_Hidden('broadperiod');
     $broadperiod->setValue('IRON AGE')->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addFilters(array('StripTags', 'StringTrim'));
     $mack_type = new Zend_Form_Element_Text('mackType');
     $mack_type->setLabel('Mack Type: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $bmc_type = new Zend_Form_Element_Text('bmc');
     $bmc_type->setLabel('British Museum catalogue number: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $allen_type = new Zend_Form_Element_Text('allenType');
     $allen_type->setLabel('Allen Type: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $va_type = new Zend_Form_Element_Text('vaType');
     $va_type->setLabel('Van Arsdell Number (VA): ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $rudd_type = new Zend_Form_Element_Text('abcType');
     $rudd_type->setLabel('Ancient British Coins number (ABC): ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $phase_date_1 = new Zend_Form_Element_Text('phase_date_1');
     $phase_date_1->setLabel('Phase date 1: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $phase_date_2 = new Zend_Form_Element_Text('phase_date_2');
     $phase_date_2->setLabel('Phase date 2: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $context = new Zend_Form_Element_Text('context');
     $context->setLabel('Context of coins: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $depositionDate = new Zend_Form_Element_Text('depositionDate');
     $depositionDate->setLabel('Date of deposition: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $numChiab = new Zend_Form_Element_Text('numChiab');
     $numChiab->setLabel('Coin hoards of Iron Age Britain number: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit your search');
     $institution = new Zend_Form_Element_Select('institution');
     $institution->setLabel('Recording institution: ')->setAttrib('class', 'input-xlarge selectpicker show-menu-arrow')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose institution', 'Available institutions' => $inst_options));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $this->addElements(array($old_findID, $description, $workflow, $rally, $rallyID, $county, $regionID, $district, $parish, $fourFigure, $gridref, $denomination, $ruler, $mint, $axis, $obverseinsc, $obversedesc, $reverseinsc, $reversedesc, $ruler2, $tribe, $objecttype, $broadperiod, $geographyID, $bmc_type, $mack_type, $allen_type, $va_type, $rudd_type, $numChiab, $context, $depositionDate, $phase_date_1, $phase_date_2, $institution, $cci, $submit, $hash));
     $this->addDisplayGroup(array('cciNumber', 'denomination', 'geographyID', 'ruler', 'ruler2', 'tribe', 'mint', 'axis', 'obverseLegend', 'obverseDescription', 'reverseLegend', 'reverseDescription', 'bmc', 'vaType', 'allenType', 'abcType', 'mackType', 'numChiab', 'context', 'phase_date_1', 'phase_date_2', 'depositionDate'), 'numismatics')->removeDecorator('HtmlTag');
     $this->numismatics->setLegend('Numismatic details: ');
     $this->addDisplayGroup(array('old_findID', 'description', 'rally', 'rallyID', 'workflow'), 'details')->removeDecorator('HtmlTag');
     $this->details->setLegend('Object details: ');
     $this->addDisplayGroup(array('countyID', 'regionID', 'districtID', 'parishID', 'gridref', 'fourFigure', 'institution'), 'spatial');
     $this->spatial->setLegend('Spatial details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
 public function __construct(array $options = null)
 {
     //Get Rally data
     $rallies = new Rallies();
     $rally_options = $rallies->getRallies();
     $counties = new OsCounties();
     $county_options = $counties->getCountiesID();
     $denominations = new Denominations();
     $denom_options = $denominations->getOptionsRoman();
     $rulers = new Rulers();
     $ruler_options = $rulers->getRomanRulers();
     $mints = new Mints();
     $mint_options = $mints->getRomanMints();
     $axes = new Dieaxes();
     $axis_options = $axes->getAxes();
     $reeces = new Reeces();
     $reece_options = $reeces->getReeces();
     $regions = new OsRegions();
     $region_options = $regions->getRegionsID();
     $moneyers = new Moneyers();
     $money = $moneyers->getRepublicMoneyers();
     $institutions = new Institutions();
     $inst_options = $institutions->getInsts();
     parent::__construct($options);
     $this->setName('search-roman-coins');
     $old_findID = new Zend_Form_Element_Text('old_findID');
     $old_findID->setLabel('Find number: ')->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid number!');
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Object description contains: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 90)->addErrorMessage('Please enter a valid term');
     $workflow = new Zend_Form_Element_Select('workflow');
     $workflow->setLabel('Workflow stage: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     if (in_array($this->_role, $this->_higherlevel)) {
         $workflow->addMultiOptions(array(null => 'Choose workflow', 'Available worklow stage' => array('1' => 'Quarantine', '2' => 'On review', '4' => 'Awaiting validation', '3' => 'Published')));
     }
     if (in_array($this->_role, $this->_restricted)) {
         $workflow->addMultiOptions(array(null => 'Choose a workflow stage', 'Available worklow stage' => array('4' => 'Awaiting validation', '3' => 'Published')));
     }
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $this->addElement($hash);
     //Rally details
     $rally = new Zend_Form_Element_Checkbox('rally');
     $rally->setLabel('Rally find: ')->addFilters(array('StripTags', 'StringTrim'))->setUncheckedValue(null);
     $rallyID = new Zend_Form_Element_Select('rallyID');
     $rallyID->setLabel('Found at this rally: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose rally name', 'Available rallies' => $rally_options))->addValidator('InArray', false, array(array_keys($rally_options)));
     $county = new Zend_Form_Element_Select('countyID');
     $county->setLabel('County: ')->addValidators(array('NotEmpty'))->addMultiOptions(array(null => 'Choose county first', 'Available counties' => $county_options))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($county_options)));
     $district = new Zend_Form_Element_Select('districtID');
     $district->setLabel('District: ')->addMultiOptions(array(null => 'Choose district after county'))->setRegisterInArrayValidator(false)->addValidator('District')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->disabled = true;
     $parish = new Zend_Form_Element_Select('parishID');
     $parish->setLabel('Parish: ')->addMultiOptions(array(null => 'Choose parish after county'))->setRegisterInArrayValidator(false)->addValidator('Parish')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->disabled = true;
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('European region: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a region for a wide result', 'Choose region' => $region_options))->addValidator('InArray', false, array(array_keys($region_options)))->addFilters(array('StripTags', 'StringTrim'));
     $gridref = new Zend_Form_Element_Text('gridref');
     $gridref->setLabel('Grid reference: ')->addValidators(array('ValidGridRef'))->addFilters(array('StripTags', 'StringTrim'));
     $fourFigure = new Zend_Form_Element_Text('fourFigure');
     $fourFigure->setLabel('Four figure grid reference: ')->addValidators(array('ValidGridRef'))->addFilters(array('StripTags', 'StringTrim'));
     ###
     ##Numismatic data
     ###
     //Denomination
     $denomination = new Zend_Form_Element_Select('denomination');
     $denomination->setLabel('Denomination: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose denomination type', 'Available denominations' => $denom_options))->addValidator('InArray', false, array(array_keys($denom_options)))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     //Primary ruler
     $ruler = new Zend_Form_Element_Select('ruler');
     $ruler->setLabel('Ruler / issuer: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose primary ruler', 'Available rulers' => $ruler_options))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($ruler_options)));
     //Mint
     $mint = new Zend_Form_Element_Select('mint');
     $mint->setLabel('Issuing mint: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose issuing mint', 'Available mints' => $mint_options))->addValidator('InArray', false, array(array_keys($mint_options)))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     //Reece
     $reece = new Zend_Form_Element_Select('reeceID');
     $reece->setLabel('Reece period: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose Reece period', 'Available Reece periods' => $reece_options))->addValidator('InArray', false, array(array_keys($reece_options)))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     //Reverse type
     $reverse = new Zend_Form_Element_Select('revtypeID');
     $reverse->setLabel('Fourth Century reverse type: ')->setDescription('This field is only applicable for fourth century AD coins.')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Only available after choosing a 4th century issuer'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     $moneyer = new Zend_Form_Element_Select('moneyer');
     $moneyer->setLabel('Republican moneyers: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Only available after choosing a Republican issuer'))->setDescription('This field is only applicable for Republican coins.')->addValidator('InArray', false, array(array_keys($money)))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     //Obverse inscription
     $obverseinsc = new Zend_Form_Element_Text('obverseLegend');
     $obverseinsc->setLabel('Obverse inscription contains: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Please enter a valid term');
     //Obverse description
     $obversedesc = new Zend_Form_Element_Text('obverseDescription');
     $obversedesc->setLabel('Obverse description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Please enter a valid term');
     //reverse inscription
     $reverseinsc = new Zend_Form_Element_Text('reverseLegend');
     $reverseinsc->setLabel('Reverse inscription contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term')->setAttrib('size', 60);
     //reverse description
     $reversedesc = new Zend_Form_Element_Text('reverseDescription');
     $reversedesc->setLabel('Reverse description contains: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid term')->setAttrib('size', 60);
     //Die axis
     $axis = new Zend_Form_Element_Select('axis');
     $axis->setLabel('Die axis measurement: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Choose die axis', 'Available axes' => $axis_options))->addValidator('InArray', false, array(array_keys($axis_options)));
     $objecttype = new Zend_Form_Element_Hidden('objecttype');
     $objecttype->setValue('coin')->addFilter('StringToUpper');
     $broadperiod = new Zend_Form_Element_Hidden('broadperiod');
     $broadperiod->setValue('Roman')->setAttrib('class', 'none')->addFilters(array('StringToUpper', 'StripTags', 'StringTrim'))->addValidator('Alpha');
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Search');
     $institution = new Zend_Form_Element_Select('institution');
     $institution->setLabel('Recording institution: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose institution', 'Available institution' => $inst_options))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     $this->addElements(array($old_findID, $description, $workflow, $rally, $rallyID, $county, $regionID, $district, $parish, $fourFigure, $gridref, $denomination, $ruler, $mint, $axis, $reece, $reverse, $obverseinsc, $obversedesc, $reverseinsc, $reversedesc, $moneyer, $objecttype, $broadperiod, $submit, $hash, $institution));
     $this->addDisplayGroup(array('denomination', 'ruler', 'mint', 'moneyer', 'axis', 'reeceID', 'revtypeID', 'obverseLegend', 'obverseDescription', 'reverseLegend', 'reverseDescription'), 'numismatics');
     $this->addDisplayGroup(array('old_findID', 'description', 'rally', 'rallyID', 'workflow'), 'details');
     $this->addDisplayGroup(array('countyID', 'regionID', 'districtID', 'parishID', 'gridref', 'fourFigure', 'institution'), 'spatial');
     $this->addDisplayGroup(array('submit'), 'buttons');
     $this->numismatics->setLegend('Numismatic details');
     $this->details->setLegend('Artefact details');
     $this->spatial->setLegend('Spatial details');
     parent::init();
 }
 /** 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();
 }
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     //Get data to form select menu for primary and secondary material
     $primaries = new Materials();
     $primary_options = $primaries->getPrimaries();
     //Get Rally data
     $rallies = new Rallies();
     $rally_options = $rallies->getRallies();
     $counties = new OsCounties();
     $county_options = $counties->getCountiesID();
     $rulers = new Rulers();
     $ruler_options = $rulers->getRulersByzantine();
     $denominations = new Denominations();
     $denomination_options = $denominations->getDenomsGreek();
     $mints = new Mints();
     $mint_options = $mints->getMintsGreek();
     $axis = new Dieaxes();
     $axis_options = $axis->getAxes();
     $regions = new OsRegions();
     $region_options = $regions->getRegionsID();
     parent::__construct($options);
     $this->setName('greek-search');
     $old_findID = new Zend_Form_Element_Text('old_findID');
     $old_findID->setLabel('Find number: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Please enter a valid number!');
     $description = new Zend_Form_Element_Text('description');
     $description->setLabel('Object description contains: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Please enter a valid term');
     $workflow = new Zend_Form_Element_Select('workflow');
     $workflow->setLabel('Workflow stage: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow');
     if (in_array($this->_role, $this->_higherlevel)) {
         $workflow->addMultiOptions(array(null => 'Choose a workflow stage', 'Available workflow stages' => array('1' => 'Quarantine', '2' => 'On review', '4' => 'Awaiting validation', '3' => 'Published')));
     }
     if (in_array($this->_role, $this->_restricted)) {
         $workflow->addMultiOptions(array(null => 'Choose a workflow stage', 'Available workflow stages' => array('4' => 'Awaiting validation', '3' => 'Published')));
     }
     //Rally details
     $rally = new Zend_Form_Element_Checkbox('rally');
     $rally->setLabel('Rally find: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->setUncheckedValue(null);
     $rallyID = new Zend_Form_Element_Select('rallyID');
     $rallyID->setLabel('Found at this rally: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Int')->addValidator('InArray', false, array(array_keys($rally_options)));
     $county = new Zend_Form_Element_Select('countyID');
     $county->setLabel('County: ')->addFilters(array('StringTrim', 'StripTags'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose county', 'Available counties' => $county_options))->addValidator('InArray', false, array(array_keys($county_options)));
     $district = new Zend_Form_Element_Select('districtID');
     $district->setLabel('District: ')->setRegisterInArrayValidator(false)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose district after county'));
     $parish = new Zend_Form_Element_Select('parishID');
     $parish->setLabel('Parish: ')->setRegisterInArrayValidator(false)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose parish after county'));
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('European region: ')->addMultiOptions(array(null => 'Choose a region for a wide result', 'Choose region' => $region_options))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Digits')->addFilters(array('StringTrim', 'StripTags'));
     $gridref = new Zend_Form_Element_Text('gridref');
     $gridref->setLabel('Grid reference: ')->addValidators(array('NotEmpty', 'ValidGridRef', 'Alnum'))->addFilters(array('StringTrim', 'StripTags'));
     $fourFigure = new Zend_Form_Element_Text('fourfigure');
     $fourFigure->setLabel('Four figure grid reference: ')->addValidators(array('NotEmpty', 'ValidGridRef', 'Alnum'))->addFilters(array('StringTrim', 'StripTags'));
     ###
     ##Numismatic data
     ###
     //Denomination
     $denomination = new Zend_Form_Element_Select('denomination');
     $denomination->setLabel('Denomination: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose denomination type', 'Available denominations' => $denomination_options))->addValidator('InArray', false, array(array_keys($denomination_options)));
     //Primary ruler
     $ruler = new Zend_Form_Element_Select('ruler');
     $ruler->setLabel('Ruler / issuer: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose primary ruler', 'Available rulers' => $ruler_options))->addValidator('InArray', false, array(array_keys($ruler_options)));
     //Mint
     $mint = new Zend_Form_Element_Select('mint');
     $mint->setLabel('Issuing mint: ')->setRegisterInArrayValidator(false)->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose issuing mint', 'Available mints' => $mint_options))->addValidator('InArray', false, array(array_keys($mint_options)));
     //Obverse inscription
     $obverseinsc = new Zend_Form_Element_Text('obverseLegend');
     $obverseinsc->setLabel('Obverse inscription contains: ')->setRequired(false)->setAttrib('size', 50)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Please enter a valid term');
     //Obverse description
     $obversedesc = new Zend_Form_Element_Text('obverseDescription');
     $obversedesc->setLabel('Obverse description contains: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('size', 50)->addErrorMessage('Please enter a valid term');
     //reverse inscription
     $reverseinsc = new Zend_Form_Element_Text('reverseLegend');
     $reverseinsc->setLabel('Reverse inscription contains: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('size', 50)->addErrorMessage('Please enter a valid term');
     //reverse description
     $reversedesc = new Zend_Form_Element_Text('reverseDescription');
     $reversedesc->setLabel('Reverse description contains: ')->setRequired(false)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('size', 50)->addErrorMessage('Please enter a valid term');
     //Die axis
     $axis = new Zend_Form_Element_Select('axis');
     $axis->setLabel('Die axis measurement: ')->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(null => 'Choose measurement', 'Available axes' => $axis_options))->addValidator('InArray', false, array(array_keys($axis_options)));
     $objecttype = new Zend_Form_Element_Hidden('objecttype');
     $objecttype->setValue('coin');
     $objecttype->removeDecorator('HtmlTag')->addFilters(array('StringTrim', 'StripTags', 'StringToUpper'));
     $broadperiod = new Zend_Form_Element_Hidden('broadperiod');
     $broadperiod->setValue('Greek and Roman Provincial')->addFilters(array('StringTrim', 'StripTags', 'StringToUpper'))->removeDecorator('label');
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Search..');
     $this->addElements(array($old_findID, $description, $workflow, $rally, $rallyID, $county, $regionID, $district, $parish, $fourFigure, $gridref, $denomination, $ruler, $mint, $axis, $obverseinsc, $obversedesc, $reverseinsc, $reversedesc, $objecttype, $broadperiod, $submit));
     $this->addDisplayGroup(array('denomination', 'ruler', 'mint', 'moneyer', 'axis', 'obverseLegend', 'obverseDescription', 'reverseLegend', 'reverseDescription'), 'numismatics');
     $this->addDisplayGroup(array('old_findID', 'description', 'rally', 'rallyID', 'workflow'), 'details');
     $this->addDisplayGroup(array('countyID', 'regionID', 'districtID', 'parishID', 'gridref', 'fourfigure'), 'spatial');
     $this->numismatics->setLegend('Numismatic details');
     $this->details->setLegend('Artefact details');
     $this->spatial->setLegend('Spatial details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }