Beispiel #1
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $this->setName('vacancies');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Role title: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a title for this vacancy.')->setAttrib('size', 60);
     $salary = new Zend_Form_Element_Text('salary');
     $salary->setLabel('Salary: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('size', 20)->addErrorMessage('You must enter a salary.');
     $specification = new Pas_Form_Element_CKEditor('specification');
     $specification->setLabel('Job specification: ')->setRequired(true)->addFilters(array('BasicHtml', 'StringTrim'))->setAttribs(array('cols' => 50, 'rows' => 10, 'Height' => 400))->addErrorMessage('You must enter a job description.');
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('Location of role: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('InArray', false, array(array_keys($staffregions_options)))->addMultiOptions(array(null => 'Choose region', 'Available regions' => $staffregions_options))->addErrorMessage('You must choose a region');
     $live = new ZendX_JQuery_Form_Element_DatePicker('live');
     $live->setLabel('Date for advert to go live: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20);
     $expire = new ZendX_JQuery_Form_Element_DatePicker('expire');
     $expire->setLabel('Date for advert to expire: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20);
     $status = new Zend_Form_Element_Select('status');
     $status->SetLabel('Publish status: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a status', 2 => 'Publish', 1 => 'Draft'))->setValue(2)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must choose a status');
     $submit = new Zend_Form_Element_Submit('submit');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $this->addElements(array($title, $salary, $specification, $regionID, $live, $expire, $status, $submit, $hash));
     $this->addDisplayGroup(array('title', 'salary', 'specification', 'regionID'), 'details');
     $this->details->setLegend('Vacancy details');
     $this->addDisplayGroup(array('live', 'expire', 'status'), 'dates');
     $this->dates->setLegend('Publication details');
     $this->setLegend('Vacancy details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
Beispiel #2
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $users = new Users();
     $users_options = $users->getOptions();
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new OsCounties();
     $county_options = $counties->getCountiesID();
     $activities = new PrimaryActivities();
     $activities_options = $activities->getTerms();
     $organisations = new Organisations();
     $organisations_options = $organisations->getOrgs();
     parent::__construct($options);
     $this->setName('people');
     $title = new Zend_Form_Element_Select('title');
     $title->setLabel('Title: ')->addFilters(array('StripTags', 'StringTrim'))->setValue('Mr')->addErrorMessage('Choose title of person')->setAttrib('class', 'span2 selectpicker show-menu-arrow')->addMultiOptions(array('Mr' => 'Mr', 'Mrs' => 'Mrs', 'Miss' => 'Miss', 'Ms' => 'Ms', 'Dr' => 'Dr.', 'Prof' => 'Prof.', 'Sir' => 'Sir', 'Lord' => 'Lord', 'Lady' => 'Lady', 'Other' => 'Other', 'Captain' => 'Captain', 'Master' => 'Master', 'Dame' => 'Dame', 'Duke' => 'Duke', 'Admiral' => 'Admiral', 'Baron' => 'Baron', 'Baroness' => 'Baroness', 'Brigadier' => 'Brigadier', 'Captain' => 'Captain', 'Colonel' => 'Colonel', 'Colonel Sir' => 'Colonel Sir', 'Commander' => 'Commander', 'Commodore' => 'Commodore', 'Countess' => 'Countess', 'Earl' => 'Earl', 'Field Marshal Lord' => 'Field Marshal Lord', 'General' => 'General', 'Group Captain' => 'Group Captain', 'Lieutenant' => 'Lieutenant', 'Lieutenant Commander' => 'Lieutenant Commander', 'Lt-Col' => 'Lt-Col', 'Lt-Gen Sir' => 'Lt-Gen Sir', 'Maj-Gen' => 'Maj-Gen', 'Major' => 'Major', 'Prince' => 'Prince', 'Princesss' => 'Princess', 'Rear Admiral' => 'Rear Admiral', 'Squadron Leader' => 'Squadron Leader', 'The Baroness' => 'The Baroness', 'The Countess' => 'The Countess', 'The Countess of' => 'The Countess of', 'The Duchess of' => 'The Duchess of', 'The Duke of' => 'The Duke of', 'The Earl of' => 'The Earl of', 'The Hon' => 'The Hon', 'His Honour Judge' => 'His Honour Judge', 'The Hon Mrs' => 'The Hon Mrs', 'The Marchioness of' => 'The Marchioness of', 'The Marquess of' => 'The Marquess of', 'The Viscount' => 'The Viscount', 'The Viscountess' => 'The Viscountess', 'Wing Commander' => 'Wing Commander', 'The Reverend' => 'The Reverend', 'Archbishop' => 'Archbishop', 'Canon' => 'Canon', 'Bishop' => 'Bishop'));
     $forename = new Zend_Form_Element_Text('forename');
     $forename->setLabel('Forename: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter person\'s forename')->addFilter(new Zend_Filter_Callback(array('callback' => 'ucfirst')));
     $surname = new Zend_Form_Element_Text('surname');
     $surname->setLabel('Surname: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addFilter(new Zend_Filter_Callback(array('callback' => 'ucfirst')))->addErrorMessage('Please enter person\'s surname');
     $fullname = new Zend_Form_Element_Text('fullname');
     $fullname->setLabel('Fullname: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter person\'s fullname');
     $email = new Zend_Form_Element_Text('email');
     $email->SetLabel('Email address: ')->addFilters(array('StringTrim', 'StringToLower', 'StripTags'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false, array('mx' => true))->setAttrib('size', '60');
     $dbaseID = new Zend_Form_Element_Select('dbaseID');
     $dbaseID->setLabel('User account: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Int')->addValidator('InArray', false, array(array_keys($users_options), null))->addMultiOptions(array(null => 'Choose a user account', 'Existing accounts' => $users_options))->addErrorMessage('You must enter a database account.');
     $canRecord = $this->addElement('checkbox', 'canRecord', array('label' => 'Allowed to record: '))->canRecord;
     $address = new Zend_Form_Element_Text('address');
     $address->SetLabel('Address: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 500));
     $town_city = new Zend_Form_Element_Text('town_city');
     $town_city->SetLabel('Town: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 200));
     $countyID = new Zend_Form_Element_Select('countyID');
     $countyID->setLabel('County: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Please choose a county', 'Valid counties' => $county_options));
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->SetLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToUpper', 'Purifier'))->addValidator('StringLength', false, array(1, 200))->addValidator('ValidPostCode');
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 4))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions(array(null => 'Please choose a country of residence', 'Valid countries' => $countries_options))->setValue('GB');
     $hometel = new Zend_Form_Element_Text('hometel');
     $hometel->SetLabel('Home telephone number: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 30));
     $worktel = new Zend_Form_Element_Text('worktel');
     $worktel->SetLabel('Work telephone number: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 30));
     $fax = new Zend_Form_Element_Text('faxno');
     $fax->SetLabel('Fax number: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 30));
     $comments = new Pas_Form_Element_CKEditor('comments');
     $comments->SetLabel('Comments: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $organisationID = new Zend_Form_Element_Select('organisationID');
     $organisationID->SetLabel('Organisation attached to: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Please choose an organisation', 'Valid organisations' => $organisations_options))->addValidator('InArray', false, array(array_keys($organisations_options)));
     $primary_activity = new Zend_Form_Element_Select('primary_activity');
     $primary_activity->SetLabel('Person\'s primary activity: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('Int')->addValidator('InArray', false, array(array_keys($activities_options)))->addMultiOptions(array(null => 'Choose a primary activity', 'Valid activities' => $activities_options))->addErrorMessage('You must enter an activity for this person.');
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($title, $forename, $surname, $fullname, $email, $address, $town_city, $countyID, $postcode, $country, $dbaseID, $canRecord, $hometel, $worktel, $fax, $comments, $organisationID, $primary_activity, $submit));
     $this->addDisplayGroup(array('title', 'forename', 'surname', 'fullname', 'email', 'address', 'town_city', 'countyID', 'postcode', 'country', 'dbaseID', 'canRecord', 'hometel', 'worktel', 'faxno', 'comments', 'organisationID', 'primary_activity'), 'details');
     $this->details->setLegend('Person details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
 public function __construct($options = null)
 {
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new Counties();
     $counties_options = $counties->getCountyname2();
     $peoples = new Peoples();
     $people_options = $peoples->getNames2();
     parent::__construct($options);
     $this->setName('organisation');
     $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li')));
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Organisation name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Please enter an organisation name: ')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $website = new Zend_Form_Element_Text('website');
     $website->setLabel('Organisation website: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Pas_Validate_Url())->addErrorMessage('Please enter a valid URL')->setAttrib('size', 60)->setDecorators($decorators);
     $address1 = new Zend_Form_Element_Text('address1');
     $address1->setLabel('Address line one: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $address2 = new Zend_Form_Element_Text('address2');
     $address2->setLabel('Address line two: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $address3 = new Zend_Form_Element_Text('address3');
     $address3->setLabel('Address line three: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $address = new Zend_Form_Element_Text('address');
     $address->setLabel('Full address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $town_city = new Zend_Form_Element_Text('town_city');
     $town_city->setLabel('Town or city: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Please choose a county', 'Valid counties' => $counties_options))->addValidator('InArray', false, array(array_keys($counties_options)))->setDecorators($decorators);
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(true)->setValue('GB')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Please choose a country', 'Valid countries' => $countries_options))->addValidator('InArray', false, array(array_keys($countries_options)))->setDecorators($decorators);
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->setLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 10))->addValidator('ValidPostCode')->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('Please enter a valid postcode')->setAttrib('size', 10)->setDecorators($decorators);
     $contactperson = new Zend_Form_Element_Text('contact');
     $contactperson->setLabel('Organisation\'s lead contact: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setAttrib('size', 50)->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators);
     $contactpersonID = new Zend_Form_Element_Hidden('contactpersonID');
     $contactpersonID->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label');
     $submit = $this->addElement('submit', 'submit', array('label' => 'Login...'));
     $submit = $this->getElement('submit');
     $submit->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'large');
     $this->addElements(array($name, $website, $address1, $address2, $address3, $address, $town_city, $county, $country, $postcode, $contactperson, $contactpersonID));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $this->addElement($hash);
     $this->addDisplayGroup(array('name', 'website', 'address1', 'address2', 'address3', 'address', 'town_city', 'county', 'country', 'postcode', 'contact', 'contactpersonID'), 'details');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->setLegend('Organisation details: ');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
Beispiel #4
0
 public function __construct($options = null)
 {
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new Counties();
     $county_options = $counties->getCountyName2();
     parent::__construct($options);
     $this->setAttrib('accept-charset', 'UTF-8');
     $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('coroner');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel('First name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Come on it\'s not that hard, enter a firstname!')->setDecorators($decorators);
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setLabel('Last name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $email = new Zend_Form_Element_Text('email');
     $email->SetLabel('Email address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false)->setDecorators($decorators);
     $address_1 = new Zend_Form_Element_Text('address_1');
     $address_1->SetLabel('Address line one: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $address_2 = new Zend_Form_Element_Text('address_2');
     $address_2->SetLabel('Address line two: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $town = new Zend_Form_Element_Text('town');
     $town->SetLabel('Town: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->addFilters(array('StripTags', 'StringTrim'))->addValidators(array('NotEmpty'))->addMultiOptions(array(NULL => 'Choose county', 'Valid county' => $county_options))->setDecorators($decorators);
     $region_name = new Zend_Form_Element_Text('region_name');
     $region_name->SetLabel('Administrative region: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->SetLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('ValidPostCode')->setDecorators($decorators);
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 4))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions($countries_options)->setValue('GB')->setDecorators($decorators);
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->SetLabel('Telephone number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     $fax = new Zend_Form_Element_Text('fax');
     $fax->SetLabel('Fax number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large');
     $this->addElements(array($firstname, $lastname, $email, $address_1, $address_2, $town, $postcode, $county, $country, $telephone, $fax, $region_name, $submit));
     $this->addDisplayGroup(array('firstname', 'lastname', 'region_name', 'email', 'address_1', 'address_2', 'town', 'postcode', 'county', 'country', 'telephone', 'fax'), 'details')->removeDecorator('HtmlTag');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->removeDecorator('HtmlTag');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->submit->removeDecorator('DtDdWrapper');
     $this->submit->removeDecorator('HtmlTag');
     $this->details->setLegend('Submit Coroner\'s details ');
 }
Beispiel #5
0
 public function __construct($options = null)
 {
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     ZendX_JQuery::enableForm($this);
     parent::__construct($options);
     $decorator = array('SimpleInput');
     $decoratorSelect = array('SelectInput');
     $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('vacancies');
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Role title: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addErrorMessage('You must enter a title for this vacancy.')->setAttrib('size', 60)->setDecorators($decorators);
     $salary = new Zend_Form_Element_Text('salary');
     $salary->setLabel('Salary: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->setAttrib('size', 20)->addValidator('Currency')->addErrorMessage('You must enter a salary.')->setDecorators($decorators);
     $specification = new Pas_Form_Element_RTE('specification');
     $specification->setLabel('Job specification: ')->setRequired(true)->addFilters(array('BasicHtml', 'StringTrim'))->setAttribs(array('cols' => 50, 'rows' => 10, 'Height' => 400))->setAttrib('ToolbarSet', 'Basic')->addErrorMessage('You must enter a job description.');
     $regionID = new Zend_Form_Element_Select('regionID');
     $regionID->setLabel('Location of role: ')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addValidator('InArray', false, array(array_keys($staffregions_options)))->addMultiOptions(array(NULL => NULL, 'Choose region' => $staffregions_options))->setDecorators($decorators)->addErrorMessage('You must choose a region');
     $live = new ZendX_JQuery_Form_Element_DatePicker('live');
     $live->setLabel('Date for advert to go live: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Date')->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $expire = new ZendX_JQuery_Form_Element_DatePicker('expire');
     $expire->setLabel('Date for advert to expire: ')->setRequired(true)->setJQueryParam('dateFormat', 'yy-mm-dd')->setJQueryParam('maxDate', '+1y')->addFilters(array('StringTrim', 'StripTags'))->addValidator('Date')->addErrorMessage('Come on it\'s not that hard, enter a title!')->setAttrib('size', 20)->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'li'))->removeDecorator('DtDdWrapper');
     $status = new Zend_Form_Element_Select('status');
     $status->SetLabel('Publish status: ')->setRequired(true)->addMultiOptions(array(NULL => 'Choose a status', '2' => 'Publish', '1' => 'Draft'))->setValue(2)->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators)->addErrorMessage('You must choose a status');
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'large');
     $this->addElements(array($title, $salary, $specification, $regionID, $live, $expire, $status, $submit));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $this->addElement($hash);
     $this->removeDecorator('DtDdWrapper');
     $this->addDisplayGroup(array('title', 'salary', 'specification', 'regionID'), 'details');
     $this->details->setLegend('Vacancy details');
     $this->details->removeDecorator('DtDdWrapper');
     $this->addDisplayGroup(array('live', 'expire', 'status'), 'dates');
     $this->dates->setLegend('Publication details');
     $this->dates->removeDecorator('DtDdWrapper');
     $this->setLegend('Vacancy details');
     $this->addDisplayGroup(array('submit'), 'submit');
 }
Beispiel #6
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new OsCounties();
     $county_options = $counties->getCountyNames();
     parent::__construct($options);
     $this->setName('coroner');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel('First name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Enter a firstname!');
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setLabel('Last name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $email = new Zend_Form_Element_Text('email');
     $email->SetLabel('Email address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false);
     $address_1 = new Zend_Form_Element_Text('address_1');
     $address_1->SetLabel('Address line one: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $address_2 = new Zend_Form_Element_Text('address_2');
     $address_2->SetLabel('Address line two: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $town = new Zend_Form_Element_Text('town');
     $town->SetLabel('Town: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidators(array('NotEmpty'))->addMultiOptions(array(null => 'Choose county', 'Valid county' => $county_options));
     $region_name = new Zend_Form_Element_Text('region_name');
     $region_name->SetLabel('Administrative region: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->SetLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('ValidPostCode');
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 4))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions($countries_options)->setValue('GB');
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->SetLabel('Telephone number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $fax = new Zend_Form_Element_Text('fax');
     $fax->SetLabel('Fax number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     //Submit button
     $submit = new Zend_Form_Element_Submit('submit');
     $this->addElements(array($firstname, $lastname, $email, $address_1, $address_2, $town, $postcode, $county, $country, $telephone, $fax, $region_name, $submit));
     $this->addDisplayGroup(array('firstname', 'lastname', 'region_name', 'email', 'address_1', 'address_2', 'town', 'postcode', 'county', 'country', 'telephone', 'fax'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     $this->details->setLegend('Submit Coroner\'s details ');
     parent::init();
 }
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new OsCounties();
     $counties_options = $counties->getCountiesID();
     parent::__construct($options);
     $this->setName('organisation');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Organisation name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Please enter an organisation name')->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $website = new Zend_Form_Element_Text('website');
     $website->setLabel('Organisation website: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator(new Pas_Validate_Url())->addErrorMessage('Please enter a valid URL')->setAttrib('size', 60);
     $address1 = new Zend_Form_Element_Text('address1');
     $address1->setLabel('Address line one: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', 200);
     $address2 = new Zend_Form_Element_Text('address2');
     $address2->setLabel('Address line two: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', 200);
     $address3 = new Zend_Form_Element_Text('address3');
     $address3->setLabel('Address line three: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', 200);
     $address = new Zend_Form_Element_Text('address');
     $address->setLabel('Full address: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', 200);
     $town_city = new Zend_Form_Element_Text('town_city');
     $town_city->setLabel('Town or city: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', 60);
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Please choose a county', 'Valid counties' => $counties_options))->addValidator('InArray', false, array(array_keys($counties_options)));
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setValue('GB')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(null => 'Please choose a country', 'Valid countries' => $countries_options))->addValidator('InArray', false, array(array_keys($countries_options)));
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->setLabel('Postcode: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 10))->addValidator('ValidPostCode')->addErrorMessage('Please enter a valid postcode')->setAttrib('size', 10);
     $contactperson = new Zend_Form_Element_Text('contact');
     $contactperson->setLabel('Lead contact: ')->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addValidator('StringLength', false, array(1, 200))->setAttrib('size', 50);
     $contactpersonID = new Zend_Form_Element_Hidden('contactpersonID');
     $contactpersonID->addFilters(array('StripTags', 'StringTrim'));
     $submit = $this->addElement('submit', 'submit', array('label' => 'Login...'));
     $this->addElements(array($name, $website, $address1, $address2, $address3, $address, $town_city, $county, $country, $postcode, $contactperson, $contactpersonID, $submit));
     $this->addDisplayGroup(array('name', 'website', 'address1', 'address2', 'address3', 'address', 'town_city', 'county', 'country', 'postcode', 'contact', 'contactpersonID'), 'details');
     $this->details->setLegend('Organisation details: ');
     $this->addDisplayGroup(array('submit'), 'buttons');
     parent::init();
 }
Beispiel #8
0
 public function __construct($options = null)
 {
     $users = new Users();
     $users_options = $users->getOptions();
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $counties = new Counties();
     $counties_options = $counties->getCountyname2();
     $activities = new PrimaryActivities();
     $activities_options = $activities->getTerms();
     $organisations = new Organisations();
     $organisations_options = $organisations->getOrgs();
     parent::__construct($options);
     $this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate');
     $this->setName('people');
     $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')));
     $title = new Zend_Form_Element_Select('title');
     $title->setLabel('Title: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setValue('Mr')->addErrorMessage('Choose title of person')->addMultiOptions(array('Mr' => 'Mr', 'Mrs' => 'Mrs', 'Miss' => 'Miss', 'Ms' => 'Ms', 'Dr' => 'Dr.', 'Prof' => 'Prof.', 'Sir' => 'Sir', 'Lady' => 'Lady', 'Other' => 'Other', 'Captain' => 'Captain', 'Master' => 'Master', 'Dame' => 'Dame', 'Duke' => 'Duke'))->setDecorators($decorators);
     $forename = new Zend_Form_Element_Text('forename');
     $forename->setLabel('Forename: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter person\'s forename')->setDecorators($decorators)->addFilter(new Zend_Filter_Callback(array('callback' => 'ucfirst')));
     $surname = new Zend_Form_Element_Text('surname');
     $surname->setLabel('Surname: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addFilter(new Zend_Filter_Callback(array('callback' => 'ucfirst')))->addErrorMessage('Please enter person\'s surname')->setDecorators($decorators);
     $fullname = new Zend_Form_Element_Text('fullname');
     $fullname->setLabel('Fullname: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter person\'s fullname')->setDecorators($decorators);
     $email = new Zend_Form_Element_Text('email');
     $email->SetLabel('Email address: ')->setRequired(false)->addFilters(array('StringTrim', 'StringToLower', 'StripTags'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false, array('mx' => true))->setAttrib('size', '60')->setDecorators($decorators);
     $dbaseID = new Zend_Form_Element_Select('dbaseID');
     $dbaseID->setLabel('User account: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addValidator('InArray', false, array(array_keys($users_options), null))->addMultiOptions(array(NULL => 'Choose a user account', 'Existing accounts' => $users_options))->addErrorMessage('You must enter a database account.')->setDecorators($decorators);
     $address = new Zend_Form_Element_Text('address');
     $address->SetLabel('Address: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $town_city = new Zend_Form_Element_Text('town_city');
     $town_city->SetLabel('Town: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $county = new Zend_Form_Element_Select('county');
     $county->setLabel('County: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Please choose a county', 'Valid counties' => $counties_options))->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->SetLabel('Postcode: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim', 'StringToUpper'))->addValidator('StringLength', false, array(1, 200))->addValidator('ValidPostCode')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 4))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions(array(NULL => 'Please choose a country of residence', 'Valid countries' => $countries_options))->setValue('GB')->setDecorators($decorators);
     $hometel = new Zend_Form_Element_Text('hometel');
     $hometel->SetLabel('Home telephone number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 30))->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $worktel = new Zend_Form_Element_Text('worktel');
     $worktel->SetLabel('Work telephone number: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 30))->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $fax = new Zend_Form_Element_Text('faxno');
     $fax->SetLabel('Fax number: ')->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 30))->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $comments = new Pas_Form_Element_RTE('comments');
     $comments->SetLabel('Comments: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
     $organisationID = new Zend_Form_Element_Select('organisationID');
     $organisationID->SetLabel('Organisation attached to: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => 'Please choose an organisation', 'Valid organisations' => $organisations_options))->addValidator('InArray', false, array(array_keys($organisations_options)))->setDecorators($decorators);
     $primary_activity = new Zend_Form_Element_Select('primary_activity');
     $primary_activity->SetLabel('Person\'s primary activity: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addValidator('InArray', false, array(array_keys($activities_options)))->addMultiOptions(array(NULL => 'Choose a primary activity', 'Valid activities' => $activities_options))->addErrorMessage('You must enter an activity for this person.')->setDecorators($decorators);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large');
     $this->addElements(array($title, $forename, $surname, $fullname, $email, $address, $town_city, $county, $postcode, $country, $dbaseID, $hometel, $worktel, $fax, $comments, $organisationID, $primary_activity, $submit));
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800);
     $this->addElement($hash);
     $this->addDisplayGroup(array('title', 'forename', 'surname', 'fullname', 'email', 'address', 'town_city', 'county', 'postcode', 'country', 'dbaseID', 'hometel', 'worktel', 'faxno', 'comments', 'organisationID', 'primary_activity'), 'details');
     $this->details->setLegend('Person details: ');
     $this->addDisplayGroup(array('submit'), 'submit');
     $this->details->removeDecorator('DtDdWrapper');
     $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
 }
Beispiel #9
0
 /** The constructor
  * @access public
  * @param array $options
  * @return void
  */
 public function __construct(array $options = null)
 {
     $roles = new StaffRoles();
     $role_options = $roles->getOptions();
     $institutions = new Institutions();
     $insts = $institutions->getInsts();
     $staffregions = new StaffRegions();
     $staffregions_options = $staffregions->getOptions();
     $countries = new Countries();
     $countries_options = $countries->getOptions();
     $users = new Users();
     $users_options = $users->getOptions();
     parent::__construct($options);
     $this->setName('contact');
     $firstname = new Zend_Form_Element_Text('firstname');
     $firstname->setLabel('First name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a firstname')->addValidator('StringLength', false, array(1, 200));
     $lastname = new Zend_Form_Element_Text('lastname');
     $lastname->setLabel('Last name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a lastname');
     $role = new Zend_Form_Element_Select('role');
     $role->setLabel('Role within the Scheme: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose a role', 'Available roles' => $role_options))->addErrorMessage('You must choose a role');
     $dbaseID = new Zend_Form_Element_Select('dbaseID');
     $dbaseID->setLabel('Database account: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose account', 'Available accounts' => $users_options))->addErrorMessage('You must enter a database account.');
     $email_one = new Zend_Form_Element_Text('email_one');
     $email_one->SetLabel('Primary email address: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false)->addErrorMessage('You must enter an email address');
     $email_two = new Zend_Form_Element_Text('email_two');
     $email_two->SetLabel('Secondary email address: ')->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('EmailAddress', false);
     $address_1 = new Zend_Form_Element_Text('address_1');
     $address_1->SetLabel('Address line one: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a first line for the address');
     $address_2 = new Zend_Form_Element_Text('address_2');
     $address_2->SetLabel('Address line two: ')->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $town = new Zend_Form_Element_Text('town');
     $town->SetLabel('Town: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a town');
     $county = new Zend_Form_Element_Text('county');
     $county->SetLabel('County: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a county or unitary authority');
     $euroregion = new Zend_Form_Element_Text('euroregion');
     $euroregion->SetLabel('Administrative region: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $postcode = new Zend_Form_Element_Text('postcode');
     $postcode->SetLabel('Postcode: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('ValidPostCode')->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a postal code');
     $country = new Zend_Form_Element_Select('country');
     $country->SetLabel('Country: ')->setRequired(true)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('InArray', false, array(array_keys($countries_options)));
     $telephone = new Zend_Form_Element_Text('telephone');
     $telephone->SetLabel('Telephone number: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addErrorMessage('You must enter a telephone number');
     $fax = new Zend_Form_Element_Text('fax');
     $fax->SetLabel('Fax number: ')->setRequired(false)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200));
     $identifier = new Zend_Form_Element_Select('identifier');
     $identifier->SetLabel('Database entry identifier: ')->setRequired(true)->addMultiOptions(array(null => null, 'Choose institution' => $insts))->addValidator('InArray', false, array(array_keys($insts)))->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 6));
     $region = new Zend_Form_Element_Select('region');
     $region->SetLabel('Recording region: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('StringLength', false, array(1, 10))->addValidator('InArray', false, array(array_keys($staffregions_options)))->addMultiOptions(array(null => null, 'Choose staff region' => $staffregions_options));
     $profile = new Pas_Form_Element_CKEditor('profile');
     $profile->setLabel('Profile: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilter('StringTrim')->addFilter('BasicHtml')->addFilter('EmptyParagraph')->addFilter('WordChars');
     $website = new Zend_Form_Element_Text('website');
     $website->SetLabel('Employer\'s website address: ')->setRequired(false)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 150));
     $alumni = new Zend_Form_Element_Checkbox('alumni');
     $alumni->SetLabel('Currently employed by the Scheme: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
     $submit = new Zend_Form_Element_Submit('submit');
     $hash = new Zend_Form_Element_Hash('csrf');
     $hash->setValue($this->_salt)->setTimeout(4800);
     $this->addElements(array($firstname, $lastname, $role, $dbaseID, $email_one, $email_two, $address_1, $address_2, $town, $postcode, $county, $identifier, $telephone, $fax, $region, $profile, $website, $alumni, $submit, $hash));
     $this->addDisplayGroup(array('firstname', 'lastname', 'role', 'dbaseID', 'identifier', 'region', 'profile', 'email_one', 'email_two', 'address_1', 'address_2', 'town', 'postcode', 'county', 'telephone', 'fax', 'website', 'alumni'), 'details');
     $this->addDisplayGroup(array('submit'), 'buttons');
     $this->details->setLegend('Contact details');
     parent::init();
 }
Beispiel #10
0
    public function __construct($options = null)
    {
        $countries = new Countries();
        $countries_options = $countries->getOptions();
        $counties = new Counties();
        $counties_options = $counties->getCountyname2();
        parent::__construct($options);
        $decorators = array(array('ViewHelper'), array('Description', array('tag' => '', 'placement' => 'append')), array('Errors', array('placement' => 'append', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *')), array('HtmlTag', array('tag' => 'li')));
        $this->setName('request');
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel('Enter your email address: ')->setDecorators($decorators)->addValidator('EmailAddress', false, array('allow' => Zend_Validate_Hostname::ALLOW_DNS, 'mx' => true, 'deep' => true))->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'));
        $title = new Zend_Form_Element_Select('title');
        $title->setLabel('Title: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->setValue('Mr')->addErrorMessage('Choose title of person')->addMultiOptions(array('Mr' => 'Mr', 'Mrs' => 'Mrs', 'Miss' => 'Miss', 'Ms' => 'Ms', 'Dr' => 'Dr.', 'Prof' => 'Prof.', 'Sir' => 'Sir', 'Lady' => 'Lady', 'Other' => 'Other', 'Captain' => 'Captain', 'Master' => 'Master', 'Dame' => 'Dame', 'Duke' => 'Duke', 'Baron' => 'Baron', 'Duchess' => 'Duchess'))->setDecorators($decorators);
        $fullname = new Zend_Form_Element_Text('fullname');
        $fullname->setLabel('Enter your name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 50)->addErrorMessage('Please enter a valid name!')->setDecorators($decorators);
        $address = new Zend_Form_Element_Text('address');
        $address->SetLabel('Address: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
        $town_city = new Zend_Form_Element_Text('town_city');
        $town_city->SetLabel('Town: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators);
        $postcode = new Zend_Form_Element_Text('postcode');
        $postcode->SetLabel('Postcode: ')->setRequired(true)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('Alnum', false, array('allowWhiteSpace' => true))->addValidator('ValidPostCode')->setDecorators($decorators);
        $county = new Zend_Form_Element_Select('county');
        $county->setLabel('County: ')->addValidators(array('NotEmpty'))->addMultiOptions(array(NULL => NULL, 'Choose county' => $counties_options))->addValidator('InArray', false, array(array_keys($counties_options)))->setDecorators($decorators);
        $country = new Zend_Form_Element_Select('country');
        $country->SetLabel('Country: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->addValidator('InArray', false, array(array_keys($countries_options)))->addMultiOptions(array(NULL => 'Please choose a country of residence', 'Valid countries' => $countries_options))->setValue('GB')->setDecorators($decorators);
        $tel = new Zend_Form_Element_Text('tel');
        $tel->SetLabel('Contact number: ')->setRequired(false)->setAttrib('size', 50)->addFilters(array('StripTags', 'StringTrim'))->addValidator('StringLength', false, array(1, 200))->setDecorators($decorators);
        $leaflets = new Zend_Form_Element_MultiCheckbox('leaflets');
        $leaflets->setLabel('Scheme leaflets: ')->addMultiOptions(array('Advice for finders' => 'Advice for finders', 'Treasure Act' => 'Treasure Act'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $message = new Pas_Form_Element_RawText('message');
        $message->setValue('<p>Some of our literature is now rather bulky, and therefore we have to 
	charge postage or arrange collection from your local FLO. Please tick what you would like and
	we will contact you about delivery if needed.</p>')->setAttrib('class', 'info');
        $reports = new Zend_Form_Element_MultiCheckbox('reports');
        $reports->setLabel('Annual Reports: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array('Report 2000' => 'Annual report 2000 - 2001', 'Annual report 2001/3' => 'Annual report 2001 - 2003', 'Report 2003/4' => 'Annual report 2003 - 2004', 'Annual report 2004/5' => 'Annual report 2004 - 2005', 'AR 2005/6' => 'Annual Report 2005 -2006'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $treasure = new Zend_Form_Element_MultiCheckbox('treasure');
        $treasure->setLabel('Treasure Reports: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array('T Report 2000' => 'Report 2000', 'T Report 2001' => 'Report 2001', 'T Report 2002' => 'Report 2002', 'T report 2003' => 'Report 2003'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $combined = new Zend_Form_Element_MultiCheckbox('combined');
        $combined->setLabel('Combined Treasure & PAS Reports: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array('Report 2007' => 'Annual report 2007'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $codes = new Zend_Form_Element_MultiCheckbox('codes');
        $codes->setLabel('Codes of practice: ')->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array('Responsible metal detecting' => 'Responsible Metal Detecting', 'Treasure CofP' => 'Treasure Code of Practice'))->setOptions(array('separator' => ''))->setDecorators($decorators);
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setAttrib('class', 'large')->setLabel('Submit your request');
        $auth = Zend_Auth::getInstance();
        if (!$auth->hasIdentity()) {
            $privateKey = $this->_config->webservice->recaptcha->privatekey;
            $pubKey = $this->_config->webservice->recaptcha->pubkey;
            $captcha = new Zend_Form_Element_Captcha('captcha', array('captcha' => 'ReCaptcha', 'label' => 'Prove you are not a robot', 'captchaOptions' => array('captcha' => 'ReCaptcha', 'privKey' => $privateKey, 'pubKey' => $pubKey, 'theme' => 'clean')));
            $this->addElements(array($title, $fullname, $address, $town_city, $county, $postcode, $country, $tel, $email, $message, $leaflets, $reports, $combined, $treasure, $codes, $captcha, $submit));
            $this->addDisplayGroup(array('title', 'fullname', 'email', 'address', 'town_city', 'county', 'postcode', 'country', 'tel', 'message', 'leaflets', 'reports', 'combined', 'treasure', 'codes', 'captcha'), 'details')->removeDecorator('HtmlTag');
            $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
            $this->details->removeDecorator('DtDdWrapper');
            $this->details->removeDecorator('HtmlTag');
            $this->details->setLegend('Enter your comments: ');
        } else {
            $this->addElements(array($title, $fullname, $address, $town_city, $county, $postcode, $country, $tel, $message, $email, $leaflets, $reports, $combined, $treasure, $codes, $submit));
            $this->addDisplayGroup(array('title', 'fullname', 'email', 'address', 'town_city', 'county', 'postcode', 'country', 'tel', 'message', 'leaflets', 'reports', 'combined', 'treasure', 'codes'), 'details')->removeDecorator('HtmlTag');
            $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul'))));
            $this->details->removeDecorator('DtDdWrapper');
            $this->details->setLegend('Enter your comments: ');
        }
        $this->addDisplayGroup(array('submit'), 'submit');
        $this->submit->removeDecorator('DtDdWrapper');
        $this->submit->removeDecorator('HtmlTag');
    }