public function __construct($options = null) { $this->_disabledDefaultActions = true; $this->_addRequiredAsterisks = false; parent::__construct($options); $baseDir = $this->getView()->baseUrl(); $this->getView()->headLink()->appendStylesheet("{$this->getView()->baseUrl()}/themes/default/css/login.css", 'all'); $this->setAttrib('class', 'login'); $regexValidate = new Cible_Validate_Email(); $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch'); $email = new Zend_Form_Element_Text('email'); $email->setLabel($this->getView()->getClientText('login_form_email_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'loginTextInput'); $this->addElement($email); $password = new Zend_Form_Element_Password('password'); $password->setLabel($this->getView()->getClientText('login_form_password_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'loginTextInput')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))); $this->addElement($password); // checkbox for client persistance $status = new Zend_Form_Element_Checkbox('stayOn'); $status->setLabel($this->getView()->getClientText('login_form_stayOn_label')); $status->setValue(1); $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd')))); $this->addElement($status); // Submit button $submit = new Zend_Form_Element_Submit('submit_login'); $submit->setLabel('')->setAttrib('class', 'subscribeButton-' . Zend_Registry::get("languageSuffix")); $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd')))); $this->addElement($submit); $this->setAttrib('class', 'login-form'); }
public function __construct($options = null) { $periods = new Periods(); $period_options = $periods->getPeriodFrom(); parent::__construct($options); $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('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')->setDecorators($decorators); $fromdate = new Zend_Form_Element_Text('fromdate'); $fromdate->setLabel('Date period starts: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidators('Digits')->addErrorMessage('You must enter a start date')->setDecorators($decorators); $todate = new Zend_Form_Element_Text('todate'); $todate->setLabel('Date period ends: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidators('Digits')->addErrorMessage('You must enter an end date')->setDecorators($decorators); $notes = new Pas_Form_Element_RTE('notes'); $notes->setLabel('Period notes: ')->setRequired(false)->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')->setDecorators($decorators); $parent = new Zend_Form_Element_Select('parent'); $parent->setLabel('Period belongs to: ')->setRequired(false)->addMultiOptions(array(NULL => NULL, 'Choose period to' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($term, $fromdate, $todate, $valid, $notes, $parent, $submit)); $this->addDisplayGroup(array('term', 'fromdate', 'todate', 'parent', 'notes', 'valid'), 'details')->removeDecorator('HtmlTag'); $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->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('Period details: '); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); }
/** 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(); }
/** 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(); }
public function init() { $country_code = new Zend_Form_Element_Text('country_code'); $country_code->setLabel('Country code'); $country_code->setDescription('List of codes you can see here: http://framework.zend.com/manual/1.12/en/zend.locale.appendix.html'); $country_code->setRequired(true); $this->addElement($country_code); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name'); $name->setRequired(true); $this->addElement($name); $is_active = new Zend_Form_Element_Checkbox('is_active'); $is_active->setLabel('Active'); $is_active->setRequired(true); $this->addElement($is_active); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/locale/languages/'"); $this->addElement($cancel); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Confirm'); $this->setAction('')->setMethod('post')->addElement($submit); }
/** 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(); }
public function startFrom() { $setting = $this->setting; if (Application_Model_Preference::GetPlanLevel() == 'disabled') { $output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device'); $output_sound_device->setLabel('Hardware Audio Output')->setRequired(false)->setValue($setting['output_sound_device'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $output_sound_device->setAttrib("readonly", true); } $this->addElement($output_sound_device); $output_types = array("ALSA" => "ALSA", "AO" => "AO", "OSS" => "OSS", "Portaudio" => "Portaudio", "Pulseaudio" => "Pulseaudio"); $output_type = new Zend_Form_Element_Select('output_sound_device_type'); $output_type->setLabel("Output Type")->setMultiOptions($output_types)->setValue($setting['output_sound_device_type'])->setDecorators(array('ViewHelper')); if ($setting['output_sound_device'] != "true") { $output_type->setAttrib("disabled", "disabled"); } $this->addElement($output_type); } $icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata'); $icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')->setRequired(false)->setValue($setting['icecast_vorbis_metadata'] == "true" ? 1 : 0)->setDecorators(array('ViewHelper')); if (Application_Model_Preference::GetEnableStreamConf() == "false") { $icecast_vorbis_metadata->setAttrib("readonly", true); } $this->addElement($icecast_vorbis_metadata); $stream_format = new Zend_Form_Element_Radio('streamFormat'); $stream_format->setLabel('Stream Label:'); $stream_format->setMultiOptions(array("Artist - Title", "Show - Artist - Title", "Station name - Show name")); $stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat()); $stream_format->setDecorators(array('ViewHelper')); $this->addElement($stream_format); }
public function init() { $this->setAction(URL_BASE . '/action'); $tr = Zend_Registry::get('tr'); $name = new Zend_Form_Element_Text('name'); $name->setLabel($tr->_('NAME')); $name->setRequired(true); $name->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($name); $enabled = new Zend_Form_Element_Checkbox('enabled'); $enabled->setLabel($tr->_('IS_ACTION_ENABLED')); $this->addElement($enabled); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel($tr->_('IS_ACTION_PUBLIC')); $this->addElement($public); $route = new Zend_Form_Element_Text('route'); $route->setLabel($tr->_('CUSTOM_ROUTE')); $route->setRequired(true); $route->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($route); $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 35; $desc->rows = 15; $desc->setLabel($tr->_('DESCRIPTION')); $desc->setRequired(false); $this->addElement($desc); parent::init(); }
public function __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // select box category (Parameter #1) $blockCategory = new Zend_Form_Element_Select('Param1'); $blockCategory->setLabel('Catégorie d\'évènement de ce bloc')->setAttrib('class', 'largeSelect'); $categories = new Categories(); $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 7)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title'); $categoriesArray = $categories->fetchAll($select); foreach ($categoriesArray as $category) { $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']); } // number of news to show in front-end (Parameter #2) $at_least_one = new Zend_Validate_GreaterThan('0'); $at_least_one->setMessage('Vous devez afficher au moins un événement.'); $not_null = new Zend_Validate_NotEmpty(); $not_null->setMessage($this->getView()->getCibleText('validation_message_empty_field')); $blockNewsMax = new Zend_Form_Element_Text('Param2'); $blockNewsMax->setLabel('Nombre d\'évènement à afficher')->setRequired(true)->setValue('1')->addValidator($not_null, true)->addValidator($at_least_one, true)->setAttrib('class', 'smallTextInput'); // show the breif text in front-end (Parameter #3) $blockShowBrief = new Zend_Form_Element_Checkbox('Param3'); $blockShowBrief->setLabel('Afficher le texte bref'); $blockShowBrief->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElements(array($blockCategory, $blockNewsMax, $blockShowBrief)); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param999', 'Param1', 'Param2', 'Param3'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); //$parameters->setLegend($this->_view->getCibleText('form_parameters_fieldset')); }
public function init() { $this->setName('user'); $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')))); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password')->addValidator('NotEmpty', true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('StringLength', false, array(3, 20))->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $date = new Zend_Form_Element_Text('date'); $date->setLabel('Date')->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')))); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $status = new Zend_Form_Element_Text('status'); $status->setLabel('status')->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')))); $person_id = new Zend_Form_Element_Text('person_id'); $person_id->setLabel('person_id')->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')))); $validation_code = new Zend_Form_Element_Text('validation_code'); $validation_code->setLabel('validation')->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')))); $phone = new Zend_Form_Element_Text('phone'); $phone->setLabel('Phone')->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')))); $role_id = new Zend_Form_Element_Select('role_id'); $role_id->setLabel('Role')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsRole())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $company_id = new Zend_Form_Element_Select('company_id'); $company_id->setLabel('company')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsCompany())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.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'); $add_contact = new Zend_Form_Element_Checkbox('add_contact'); $add_contact->setLabel('add contact')->setRequired(true); $this->addElements(array($id, $name, $password, $date, $email, $status, $validation_code, $person_id, $phone, $role_id, $company_id, $add_contact, $submit)); }
public function __construct($options = null) { parent::__construct($options); $this->setAttrib('accept-charset', 'UTF-8'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('dieaxis'); $die_axis_name = new Zend_Form_Element_Text('die_axis_name'); $die_axis_name->setLabel('Die axis term: ')->setRequired(true)->setAttrib('size', 70)->addErrorMessage('Please enter a term.')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Die axis term is in use: ')->setRequired(true)->addValidator('Int')->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->removeDecorator('DtDdWrapper'); $submit->removeDecorator('HtmlTag'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $this->addElements(array($die_axis_name, $valid, $submit)); $this->addDisplayGroup(array('die_axis_name', 'valid'), 'details'); $this->details->setLegend('Die axis details: '); $this->details->removeDecorator('HtmlTag'); $this->details->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); parent::__construct($options); $this->setName('activity'); $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'))); $decorators2 = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('HtmlTag', array('tag' => 'li'))); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Choose title for the project.')->addValidator('Alnum', false, array('allowWhiteSpace' => true))->setDecorators($decorators); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel('Short description of project: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->addFilters(array('BasicHtml', 'EmptyParagraph', 'StringTrim'))->addDecorator('HtmlTag', array('tag' => 'li')); $length = new Zend_Form_Element_Text('length'); $length->setLabel('Length of project: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a duration for this project in months')->addValidator('Digits')->setDecorators($decorators); $managedBy = new Zend_Form_Element_Text('managedBy'); $managedBy->setLabel('Managed by: ')->setAttrib('size', 12)->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a manager for this project.')->setDecorators($decorators); $suitableFor = new Zend_Form_Element_Select('suitableFor'); $suitableFor->setLabel('Suitable for: ')->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->setRequired(true)->addValidator('InArray', false, array($projectype_list))->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter suitability for this task.')->setDecorators($decorators); $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.')->setDecorators($decorators); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Publish this task? ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->removeDecorator('HtmlTag'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('label')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper')->setDecorators($decorators2); $this->addElements(array($title, $description, $length, $valid, $managedBy, $suitableFor, $location, $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', 'description', 'length', 'location', 'suitableFor', 'managedBy', 'valid', 'submit'), 'details')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->removeDecorator('HtmlTag'); $this->details->setLegend('Activity details: '); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); }
public function __construct($options = null) { parent::__construct($options); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('workflow'); $workflowstage = new Zend_Form_Element_Text('workflowstage'); $workflowstage->setLabel('Work flow stage title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Workflow stage is currently in use: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->addValidator('Digits'); $termdesc = new Pas_Form_Element_RTE('termdesc'); $termdesc->setLabel('Description of workflow stage: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Basic')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($workflowstage, $valid, $termdesc, $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('workflowstage', 'termdesc', 'valid'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); $this->details->setLegend('HER details: '); $this->addDisplayGroup(array('submit'), 'submit'); $this->submit->removeDecorator('DtDdWrapper'); $this->submit->removeDecorator('HtmlTag'); }
public function __construct($options = null) { $landuses = new Landuses(); $landuse_opts = $landuses->getUsesValid(); $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'))); parent::__construct($options); $this->setName('Landuse'); $term = new Zend_Form_Element_Text('term'); $term->setLabel('Landuse term name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this landuse!')->setDecorators($decorators); $oldID = new Zend_Form_Element_Text('oldID'); $oldID->setLabel('Old landuse type code: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this landuse!')->setDecorators($decorators); $termdesc = new Pas_Form_Element_RTE('termdesc'); $termdesc->setLabel('Description of landuse type: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars')); $belongsto = new Zend_Form_Element_Select('belongsto'); $belongsto->setLabel('Belongs to landuse type: ')->setRequired(false)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL, 'Choose period:' => $landuse_opts))->addValidator('InArray', false, array(array_keys($landuse_opts)))->setDecorators($decorators); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Landuse type is currently in use: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($term, $termdesc, $oldID, $valid, $belongsto, $submit)); $this->addDisplayGroup(array('term', 'termdesc', 'oldID', 'belongsto', 'valid'), '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'); }
public function init() { $this->setMethod('post')->setAttrib('enctype', 'multipart/form-data'); $this->clearDecorators(); $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'div_form'))->addDecorator('Form'); $this->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'p', 'class' => 'element-group')))); $this->addElement('text', 'nombre', array('label' => 'Nombre * ', 'required' => true, 'filters' => array('StripTags'))); $validator = new Zend_Validate_Alpha(array('allowWhiteSpace' => true)); $this->nombre->setAttrib('placeholder', 'Nombre'); $this->nombre->addValidator($validator); $this->nombre->setErrorMessages(array('messages' => 'El campo nombre solo puede contener letras')); $this->addElement('text', 'apellido', array('label' => 'Apellido *', 'value' => '', 'required' => true, 'filters' => array('StripTags'))); $this->apellido->setAttrib('placeholder', 'Apellido'); $this->apellido->addValidator($validator)->setErrorMessages(array('messages' => 'El campo nombre solo puede contener letras')); $this->addElement('text', 'telefono', array('label' => 'Telefono', 'filters' => array('StringTrim', 'StripTags', 'StringToLower'))); $this->telefono->addValidator('digits')->setErrorMessages(array('messages' => 'El campo nombre solo puede contener numeros')); $this->addElement('text', 'domicilio', array('label' => 'Domicilio', 'filters' => array('StringTrim', 'StripTags'))); $this->addElement('password', 'contraseña', array('label' => 'Contraseña *', 'filters' => array('StringTrim', 'StripTags'))); $this->contraseña->addValidator('stringLength', false, array(6, 50))->setErrorMessages(array('messages' => 'La Contraseña debe tener como minimo 6 caracteres')); $this->addElement('password', 'verifypassword', array('label' => 'Verifica la Contraseña', 'required' => true, 'validators' => array(array('identical', true, array('contraseña'))))); $this->addElement('text', 'email', array('label' => 'Email *', 'required' => true, 'filters' => array('StringTrim', 'StripTags', 'StringToLower'))); $this->email->setAttrib('placeholder', '*****@*****.**'); $this->email->addValidator('EmailAddress', TRUE); $db_lookup_validator = new Zend_Validate_Db_NoRecordExists('usuarios', 'email'); $this->email->addValidator($db_lookup_validator); $element = new Zend_Form_Element_File('element'); $element->setRequired(false)->setLabel('Subir Imagen de Perfil')->setValueDisabled(true)->addValidator('Extension', false, 'jpg,png,gif,jpeg'); $this->addElement($element); $check = new Zend_Form_Element_Checkbox('check'); $check->setLabel('Acepto el envio de promociones e Informacion por parte del Restaurant *')->setUncheckedValue(null)->setRequired()->setDecorators(array('ViewHelper', 'Description', 'Errors', array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'div', 'class' => 'terminos')))); $this->addElement($check); $this->addElement('submit', 'Enviar', array('ignore' => true, 'decorators' => array(array('ViewHelper'), array('HtmlTag', array('tag' => 'p', 'class' => 'submit-group'))))); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); ZendX_JQuery::enableForm($this); parent::__construct($options); $this->setName('research'); $investigator = new Zend_Form_Element_Text('investigator'); $investigator->setLabel('Principal work conducted by: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a lead for this project.'); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addMultiOptions(array(null => null, 'Choose type of research' => $projectype_list))->addValidator('inArray', false, array(array_keys($projectype_list))); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'Purifier'))->setAttrib('size', 60)->addErrorMessage('Choose title for the project.'); $description = new Pas_Form_Element_CKEditor('description'); $description->setLabel('Short description of project: ')->setRequired(false)->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph')); $startDate = new ZendX_JQuery_Form_Element_DatePicker('startDate'); $startDate->setLabel('Start date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->setRequired(false)->addErrorMessage('You must enter a start date for this project'); $endDate = new ZendX_JQuery_Form_Element_DatePicker('endDate'); $endDate->setLabel('End date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->setRequired(false)->addErrorMessage('You must enter an end date for this project'); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Make public: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits'); $submit = new Zend_Form_Element_Submit('submit'); $this->addElements(array($title, $description, $level, $startDate, $endDate, $valid, $investigator, $submit)); $this->addDisplayGroup(array('title', 'investigator', 'level', 'description', 'startDate', 'endDate', 'valid'), 'details'); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
public function init() { $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name'); $name->setRequired(true); $this->addElement($name); $enabled = new Zend_Form_Element_Checkbox('enabled'); $enabled->setLabel('Is the action enabled ?'); $this->addElement($enabled); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel('Is the action public ?'); $this->addElement($public); $use_custom_route = new Zend_Form_Element_Checkbox('use_custom_route'); $use_custom_route->setLabel('Custom Route'); $this->addElement($use_custom_route); $custom_route = new Zend_Form_Element_Text('route'); //$custom_route->setLabel('Custom Route'); $this->addElement($custom_route); $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 40; $desc->rows = 15; $desc->setLabel('Description'); $desc->setRequired(false); $this->addElement($desc); parent::init(); }
public function __construct($options = null) { parent::__construct($options); $services = new WebServices(); $servicesListed = $services->getValidServices(); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $this->setName('socialweb'); $username = new Zend_Form_Element_Text('account'); $username->setLabel('Account username: '******'StringTrim', 'StripTags'))->setAttrib('size', 30)->addErrorMessage('Please enter a valid username!')->setDecorators($decorators); $service = new Zend_Form_Element_Select('accountName'); $service->setLabel('Social services: ')->addFilters(array('StringTrim', 'StripTags'))->addMultiOptions(array(NULL => 'Choose a service', 'Valid services' => $servicesListed))->addValidator('InArray', false, array(array_keys($servicesListed)))->setDecorators($decorators); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel('Show this to public users?: ')->addFilters(array('StringTrim', 'StripTags'))->setRequired(true)->setDecorators($decorators)->addErrorMessage('You must set the status of this account'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElements(array($service, $hash, $username, $public, $submit)); $this->addDisplayGroup(array('accountName', 'account', 'public'), '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'); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $periods = new Periods(); $period_options = $periods->getPeriodFrom(); parent::__construct($options); $this->setName('suggested'); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array(null => 'Please choose a level', 'Research levels' => $projectype_list))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags')); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array(null => 'Please choose a period', 'Periods available' => $period_options))->setAttrib('class', 'input-xxlarge selectpicker show-menu-arrow')->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags')); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.'); $description = new Pas_Form_Element_CKEditor('description'); $description->setLabel('Short description of project: ')->setRequired(false)->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph')); $valid = new Zend_Form_Element_Checkbox('taken'); $valid->setLabel('Is the topic taken: ')->setRequired(true)->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_salt)->setTimeout(4800); $submit = new Zend_Form_Element_Submit('submit'); $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash)); $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), 'details'); $this->addDisplayGroup(array('submit'), 'buttons'); parent::init(); }
public function init() { $tr = Zend_Registry::get('tr'); $locale = Zend_Registry::get('Zend_Locale'); $available_languages = array ( 'en' => 'English', 'fr' => 'Francais', 'it' => 'Italiano', 'ru' => 'Русский', ); $this->setAction('/language'); $this->setAttrib('id', 'language-form'); $languages = new Zend_Form_Element_Select('languages'); $languages->setLabel($tr->_('LANGUAGE')); $languages->addMultiOptions($available_languages); $languages->setValue(isset($locale->value) ? $locale->value : 'en'); $this->addElement($languages); $system_wide = new Zend_Form_Element_Checkbox('system_wide'); $system_wide->setLabel($tr->_('UPDATE_SYSTEM_WIDE') . '?'); $system_wide->setRequired(false); $this->addElement($system_wide); $this->addElement(new Zend_Form_Element_Submit($tr->_('SAVE'))); parent::init(); }
/** * Form initialization * * @return void */ public function init() { $this->setName('loginForm'); $this->setElementsBelongTo('loginForm'); $element = new Zend_Form_Element_Text('username'); $element->setLabel('Username')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $this->addElement($element); $element = new Zend_Form_Element_Password('password'); $element->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $this->addElement($element); $element = new Zend_Form_Element_Checkbox('rememberMe'); $element->setLabel('Remember me'); $this->addElement($element); /** * @var $request Zend_Controller_Request_Http */ $request = Zend_Controller_Front::getInstance()->getRequest(); $element = new Zend_Form_Element_Hidden('redirect'); $element->setValue($request->getParam('from', '/'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim'); $element->getDecorator('HtmlTag')->setOption('class', 'hidden'); $element->getDecorator('Label')->setOption('tagClass', 'hidden'); $this->addElement($element); $element = new Zend_Form_Element_Submit('submit'); $element->setLabel('Connection'); $this->addElement($element); }
/** * * @param array $options Options to build the form */ public function __construct($options = null) { parent::__construct($options); // Title $title = new Zend_Form_Element_Text('FSI_Title'); $title->setLabel($this->getView()->getCibleText('form_section_title_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'section_title_edit', 'id' => 'title'))))->setAttrib('class', 'stdTextInput'); $this->addElement($title); // Show title $showTitle = new Zend_Form_Element_Checkbox('FS_ShowTitle'); $showTitle->setLabel($this->getView()->getCibleText('form_section_showtitle_label')); $showTitle->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($showTitle); // Repeat section $repeat = new Zend_Form_Element_Checkbox('FS_Repeat'); $repeat->setLabel($this->getView()->getCibleText('form_label_has_profil')); $repeat->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $this->addElement($repeat); // Repeat min $repeatMin = new Zend_Form_Element_Text('FS_RepeatMin'); $repeatMin->setLabel($this->getView()->getCibleText('form_section_repeatMin_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'section_RepeatMin'); $this->addElement($repeatMin); // Repeat max $repeatMax = new Zend_Form_Element_Text('FS_RepeatMax'); $repeatMax->setLabel($this->getView()->getCibleText('form_section_repeatMax_label') . " <span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'section_RepeatMax'); $this->addElement($repeatMax); // Sequence - hidden input $sequence = new Zend_Form_Element_Hidden('FS_Seq'); $this->addElement($sequence); // page break - hiden input $pageBreak = new Zend_Form_Element_Hidden('FS_PageBreak'); $this->addElement($pageBreak); // Set the form id $this->setAttrib('id', 'section'); }
public function __construct($options = null) { parent::__construct($options); $this->setName('Decmethods'); $decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'apppend', 'class' => 'error', 'tag' => 'li')), array('Label'), array('HtmlTag', array('tag' => 'li'))); $term = new Zend_Form_Element_Text('term'); $term->setLabel('Decoration style term: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('Please enter a valid title for this decorative method!')->setDecorators($decorators); $termdesc = new Pas_Form_Element_RTE('termdesc'); $termdesc->setLabel('Description of decoration style: ')->setRequired(false)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('BasicHtml', 'EmptyParagraph'))->addFilter('WordChars'); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Is this term valid?: ')->setRequired(true)->setDecorators($decorators); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $this->addElements(array($term, $termdesc, $valid, $submit)); $this->addDisplayGroup(array('term', 'termdesc', 'valid'), '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('Decoration method details: '); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); ZendX_JQuery::enableForm($this); parent::__construct($options); $this->setName('research'); $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'))); $investigator = new Zend_Form_Element_Text('investigator'); $investigator->setLabel('Principal work conducted by: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a lead for this project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addMultiOptions(array(NULL => NULL, 'Choose type of research' => $projectype_list))->addValidator('inArray', false, array(array_keys($projectype_list)))->setDecorators($decorators); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttrib('size', 60)->addErrorMessage('Choose title for the project.')->setDecorators($decorators)->addValidator('Alnum', false, array('allowWhiteSpace' => true)); $description = $this->addElement('RTE', 'description', array('label' => 'Short description of project: ')); $description = $this->getElement('description')->setRequired(false)->addFilter('stringTrim')->setAttribs(array('cols' => 80, 'rows' => 10))->addFilters(array('BasicHtml', 'StringTrim', 'EmptyParagraph'))->addDecorator('HtmlTag', array('tag' => 'li')); $startDate = new ZendX_JQuery_Form_Element_DatePicker('startDate'); $startDate->setLabel('Start date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->addValidator('Date')->setRequired(false)->addErrorMessage('You must enter a start date for this project')->setDecorators($decorators); $endDate = new ZendX_JQuery_Form_Element_DatePicker('endDate'); $endDate->setLabel('End date of project')->setAttrib('size', 20)->setJQueryParam('dateFormat', 'yy-mm-dd')->setRequired(false)->addValidator('Date')->addErrorMessage('You must enter an end date for this project')->setDecorators($decorators); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Make public: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Digits')->setDecorators($decorators); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->removeDecorator('label')->setAttrib('class', 'large')->removeDecorator('HtmlTag')->removeDecorator('DtDdWrapper'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $this->addElements(array($title, $description, $level, $startDate, $endDate, $valid, $investigator, $submit, $hash)); $this->addDisplayGroup(array('title', 'investigator', 'level', 'description', 'startDate', 'endDate', 'valid'), 'details')->removeDecorator('HtmlTag'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options = null) { $projecttypes = new ProjectTypes(); $projectype_list = $projecttypes->getTypes(); $periods = new Periods(); $period_options = $periods->getPeriodFrom(); parent::__construct($options); $this->setName('suggested'); $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'))); $level = new Zend_Form_Element_Select('level'); $level->setLabel('Level of research: ')->setRequired(true)->addMultiOptions(array('Please choose a level' => NULL, 'Research levels' => $projectype_list))->addValidator('InArray', false, array(array_keys($projectype_list)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators); $period = new Zend_Form_Element_Select('period'); $period->setLabel('Broad research period: ')->setRequired(true)->addMultiOptions(array('Please choose a period' => NULL, 'Periods available' => $period_options))->addValidator('InArray', false, array(array_keys($period_options)))->addFilters(array('StringTrim', 'StripTags'))->setDecorators($decorators); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Project title: ')->setRequired(true)->setAttrib('size', 60)->addFilters(array('StringTrim', 'StripTags'))->addErrorMessage('Choose title for the project.')->setDecorators($decorators); $description = $this->addElement('Textarea', 'description', array('label' => 'Short description of project: ')); $description = $this->getElement('description')->setRequired(false)->addFilters(array('StringTrim', 'BasicHtml', 'EmptyParagraph', 'WordChars'))->setAttribs(array('cols' => 80, 'rows' => 10))->addDecorator('HtmlTag', array('tag' => 'li')); $valid = new Zend_Form_Element_Checkbox('taken'); $valid->setLabel('Is the topic taken: ')->setRequired(true)->setDecorators($decorators)->addValidator('Int'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(4800); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->removeDecorator('label')->removeDecorator('HtmlTag')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper'); $this->addElements(array($title, $level, $period, $description, $valid, $submit, $hash)); $this->addDisplayGroup(array('title', 'level', 'period', 'description', 'taken'), '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'); }
public function init() { $tr = Zend_Registry::get('tr'); $name = new Zend_Form_Element_Text('name'); $name->setLabel($tr->_('NAME')); $name->setRequired(true); $this->addElement($name); $enabled = new Zend_Form_Element_Checkbox('enabled'); $enabled->setLabel($tr->_('IS_ACTION_ENABLED')); $this->addElement($enabled); $public = new Zend_Form_Element_Checkbox('public'); $public->setLabel($tr->_('IS_ACTION_PUBLIC')); $this->addElement($public); $route = new Zend_Form_Element_Text('route'); $route->setLabel($tr->_('ROUTE')); $route->setRequired(true); $this->addElement($route); $desc = new Zend_Form_Element_Textarea('description'); $desc->cols = 35; $desc->rows = 15; $desc->setLabel($tr->_('DESCRIPTION')); $desc->setRequired(false); $this->addElement($desc); parent::init(); }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oMessage = new Zend_Form_Element_Textarea("message"); $oMessage->setFilters($this->_aFilters); $oMessage->setRequired(FALSE); $oMessage->removeDecorator("label"); $this->addElement($oMessage); $oIsDing = new Zend_Form_Element_Checkbox("is_ding"); $oIsDing->setLabel("Włącz dźwięk"); $oIsDing->setValue(1); $this->addElement($oIsDing); $oSubmit = new Zend_Form_Element_Submit("send_message"); $oSubmit->setLabel("Wyślij wiadomość"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/chat.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
public function init() { $this->setAction('/core/event/new'); $this->setAttrib('enctype', 'multipart/form-data'); $eventModel = new Core_Model_Event(); $category = new Zend_Form_Element_Select('category_id'); $category->setLabel('Category')->setMultiOptions($eventModel->getCategories())->setAttrib('class', 'medium')->setDecorators(array('Composite')); $title = new Zend_Form_Element_Text('title'); $title->setLabel('Title')->setRequired(true)->addValidator('regex', true, array('pattern' => '/^.*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Wrong format')))->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'sessions', 'field' => 'title')))->setAttrib('class', 'medium')->setDescription('Must be between 2 and 30 characters, only letters, numbers and spaces allowed')->setDecorators(array('Composite')); $desc = new Zend_Form_Element_Textarea('description'); $desc->setLabel('Description')->setAttrib('class', 'medium')->setDescription('Please don\'t make your description too long')->setRequired(false)->addValidator('StringLength', true, array(1, 5000, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Please provide a longer description', Zend_Validate_StringLength::TOO_LONG => 'Your description is too long')))->setDecorators(array('Composite')); $locationModel = new Core_Model_Location(); $location = new Zend_Form_Element_Select('location_id'); $location->setLabel('Location')->setDescription('<a href="/core/location/new/type/2">Add a new location</a>')->setMultiOptions($locationModel->getLocationsForSelect())->setAttrib('class', 'medium')->setDecorators(array('Composite')); $closed = new Zend_Form_Element_Checkbox('closed'); $closed->setLabel('Closed meeting')->setRequired(false)->setDecorators(array('Composite')); $cancelled = new Zend_Form_Element_Checkbox('cancelled'); $cancelled->setLabel('Meeting cancelled')->setRequired(false)->setDecorators(array('Composite')); $registration = new Zend_Form_Element_Text('registration'); $registration->setLabel('Registration link')->addValidator('Url')->setAttrib('class', 'medium')->setDescription('Please supply a valid Url')->setDecorators(array('Composite')); $person = new Zend_Form_Element_Text('persons'); $person->setLabel('Persons')->setAttrib('class', 'medium')->setDescription('Please add person(s)')->setDecorators(array('Composite')); $start = new Zend_Form_Element_Text('tstart'); $start->setLabel('Start')->setDescription('dd/MM/yyyy HH:mm - 23/11/2011 14:30')->setAttrib('class', 'medium')->addFilter('Null')->setRequired(false)->setDecorators(array('Composite')); $end = new Zend_Form_Element_Text('tend'); $end->setLabel('End')->setDescription('dd/MM/yyyy HH:mm')->setAttrib('class', 'medium')->addFilter('Null')->addValidator('DateIsLater', false, array('tstart'))->setRequired(false)->setDecorators(array('Composite')); $resize = new TA_Filter_ImageResize(); $resize->setWidth(260)->setHeight(170); $image = new TA_Form_Element_MagicFile('file'); $image->setLabel('Image')->setDescription('This image will show on the event details page')->addDecorators($this->_magicFileElementDecorator)->addFilter($resize)->addValidators(array(array('Count', true, 1), array('IsImage', true), array('Size', true, array('max' => '5Mb')), array('ImageSize', true, array('minwidth' => 300, 'minheight' => 200)))); $this->addElements(array($category, $title, $person, $start, $end, $registration, $desc, $location, $closed, $cancelled, $image)); $this->addElement('submit', 'submit', array('label' => 'Submit', 'decorators' => $this->_buttonElementDecorator)); }
/** The constructor * @access public * @param array $options * @return void */ public function __construct(array $options = null) { $finds = new Findspots(); $schema = $finds->info(); $fields = array_flip($schema['cols']); $remove = array('updated', 'created', 'updatedBy', 'createdBy', 'institution', 'findID', 'address', 'fourFigure', 'gridlen', 'postcode', 'easting', 'northing', 'declong', 'declat', 'fourFigureLat', 'fourFigureLon', 'woeid', 'geonamesID', 'osmNode', 'elevation', 'geohash', 'country', 'map25k', 'map10k', 'soiltype', 'smrref', 'otherref', 'id', 'accuracy', 'secuid', 'old_occupierid', 'occupier', 'old_findspotid', 'date'); foreach ($remove as $rem) { unset($fields[$rem]); } $labels = array('gridrefcert' => 'Grid reference certainty', 'gridref' => 'Grid reference', 'knownas' => 'Known as', 'disccircum' => 'Discovery circumstances', 'gridrefsrc' => 'Grid reference source', 'landusevalue' => 'Land use value', 'landusecode' => 'Land use code', 'depthdiscovery' => 'Depth of discovery', 'Highsensitivity' => 'High sensitivity'); parent::__construct($options); $this->setName('configureFindSpotCopy'); $elements = array(); foreach (array_keys($fields) as $field) { $label = $field; $field = new Zend_Form_Element_Checkbox($field); if (array_key_exists($label, $labels)) { $clean = ucfirst($labels[$label]); } else { $clean = ucfirst($label); } $field->setLabel($clean)->setRequired(false)->addValidator('NotEmpty', 'boolean'); $elements[] = $field; $this->addElement($field); } $this->addDisplayGroup($elements, 'details'); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Submit find spot configuration'); $this->addElement($submit); $this->details->setLegend('Choose fields: '); parent::init(); }
public function __construct($options = null) { parent::__construct($options); $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('dynasticDetails'); $dynasty = new Zend_Form_Element_Text('dynasty'); $dynasty->setLabel('Dynastic name: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('NotEmpty')->addErrorMessage('Come on it\'s not that hard, enter a name for this dynasty!')->setDecorators($decorators); $date_from = new Zend_Form_Element_Text('date_from'); $date_from->setLabel('Issued coins from: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a date for the start of reign')->setDecorators($decorators); $date_to = new Zend_Form_Element_Text('date_to'); $date_to->setLabel('Issued coins until: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Int')->addErrorMessage('You must enter a date for the end of reign')->setDecorators($decorators); $description = new Pas_Form_Element_RTE('description'); $description->setLabel('Description: ')->setRequired(true)->setAttrib('rows', 10)->setAttrib('cols', 40)->setAttrib('Height', 400)->setAttrib('ToolbarSet', 'Finds')->addFilters(array('BasicHtml', 'EmptyParagraph', 'WordChars'))->addErrorMessage('You must enter a description')->addDecorator('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')); $valid = new Zend_Form_Element_Checkbox('valid'); $valid->setLabel('Is this dynasty valid?')->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submit')->setAttrib('class', 'large')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag'); $hash = new Zend_Form_Element_Hash('csrf'); $hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60); $this->addElement($hash); $this->addElements(array($dynasty, $date_from, $date_to, $description, $valid, $submit)); $this->removeDecorator('HtmlTag'); $this->addDisplayGroup(array('dynasty', 'date_from', 'date_to', 'description', 'valid', 'submit'), 'details'); $this->details->addDecorators(array('FormElements', array('HtmlTag', array('tag' => 'ul')))); $this->details->removeDecorator('DtDdWrapper'); $this->details->removeDecorator('HtmlTag'); }