public function __construct($options = null) { // Construct the select menu data $counties = new Counties(); $county_options = $counties->getCountyName2(); $origins = new MapOrigins(); $origin_options = $origins->getValidOrigins(); $landusevalues = new Landuses(); $landuse_options = $landusevalues->getUsesValid(); $landusecodes = new Landuses(); $landcodes_options = $landusecodes->getCodesValid(); parent::__construct($options); $this->addPrefixPath('Pas_Form_Decorator', 'Pas/Form/Decorator/', 'decorator'); $this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element'); $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate'); $decorator = array('SimpleInput'); $decoratorButton = array('NormalDecButton'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('findspots'); // Object specifics $county = new Zend_Form_Element_Select('county'); $county->setLabel('County: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose county', 'Valid counties' => $county_options))->addValidator('InArray', false, array(array_keys($county_options)))->setDecorators($decorators); $district = new Zend_Form_Element_Select('district'); $district->setLabel('District: ')->setRequired(false)->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose district after county')); $parish = new Zend_Form_Element_Select('parish'); $parish->setLabel('Parish: ')->setRequired(false)->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose parish after district')); $regionID = new Zend_Form_Element_Select('regionID'); $regionID->setLabel('European region: ')->setRegisterInArrayValidator(false)->setDecorators($decorators)->addValidator('Digits')->addMultiOptions(array(NULL => 'Choose region after county')); $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName(); $gridref = new Zend_Form_Element_Text('gridref'); $gridref->setLabel('Grid reference: ')->addValidators(array('NotEmpty', 'ValidGridRef'))->addValidator('Alnum', array('allowWhiteSpace' => true))->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim')); $gridrefsrc = new Zend_Form_Element_Select('gridrefsrc'); $gridrefsrc->setLabel('Grid reference source: ')->addMultioptions(array(NULL => NULL, 'Choose source' => $origin_options))->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($origin_options)))->addValidator('Int'); $gridrefcert = new Zend_Form_Element_Radio('gridrefcert'); $gridrefcert->setLabel('Grid reference certainty: ')->addMultiOptions(array('1' => 'Certain', '2' => 'Probably', '3' => 'Possibly'))->setValue(1)->addFilters(array('StripTags', 'StringTrim'))->setOptions(array('separator' => ''))->addDecorator('HtmlTag', array('placement' => 'prepend', 'tag' => 'div', 'id' => 'radios'))->setDecorators($decorators); if ($action == 'edit') { $fourFigure = new Zend_Form_Element_Text('fourFigure'); $fourFigure->setLabel('Four figure grid reference: ')->addValidator('NotEmpty', 'ValidGridRef')->addValidator('Alnum')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->disabled = true; $easting = new Zend_Form_Element_Text('easting'); $easting->setLabel('Easting: ')->addValidator('NotEmpty', 'Digits')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->disabled = true; $northing = new Zend_Form_Element_Text('northing'); $northing->setLabel('Northing: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->setDecorators($decorators)->disabled = true; $map10k = new Zend_Form_Element_Text('map10k'); $map10k->setLabel('10 km map: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Alnum')->setDecorators($decorators)->disabled = true; $map25k = new Zend_Form_Element_Text('map25k'); $map25k->setLabel('25 km map: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Alnum')->setDecorators($decorators)->disabled = true; $declong = new Zend_Form_Element_Text('declong'); $declong->setLabel('Longitude: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Float')->setDecorators($decorators)->disabled = true; $declat = new Zend_Form_Element_Text('declat'); $declat->setLabel('Latitude: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Float')->setDecorators($decorators)->disabled = true; $woeid = new Zend_Form_Element_Text('woeid'); $woeid->setLabel('Where on Earth ID: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->setDecorators($decorators)->disabled = true; $elevation = new Zend_Form_Element_Text('elevation'); $elevation->setLabel('Elevation: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->setDecorators($decorators)->disabled = true; } $depthdiscovery = new Zend_Form_Element_Select('depthdiscovery'); $depthdiscovery->setLabel('Depth of discovery')->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->addMultiOptions(array(NULL => NULL, 'Approximate depth' => array('10' => '0 - 10cm', '20' => '10 - 20cm', '30' => '20 - 30cm', '40' => '30 - 40cm', '50' => '40 - 50cm', '60' => 'Over 60 cm'))); $soiltype = new Zend_Form_Element_Select('soiltype'); $soiltype->setLabel('Type of soil around findspot: ')->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty', 'Digits')->addMultiOptions(array(NULL => NULL)); $landusevalue = new Zend_Form_Element_Select('landusevalue'); $landusevalue->setLabel('Landuse type: ')->addValidators(array('NotEmpty'))->setRegisterInArrayValidator(false)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Choose landuse', 'Valid landuses' => $landuse_options)); $landusecode = new Zend_Form_Element_Select('landusecode'); $landusecode->setLabel('Specific landuse: ')->setRegisterInArrayValidator(false)->addValidators(array('NotEmpty'))->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Specific landuse will be enabled after type')); $address = new Zend_Form_Element_Textarea('address'); $address->setLabel('Address: ')->addValidators(array('NotEmpty'))->setAttrib('rows', 5)->setAttrib('cols', 40)->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'))->setAttrib('class', 'expanding')->setAttrib('class', 'privatedata'); $postcode = new Zend_Form_Element_Text('postcode'); $postcode->setLabel('Postcode: ')->addValidators(array('NotEmpty', 'ValidPostcode'))->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim', 'StringToUpper')); $knownas = new Zend_Form_Element_Text('knownas'); $knownas->setLabel('Findspot to be known as: ')->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators)->setAttrib('class', 'privatedata')->addFilters(array('StripTags', 'StringTrim')); $landownername = new Zend_Form_Element_Text('landownername'); $landownername->setLabel('Landowner: ')->addValidators(array('NotEmpty'))->setDecorators($decorators)->setAttrib('class', 'privatedata')->addFilters(array('StripTags', 'StringTrim')); $landowner = new Zend_Form_Element_Hidden('landowner'); $landowner->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->removeDecorator('Label')->addFilters(array('StripTags', 'StringTrim')); $description = new Pas_Form_Element_RTE('description'); $description->setLabel('Findspot description: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $comments = new Pas_Form_Element_RTE('comments'); $comments->setLabel('Findspot comments: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(600); $this->addElement($hash); if ($action == 'edit') { $this->addElements(array($county, $district, $parish, $knownas, $description, $comments, $regionID, $gridref, $fourFigure, $easting, $northing, $map10k, $map25k, $declong, $declat, $woeid, $elevation, $address, $gridrefsrc, $gridrefcert, $depthdiscovery, $postcode, $landusevalue, $landusecode, $landownername, $landowner, $submit, $hash)); } else { $this->addElements(array($county, $district, $parish, $knownas, $depthdiscovery, $description, $comments, $regionID, $gridref, $findsecuid, $gridrefsrc, $gridrefcert, $address, $postcode, $landusevalue, $landusecode, $landownername, $landowner, $submit, $hash)); } $this->addDisplayGroup(array('county', 'regionID', 'district', 'parish', 'knownas', 'address', 'postcode', 'landownername', 'landowner'), 'details'); $this->details->setLegend('Findspot information'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); if ($action == 'edit') { $this->addDisplayGroup(array('gridref', 'gridrefcert', 'gridrefsrc', 'fourFigure', 'easting', 'northing', 'map25k', 'map10k', 'declat', 'declong', 'woeid', 'elevation', 'landusevalue', 'landusecode', 'depthdiscovery'), 'spatial'); } else { $this->addDisplayGroup(array('gridref', 'gridrefcert', 'gridrefsrc', 'landusevalue', 'landusecode', 'depthdiscovery', 'soiltype'), 'spatial'); } $this->spatial->setLegend('Spatial information'); $this->spatial->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->spatial->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('description', 'comments'), 'commentary'); $this->commentary->setLegend('Findspot comments'); $this->commentary->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->commentary->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('submit'), 'submit'); }
/** 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(); }