本文整理汇总了PHP中Zend_Form_Element_Text::SetLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Text::SetLabel方法的具体用法?PHP Zend_Form_Element_Text::SetLabel怎么用?PHP Zend_Form_Element_Text::SetLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Text
的用法示例。
在下文中一共展示了Zend_Form_Element_Text::SetLabel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/** 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();
}
示例2: __construct
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 ');
}
示例3: __construct
/** 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();
}
示例4: __construct
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'))));
}
示例5: __construct
/** 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();
}
示例6: __construct
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');
}