private function _buildElements() { $date = new Zend_Form_Element_Text($this->_name . "_Date"); $date->setLabel("Date de publication"); $date->addValidator(new Zend_Validate_Date(array("format" => "dd/MM/yyyy hh:mm")), true); $date->setDescription("JJ/MM/AAAA hh:mm"); $date->setAttrib("size", 16); $date->addDecorators(array("br" => new Zend_Form_Decorator_HtmlTag(array("tag" => "br", "noAttribs" => true)), "hr" => new Zend_Form_Decorator_HtmlTag(array("tag" => "hr", "noAttribs" => true)))); $active = new Zend_Form_Element_Checkbox($this->_name . "_Active"); $active->setLabel("Est Actif"); $active->removeDecorator("dtDdWrapper"); $submit = new Zend_Form_Element_Submit($this->_name . "_Submit"); $submit->setLabel("Creer"); return array($date, $active, $submit); }
private function _buildTranslateFields() { $finalArray = array(); foreach ($this->_localeLanguageTable->getList() as $locale) { $titre = new Zend_Form_Element_Text($this->_name . "_Titre_" . $locale); $titre->setLabel("Titre " . $locale); $titre->addDecorators(array("article" => new Zend_Form_Decorator_HtmlTag(array("tag" => "article", "openOnly" => true)), "br" => new Zend_Form_Decorator_HtmlTag(array("tag" => "br", "noAttribs" => true)), "hr" => new Zend_Form_Decorator_HtmlTag(array("tag" => "hr", "noAttribs" => true)))); $text = new Zend_Form_Element_Textarea($this->_name . "_Text_" . $locale); $text->setLabel("Texte " . $locale); $text->addDecorators(array("article" => new Zend_Form_Decorator_HtmlTag(array("tag" => "article", "closeOnly" => true)))); $finalArray[] = $titre; $finalArray[] = $text; } return $finalArray; }
public function init() { $this->clearDecorators(); $this->setMethod("post"); // user $user = new Zend_Form_Element_Text('user'); $user->setLabel('User'); $user->setRequired(true); //$name->addValidator('alnum'); $user->addDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')))); $this->addElement($user); // password $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password'); $password->setRequired(true); //$name->addValidator('alnum'); $password->addDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')))); $this->addElement($password); }
public function init() { // cliente_id $cliente_id = new Zend_Form_Element_Select('cliente_id'); $cliente_id->setLabel('Cliente: '); $cliente_id->setMultiOptions($this->getClientes()); $cliente_id->addDecorators(Form_Decorators::$simpleElementDecorators); $cliente_id->setRequired(); // senha_tipo_id $senha_tipo_id = new Zend_Form_Element_Select('senha_tipo_id'); $senha_tipo_id->setLabel('Tipo Senha: '); $senha_tipo_id->setMultiOptions($this->getSenhasTipo()); $senha_tipo_id->setRequired(); $senha_tipo_id->addDecorators(Form_Decorators::$simpleElementDecorators); // senha_host $senha_host = new Zend_Form_Element_Text('senha_host'); $senha_host->setLabel('Host: '); $senha_host->setRequired(); $senha_host->addDecorators(Form_Decorators::$simpleElementDecorators); // senha_usuario $senha_usuario = new Zend_Form_Element_Text('senha_usuario'); $senha_usuario->setLabel('Usuário: '); $senha_usuario->setRequired(); $senha_usuario->addDecorators(Form_Decorators::$simpleElementDecorators); // senha_senha $senha_senha = new Zend_Form_Element_Text('senha_senha'); $senha_senha->setLabel('Senha: '); $senha_senha->setRequired(); $senha_senha->addDecorators(Form_Decorators::$simpleElementDecorators); // senha_observacao $senha_observacao = new Zend_Form_Element_Textarea('senha_observacao'); $senha_observacao->setLabel('Observações: '); $senha_observacao->setAttrib('rows', 10); // submit $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Cadastrar'); $submit->setAttribs(array('id' => 'btn-nova-senha', 'class' => 'btn btn-sm btn-info form-control')); // add elements $this->addElements(array($cliente_id, $senha_tipo_id, $senha_host, $senha_usuario, $senha_senha, $senha_observacao, $submit)); // set defaults form attribs $this->setDefaultAttribs(); }
public function __construct($options = null) { $decorator = new My_Decorator_SimpleInput(); parent::__construct($options); $this->setDecorators(array('FormElements', 'Fieldset', 'Form')); $this->setName('datepicker'); $datefrom = new Zend_Form_Element_Text('datefrom'); $datefrom->setLabel('Date from: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Date'); $datefrom->addDecorators(array($decorator)); $dateto = new Zend_Form_Element_Text('dateto'); $dateto->setLabel('Date to: ')->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->addValidator('Date'); $dateto->addDecorators(array($decorator)); //Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setAttrib('class', 'datepick'); $submit->removeDecorator('DtDdWrapper'); $submit->removeDecorator('Label'); $this->addElements(array($datefrom, $dateto, $submit)); $this->setLegend('Choose your own dates: '); $this->addDisplayGroup(array('submit'), 'submit'); }
public function __construct($options, $levelno) { if ($options == 0) { $ZendTranslate = Zend_Registry::get('Zend_Translate'); $officeNo = new Zend_Form_Element_Select('officeNo'); $officeNo->setRequired(true); $officeNo->addMultiOption('', $ZendTranslate->_('select') . '...'); $officeNo->addMultiOption('2', '2'); $officeNo->addMultiOption('3', ' 3'); $officeNo->addMultiOption('4', ' 4'); $officeNo->addMultiOption('5', ' 5'); $officeNo->addMultiOption('6', ' 6'); $officeNo->addMultiOption('7', ' 7'); $officeNo->addMultiOption('8', ' 8'); $officeNo->addMultiOption('9', ' 9'); $officeNo->addMultiOption('10', ' 10'); $officeNo->setAttrib('class', 'selectbutton'); $officeType = new Zend_Form_Element_Text('officeType1'); $officeType->setRequired(true)->addValidators(array(array('NotEmpty'))); $officeType->setAttrib('class', 'txt_put'); $officeType->setAttrib('id', 'officeType1'); $officeCode = new Zend_Form_Element_Text('officeCode1'); $officeCode->setRequired(true)->addValidators(array(array('NotEmpty'))); $officeCode->setAttrib('class', 'txt_put'); $officeCode->setAttrib('id', 'officeCode1')->setAttrib('size', '2'); $this->addElements(array($officeType, $officeCode)); for ($i = 2; $i <= $levelno; $i++) { $id = new Zend_Form_Element_Hidden('id' . $i); $officeType = new Zend_Form_Element_Text('officeType' . $i); $officeType->setRequired(true)->addValidators(array(array('NotEmpty'))); $officeType->setAttrib('class', 'txt_put'); $officeType->setAttrib('id', 'officeType' . $i); $officeCode = new Zend_Form_Element_Text('officeCode' . $i); $officeCode->setRequired(true)->addValidators(array(array('NotEmpty'))); $officeCode->setAttrib('class', 'txt_put'); $officeCode->setAttrib('id', 'officeCode' . $i)->setAttrib('size', '2'); $this->addElements(array($id, $officeType, $officeCode)); } $submit = new Zend_Form_Element_Submit('Edit'); $submit->setAttrib('class', 'officesubmit'); $submit->setLabel('edit'); $this->addElements(array($submit)); $this->addElements(array($officeNo)); } else { /**this create form to display existed Office hierarchy*/ for ($i = 1; $i <= $options; $i++) { $db_lookup_validator = new Zend_Validate_Db_NoRecordExists('ourbank_officehierarchy', 'officetype'); $id = new Zend_Form_Element_Hidden('id' . $i); $hierarchyLevel = new Zend_Form_Element_Hidden('hierarchyLevel' . $i); $officeType = new Zend_Form_Element_Text('officeType' . $i); $officeType->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(4, 50)))); $officeType->setAttrib('class', 'txt_put'); $officeType->setAttrib('id', 'officeType' . $i); $officeCode = new Zend_Form_Element_Text('officeCode' . $i); $officeCode->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(2, 2)))); $officeCode->setAttrib('class', 'txt_put'); $officeCode->setAttrib('id', 'officeCode' . $i)->setAttrib('size', '2'); $this->addElements(array($id, $officeType, $officeCode, $hierarchyLevel)); } $officeNo = new Zend_Form_Element_Hidden('officeNo'); $OfficeLevel = new Zend_Form_Element_Text('officeLevel'); $OfficeLevel->setAttrib('size', '2'); $OfficeLevel->setAttrib('id', 'officeLevel'); $OfficeLevel->setAttrib('class', 'txt_put'); $OfficeLevel->addDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'h')), array('Label', array('tag' => 'h')))); $submit = new Zend_Form_Element_Submit('Edit'); $submit->setAttrib('class', 'officebutton'); $submit->setLabel('edit'); $next = new Zend_Form_Element_Submit('Next'); $next->setAttrib('class', 'officesubmit'); $next->setLabel('Next'); $this->addElements(array($submit, $officeNo, $OfficeLevel, $next)); } }
public function __construct($options, $levelno) { parent::__construct($options); $this->setName('updateloanscheme'); //set drop down and validate if ($options == 0) { $OFFICE_NO = new Zend_Form_Element_Select('officeNo'); $OFFICE_NO->setRequired(true); $OFFICE_NO->addMultiOption('', 'Select...'); $OFFICE_NO->addMultiOption('3', ' 3'); $OFFICE_NO->addMultiOption('4', ' 4'); $OFFICE_NO->addMultiOption('5', ' 5'); $OFFICE_NO->addMultiOption('6', ' 6'); $OFFICE_NO->addMultiOption('7', ' 7'); $OFFICE_NO->addMultiOption('8', ' 8'); $OFFICE_NO->addMultiOption('9', ' 9'); $OFFICE_NO->addMultiOption('10', ' 10'); $OFFICE_NO->setAttrib('class', 'selectbutton'); $OFFICE_NO->setAttrib('onchange', 'reload(this.value)'); $officetype = new Zend_Form_Element_Hidden('officeType1'); $officetype->setRequired(true)->addValidators(array(array('NotEmpty'))); $officetype->setAttrib('class', 'txt_put'); $officetype->setAttrib('id', 'officeType1'); $officecode = new Zend_Form_Element_Hidden('officeCode1'); $officecode->setRequired(true)->addValidators(array(array('NotEmpty'))); $officecode->setAttrib('class', 'txt_put'); $officecode->setAttrib('id', 'officeCode1')->setAttrib('size', '2'); $this->addElements(array($officetype, $officecode)); //set office levels for ($i = 2; $i <= $levelno; $i++) { $id = new Zend_Form_Element_Hidden('id' . $i); $officetype = new Zend_Form_Element_Hidden('officeType' . $i); $officetype->setRequired(true)->addValidators(array(array('NotEmpty'))); $officetype->setAttrib('class', 'txt_put'); $officetype->setAttrib('id', 'officeType' . $i); $officecode = new Zend_Form_Element_Hidden('officeCode' . $i); $officecode->setRequired(true)->addValidators(array(array('NotEmpty'))); $officecode->setAttrib('class', 'txt_put'); $officecode->setAttrib('id', 'officeCode' . $i)->setAttrib('size', '2'); $this->addElements(array($id, $officetype, $officecode)); } $submit = new Zend_Form_Element_Submit('Edit'); $submit->setAttrib('class', 'officesubmit'); $submit->setLabel('edit'); $this->addElements(array($submit)); $this->addElements(array($OFFICE_NO)); } else { for ($i = 1; $i <= $options; $i++) { $id = new Zend_Form_Element_Hidden('id' . $i); $hierarchy_level = new Zend_Form_Element_Hidden('hierarchyLevel' . $i); $officetype = new Zend_Form_Element_Hidden('officeType' . $i); $officetype->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(4, 50)))); $officetype->setAttrib('class', 'txt_put'); $officetype->setAttrib('id', 'officeType' . $i); $officecode = new Zend_Form_Element_Hidden('officeCode' . $i); //add validation and fix length $officecode->setRequired(true)->addValidators(array(array('NotEmpty'), array('stringLength', false, array(2, 2)))); $officecode->setAttrib('class', 'txt_put'); $officecode->setAttrib('id', 'officeCode' . $i)->setAttrib('size', '2'); $this->addElements(array($id, $officetype, $officecode, $hierarchy_level)); } $OFFICE_NO = new Zend_Form_Element_Hidden('officeNo'); $Office_level = new Zend_Form_Element_Text('officeLevel'); //add validation and fix length $Office_level->setAttrib('size', '2'); $Office_level->setAttrib('id', 'officeLevel'); $Office_level->setAttrib('class', 'txt_put'); $Office_level->addDecorators(array('ViewHelper', 'Errors', array('HtmlTag', array('tag' => 'h')), array('Label', array('tag' => 'h')))); $submit = new Zend_Form_Element_Submit('Edit'); $submit->setLabel('edit'); $Next = new Zend_Form_Element_Submit('Next'); //add submit button $submit->setAttrib('class', 'officebutton'); $Next->setAttrib('class', 'officesubmit'); $Next->setLabel('Next'); $this->addElements(array($submit, $OFFICE_NO, $Office_level, $Next)); } }
/** * Builds a search form * @return unknown_type */ protected function _getSearchForm() { $form = new Zend_Form(); $form->setAction($this->getUrl() . '/list'); $form->setMethod('post'); $elements = array(); $element = new Zend_Form_Element_Select('key'); $element->setMultiOptions($this->_searchOptions); $elements[] = $element; $element = new Zend_Form_Element_Text('value'); $elements[] = $element; foreach ($elements as $element) { $element->addDecorators(array(array('HtmlTag', array('tag' => 'td')), array('Label', array('tag' => 'td')))); $form->addElement($element); } $element = new Zend_Form_Element_Submit($this->_searchButtonLabel); $form->addElement($element); return $form; }
/** * Add an input text element to the form. * * @param array $question * * @return void */ private function _addText($question) { $elemName = $question['FQT_TypeName'] . self::UNDERSCORE . $question['FQ_ElementID']; $element = new Zend_Form_Element_Text($elemName); $element->removeDecorator('DtDdWrapper'); $element->addDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'answer-zone')))); $element->setAttrib('class', 'stdTextInput'); $this->_addExtras($element, $question); $this->addElement($element); $this->_displayGroupElements[] = $elemName; }