public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'holidaygroups'); $id = new Zend_Form_Element_Hidden('id'); $holidayname = new Zend_Form_Element_Text('holidayname'); $holidayname->setAttrib('maxLength', 20); $holidayname->addFilter(new Zend_Filter_StringTrim()); $holidayname->setRequired(true); $holidayname->addValidator('NotEmpty', false, array('messages' => 'Please enter holiday.')); $holidayname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9.\\- ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid holiday.'))); $groupid = new Zend_Form_Element_Multiselect('groupid'); $groupid->setAttrib('class', 'selectoption'); $groupid->setRegisterInArrayValidator(false); $groupid->setRequired(true); $groupid->addValidator('NotEmpty', false, array('messages' => 'Please select holiday group.')); $holiday_date = new ZendX_JQuery_Form_Element_DatePicker('holidaydate'); $holiday_date->setAttrib('readonly', 'true'); $holiday_date->setAttrib('onfocus', 'this.blur()'); $holiday_date->setOptions(array('class' => 'brdr_none')); $holiday_date->setRequired(true); $holiday_date->addValidator('NotEmpty', false, array('messages' => 'Please select date.')); $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, $holidayname, $groupid, $holiday_date, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); $this->setElementDecorators(array('UiWidgetElement'), array('holidaydate')); }
protected function createButtons() { $this->submit = new Zend_Form_Element_Submit(self::BUTTON_SUBMIT); $this->submit->setLabel($this->submitName)->setAttrib('class', self::BUTTON_SUBMIT)->setIgnore(true); $this->cancel = new Zend_Form_Element_Submit(self::BUTTON_CANCEL); $this->cancel->setLabel('Cancel')->setAttrib('class', self::BUTTON_SUBMIT . ' ' . self::BUTTON_CANCEL)->setIgnore(true); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'timeformat/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'timeformat'); $id = new Zend_Form_Element_Hidden('id'); $timeformat = new Zend_Form_Element_Text('timeformat'); $timeformat->setAttrib('maxLength', 20); $timeformat->addFilter(new Zend_Filter_StringTrim()); $timeformat->setRequired(true); $timeformat->addValidator('NotEmpty', false, array('messages' => 'Please enter time format.')); $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'); $url = "'timeformat/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'timeformat\\');'"; $this->addElements(array($id, $timeformat, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function __construct($options = null) { parent::__construct($options); $this->setAttrib('enctype', 'multipart/form-data'); $this->setName('AddRulerImage'); $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'))); $image = new Zend_Form_Element_File('image'); $image->setLabel('Upload an image: ')->setRequired(true)->setDestination('./images/rulers/')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'jpeg,tif,jpg,png,gif,JPG,TIFF')->setMaxFileSize(1024000)->setAttribs(array('class' => 'textInput'))->addValidator('Count', false, array('min' => 1, 'max' => 1))->addDecorator('File'); $caption = new Zend_Form_Element_Text('caption'); $caption->setLabel('Image caption')->setRequired(true)->setAttrib('size', 60)->setDecorators($decorators)->addFilters(array('StripTags', 'StringTrim'))->addErrorMessage('You must enter a label'); $rulerID = new Zend_Form_Element_Hidden('rulerID'); $rulerID->removeDecorator('label')->removeDecorator('HtmlTag')->addValidator('Int')->setRequired(true); $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 button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Upload an image of a ruler')->setAttribs(array('class' => 'large')); $this->addElements(array($image, $rulerID, $caption, $submit))->setLegend('Add an image to a ruler profile'); $this->addDisplayGroup(array('image', 'caption'), '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'); //$this->setAttrib('action',DOMAIN.'language/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'servicedeskdepartment'); $id = new Zend_Form_Element_Hidden('id'); $servicedeskdepartment = new Zend_Form_Element_Text("service_desk_name"); $servicedeskdepartment->setLabel("Category"); $servicedeskdepartment->setAttrib('maxLength', 30); $servicedeskdepartment->addFilter(new Zend_Filter_StringTrim()); $servicedeskdepartment->setRequired(true); $servicedeskdepartment->addValidator('NotEmpty', false, array('messages' => 'Please enter category.')); $servicedeskdepartment->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9\\- ]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid category.'))); $servicedeskdepartment->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_sd_depts', 'field' => 'service_desk_name', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" AND isactive=1'))); $servicedeskdepartment->getValidator('Db_NoRecordExists')->setMessage('Category name already exists.'); $description = new Zend_Form_Element_Textarea('description'); $description->setLabel("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, $servicedeskdepartment, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function __construct(array $dataBusinessId, $options = null) { parent::__construct($options); $this->setName('frmEmployee'); $this->setMethod('post'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Employee name'); $name->setAttrib('maxlength', 80); $name->setRequired(true); $name->addValidator(new Zend_Validate_NotEmpty()); $this->addElement($name); $age = new Zend_Form_Element_Text('age'); $age->setLabel('Employee age'); $age->addValidator(new Zend_Validate_Int()); $this->addElement($age); $businessId = new Zend_Form_Element_Select('business_id'); $businessId->setLabel('Business'); $businessId->setRequired(true); $businessId->addValidator(new Zend_Validate_NotEmpty()); $businessId->addValidator(new Zend_Validate_Int()); $businessId->addMultiOptions($dataBusinessId); $this->addElement($businessId); $submit = new Zend_Form_Element_Submit('bt_submit'); $submit->setLabel('Save'); $this->addElement($submit); }
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')); }
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')); }
/** 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(); }
public function init() { $this->setName('transfer_target'); $this->setAttrib('class', 'form-inline'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $host2 = new Zend_Form_Element_Text('host2'); $host2->setAttrib('class', 'form-control')->setLabel('host2'); $host2->setDecorators(array('ViewHelper', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3')))); $user2 = new Zend_Form_Element_Text('user2'); $user2->setLabel('user2'); $user2->setAttrib('class', 'form-control'); $user2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3')))); $password2 = new Zend_Form_Element_Text('password2'); $password2->setLabel('pass2'); $password2->setAttrib('class', 'form-control'); $password2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Submit'); $submit->setAttrib('class', 'btn btn-default'); $submit->setValue('transfer_target'); $submit->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'colspan' => 2, 'align' => 'center')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $this->addElements(array($host2, $user2, $password2, $submit)); $this->setDecorators(array('FormElements', 'Form')); }
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)); }
/** * 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); }
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 __construct($options = null) { $this->_disabledDefaultActions = true; $readOnly = $options['readOnlyForm']; $payement = $options['payMean']; $config = Zend_Registry::get('config'); unset($options['readOnlyForm']); unset($options['payMean']); parent::__construct($options); $this->setAttrib('id', 'accountManagement'); $buttonLabel = $this->getView()->getClientText('form_label_confirm_order_btn'); if (in_array($payement, array('visa', 'mastercard'))) { $this->setAction($config->payment->url); $buttonLabel = $this->getView()->getClientText('form_label_confirm_payment_btn'); } $baseDir = $this->getView()->baseUrl(); // Account data summary $summary = new Cible_Form_Element_Html('summary', array('value' => $readOnly)); $summary->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline left')))); $this->addElement($summary); $storeId = new Zend_Form_Element_Hidden('ps_store_id', array('value' => $config->payment->storeId)); $storeId->removeDecorator('label'); $this->addElement($storeId); $hppKey = new Zend_Form_Element_Hidden('hpp_key', array('value' => $config->payment->hppkey)); $hppKey->removeDecorator('label'); $this->addElement($hppKey); $total = new Zend_Form_Element_Hidden('charge_total'); $total->removeDecorator('label'); $this->addElement($total); // Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel($buttonLabel)->setAttrib('class', 'nextStepButton')->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'stepBottomNext')))); $this->addElement($submit); }
private function _setupElements() { $translate = Zend_Registry::get('Zend_Translate'); $this->setAttrib('id', 'signupForm'); $this->setTranslator($translate); $email = new Zend_Form_Element_Text('email'); $email->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'email')->addValidator('EmailAddress'); $email->addValidator(new Ziown_Form_Validate_EmailAddress(), false); $email->getValidator('NotEmpty')->setMessage('Email Address is Required', 'isEmpty'); $username = new Zend_Form_Element_Text('username'); $username->setRequired(true)->addFilter('StringTrim')->addFilter('StripTags')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'username'); $username->addValidator(new Ziown_Form_Validate_UserName()); $username->getValidator('NotEmpty')->setMessage('User name is Required', 'isEmpty'); $password = new Zend_Form_Element_Password('password'); $password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-password')->setErrorMessages(array('Password is required')); $identValidator = new Zend_Validate_Identical($_POST['password']); $identValidator->setMessages(array('notSame' => 'Password doesn\'t match!', 'missingToken' => 'Password doesn\'t match!')); $confirm_password = new Zend_Form_Element_Password('confirm_password'); $confirm_password->setRequired(true)->removeDecorator('HtmlTag')->removeDecorator('DtDWrapper')->removeDecorator('label')->setAttrib('id', 'txt-confirm-password')->addValidator($identValidator); $signup = new Zend_Form_Element_Submit('signup'); $signup->setLabel('Sign Up'); $signup->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->setAttrib('class', 'u-login'); $this->setDecorators(array(array('ViewScript', array('script' => 'signup.phtml')))); $this->addElements(array($username, $password, $confirm_password, $signup, $email)); }
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() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'veteranstatus/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'veteranstatus'); $id = new Zend_Form_Element_Hidden('id'); $veteranstatus = new Zend_Form_Element_Text('veteranstatus'); $veteranstatus->setAttrib('maxLength', 20); $veteranstatus->setRequired(true); $veteranstatus->addValidator('NotEmpty', false, array('messages' => 'Please enter veteran status.')); $veteranstatus->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid veteran status.'))))); $veteranstatus->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_veteranstatus', 'field' => 'veteranstatus', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $veteranstatus->getValidator('Db_NoRecordExists')->setMessage('Veteran status already exists.'); $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'); $url = "'gender/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'gender\\');'"; $this->addElements(array($id, $veteranstatus, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { /* $this->setDecorators(array( array('Description', array('tag' => 'p', 'class' => 'description','escape' => false)), 'formElements', 'fieldset', array('form',array('class' => 'formdefault')) )); $this->setElementDecorators(array( 'ViewHelper', 'Description', 'Label', 'Errors', array(array('tipo' => 'HtmlTag'), array('tag' => 'div')) ));*/ //$this->setAttrib('class','formdefault consumidorForm'); //$this->setLegend('Enviar Arquivos'); $this->setName('upload'); $this->setAttrib('enctype', 'multipart/form-data'); $description = new Zend_Form_Element_Text('description'); $description->setLabel('Description')->setRequired(true)->addValidator('NotEmpty'); $file = new Zend_Form_Element_File('arquivo'); $file->setLabel('Selecione os arquivos EDI"s Zipados')->setDestination('temp/arquivos/zip')->setRequired(true)->addValidator('Extension', false, 'zip'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Enviar'); $this->addElements(array($file, $submit)); }
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() { $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->setName('send-tweet'); $e = new Zend_Form_Element_Text('latitude'); $e->setLabel('Latitude'); $e->addFilter('StringTrim'); $e->setAttrib('onblur', 'setMarkerFromForm()'); $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/')); $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Latitude is not valid'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Text('longitude'); $e->setLabel('Longitude'); $e->addFilter('StringTrim'); $e->setAttrib('onblur', 'setMarkerFromForm()'); $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/')); $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Longitude is not valid'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Textarea('tweet'); $e->setLabel('Tweet'); $e->setRequired(true); $e->addFilter('StripTags'); $e->addFilter('StringTrim'); $e->addValidator(new Zend_Validate_StringLength(array('max' => 140))); $e->setTranslator(new Zend_Translate_Adapter_Array(array('isEmpty' => 'Please supply the message to be tweeted', 'stringLengthTooLong' => 'No more than 140 characters please!'), 'en')); $this->addElement($e); $e = new Zend_Form_Element_Submit('send'); $e->setIgnore(true); $e->setLabel('Tweet!'); $this->addElement($e); }
public function __construct($options = null) { parent::__construct($options); $this->setName('WhatIDoForm'); // image, uploader $image = new Zend_Form_Element_File('Image'); $image->setLabel('Image:')->setDestination('img/profile')->addValidator('Count', false, 1)->addValidator('Size', false, 10000000)->addValidator('Extension', false, 'jpg,png,gif')->addFilter('Rename', 'WhatIDo.jpg'); // PictureCaption, string $pictureCaption = new Zend_Form_Element_Textarea('PictureCaption'); $pictureCaption->setLabel('Picture caption:')->setRequired(); // MainText, string $mainText = new Zend_Form_Element_Textarea('MainText'); $mainText->setLabel('Main text:')->setRequired(); // FooterText, string $footerText = new Zend_Form_Element_Textarea('FooterText'); $footerText->setLabel('Footer text:')->setRequired(); // LinkText, string $linkText = new Zend_Form_Element_Text('LinkText'); $linkText->setLabel('Link text:')->setRequired(); // LinkUrl, string $linkUrl = new Zend_Form_Element_Text('LinkUrl'); $linkUrl->setLabel('Link Url:')->setRequired(); // Submit button $submit = new Zend_Form_Element_Submit('Submit'); $submit->setLabel('Submit'); $this->addElements(array($image, $pictureCaption, $mainText, $footerText, $linkText, $linkUrl, $submit)); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'pdcategories'); $this->setAttrib('name', 'pdcategories'); $categoryName = new Zend_Form_Element_Text('category'); $categoryName->setAttrib('id', 'category'); $categoryName->setAttrib('name', 'category'); $categoryName->setAttrib('maxlength', '30'); $categoryName->setAttrib('onblur', 'chkCategory()'); $categoryName->setAttrib('onkeypress', 'chkCategory()'); $categoryName->addFilter(new Zend_Filter_StringTrim()); $categoryName->setRequired(true); $categoryName->addValidator('NotEmpty', false, array("messages" => 'Please enter category')); $categoryName->addValidator('regex', true, array('pattern' => '/^[a-zA-Z0-9][\\s+[a-zA-Z0-9]+]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid category'))); $categoryName->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_pd_categories', 'field' => 'category', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive = 1'))); $categoryName->getValidator('Db_NoRecordExists')->setMessage('Category already exists'); $categoryDesc = new Zend_Form_Element_Textarea('description'); $categoryDesc->setAttrib('id', 'description'); $categoryDesc->setAttrib('name', 'description'); $categoryDesc->setAttrib('rows', 10); $categoryDesc->setAttrib('cols', 50); $categoryDesc->setAttrib('maxlength', 250); $submitBtn = new Zend_Form_Element_Submit('submit'); $submitBtn->setAttrib('id', 'submitBtn'); $submitBtn->setLabel('Add'); $this->addElements(array($categoryName, $categoryDesc, $submitBtn)); $this->setElementDecorators(array('ViewHelper')); }
public function __construct($options = null) { parent::__construct($options); $accountId1 = new Zend_Form_Element_Hidden('accountId'); $productId1 = new Zend_Form_Element_Hidden('productId'); $memberId1 = new Zend_Form_Element_Hidden('memberId'); $maturedamount = new Zend_Form_Element_Hidden('maturedinterestamount'); $interestamountto = new Zend_Form_Element_Hidden('interestamountto'); $capitalamount = new Zend_Form_Element_Hidden('capitalamount'); $penalinterest = new Zend_Form_Element_Hidden('penalinterest'); $paymenttype = new Zend_Form_Element_Select('paymenttype'); $paymenttype->addMultiOption('', 'select..'); $paymenttype->setAttrib('class', 'NormalBtn'); $paymenttype->setAttrib('id', 'paymenttype'); $paymenttype->setAttrib('onchange', 'toggleField();'); $paymenttype->setRequired(true); $description = new Zend_Form_Element_Textarea('transactiondescription'); $description->setAttrib('class', 'textfield'); $description->setAttrib('rows', '2'); $description->setAttrib('cols', '20'); $no = new Zend_Form_Element_Textarea('paymenttype_details'); $no->setAttrib('class', 'textfield'); $no->setAttrib('rows', '1'); $no->setAttrib('cols', '20'); $no->setAttrib('id', 'paymenttype_details'); $no->setAttrib('style', 'display:none;'); $no->setRequired(true); $submit = new Zend_Form_Element_Submit('Finalize'); $submit->setLabel('Finalize'); $submit->setAttrib('class', 'recurring'); $this->addElements(array($accountId1, $productId1, $memberId1, $maturedamount, $submit, $capitalamount, $interestamountto, $penalinterest, $paymenttype, $description, $no)); }
public function __construct($parent = null, $options = null) { parent::__construct($options); $parentId = 0; if ($parent != null) { $parentId = $parent; } $translate = Zend_Registry::get('Zend_Translate'); $this->setName('comment_form'); $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator'); /* $comment_subject = new Zend_Form_Element_Text('comment_subject'); $comment_subject->setLabel($translate->_("content-view-comment-form-subject")) ->setRequired(true) ->setAttribs(array( 'class' => 'comment_subject')) ->addValidators(array( array('NotEmpty', true, array('messages' => array('isEmpty' => 'Tyhjä'))) )); */ $comment_message = new Zend_Form_Element_Textarea('comment_message'); $comment_message->setRequired(true)->setAttribs(array('rows' => 10, 'cols' => 58, 'class' => 'comment_textarea'))->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Tyhjä'))))); $comment_parent = new Zend_Form_Element_Hidden('comment_parent'); $comment_parent->setValue($parentId)->setAttribs(array('class' => 'comment_subject')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel($translate->_("submit")); $parent_username = new Zend_Form_Element_Hidden('parent_username'); $this->addElements(array($comment_message, $comment_parent, $submit, $parent_username)); }
/** * 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')); }
/** 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 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); }
public function __construct($options = null) { parent::__construct($options); $id = new Zend_Form_Element_Hidden('id'); $hierarchyLevel = new Zend_Form_Element_Hidden('hierarchyLevel'); $officeType = new Zend_Form_Element_Text('officeType'); $officeType->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(4, 50)))); // $officeType->addValidator($db_lookup_validator); $officeType->setAttrib('class', 'txt_put'); $officeType->setAttrib('id', 'officeType'); $officeCode = new Zend_Form_Element_Text('officeCode'); //add validation $officeCode->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(2, 2)))); $officeCode->setAttrib('class', 'txt_put'); $officeCode->setAttrib('id', 'officeCode')->setAttrib('size', '2'); $this->addElements(array($id, $officeType, $officeCode, $hierarchyLevel)); $submit = new Zend_Form_Element_Submit('Edit'); $submit->setAttrib('class', 'officebutton'); $submit->setLabel('edit'); $submit->removeDecorator('DtDdWrapper'); $next = new Zend_Form_Element_Submit('Next'); $next->setAttrib('class', 'officesubmit'); $next->setLabel('Next'); //add form element to form $this->addElements(array($submit, $next)); }
public function init() { $this->setMethod('post'); $this->setAttrib('action', DOMAIN . 'workeligibilitydoctypes/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'workeligibilitydoctypes'); $id = new Zend_Form_Element_Hidden('id'); $documenttype = new Zend_Form_Element_Text('documenttype'); $documenttype->setAttrib('maxLength', 50); $documenttype->setRequired(true); $documenttype->addValidator('NotEmpty', false, array('messages' => 'Please enter document type.')); $documenttype->addValidator("regex", true, array('pattern' => '/^(?=.*[a-zA-Z])([^ ][a-zA-Z0-9\\-\\s]*)$/', 'messages' => array('regexNotMatch' => 'Please enter valid document type.'))); $documenttype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_workeligibilitydoctypes', 'field' => 'documenttype', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $documenttype->getValidator('Db_NoRecordExists')->setMessage('Document type already exists.'); $issuingauthority = new Zend_Form_Element_Select('issuingauthority'); $issuingauthority->setRegisterInArrayValidator(false); $issuingauthority->setMultiOptions(array('' => 'Select issuing authority', '1' => 'Country', '2' => 'State', '3' => 'City')); $issuingauthority->setRequired(true); $issuingauthority->addValidator('NotEmpty', false, array('messages' => 'Please select issuing authority.')); $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, $documenttype, $issuingauthority, $description, $submit)); $this->setElementDecorators(array('ViewHelper')); }