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); }
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')); }
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')); }
/** 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(); }
/** 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(); }
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)); }
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')); }
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)); }
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')); }
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)); }
/** 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(); }
/** * * 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(); }
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)); }
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); }
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')); }
public function init() { require_once APPLICATION_PATH . '/configs/translations/pt_BR.php'; $translate = new Zend_Translate('array', $translationStrings, 'pt'); $this->setTranslator($translate); $this->addElementPrefixPath('FernandoMantoan_Validate', 'FernandoMantoan/Validate/', 'validate'); $this->setName('emprestimo'); $id = new Zend_Form_Element_Hidden('id'); $data_emprestimo = new Zend_Form_Element_Text('data_emprestimo'); $data_emprestimo->setLabel('Data do Empréstimo:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Date'); $membroFacade = FernandoMantoan_DesignPatterns_Factory_FactoryFacade::createInstance(FernandoMantoan_DesignPatterns_Factory_FactoryFacade::FACADE_MEMBER); $membros_options = $membroFacade->htmlselectBusiness(); $membro_id = new Zend_Form_Element_Select('membro_id'); $membro_id->addMultiOption('', 'Escolha um Membro'); if (sizeof($membros_options) > 0) { foreach ($membros_options as $membro) { $membro_id->addMultiOption($membro['id'], $membro['nome']); } } $membro_id->setLabel('Membro:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $valor_juros = new Zend_Form_Element_Text('valor_juros'); $valor_juros->setLabel('Valor do Juros: R$')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Float'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Salvar')->setAttrib('id', 'submitbutton'); $this->addElements(array($id, $data_emprestimo, $membro_id, $valor_juros, $submit)); }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $itemid = new Zend_Form_Element_Hidden('ItemID'); $itemid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden')))); $maTS = new Zend_Form_Element_Text('MaTS'); $maTS->setOptions(array('label' => 'Mã TS', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $tenTS = new Zend_Form_Element_Text('TenTS'); $tenTS->setOptions(array('label' => 'Tên tài sản', 'required' => TRUE, 'filters' => array('StringTrim')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $descr = new Zend_Form_Element_Textarea('Description'); $descr->setOptions(array('label' => 'Mô tả', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $type = new Zend_Form_Element_Select('Type'); $type->setOptions(array('label' => 'Loại bảo mật', 'required' => TRUE, 'MultiOptions' => array(1 => 'Bảo mật thấp', 0 => 'Bảo mật cao')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $startDate = new Zend_Form_Element_Text('StartDate'); $startDate->setOptions(array('label' => 'Bắt đầu SD', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $price = new Zend_Form_Element_Text('Price'); $price->setOptions(array('label' => 'Giá', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $warrantyTime = new Zend_Form_Element_Text('WarrantyTime'); $warrantyTime->setOptions(array('label' => 'Bảo hành', 'required' => TRUE, 'filters' => array('Int')))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $status = new Zend_Form_Element_Select('Status'); $status->setOptions(array('label' => 'Tình trạng', 'required' => TRUE, 'MultiOptions' => array(0 => 'Có thể mượn', 1 => 'Đang cho mượn', 2 => 'Hỏng')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $place = new Zend_Form_Element_Textarea('Place'); $place->setOptions(array('label' => 'Địa điểm hiện tại', 'style' => "width: 200px; height: 50px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('item-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($itemid, $maTS, $tenTS, $descr, $type, $startDate, $price, $warrantyTime, $status, $place))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
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'); $types = Engine_Api::_()->getDbtable('modules', 'ynmoderation')->getTypesAssoc(); $typeMultiOptions = array(0 => ' '); foreach ($types as $key => $value) { $typeMultiOptions[$key] = $value; } $type_id = new Zend_Form_Element_Select('type_id'); $type_id->setLabel('Type')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($typeMultiOptions); $description = new Zend_Form_Element_Text('description'); $description->setLabel('Description')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $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->addElements(array($type_id, $description, $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)); }
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'); }
/** * Initializing form */ public function init() { parent::init(); $element = new Zend_Form_Element_Select('year'); $element->setLabel('Jaar')->addMultiOption('', '...')->setDescription('Percentages zijn van toepassing op dit jaartal')->setRequired(true); $entries = Model_Hm_Week_Percentage::findAllByHomeId($this->getHomeId())->select('wp.year, wp.id, wp.hm_home_id')->execute(null, Doctrine_Core::HYDRATE_ARRAY); $availableYears = new Model_Hm_AvailableYears($entries); foreach ($availableYears->toArray() as $year) { $element->addMultiOption($year, $year); } $this->addElement($element); $this->addDisplayGroup(array('year'), 'year-group', array('legend' => 'Algemeen', 'class' => 'width100')); for ($weekNo = 01; $weekNo <= 53; $weekNo++) { $elementName = 'week_' . $weekNo; $elements[] = $elementName; $element = new Zend_Form_Element_Text($elementName); $element->setLabel('Percentage')->setValidators(array(array('Float')))->setAttribs(array('maxlength' => 6))->setRequired(true); $this->addElement($element); $this->addDisplayGroup(array($elementName), $elementName . 'group', array('class' => 'weekpercentage', 'legend' => 'Week ' . $weekNo)); } $element = new Zend_Form_Element_Submit('submit_percentageweek'); $element->setLabel('Verwerken')->setAttrib('class', 'submit'); $this->addElement($element); $this->addDisplayGroup(array('submit_percentageweek'), 'submit', array('class' => 'submit')); $this->bhvkDecorators(); $this->bhvkDecorateSubmitElement($this->getElement('submit_percentageweek')); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $noi_dung = new Zend_Form_Element_Textarea('noi_dung'); $noi_dung->setLabel('Nội dung (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'noi_dung', 'class' => 'text-input textarea')); $soundcloud_embed = new Zend_Form_Element_Text('soundcloud_embed'); $soundcloud_embed->setLabel('Embed SoundCloud')->setDescription('How to get SoundCloud embed code? <a href="http://help.soundcloud.com/customer/portal/articles/243751-how-can-i-put-my-track-or-playlist-on-my-site-or-blog-" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $youtube_embed = new Zend_Form_Element_Text('youtube_embed'); $youtube_embed->setLabel('Embed Youtube')->setDescription('How to get Youtube embed code? <a href="https://support.google.com/youtube/answer/171780?hl=en" target="_blank">Click here</a>')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'div', 'escape' => false, 'placement' => 'append')), array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $link_nct = new Zend_Form_Element_Text('link_nct'); $link_nct->setLabel('Nhac cua tui')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $link_mp3 = new Zend_Form_Element_Text('link_mp3'); $link_mp3->setLabel('Mp3')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 90%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $noi_bat = new Zend_Form_Element_Select('noi_bat'); $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/bai_giang')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $_SERVER['HTTP_REFERER'] . '"')); $this->addElements(array($tieu_de, $noi_dung, $soundcloud_embed, $youtube_embed, $link_nct, $link_mp3, $trang_thai, $noi_bat, $photo, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); }
public function init() { $this->setName('f2')->setAttrib('enctype', 'multipart/form-data')->setMethod('post'); $this->addElement('Hidden', 'search', array('value' => 1)); $tieu_de = new Zend_Form_Element_Text('tieu_de'); $tieu_de->setLabel('Tiêu đề (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 85%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input large-input'); $quan_trong = new Zend_Form_Element_Select('quan_trong'); $quan_trong->setLabel('Quan Trọng')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $noi_bat = new Zend_Form_Element_Select('noi_bat'); $noi_bat->setLabel('Nổi Bật')->setRequired(true)->setValue(0)->addMultiOptions(array(0 => 'Không', 1 => 'Có'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $photo = new Zend_Form_Element_File('photo'); $photo->setLabel('Upload hình')->setDescription('(*.jgp, *.gif, *.png , < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('jpg,gif,png')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $image = new Zend_Form_Element_Image('image'); $image->setLabel('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $statusOptions = array("multiOptions" => Default_Model_Constraints::trang_thai()); $trang_thai = new Zend_Form_Element_Radio('trang_thai', $statusOptions); $trang_thai->setRequired(true)->setLabel('Trạng thái')->setValue('1')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $mo_ta_tom_tat = new Zend_Form_Element_Textarea('mo_ta_tom_tat'); $mo_ta_tom_tat->setLabel('Mô tả tóm tắt')->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_tom_tat', 'class' => 'textarea', 'rows' => '4')); $mo_ta_chi_tiet = new Zend_Form_Element_Textarea('mo_ta_chi_tiet'); $mo_ta_chi_tiet->setLabel('Mô tả chi tiết (*)')->setRequired(true)->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mo_ta_chi_tiet', 'class' => 'text-input textarea')); $pdf = new Zend_Form_Element_File('pdf'); $pdf->setLabel('Upload PDF')->setDescription('(*.pdf < 10MB )')->setDestination(BASE_PATH . '/upload/files/tin_tuc')->addValidator(new Zend_Validate_File_Extension(array('pdf')))->addValidator(new Zend_Validate_File_FilesSize(array('min' => 1, 'max' => 10485760, 'bytestring' => true)))->setDecorators(array('File', 'Errors', array('Description', array('escape' => false, 'tag' => 'div', 'placement' => 'append')), array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $submitCon = new Zend_Form_Element_Submit('submitCon'); $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $submitExit = new Zend_Form_Element_Submit('submitExit'); $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button')); $url = new Zend_View_Helper_Url(); $link = $url->url(array('module' => 'admin', 'controller' => 'tin-tuc', 'action' => 'index'), null, true); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"')); $this->addElements(array($tieu_de, $quan_trong, $noi_bat, $photo, $image, $pdf, $trang_thai, $mo_ta_tom_tat, $mo_ta_chi_tiet, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submit', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'tin_tuc')), 'Form')); }
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')); $username = new Zend_Form_Element_Text('username'); $username->setLabel('Username')->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')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $levelMultiOptions = array(0 => ' '); /* $table = $this->_helper->api()->getItemTable('user'); $select = $viewer->membership()->getMembersSelect('user_id'); $friends = $table->fetchAll($select);*/ $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->fetchAll(); foreach ($levels as $row) { $levelMultiOptions[$row->level_id] = $row->getTitle(); } $level_id = new Zend_Form_Element_Select('level_id'); $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions); $enabled = new Zend_Form_Element_Select('enabled'); $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->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->addElements(array($username, $email, $level_id, $enabled, $submit)); // Set default action $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array())); }
public function FrmSaleOrderUpdate($frm = null) { $db = new saleorder_Model_DbTable_DbSaleOrder(); $rs_table = $db->getAllTable(); $option_table = array('0' => $this->tr->translate("CHOOSE_TABLE")); foreach ($rs_table as $row) { $option_table[$row["tab_id"]] = $row["code"] . ":" . $row["name_en"] . "-" . $row["name_km"]; } $table = new Zend_Form_Element_Select("tables"); $table->setAttribs(array('class' => 'select validate[required]', 'style' => 'width:100%')); $table->setMultiOptions($option_table); $rs_product = $db->getAllProduct(); $option_product = array(0 => $this->tr->translate('CHOOSE_PRODUCT')); foreach ($rs_product as $row) { $option_product[$row["pro_id"]] = $row["item_code"] . '-' . $row["name_kh"] . '-' . $row["name_en"]; } $product = new Zend_Form_Element_Select("product"); $product->setAttribs(array('class' => 'select form-control', 'style' => 'width:100%')); $product->setMultiOptions($option_product); $c_date = date('Y-m-d'); $date = new Zend_Form_Element_Text('dates'); $date->setAttribs(array('id' => 'dates', 'style' => 'float:left;width:100%', 'class' => 'form-control validate[required]')); //$date->setValue($c_date); $saleorder_num = $db->getSaleOrderNo(); $saleorder_no = new Zend_Form_Element_Text("saleorder_nos"); $saleorder_no->setAttribs(array('class' => 'validate[required]', 'readOnly' => 'readOnly', 'style' => 'color:red')); $saleorder_no->setValue($saleorder_num); $this->addElements(array($product, $table, $date, $saleorder_no)); if ($frm != "") { $saleorder_no->setValue($frm["saleorder_no"]); $table->setValue($frm["tab_id"]); $date->setValue($frm["date"]); } return $this; }
public function init() { // if (!$this->hasTranslator()) { // $this->setTranslator(Zend_Registry::get('Zend_Translate')); // } $userid = new Zend_Form_Element_Hidden('UserID'); $userid->setDecorators(array(array('ViewHelper', array('helper' => 'formHidden')))); $username = new Zend_Form_Element_Text('Username'); $username->setOptions(array('label' => 'Username', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $birthday = new Zend_Form_Element_Text('Birthday'); $birthday->setOptions(array('label' => 'Birthday', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $role = new Zend_Form_Element_Select('Role'); $role->setOptions(array('label' => 'User Type', 'MultiOptions' => array(3 => 'User', 2 => 'IT', 1 => 'Admin', 0 => 'SuperAdmin')))->setDecorators(array(array('ViewHelper', array('helper' => 'formSelect')), array('Label', array('class' => 'label')))); $fullname = new Zend_Form_Element_Text('FullName'); $fullname->setOptions(array('label' => 'FullName'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $email = new Zend_Form_Element_Text('Email'); $email->setOptions(array('label' => 'Email', 'required' => TRUE))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $group = new Zend_Form_Element_Text('Group'); $group->setOptions(array('label' => 'Group'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $phone = new Zend_Form_Element_Text('Phone'); $phone->setOptions(array('label' => 'Phone'))->setDecorators(array(array('ViewHelper', array('helper' => 'formText')), array('Label', array('class' => 'label')))); $address = new Zend_Form_Element_Textarea('Address'); $address->setOptions(array('label' => 'Address', 'style' => "width: 200px; height: 150px"))->setDecorators(array(array('ViewHelper', array('helper' => 'formTextarea')), array('Label', array('class' => 'label')))); $this->setName('user-form')->setMethod(Zend_Form::METHOD_POST)->setEnctype(Zend_Form::ENCTYPE_URLENCODED)->addElements(array($userid, $username, $role, $fullname, $email, $birthday, $group, $phone, $address))->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'fieldset', 'style' => "padding: 0; border: 0; margin-top: 25px;")), 'Form')); }
/** * * Themes & styles * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap'); $css_theme = new Zend_Form_Element_Select('css_theme'); $css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control'); $wide_layout = new Zend_Form_Element_Checkbox('wide_layout'); $wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0"); $cover_ysize = new Zend_Form_Element_Text('cover_ysize'); $cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control'); $user_background = new Zend_Form_Element_Checkbox('user_background'); $user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background'); $subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $custom_css = new Zend_Form_Element_Textarea('css_custom'); $custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit)); $this->postInit(); }
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'); $displayname = new Zend_Form_Element_Text('displayname'); $displayname->setLabel('Display Name')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $username = new Zend_Form_Element_Text('username'); $username->setLabel('Username')->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')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div')); $levels = Engine_Api::_()->getDbtable('levels', 'authorization')->getLevelsAssoc(); $levelMultiOptions = array(0 => ' '); foreach ($levels as $key => $value) { $levelMultiOptions[$key] = $value; } $level_id = new Zend_Form_Element_Select('level_id'); $level_id->setLabel('Level')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions($levelMultiOptions); $enabled = new Zend_Form_Element_Select('enabled'); $enabled->setLabel('Approved')->clearDecorators()->addDecorator('ViewHelper')->addDecorator('Label', array('tag' => null, 'placement' => 'PREPEND'))->addDecorator('HtmlTag', array('tag' => 'div'))->setMultiOptions(array('-1' => '', '0' => 'Not Approved', '1' => 'Approved'))->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($displayname, $username, $email, $level_id, $enabled, $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)); }
public function __construct($options = null) { parent::__construct($options); // salutation $salutation = new Zend_Form_Element_Select('salutation'); $salutation->setLabel('Salutation :')->setAttrib('class', 'largeSelect'); $categoriesData = $this->getView()->getAllSalutation(); foreach ($categoriesData as $categoryData) { $salutation->addMultiOption($categoryData['C_ID'], $categoryData['CI_Title']); } $this->addElement($salutation); // fName $fname = new Zend_Form_Element_Text('firstName'); $fname->setLabel($this->getView()->getCibleText('form_label_fname'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($fname); // lName $lname = new Zend_Form_Element_Text('lastName'); $lname->setLabel($this->getView()->getCibleText('form_label_lname'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($lname); // email $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()->getCibleText('form_label_email'))->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', 'stdTextInput'); $this->addElement($email); }
public function __construct($options = null) { // variable parent::__construct($options); $baseDir = $options['baseDir']; // name $name = new Zend_Form_Element_Text('EGI_Name'); $name->setLabel($this->getView()->getCibleText('form_label_name'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput'); $this->addElement($name); // description $description = new Zend_Form_Element_Textarea('EGI_Description'); $description->setLabel($this->getView()->getCibleText('form_label_description'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextareaEdit'); $this->addElement($description); //status $status = new Zend_Form_Element_Select('EG_Status'); $status->setLabel($this->getView()->getCibleText('form_label_status'))->setAttrib('class', 'stdSelect'); $status = Cible_FunctionsGeneral::fillStatusSelectBox($status, 'Extranet_Groups', 'EG_Status'); $this->addElement($status); // Hidden GroupID $groupID = new Zend_Form_Element_Hidden('groupID'); $groupID->removeDecorator('label'); $groupID->removeDecorator('DtDdWrapper'); if (isset($options['groupID'])) { $groupID->setValue($options['groupID']); } $this->addElement($groupID); }
/** Construct the form * @access public * @param type $options * @return void */ public function __construct(array $options = null) { $cats = new CategoriesCoins(); $cat_options = $cats->getCategoriesAll(); $rulers = new Rulers(); $ruler_options = $rulers->getAllMedRulers(); parent::__construct($options); $this->setName('MedievalType'); $type = new Zend_Form_Element_Text('type'); $type->setLabel('Medieval type: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setAttribs(array('class' => 'textInput', 'class' => 'span8')); $broadperiod = new Zend_Form_Element_Select('periodID'); $broadperiod->setLabel('Broadperiod for type: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower'))->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'))->addMultioptions(array(null => 'Choose broadperiod', 'Available options' => array(47 => 'Early Medieval', 29 => 'Medieval', 36 => 'Post Medieval'))); $category = new Zend_Form_Element_Select('categoryID'); $category->setLabel('Coin category: ')->setAttribs(array('class' => 'textInput'))->addFilter('StringTrim')->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'))->addMultioptions(array(null => 'Choose a category', 'Available options' => $cat_options))->addValidator('InArray', false, array(array_keys($cat_options))); $ruler = new Zend_Form_Element_Select('rulerID'); $ruler->setLabel('Ruler assigned to: ')->setAttribs(array('class' => 'input-xxlarge selectpicker show-menu-arrow'))->addFilter('StringTrim')->addMultioptions(array(null => 'Choose a ruler', 'Available options' => $ruler_options))->addValidator('inArray', false, array(array_keys($ruler_options))); $datefrom = new Zend_Form_Element_Text('datefrom'); $datefrom->setLabel('Date type in use from: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower')); $dateto = new Zend_Form_Element_Text('dateto'); $dateto->setLabel('Date type in use until: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim', 'StringToLower')); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Submit details for medieval coin type'); $this->addElements(array($type, $broadperiod, $category, $ruler, $datefrom, $dateto, $submit))->setLegend('Add an active type of Medieval coin')->setMethod('post'); parent::init(); }