本文整理汇总了PHP中Zend_Form_Element_Select类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Select类的具体用法?PHP Zend_Form_Element_Select怎么用?PHP Zend_Form_Element_Select使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Form_Element_Select类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($options = null)
{
parent::__construct($options);
if (empty($this->tableName)) {
throw new Exception('You need to set the $tableName protected variable in your Form instance');
}
$baseDir = $options['baseDir'];
Zend_Registry::set('baseUrl', $baseDir);
$cancel_url = $options['cancelUrl'];
// Title
$title = new Zend_Form_Element_Text($this->tableFieldPrefix . 'Title');
$title->setLabel(Cible_Translation::getCibleText('form_label_title'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput');
$label = $title->getDecorator('Label');
$label->setOption('class', $this->_labelCSS);
$this->addElement($title);
// Status
$status = new Zend_Form_Element_Select($this->tableFieldPrefix . 'Status');
$status->setLabel(Cible_Translation::getCibleText('form_label_status'))->setAttrib('class', 'stdSelect');
$db = $this->_db;
$sql = 'SELECT * FROM Status';
$status_options = $db->fetchAll($sql);
foreach ($status_options as $_option) {
$status->addMultiOption($_option['S_ID'], Cible_Translation::getCibleText("status_{$_option['S_Code']}"));
}
$this->addElement($status);
}
示例2: init
public function init()
{
$this->setMethod('post');
$this->addElement('text', 'fullname', array('label' => 'Name', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'title'));
$this->addElement('text', 'nickname', array('label' => 'Nickname', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text'));
$this->addElement('text', 'email', array('label' => 'Email', 'required' => false, 'validators' => array('emailAddress'), 'filters' => array('StringTrim', 'StripTags'), 'class' => 'text'));
$this->addElement('select', 'gender', array('label' => 'Gender', 'required' => false, 'validators' => array(array('inArray', false, array(array('M', 'F')))), 'multiOptions' => array('' => 'Not specified', 'M' => 'Male', 'F' => 'Female')));
$this->addElement('text', 'dob', array('label' => 'Date of birth (dd/mm/yyyy)', 'required' => false, 'class' => 'text', 'validators' => array(array('date', false, array('d/m/Y'))), 'filters' => array('StringTrim', 'StripTags')));
// get the list of countries
$countries = Zend_Locale::getTranslationList('Territory', 'en', 2);
asort($countries, SORT_LOCALE_STRING);
$country = new Zend_Form_Element_Select('country');
$country->setLabel('Country')->addMultiOption('', 'Not specified')->addMultiOption('GB', 'United Kingdom')->addMultiOptions($countries)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
$postcode = new Zend_Form_Element_Text('postcode');
$postcode->setLabel('Postcode')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
$languages = Zend_Locale::getTranslationList('Language', 'en');
asort($languages, SORT_LOCALE_STRING);
$language = new Zend_Form_Element_Select('language');
$language->setLabel('Language')->addMultiOption('', 'Not specified')->addMultiOption('en_GB', 'British English')->addMultiOptions($languages)->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim');
$timeZone = new Zend_Form_Element_Text('timezone');
$timeZone->setLabel('Timezone')->setAttrib("class", "text")->setRequired(false)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
$this->addElements(array($country, $postcode, $language, $timeZone));
$this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Save'));
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset')), array('Description', array('placement' => 'prepend', 'class' => 'error')), 'Form'));
}
示例3: init
public function init()
{
parent::init();
if (!$this->getHmHomeId()) {
throw new Exception();
}
$element = new Zend_Form_Element_Select('year');
$element->setLabel('Jaar')->setRequired(true)->addMultiOption('', '...');
$percentages = Model_Hm_Day_Percentage::findAllByHomeId($this->_hmHomeId)->execute(null, Doctrine_Core::HYDRATE_ARRAY);
$availableYears = new Model_Hm_AvailableYears($percentages, 5);
foreach ($availableYears->toArray() as $year) {
$element->addMultiOption($year, $year);
}
$this->addElement($element);
$elements[] = 'year';
for ($i = 1; $i <= 7; $i++) {
$elementName = $this->_labelTemplates[$i];
$elements[] = 'day_' . $i;
$element = new Zend_Form_Element_Text('day_' . $i);
$element->setLabel($elementName)->setRequired(true)->setAttribs(array('maxlength' => 6))->setValidators(array(array('float'), array('stringLength', false, array('max' => 6))));
$this->addElement($element);
}
$this->addDisplayGroup($elements, 'days', array('legend' => 'Percentage'));
$element = new Zend_Form_Element_Submit('submit_percentageday');
$element->setLabel('Verwerken')->setAttrib('class', 'submit');
$this->addElement($element);
$this->addDisplayGroup(array('submit_percentageday'), 'submit', array('class' => 'submit'));
$this->bhvkDecorators();
$this->bhvkDecorateSubmitElement($this->getElement('submit_percentageday'));
}
示例4: __construct
/** The constructor
* @access public
* @param array $options
* @return void
*/
public function __construct(array $options = null)
{
$periods = new Periods();
$period_options = $periods->getPeriodFrom();
parent::__construct($options);
$this->setName('period');
$term = new Zend_Form_Element_Text('term');
$term->setLabel('Period name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToUpper'))->addValidator('Alpha', false, array('allowWhiteSpace' => true))->setAttrib('size', 60)->addErrorMessage('You must enter a period name');
$fromdate = new Zend_Form_Element_Text('fromdate');
$fromdate->setLabel('Date period starts: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a start date');
$todate = new Zend_Form_Element_Text('todate');
$todate->setLabel('Date period ends: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter an end date');
$notes = new Pas_Form_Element_CKEditor('notes');
$notes->setLabel('Period notes: ')->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'));
$valid = new Zend_Form_Element_Checkbox('valid');
$valid->setLabel('Period is currently in use: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a status');
$parent = new Zend_Form_Element_Select('parent');
$parent->setLabel('Period belongs to: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => 'Choose period to', 'Available periods' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int');
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setValue($this->_salt)->setTimeout(4800);
//Submit button
$submit = new Zend_Form_Element_Submit('submit');
$this->addElements(array($term, $fromdate, $todate, $valid, $notes, $parent, $submit, $hash));
$this->addDisplayGroup(array('term', 'fromdate', 'todate', 'parent', 'notes', 'valid'), 'details');
$this->details->setLegend('Period details: ');
$this->addDisplayGroup(array('submit'), 'buttons');
parent::init();
}
示例5: __construct
/** the constructor
* @access public
* @param array $options
* @return void
*/
public function __construct(array $options = null)
{
$periods = new Periods();
$period_options = $periods->getCoinsPeriod();
parent::__construct($options);
$this->setName('moneyers');
$name = new Zend_Form_Element_Text('name');
$name->setLabel('Moneyer\'s name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('Enter a moneyer\'s name');
$period = new Zend_Form_Element_Select('period');
$period->setLabel('Broad period: ')->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->setRequired(true)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('You must enter a period for this type')->addMultioptions(array(null => 'Choose a period', 'Available Options' => $period_options));
$date_1 = new Zend_Form_Element_Text('date_1');
$date_1->setLabel('Issued coins from: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a date for the start of moneyer period');
$date_2 = new Zend_Form_Element_Text('date_2');
$date_2->setLabel('Issued coins until: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a date for the end of moneyer period');
$appear = new Zend_Form_Element_Text('appear');
$appear->setLabel('Appearance on coins: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
$RRC = new Zend_Form_Element_Text('RRC');
$RRC->setLabel('RRC ID number: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'));
$bio = new Pas_Form_Element_CKEditor('bio');
$bio->setLabel('Biography: ')->setRequired(true)->addFilters(array('StringTrim', 'WordChars', 'BasicHtml', 'EmptyParagraph'))->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400))->setAttrib('ToolbarSet', 'Finds')->addErrorMessage('You must enter a biography');
$valid = new Zend_Form_Element_Checkbox('valid');
$valid->setLabel('Is this term valid?: ');
$submit = new Zend_Form_Element_Submit('submit');
$this->addElements(array($period, $name, $date_1, $date_2, $bio, $appear, $RRC, $valid, $submit));
$this->addDisplayGroup(array('name', 'period', 'date_1', 'date_2', 'appear', 'RRC', 'bio', 'valid', 'submit'), 'details');
parent::init();
}
示例6: __construct
public function __construct($options = null)
{
parent::__construct($options);
$this->setAttrib('accept-charset', 'UTF-8');
$this->setName('safcontrollers');
$id = new Zend_Form_Element_Hidden('id');
$hash = new Zend_Form_Element_Hash('no_csrf_foo', array('salt' => '4s564evzaSD64sf'));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$label = new Zend_Form_Element_Text('label');
$label->setLabel('label');
$name = new Zend_Form_Element_Text('name');
$name->setLabel('name');
$image = new Zend_Form_Element_Textarea('image');
$image->setLabel('image');
$description = new Zend_Form_Element_Textarea('description');
$description->setLabel('description');
$safmodulesId = new Zend_Form_Element_Select('safmodules_id');
$options = new Safmodules();
$safmodulesId->addMultiOption('', '----------');
foreach ($options->fetchAlltoFlatArray() as $k => $v) {
$safmodulesId->addMultiOption($k, $v['mlabel']);
}
$safmodulesId->setLabel('safmodules_id');
$this->addElements(array($id, $hash, $label, $name, $image, $description, $safmodulesId));
$this->addElements(array($submit));
}
示例7: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'emailcontacts');
$this->setAttrib('action', BASE_URL . 'emailcontacts/add/');
$id = new Zend_Form_Element_Hidden('id');
$group_id = new Zend_Form_Element_Select("group_id");
$group_id->setRegisterInArrayValidator(false);
$group_id->setRequired(true);
$group_id->addValidator('NotEmpty', false, array('messages' => 'Please select group.'));
$business_unit_id = new Zend_Form_Element_Select("business_unit_id");
$business_unit_id->setRegisterInArrayValidator(false);
$business_unit_id->setRequired(true);
$business_unit_id->addValidator('NotEmpty', false, array('messages' => 'Please select business unit.'));
$business_unit_id->setAttrib('onchange', "bunit_emailcontacts('business_unit_id');");
//Group Email....
$grpEmail = new Zend_Form_Element_Text('groupEmail');
$grpEmail->addFilters(array('StringTrim', 'StripTags'));
$grpEmail->setRequired(true);
$grpEmail->addValidator('NotEmpty', false, array('messages' => 'Please enter group email.'));
$grpEmail->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid email.')));
$grpEmail->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_emailcontacts', 'field' => 'groupEmail', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1')));
$grpEmail->getValidator('Db_NoRecordExists')->setMessage('Group email already exists.');
// Form Submit .........
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $group_id, $grpEmail, $submit, $business_unit_id));
$this->setElementDecorators(array('ViewHelper'));
}
示例8: init
public function init()
{
$this->clearDecorators()->addDecorator('FormElements')->addDecorator('Form')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));
$this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('GET');
$username = new Zend_Form_Element_Text('username');
$username->setLabel('Member')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email Address')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
$ip = new Zend_Form_Element_Text('ip');
$ip->setLabel('Ip Address')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'));
$state = new Zend_Form_Element_Select('state');
$state->setLabel('State')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', 'success' => 'Success', 'bad-password' => 'Bad Password', 'no-member' => 'No Member', 'disabled' => 'Disabled', 'unpaid' => 'Unpaid', 'third-party' => 'Third-Party', 'v3-migration' => 'V3 Migration'))->setValue('-1');
$source = new Zend_Form_Element_Select('source');
$source->setLabel('Source')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', 'facebook' => 'Facebook', 'twitter' => 'Twitter', 'janrain' => 'Janrain'))->setValue('-1');
$submit = new Zend_Form_Element_Button('search', array('type' => 'submit'));
$submit->setLabel('Search')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))->addDecorator('HtmlTag2', array('tag' => 'div'));
$this->addElement('Hidden', 'order', array('order' => 10001));
$this->addElement('Hidden', 'order_direction', array('order' => 10002));
$this->addElement('Hidden', 'user_id', array('order' => 10003));
$this->addElements(array($username, $email, $ip, $state, $source, $submit));
// Set default action without URL-specified params
$params = array();
foreach (array_keys($this->getValues()) as $key) {
$params[$key] = null;
}
$this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble($params));
}
示例9: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'leavemanagementreport');
$id = new Zend_Form_Element_Hidden('id');
$department = new Zend_Form_Element_Select('department_id');
$department->setLabel('Department');
$department->addMultiOption('', 'Select Department');
$department->setAttrib('class', 'selectoption');
$department->setRegisterInArrayValidator(false);
$month = new Zend_Form_Element_Select('cal_startmonth');
$month->setLabel('Start Month');
$month->addMultiOption('', 'Select Calendar Start Month');
$month->setAttrib('class', 'selectoption');
$month->setRegisterInArrayValidator(false);
$weekend_startday = new Zend_Form_Element_Select('weekend_startday');
$weekend_startday->setLabel('Week-end 1');
$weekend_startday->addMultiOption('', 'Select Weekend Start Day');
$weekend_startday->setAttrib('class', 'selectoption');
$weekend_startday->setRegisterInArrayValidator(false);
$weekend_endday = new Zend_Form_Element_Select('weekend_endday');
$weekend_endday->setLabel('Week-end 2');
$weekend_endday->addMultiOption('', 'Select Weekend End Day');
$weekend_endday->setAttrib('class', 'selectoption');
$weekend_endday->setRegisterInArrayValidator(false);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $department, $month, $weekend_startday, $weekend_endday, $submit));
$this->setElementDecorators(array('ViewHelper'));
}
示例10: init
public function init()
{
$this->setName('activity');
$id = new Zend_Form_Element_Hidden('id');
$id->addFilter('Int');
$id->removeDecorator('label');
$name = new Zend_Form_Element_Text('name');
$name->setLabel('Name')->setRequired(true)->addFilter('StripTags')->addfilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$activity_types_id = new Zend_Form_Element_Select('activity_types_id');
$activity_types_id->setLabel('activity type')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsActivity_types())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))));
$contact_own_company_id = new Zend_Form_Element_Select('contact_own_company_id');
$contact_own_company_id->setLabel('contact own company')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsContactOwnCompanies())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))));
//
$contact_client_company_id = new Zend_Form_Element_Select('contact_client_company_id');
$contact_client_company_id->setLabel('contact client company')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsContactClientCompanies())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))));
$status_id = new Zend_Form_Element_Select('status_id');
$status_id->setLabel('Status')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsStatus())->setAttrib('maxlength', 300)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))));
$date_start = new Zend_Form_Element_Text('date_start');
$date_start->setLabel('date start')->setRequired(true)->addFilter('StripTags')->addfilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))))->setAttrib('id', 'f_date_start');
$date_end = new Zend_Form_Element_Text('date_end');
$date_end->setLabel('date end')->setRequired(true)->addFilter('StripTags')->addfilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))))->setAttrib('id', 'f_date_end');
$observation = new Zend_Form_Element_Text('observation');
$observation->setLabel('Observation')->setRequired(true)->addfilter('StripTags')->addfilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label');
$this->addElements(array($id, $name, $activity_types_id, $contact_own_company_id, $contact_client_company_id, $status_id, $date_start, $date_end, $observation, $submit));
}
示例11: __construct
/** The constructor
* @access public
* @param array $options
* @return void
*/
public function __construct(array $options = null)
{
$projecttypes = new ProjectTypes();
$projectype_list = $projecttypes->getTypes();
$authors = new Users();
$authorOptions = $authors->getAuthors();
parent::__construct($options);
$this->setName('activity');
$title = new Zend_Form_Element_Text('title');
$title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->addErrorMessage('Choose title for the project.');
$description = new Pas_Form_Element_CKEditor('description');
$description->setLabel('Short description of project: ')->setRequired(true)->setAttribs(array('rows' => 10, 'cols' => 40, 'Height' => 400))->setAttrib('ToolbarSet', 'Basic')->addFilters(array('BasicHtml', 'EmptyParagraph', 'StringTrim'));
$length = new Zend_Form_Element_Text('length');
$length->setLabel('Length of project: ')->setAttrib('size', 12)->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a duration for this project in months')->addValidator('Digits')->setDescription('Enter length in months');
$managedBy = new Zend_Form_Element_Select('managedBy');
$managedBy->setLabel('Managed by: ')->addMultiOptions(array('Choose an author' => $authorOptions))->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addFilters(array('StripTags', 'StringTrim'))->addValidator('InArray', false, array(array_keys($authorOptions)))->addErrorMessage('You must enter a manager for this project.');
$suitableFor = new Zend_Form_Element_Select('suitableFor');
$suitableFor->setLabel('Suitable for: ')->addMultiOptions(array(null => 'Choose type of research', 'Available types' => $projectype_list))->setRequired(false)->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter suitability for this task.');
$location = new Zend_Form_Element_Text('location');
$location->setLabel('Where would this be located?: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a location for the task.');
$valid = new Zend_Form_Element_Checkbox('status');
$valid->setLabel('Publish this task? ')->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(480);
$this->addElements(array($title, $description, $length, $valid, $managedBy, $suitableFor, $location, $submit, $hash));
$this->addDisplayGroup(array('title', 'description', 'length', 'location', 'suitableFor', 'managedBy', 'status', 'submit'), 'details');
$this->details->setLegend('Activity details: ');
parent::init();
}
示例12: init
/**
*
* Edit Group form
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditGroup.phtml'))));
// get group from database
$request = Zend_Controller_Front::getInstance()->getRequest();
$group = $request->getParam('name');
$Profiles = new Application_Model_Profiles();
$ProfilesMeta = new Application_Model_ProfilesMeta();
$profile = $Profiles->getProfile($group, false, true);
$owners_profile = $Profiles->getProfileByField('id', $profile->owner);
$username_minchars = Zend_Registry::get('config')->get('username_minchars');
$username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
// fields
$id = new Zend_Form_Element_Hidden('id');
$id->setValue($profile->id);
$name = new Zend_Form_Element_Text('name');
$name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Group Name'))->setValue($profile->name)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control');
$screenname = new Zend_Form_Element_Text('screen_name');
$screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control');
$description = new Zend_Form_Element_Textarea('description');
$description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($ProfilesMeta->getMetaValue('description', $profile->id))->setLabel($this->translator->translate('About this group'))->setAttrib('class', 'form-control');
$profile_privacy = new Zend_Form_Element_Select('profile_privacy');
$profile_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('group_privacy_array'))->setErrorMessages(array($this->translator->translate('Select group visibility')))->setLabel($this->translator->translate('Select group visibility'))->setRequired(true)->setValue($profile->profile_privacy)->setAttrib('class', 'form-control');
$is_hidden = new Zend_Form_Element_Checkbox('is_hidden');
$is_hidden->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($profile->is_hidden) && $profile->is_hidden == 1 ? 1 : 0)->setLabel($this->translator->translate('Remove?'))->setCheckedValue("1")->setUncheckedValue("0");
$submit = new Zend_Form_Element_Submit('formsubmit');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($id, $name, $screenname, $profile_privacy, $description, $is_hidden, $submit));
$this->postInit();
}
示例13: __construct
public function __construct($options = null)
{
parent::__construct($options);
$emailCategoryOptionList = array('Invite non-sparks to join campaign' => $this->getView()->translate('Admin_Non-Sparks_Invitation'), 'Invite sparks to join campaign' => $this->getView()->translate('Admin_Sparks_Invitation'), 'Send mail to sparks' => $this->getView()->translate('Admin_Send_Mail_To_Sparks'));
$emailCategory = new Zend_Form_Element_Select('emailCategory');
$emailCategory->setMultiOptions($emailCategoryOptionList);
$emailList = new Zend_Form_Element_Textarea('emailList');
$emailList->setAttribs(array('rows' => 5, 'cols' => 150, 'onChange' => 'datetable()'))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 65535))));
$subject = new Zend_Form_Element_Text('subject');
$subject->setAttribs(array('size' => 150))->addFilter('StringTrim');
$message = new Zend_Form_Element_Textarea('message');
$message->setAttribs(array('rows' => 30, 'cols' => 150))->addFilter('StripTags')->addFilter('StringTrim')->addValidators(array(array('StringLength', false, array(0, 65535))));
$optionList = array();
$campaign = new Campaign();
$campaigns = $campaign->fetchAll(null, "id desc", null, null);
foreach ($campaigns as $campaign) {
$optionList[$campaign->id] = $campaign->name;
}
$optionList['0'] = $this->getView()->translate('ADMIN_NOT_AUTO_INVITATION');
$campaignId = new Zend_Form_Element_Select('campaignId');
$campaignId->setMultiOptions($optionList);
$code_source = new Zend_Form_Element_Text('code_source');
$code_source->addFilter('StringTrim');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel($this->getView()->translate('INVITATION_MAIL_SEND'));
$this->addElements(array($emailCategory, $emailList, $subject, $message, $campaignId, $code_source, $submit));
}
示例14: init
public function init()
{
// Set form options
$this->setName('productBasicInfo')->setAction(SITE_ROOT . '/productlisting/' . $this->postAction)->setMethod('post');
//name
$name = new Zend_Form_Element_Text('name');
$name->setRequired(true)->addValidator('Alnum')->addvalidator('StringLength', false, array(4, 150));
//brand
$brand = new Zend_Form_Element_Select('brand');
$brand->setRequired(true)->addValidator('Alnum');
//social_usage
$socialUsage = new Zend_Form_Element_Checkbox('socialUsage');
$competativeUsage = new Zend_Form_Element_Checkbox('competativeUsage');
$price = new Zend_form_Element_Text('price');
$price->setRequired(true)->addValidator(new Zend_Validate_Float(), true);
//domestic shipping rate
$domesticShippingRate = new Zend_Form_Element_Text('domesticShippingRate');
$domesticShippingRate->setRequired(true)->addValidator(new Zend_Validate_Float(), true);
//international shipping rate
$internationalShippingRate = new Zend_Form_Element_Text('internationalShippingRate');
$internationalShippingRate->setRequired(true)->addValidator(new Custom_Validators_Price(), true);
//backordertime
$backorderTime = new Zend_Form_Element_Text('backorderTime');
//returnable
$return = new Zend_Form_Element_Radio('return');
$return->setLabel('Return:')->addMultiOptions(array('returnable' => 'Returnable', 'Unreturnable' => 'Not returnable'))->setSeparator(" ")->setAttrib("checked", "checked");
//videos
$video = new Zend_Form_Element_Text('videoYoutube');
// Add all the elements to the form
$this->addElement($name)->addElement($brand)->addElement($socialUsage)->addElement($competativeUsage)->addElement($price)->addElement($domesticShippingRate)->addElement($internationalShippingRate)->addElement($backorderTime)->addElement($return)->addElement($video);
}
示例15: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('action', DOMAIN . 'employmentstatus/edit');
$this->setAttrib('id', 'formid');
$this->setAttrib('name', 'employmentstatus');
$id = new Zend_Form_Element_Hidden('id');
$workcode = new Zend_Form_Element_Text('workcode');
$workcode->setAttrib('maxLength', 20);
$workcode->setRequired(true);
$workcode->addValidator('NotEmpty', false, array('messages' => 'Please enter work short code.'));
$workcode->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9 ]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid work short code.')));
$workcodename = new Zend_Form_Element_Select('workcodename');
$workcodename->setAttrib('class', 'selectoption');
$workcodename->setRegisterInArrayValidator(false);
$workcodename->setRequired(true);
$workcodename->addValidator('NotEmpty', false, array('messages' => 'Please select work code.'));
$description = new Zend_Form_Element_Textarea('description');
$description->setAttrib('rows', 10);
$description->setAttrib('cols', 50);
$description->setAttrib('maxlength', '200');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');
$this->addElements(array($id, $workcode, $workcodename, $description, $submit));
$this->setElementDecorators(array('ViewHelper'));
}