public function init() { $this->setMethod('post'); $this->setAction('/main/new'); $this->setAttrib('id', 'newRoute'); $note = new Zend_Form_Element_Note('title', array('value' => '<h2 id="titleProductDetails">Create a New Route</h2>')); $intermed = new Zend_Form_Element_Hidden('intermed'); $intermed->setAttrib('readonly', 'readonly'); $intermed->addFilter('StripTags'); $intermed->addFilter('HtmlEntities'); $intermed->addFilter('StringTrim'); $start = new Zend_Form_Element_Text('startForm'); $start->setLabel('Starting Point*'); $start->setAttrib('autocomplete', 'off'); $start->addFilter('StripTags'); $start->addFilter('HtmlEntities'); $start->setAttrib('class', 'form-control'); $start->addFilter('StringTrim'); $start->setRequired(true)->addErrorMessage('Start Location Required'); // $start->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\s]*$/'))->addErrorMessage('Invalid characters used'); // $start->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field'); $end = new Zend_Form_Element_Text('endForm'); $end->setLabel('Destination*'); $end->setAttrib('autocomplete', 'off'); $end->addFilter('StripTags'); $end->setAttrib('class', 'form-control'); $end->addFilter('HtmlEntities'); $end->addFilter('StringTrim'); $end->setRequired(true)->addErrorMessage('Destination Required'); // $end->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field'); $routeDate = new Zend_Form_Element_Text('routeDate'); $routeDate->setAttrib('autocomplete', 'off'); $routeDate->setAttrib('readonly', 'readonly'); $routeDate->setAttrib('maxlength', '10'); $routeDate->setAttrib('class', 'form-control'); $routeDate->setLabel('Date of Journey' . '*'); $routeDate->addFilter('StripTags'); $routeDate->addFilter('HtmlEntities'); $routeDate->addFilter('StringTrim'); $routeDate->setRequired(true)->addErrorMessage('Date Required'); $routeDate->addValidator('Regex', true, array('/^[0-9.\\s]*$/'))->addErrorMessage('Invalid characters used'); $routeDate->addValidator('StringLength', true, array(10, 10))->addErrorMessage('Required Field'); $passangers = new Zend_Form_Element_Select('passangers'); $passangers->setLabel('No of Passangers*'); $passangers->setAttrib('autocomplete', 'off'); $passangers->setAttrib('class', 'form-control'); $passangers->addFilter('StripTags'); $passangers->addFilter('HtmlEntities'); $passangers->addFilter('StringTrim'); $passangers->setRequired(true)->addErrorMessage('Password Required'); $passangers->setMultiOptions(array('1' => '1 Passanger', '2' => '2 Passangers', '3' => '3 Passangers', '4' => '4 Passangers', '5' => '5 Passangers', '6' => '6 Passangers')); $submit = new Zend_Form_Element_Submit('newRoute'); $submit->setLabel('New Route'); $submit->setAttrib('class', 'btn btn-info'); $submit->setAttrib('style', 'margin-top:20px'); $this->addElements(array($note, $intermed, $start, $end, $passangers, $routeDate, $submit)); $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors')); $submit->setDecorators(array('ViewHelper')); $this->setDecorators(array('FormElements', 'Form', array('HtmlTag', array('tag' => 'div', 'id' => 'newRouteFormContainer')))); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $idMember = App_Utilities::getIdMember(); $member_id = new Zend_Form_Element_Hidden('member_id'); $member_id->addFilter('Int')->setValue($idMember); $this->addElement($member_id); $start_date = new Zend_Form_Element_Text('start_date'); $start_date->setOptions(array('label' => $this->t('Start date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($start_date); $end_date = new Zend_Form_Element_Text('end_date'); $end_date->setOptions(array('label' => $this->t('End Date'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($end_date); $is_posted = new Zend_Form_Element_Checkbox('is_posted'); $this->addElement($is_posted); $companyName = new Zend_Form_Element_Text('name'); $companyName->setOptions(array('label' => $this->t('Company'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($companyName); $function = new Zend_Form_Element_Text('function'); $function->setOptions(array('label' => $this->t('function'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($function); $mission = new Zend_Form_Element_Textarea('mission'); $mission->setOptions(array('label' => $this->t('mission'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($mission); $city_name = new Zend_Form_Element_Text('city_name'); $city_name->setOptions(array('label' => $this->t('city'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($city_name); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
public function init() { $this->setName('shipping_address'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $customerid = new Zend_Form_Element_Hidden('customerid'); $customerid->addFilter('Int'); $address1 = new Zend_Form_Element_Text('shipping_address1'); $address1->setLabel('Street Address')->setAttrib('id', 'address1')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $address2 = new Zend_Form_Element_Text('shipping_address2'); $address2->setLabel('')->setAttrib('id', 'address2')->addFilter('StripTags')->addFilter('StringTrim'); $address3 = new Zend_Form_Element_Text('shipping_address3'); $address3->setLabel('')->setAttrib('id', 'address3')->addFilter('StripTags')->addFilter('StringTrim'); $postcode = new Zend_Form_Element_Text('shipping_postcode'); $postcode->setLabel('Postcode')->setAttrib('id', 'postcode')->addFilter('StripTags')->addFilter('StringTrim'); $country = new Zend_Form_Element_Text('shipping_country'); $country->setLabel('Country')->setAttrib('id', 'country')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $city = new Zend_Form_Element_Text('shipping_city'); $city->setLabel('City')->setAttrib('id', 'city')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $phone = new Zend_Form_Element_Text('shipping_phone'); $phone->setLabel('Phone')->setAttrib('id', 'phone')->addFilter('StripTags')->addFilter('StringTrim'); $fax = new Zend_Form_Element_Text('shipping_fax'); $fax->setLabel('Fax')->setAttrib('id', 'fax')->addFilter('StripTags')->addFilter('StringTrim'); $email = new Zend_Form_Element_Text('shipping_email'); $email->setLabel('E-Mail')->setAttrib('id', 'email')->addFilter('StripTags')->addFilter('StringTrim'); $internet = new Zend_Form_Element_Text('shipping_internet'); $internet->setLabel('Internet')->setAttrib('id', 'internet')->addFilter('StripTags')->addFilter('StringTrim'); $submit = new Zend_Form_Element_Button('shipping_submit'); $submit->setAttrib('onclick', 'addAddress()'); $this->addElements(array($id, $customerid, $address1, $address2, $address3, $postcode, $city, $country, $phone, $fax, $email, $internet, $submit)); }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setName('FormularioNoticia'); $ID_NOTICIA = new Zend_Form_Element_Hidden('ID_NOTICIA'); $ID_NOTICIA->addFilter('Int'); $ID_NOTICIA->removeDecorator('Label'); $FK_ARQUIVO = new Zend_Form_Element_Hidden('FK_ARQUIVO'); $FK_ARQUIVO->addFilter('Int'); $FK_ARQUIVO->removeDecorator('Label'); $DS_TITULO = new Zend_Form_Element_Text('DS_TITULO'); $DS_TITULO->setLabel('TÍTULO')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', "Enter t�tulo"); $TX_NOTICIA = new Zend_Form_Element_Textarea('TX_NOTICIA'); $TX_NOTICIA->setLabel('TEXTO')->setRequired(true)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('rows', '20'); $DS_RESUMO = new Zend_Form_Element_Textarea('DS_RESUMO'); $DS_RESUMO->setLabel('RESUMO')->setRequired(true)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('rows', '5'); $DT_NOTICIA = new Zend_Form_Element_Hidden('DT_NOTICIA'); $DT_NOTICIA->removeDecorator('Label'); $tiposNoticia = array("1" => "NOTICIAS", "2" => "NOVIDADES", "3" => "RECADOS"); $FK_TIPO_NOTICIA = new Zend_Form_Element_Select('FK_TIPO_NOTICIA'); $FK_TIPO_NOTICIA->setLabel('TIPO NOTÍCIA')->setRequired(true)->addMultiOptions($tiposNoticia)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control select2')->setAttrib('placeholder', "Enter tipo not�cia"); $FK_OPERADOR = new Zend_Form_Element_Hidden('FK_OPERADOR'); $FK_OPERADOR->addFilter('Int'); $FK_OPERADOR->removeDecorator('Label'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel("Adiconar"); $submit->setAttrib('id', 'submitbutton'); $submit->removeDecorator('DtDdWrapper')->setAttrib('class', 'btn btn-primary button')->removeDecorator('HtmlTag')->removeDecorator('Label'); $this->addElements(array($ID_NOTICIA, $DS_TITULO, $TX_NOTICIA, $FK_ARQUIVO, $DS_RESUMO, $DT_NOTICIA, $FK_TIPO_NOTICIA, $FK_OPERADOR, $submit)); $this->setDecorators(array(array('ViewScript', array('viewScript' => '/forms/formularioNoticia.phtml')))); }
public function init() { $this->setName('resource_activity_has_receipt'); $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')))); // // $resource_activity_has_receipt_types_id = new Zend_Form_Element_Select('resource_activity_has_receipt_types_id'); // $resource_activity_has_receipt_types_id->setLabel('resource_activity_has_receipt types') // ->addValidator('NotEmpty', true) // ->setmultiOptions($this->_selectOptions_types()) // ->setAttrib('maxlength', 200) // ->setAttrib('size', 1) // ->setAttrib("class", "toolboxdrop") // ->setDecorators(array(array('ViewScript', array( // 'viewScript' => 'forms/_element_select.phtml')))) // ; // // $resource_activity_has_receipt_types_id = new Zend_Form_Element_Multiselect('$resource_activity_has_receipt_types_id'); // $resource_activity_has_receipt_types_id->setLabel('resource_activity_has_receipt types') // ->setmultiOptions($this->_selectOptions_types()) // ->setAttrib('maxlength', 200) // ->setAttrib('size', 5) // ->setDecorators(array(array('ViewScript', array( // 'viewScript' => 'forms/_element_select.phtml')))) // ->setAttrib("class","toolboxdrop") // ; // $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, $submit)); }
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)); }
public function init() { $this->setName('client'); $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')))); $fiscal_name = new Zend_Form_Element_Text('fiscal_name'); $fiscal_name->setLabel('Fiscal name')->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')))); $company_types_id = new Zend_Form_Element_Select('company_types_id'); $company_types_id->setLabel('Type')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsCompanyTypes())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $telephone = new Zend_Form_Element_Text('telephone'); $telephone->setLabel('Telephone')->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')))); $fax = new Zend_Form_Element_Text('fax'); $fax->setLabel('fax')->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')))); $direction = new Zend_Form_Element_Text('direction'); $direction->setLabel('Direction')->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')))); $city = new Zend_Form_Element_Text('city'); $city->setLabel('City')->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')))); $country = new Zend_Form_Element_Text('country'); $country->setLabel('Country')->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')))); $postal_code = new Zend_Form_Element_Text('postal_code'); $postal_code->setLabel('Postal code')->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')))); $observation = new Zend_Form_Element_Text('observation'); $observation->setLabel('Observation')->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, $fiscal_name, $company_types_id, $email, $telephone, $fax, $direction, $city, $country, $postal_code, $observation, $submit)); }
public function init() { $this->setName('resource'); $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')))); $suppliers_id = new Zend_Form_Element_Select('suppliers_id'); $suppliers_id->setLabel('suppliers')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsSuppliers())->setOptions(array('onChange' => 'javascript:getAjaxResponse("http://globalpms.es/production/resource/getdataresource/id/"+this.value,"resource_id");javascript:getAjaxResponse("http://globalpms.es/production/resource/getdata/id/"+this.value,"contacts_id");'))->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $contacts_id = new Zend_Form_Element_Select('contacts_id'); $contacts_id->setLabel('supplier contact ')->setmultiOptions($this->_selectOptionsContactSuppliers())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $resource_id = new Zend_Form_Element_Select('resource_id'); $resource_id->setLabel('resource')->setmultiOptions($this->_selectOptionsResources())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $unbilled_hours = new Zend_Form_Element_Text('unbilled_hours'); $unbilled_hours->setLabel('Unbilled hours')->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')))); $facturation_types_id = new Zend_Form_Element_Select('facturation_types_id'); $facturation_types_id->setLabel('Facturation type')->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsFacturation_types())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $price = new Zend_Form_Element_Text('price'); $price->setLabel('Price')->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')))); $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, $suppliers_id, $resource_id, $contacts_id, $unbilled_hours, $facturation_types_id, $price, $observation, $submit)); }
protected function _id_encontro() { $e = new Zend_Form_Element_Hidden('id_encontro'); $e->addFilter('Int'); $e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', ''))); return $e; }
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() { $this->setName('cliente')->setAttrib('class', 'form-horizontal'); $cli_id_cliente = new Zend_Form_Element_Hidden('cli_id_cliente'); $cli_id_cliente->addFilter('Int'); $cli_nombre = new Zend_Form_Element_Text('cli_nombre'); $cli_nombre->setAttrib('placeholder', 'Nombres')->setLabel('Nombres:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $cli_apellido_1 = new Zend_Form_Element_Text('cli_apellido_1'); $cli_apellido_1->setAttrib('placeholder', 'Apellido Paterno')->setLabel('Apellido Paterno:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $cli_apellido_2 = new Zend_Form_Element_Text('cli_apellido_2'); $cli_apellido_2->setAttrib('placeholder', 'Apellido Paterno')->setLabel('Apellido Paterno:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $cli_rut = new Zend_Form_Element_Text('cli_rut'); $cli_rut->setAttrib('placeholder', 'RUT')->setLabel('RUT:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $cli_fono_1 = new Zend_Form_Element_Text('cli_fono_1'); $cli_fono_1->setAttrib('placeholder', 'Teléfono Móvil')->setLabel('Teléfono Móvil:')->addFilter('StripTags')->addFilter('StringTrim'); $cli_fono_2 = new Zend_Form_Element_Text('cli_fono_2'); $cli_fono_2->setAttrib('placeholder', 'Teléfono Fijo')->setLabel('Teléfono Fijo:')->addFilter('StripTags')->addFilter('StringTrim'); $cli_direccion = new Zend_Form_Element_Text('cli_direccion'); $cli_direccion->setAttrib('placeholder', 'Dirección')->setLabel('Dirección:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $cli_lugar_de_trabajo = new Zend_Form_Element_Text('cli_lugar_de_trabajo'); $cli_lugar_de_trabajo->setAttrib('placeholder', 'Dirección')->setLabel('Lugar de trabajo:')->addFilter('StripTags')->addFilter('StringTrim'); $cli_ciudad = new Zend_Form_Element_Text('cli_ciudad'); $cli_ciudad->setAttrib('placeholder', 'Ciudad')->setLabel('Ciudad:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $this->addElements(array($cli_id_cliente, $cli_rut, $cli_nombre, $cli_apellido_1, $cli_apellido_2, $cli_fono_1, $cli_fono_2, $cli_direccion, $cli_lugar_de_trabajo, $cli_ciudad, $submit)); }
public function init() { // Задаём имя форме $this->setName('warehouse'); // Создаём переменную, которая будет хранить сообщение валидации $isEmptyMessage = 'Значение является обязательным и не может быть пустым'; // Создаём элемент формы – text c именем = number $image = new Zend_Form_Element_File('image'); $image->setLabel('Загрузить фотографию')->setDestination(DATA_PATH . '/public/img/')->addValidator('Size', false, '204800000')->addValidator('Extension', true, 'png,jpg,gif')->addValidator('ImageSize', false, array('minwidth' => 50, 'minheight' => 50, 'maxwidth' => 5000, 'maxheight' => 5000)); $serial = new Zend_Form_Element_Text('serial', array('class' => 'form-control')); $serial->setLabel('Серийный номер')->setAttrib('placeholder', 'S\\N:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $isEmptyMessage)))->addValidator('regex', true, array("/^[а-яА-Яa-zA-Z0-9 \\. \\-]{3,200}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $name = new Zend_Form_Element_Text('name', array('class' => 'form-control')); $name->setLabel('Название')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[а-яА-Яa-zA-Z0-9 \\. \\- \\s ]{3,50}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $type = new Zend_Form_Element_Text('type', array('class' => 'form-control')); $type->setLabel('Тип')->setAttrib('placeholder', 'Viena,Royal,All')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[a-zA-Z0-9 \\- \\s]{3,20}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $remain = new Zend_Form_Element_Text('remain', array('class' => 'form-control')); $remain->setLabel('Остаток')->setAttrib('placeholder', 'кол-во')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[0-9 \\-]{1,20}\$/i", 'messages' => 'Не верный формат ввода'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $price = new Zend_Form_Element_Text('price', array('class' => 'form-control')); $price->setLabel('Цена')->setAttrib('placeholder', 'введите цену в грн')->setRequired(true)->addFilter('StripTags')->addValidator('NotEmpty', true, array('messages' => 'Йо на, не может быть пустым'))->addValidator('regex', true, array("/^[0-9]{0,20}\$/i", 'messages' => 'Не верный формат ввода, для ввода доступны только цифры'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); // Создаём элемент hidden c именем = id $id = new Zend_Form_Element_Hidden('id'); // Указываем, что данные в этом элементе фильтруются как число int $id->addFilter('Int')->removeDecorator('label')->removeDecorator('element'); // Создаём элемент hidden c именем = id $path = new Zend_Form_Element_Hidden('path'); // Указываем, что данные в этом элементе фильтруются как число int $path->removeDecorator('label')->removeDecorator('element'); // Создаём элемент формы Submit c именем = submit $submit = new Zend_Form_Element_Submit('submit', array('class' => 'btn btn-default')); // Добавляем все созданные элементы к форме. $this->addElements(array($id, $serial, $name, $type, $remain, $price, $image, $submit, $path)); }
public function init() { $this->setName('destinatario')->setAttrib('class', 'form-horizontal'); $des_id_destinatario = new Zend_Form_Element_Hidden('des_id_destinatario'); $des_id_destinatario->addFilter('Int'); $des_nombre = new Zend_Form_Element_Text('des_nombre'); $des_nombre->setAttrib('placeholder', 'Nombre')->setLabel('Nombre:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $des_rut = new Zend_Form_Element_Text('des_rut'); $des_rut->setAttrib('placeholder', 'RUT')->setLabel('RUT:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $des_direccion = new Zend_Form_Element_Text('des_direccion'); $des_direccion->setAttrib('placeholder', 'Dirección')->setLabel('Dirección:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $des_ciudad = new Zend_Form_Element_Text('des_ciudad'); $des_ciudad->setAttrib('placeholder', 'Ciudad')->setLabel('Ciudad:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $des_telefono = new Zend_Form_Element_Text('des_telefono'); $des_telefono->setAttrib('placeholder', 'Teléfono')->setLabel('Teléfono:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $des_tipo = new Zend_Form_Element_Select('des_tipo'); $des_tipo->setAttrib('placeholder', 'Tipo')->setLabel('Tipo:')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $des_tipo->addMultiOption("CLIENTE", "Cliente"); $des_tipo->addMultiOption("PROVEEDOR", "Proveedor"); $des_tipo->addMultiOption("INTERNO", "Tienda SMO (Interno)"); $des_comuna = new Zend_Form_Element_Text('des_comuna'); $des_comuna->setAttrib('placeholder', 'Comuna')->setLabel('Comuna:')->addFilter('StripTags')->addFilter('StringTrim'); $des_region = new Zend_Form_Element_Text('des_region'); $des_region->setAttrib('placeholder', 'Región')->setLabel('Región:')->addFilter('StripTags')->addFilter('StringTrim'); $des_contacto = new Zend_Form_Element_Text('des_contacto'); $des_contacto->setAttrib('placeholder', 'Contacto')->setLabel('Contacto:')->addFilter('StripTags')->addFilter('StringTrim'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $this->addElements(array($des_id_destinatario, $des_nombre, $des_rut, $des_direccion, $des_ciudad, $des_telefono, $des_tipo, $des_comuna, $des_region, $des_contacto, $submit)); }
public function init() { $this->setName('user'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); $name = new Zend_Form_Element_Text('name'); $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password')->addValidator('NotEmpty', true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('StringLength', false, array(3, 20))->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $date = new Zend_Form_Element_Text('date'); $date->setLabel('Date')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $status = new Zend_Form_Element_Text('status'); $status->setLabel('status')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $person_id = new Zend_Form_Element_Text('person_id'); $person_id->setLabel('person_id')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $validation_code = new Zend_Form_Element_Text('validation_code'); $validation_code->setLabel('validation')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $phone = new Zend_Form_Element_Text('phone'); $phone->setLabel('Phone')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $role_id = new Zend_Form_Element_Select('role_id'); $role_id->setLabel('Role')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsRole())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $company_id = new Zend_Form_Element_Select('company_id'); $company_id->setLabel('company')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsCompany())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label'); $add_contact = new Zend_Form_Element_Checkbox('add_contact'); $add_contact->setLabel('add contact')->setRequired(true); $this->addElements(array($id, $name, $password, $date, $email, $status, $validation_code, $person_id, $phone, $role_id, $company_id, $add_contact, $submit)); }
public function init() { $this->setName('f2')->setMethod('post')->setAttribs(array('id' => 'user')); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int')->removeDecorator('label'); $username = new Zend_Form_Element_Text('ten_dang_nhap'); $username->setLabel('Tên đăng nhập (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 32))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 83%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ten_dang_nhap', 'class' => 'text-input')); $password = new Zend_Form_Element_Password('mat_khau'); $password->setLabel('Mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->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' => 'mat_khau', 'class' => 'text-input')); $repassword = new Zend_Form_Element_Password('mat_khau_2'); $repassword->setLabel('Nhập lại mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_Identical('mat_khau'))->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' => 'mat_khau_2', 'class' => 'text-input')); $ho = new Zend_Form_Element_Text('ho'); $ho->setLabel('Họ (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 100))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 83%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ho', 'class' => 'text-input')); $ten = new Zend_Form_Element_Text('ten'); $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 20))->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' => 'ten', 'class' => 'text-input')); $ngay_sinh = new Zend_Form_Element_Text('ngay_sinh'); $ngay_sinh->setLabel('Ngày sinh (*)')->setDescription('(dd-mm-YYYY)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ngay_sinh', 'class' => 'text-input')); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_EmailAddress())->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' => 'email', 'class' => 'text-input')); $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' => 'index', 'action' => 'index')); $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($id, $username, $password, $repassword, $ho, $ten, $ngay_sinh, $email, $submitCon, $submitExit, $cancel)); $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submitbtn', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); }
public function init() { $this->setName('contact'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $id->removeDecorator('label'); // // $company_id = new Zend_Form_Element_Hidden('company_id'); // $company_id->addFilter('Int'); // $company_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')))); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml')))); $telephone = new Zend_Form_Element_Text('telephone'); $telephone->setLabel('Telephone')->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')))); $status = new Zend_Form_Element_Text('status'); $status->setLabel('Status')->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')))); $direction = new Zend_Form_Element_Text('direction'); $direction->setLabel('Direction')->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, $email, $telephone, $direction, $status, $submit)); }
public function init() { $this->setName('LoginForm')->setMethod('post')->setAction('validate'); $id = new Zend_Form_Element_Hidden('user_id'); $id->addFilter('Int'); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email address')->addValidator('EmailAddress')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); //$this->addElement(array($email_id)); //->addFilter('stringtoLower'); $email->setAttrib('class', 'input'); $password = new Zend_Form_Element_Password('password'); $password->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); //->addValidator('StringLength',false,array(12)); //->setRequired(true); //$this->addElement(array('$password')); $password->setAttrib('class', 'input'); $submit = new Zend_Form_Element_Submit('Login'); $submit->setLabel('Login here'); $submit->setAttrib('id', 'submitbutton'); //id=submitbutton /*$register = new Zend_Form_Element_Submit('Register'); $register->setLabel('Register here') ->setIgnore(true); $register->setAttrib('id', 'submitbutton');*/ $this->addElements(array($id, $email, $password, $submit)); }
public function init() { $this->setName('f2')->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $ma = new Zend_Form_Element_Text('ma'); $ma->setLabel('Mã (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 10))->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'); $ten = new Zend_Form_Element_Text('ten'); $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->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'))))->setAttrib('class', 'text-input medium-input'); $mo_ta = new Zend_Form_Element_Textarea('mo_ta'); $mo_ta->setLabel('Mô 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', 'class' => 'textarea', 'rows' => '4')); $loai_lv = new Default_Model_LoaiLinhVuc(); $llvOptions = array("multiOptions" => $loai_lv->getMultiOptions()); $ma_loai = new Zend_Form_Element_Select('ma_loai', $llvOptions); $ma_loai->setLabel('Loại lĩnh vực')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => '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' => 'linh-vuc', '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($id, $ma, $ten, $mo_ta, $ma_loai, $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' => 'linh_vuc')), 'Form')); }
public function init() { $this->setName('f2')->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $ma = new Zend_Form_Element_Text('ma'); $ma->setLabel('Mã')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToUpper')->addValidator(new Zend_Validate_StringLength(0, 10))->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'))))->setAttribs(array('class' => 'text-input')); $ten = new Zend_Form_Element_Text('ten'); $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 250))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input'); $ofSGUOptions = array("multiOptions" => array('1' => 'Thuộc', '0' => 'Không thuộc')); $thuoc_sgu = new Zend_Form_Element_Radio('thuoc_sgu', $ofSGUOptions); $thuoc_sgu->setRequired(true)->setLabel('Thuộc SGU')->setValue('1')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'class' => 'radio_inline'))))->setAttribs(array('id' => 'thuoc_sgu')); $deptOptions = array("multiOptions" => array('1' => 'Khoa - Bộ môn TT', '0' => 'Phòng ban - Trung tâm')); $la_khoa = new Zend_Form_Element_Radio('la_khoa', $deptOptions); $la_khoa->setRequired(true)->setLabel('Loại đơn vị')->setValue('1')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'id' => 'la_khoa', 'class' => 'radio_inline')))); $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' => 'don-vi', '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($id, $ma, $ten, $thuoc_sgu, $la_khoa, $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')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'don_vi')), 'Form')); }
public function init() { $this->setName('f2')->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $ma = new Zend_Form_Element_Text('ma'); $ma->setLabel('Mã')->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_StringLength(0, 10))->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'))))->setAttribs(array('class' => 'text-input')); $ho_ten = new Zend_Form_Element_Text('ho_ten'); $ho_ten->setLabel('Họ tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 120))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttrib('class', 'text-input medium-input'); $chuc_vu = new Zend_Form_Element_Text('chuc_vu'); $chuc_vu->setLabel('Chức vụ')->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'))))->setAttrib('class', 'text-input medium-input'); $don_vi = new Default_Model_DonVi(); $dvOptions = array("multiOptions" => $don_vi->getDSDV()); $ma_don_vi = new Zend_Form_Element_Select('ma_don_vi', $dvOptions); $ma_don_vi->setRequired(true)->setLabel('Đơn vị (*)')->setValue(Default_Model_Constraints::ID_DHSG)->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $hoc_vi = new Default_Model_HocVi(); $hvOptions = array("multiOptions" => $hoc_vi->getDSHV()); $ma_hoc_vi = new Zend_Form_Element_Select('ma_hoc_vi', $hvOptions); $ma_hoc_vi->setRequired(true)->setLabel('Học vị (*)')->setSeparator('')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $email = new Zend_Form_Element_Text('email'); $email->setLabel('Email')->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_EmailAddress())->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('class' => 'text-input', 'id' => 'email')); $so_dien_thoai = new Zend_Form_Element_Text('so_dien_thoai'); $so_dien_thoai->setLabel('Số điện thoại')->addFilter('StringTrim')->addValidator(new Zend_Validate_Int())->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('class' => 'text-input', 'onkeypress' => 'return inputNumber(event)')); $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')); $link = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'admin', 'controller' => 'giang-vien', '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($id, $ma, $ho_ten, $ma_don_vi, $ma_hoc_vi, $chuc_vu, $email, $so_dien_thoai, $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')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn'))))); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table', 'class' => 'giang_vien')), 'Form')); }
public function init() { global $settings; $names = new Application_Model_DbTable_Setup(); $names->setTableName('name'); $names_values = $names->getValues(); $types = new Application_Model_DbTable_Setup(); $types->setTableName('type'); $types_values = $types->getValues(); $status = new Application_Model_DbTable_Setup(); $status->setTableName('status'); $status_values = $status->getValues(); $users = new Application_Model_DbTable_Setup(); $users->setTableName('user'); $users_values = $users->getValues(); $owners = new Application_Model_DbTable_Setup(); $owners->setTableName('owner'); $owners_values = $owners->getValues(); // Задаём имя форме $this->setName('devices'); // Создаём элемент формы – text c именем = number $number = new Zend_Form_Element_Text('number', array('class' => 'form-control')); $number->setLabel('Номер')->setRequired(true)->setAttrib('placeholder', 'S/N:')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('regex', true, array("/^[A-Za-z1-90 \\.\\-]{3,20}\$/i", 'messages' => $settings['messages']['error']))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); //проверка редактирования или добавления елемента if ($_SESSION['edit'] == false) { $number->addValidator('Db_NoRecordExists', true, array('table' => 'devices', 'field' => 'number', 'messages' => $settings['messages']['db'])); } else { $_SESSION['edit'] = false; } $name = new Zend_Form_Element_Select('name', array('class' => 'form-control', "multiOptions" => $names_values)); $name->setLabel('Имя')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $type = new Zend_Form_Element_Select('type', array('class' => 'form-control', "multiOptions" => $types_values)); $type->setLabel('Группа аппаратов')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $owner = new Zend_Form_Element_Select('owner', array('class' => 'form-control', "multiOptions" => $owners_values)); $owner->setLabel('Принадлежность')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $user = new Zend_Form_Element_Select('user', array('class' => 'form-control', "multiOptions" => $users_values)); $user->setLabel('Территория')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $status = new Zend_Form_Element_Select('status', array('class' => 'form-control', "multiOptions" => $status_values)); $status->setLabel('Статус')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); // Создаём элемент формы – ТОРГОВАЯ ТОЧКА $city = new Zend_Form_Element_Text('city', array('class' => 'form-control')); $city->setLabel('Город')->setRequired(true)->setAttrib('placeholder', 'пример: Киев')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('regex', true, array("/^[А-Яа-яA-Za-z1-90 \\.\\-\\,\"\\№]{3,200}\$/i", 'messages' => $settings['messages']['error']))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $tt_name = new Zend_Form_Element_Text('tt_name', array('class' => 'form-control')); $tt_name->setLabel('Название "Торговой точки"')->setRequired(true)->setAttrib('placeholder', 'пример: магазин Novus')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('regex', true, array("/^[А-Яа-яA-Za-z1-90 \\.\\-\\,\"\\№\\)\\(]{3,200}\$/i", 'messages' => $settings['messages']['error']))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $tt_user = new Zend_Form_Element_Text('tt_user', array('class' => 'form-control')); $tt_user->setLabel('Контактные данные')->setRequired(true)->setAttrib('placeholder', 'пример: директор Олег Олегович')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('regex', true, array("/^[А-Яа-яA-Za-z1-90 \\.\\-\\,\"\\№\\)\\(]{3,200}\$/i", 'messages' => $settings['messages']['error']))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $tt_phone = new Zend_Form_Element_Text('tt_phone', array('class' => 'form-control')); $tt_phone->setLabel('Номер договора')->setRequired(true)->setAttrib('placeholder', 'пример: 1234567')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('regex', true, array("/^[А-Яа-яA-Za-z1-90 \\.\\-\\,\"\\№\\+\\(\\)]{3,200}\$/i", 'messages' => $settings['messages']['error']))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $adress = new Zend_Form_Element_Text('adress', array('class' => 'form-control')); $adress->setLabel('Адрес "Торговой точки"')->setRequired(true)->setAttrib('placeholder', 'привер: ул.Зоологическая 23')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('regex', true, array("/^[А-Яа-яA-Za-z1-90 \\.\\-\\,\"\\№\\)\\(]{3,200}\$/i", 'messages' => $settings['messages']['error']))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); // Создаём элемент hidden c именем = id $id = new Zend_Form_Element_Hidden('id'); // Указываем, что данные в этом элементе фильтруются как число int $id->addFilter('Int')->removeDecorator('label')->removeDecorator('element'); // Создаём элемент формы Submit c именем = submit $submit = new Zend_Form_Element_Submit('submit', array('class' => 'btn btn-default')); // Добавляем все созданные элементы к форме. $this->addElements(array($id, $number, $name, $type, $owner, $user, $status, $city, $adress, $tt_name, $tt_user, $tt_phone, $submit)); }
/** * */ public function init() { $this->setName('universidade'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter("Int"); $nome = new Zend_Form_Element_Text('nome'); $nome->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setOrder(0); $this->addElements(array($id, $nome)); }
public function init() { /* Form Elements & Other Definitions Here ... */ $this->setName('nome'); $this->setAttrib('enctype', 'multipart/form-data'); $ID_OPERADOR = new Zend_Form_Element_Hidden('ID_OPERADOR'); $ID_OPERADOR->addFilter('Int'); $NM_OPERADOR = new Zend_Form_Element_Text('NM_OPERADOR'); $NM_OPERADOR->setLabel('NOME')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter nome'); $DS_TELEFONE_PESSOAL = new Zend_Form_Element_Text('DS_TELEFONE_PESSOAL'); $DS_TELEFONE_PESSOAL->setLabel('TELEFONE PESSOAL')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter telefone pessoal'); $DS_TELEFONE_BIOS = new Zend_Form_Element_Text('DS_TELEFONE_BIOS'); $DS_TELEFONE_BIOS->setLabel('TELEFONE BIOS')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter telefone bios'); $DS_EMAIL_PESSOAL = new Zend_Form_Element_Text('DS_EMAIL_PESSOAL'); $DS_EMAIL_PESSOAL->setLabel('E-MAIL PESSOAL')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter e-mail pessoal'); $DS_EMAIL_BIOS = new Zend_Form_Element_Text('DS_EMAIL_BIOS'); $DS_EMAIL_BIOS->setLabel('E-MAIL BIOS')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter e-mail bios'); $DS_ENDERECO = new Zend_Form_Element_Text('DS_ENDERECO'); $DS_ENDERECO->setLabel('ENDEREÇO')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter endereco'); $DS_BAIRRO = new Zend_Form_Element_Text('DS_BAIRRO'); $DS_BAIRRO->setLabel('BAIRRO')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter bairro'); $NR_CEP = new Zend_Form_Element_Text('NR_CEP'); $NR_CEP->setLabel('CEP')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter cep'); $NR_CPF = new Zend_Form_Element_Text('NR_CPF'); $NR_CPF->setLabel('CPF')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter cpf'); $NR_IDENTIDADE = new Zend_Form_Element_Text('NR_IDENTIDADE'); $NR_IDENTIDADE->setLabel('Nº IDENTIDADE')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter nº identidade'); $DT_NASCIMENTO = new Zend_Form_Element_Text('DT_NASCIMENTO'); $DT_NASCIMENTO->setLabel('DATA NASCIMENTO')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter data nascimento'); $DS_REGISTRO_PROFISSIONAL = new Zend_Form_Element_Text('DS_REGISTRO_PROFISSIONAL'); $DS_REGISTRO_PROFISSIONAL->setLabel('REGISTRO PROFISSIONAL')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter data registro profissional'); $DS_CTF_IBAM = new Zend_Form_Element_Text('DS_CTF_IBAM'); $DS_CTF_IBAM->setLabel('CTF IBAMA')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter ctf ibama'); $DS_SKYPE = new Zend_Form_Element_Text('DS_SKYPE'); $DS_SKYPE->setLabel('SKYPE')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter skype'); $DS_LOGIN = new Zend_Form_Element_Text('DS_LOGIN'); $DS_LOGIN->setLabel('LOGIN')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter skype'); $DS_SENHA = new Zend_Form_Element_Password('DS_SENHA'); $DS_SENHA->setLabel('SENHA')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter senha'); $REPETIR_SENHA = new Zend_Form_Element_Password('REPETIR_SENHA'); $REPETIR_SENHA->setLabel('REPETIR SENHA')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter repetir senha'); $NM_CONTATO_FAMILIAR = new Zend_Form_Element_Text('NM_CONTATO_FAMILIAR'); $NM_CONTATO_FAMILIAR->setLabel('NOME CONTATO FAMILIAR')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter nome contato familiar'); $NR_TELEFONE_CONTATO_FAMILIAR = new Zend_Form_Element_Text('NR_TELEFONE_CONTATO_FAMILIAR'); $NR_TELEFONE_CONTATO_FAMILIAR->setLabel('Nº TELEFONE CONTATO FAMILIAR')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter n� telefone contato familiar'); $FK_PERFIL = new Zend_Form_Element_Select('FK_PERFIL'); $perfil = new Application_Model_DbTable_Perfil(); $FK_PERFIL->setLabel('Perfil'); $FK_PERFIL->setMultiOptions($perfil->getPerfil())->setRequired(true)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control select2'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel("Adiconar"); $submit->setAttrib('id', 'submitbutton'); $submit->removeDecorator('DtDdWrapper')->setAttrib('class', 'btn btn-primary button')->removeDecorator('HtmlTag')->removeDecorator('Label'); $this->addElements(array($ID_OPERADOR, $NM_OPERADOR, $DS_TELEFONE_PESSOAL, $DS_TELEFONE_BIOS, $DS_EMAIL_PESSOAL, $DS_EMAIL_BIOS, $DS_ENDERECO, $DS_BAIRRO, $NR_CEP, $NR_CPF, $NR_IDENTIDADE, $DT_NASCIMENTO, $DS_REGISTRO_PROFISSIONAL, $DS_CTF_IBAM, $DS_SKYPE, $DS_LOGIN, $DS_SENHA, $REPETIR_SENHA, $NM_CONTATO_FAMILIAR, $NR_TELEFONE_CONTATO_FAMILIAR, $FK_PERFIL, $submit)); // $this->addElements(array($id, $nome, $email,$senha, $submit)); $this->setDecorators(array(array('ViewScript', array('viewScript' => '/forms/formularioOperador.phtml')))); }
public function init() { $this->setName('paymentmethod'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $name = new Zend_Form_Element_Text('name'); $name->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $this->addElements(array($id, $name)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'roles'); $id = new Zend_Form_Element_Hidden('id'); $rolename = new Zend_Form_Element_Text('rolename'); $rolename->setAttrib('maxLength', 50); $rolename->setAttrib('title', 'Role name'); $rolename->addFilter(new Zend_Filter_StringTrim()); $rolename->setRequired(true); $rolename->addValidator('NotEmpty', false, array('messages' => 'Please enter role name.')); $rolename->addValidator("regex", true, array('pattern' => '/^[a-zA-Z0-9 ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter valid role name.'))); $rolename->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'rolename', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive!=0'))); $rolename->getValidator('Db_NoRecordExists')->setMessage('Role name already exists.'); $rolename->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 50, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role name must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role name must contain at least %min% characters.'))))); $roletype = new Zend_Form_Element_Text('roletype'); $roletype->setRequired(true); $roletype->setAttrib('maxLength', 25); $roletype->setAttrib('title', 'Role type'); $roletype->addFilter(new Zend_Filter_StringTrim()); $roletype->addValidator('NotEmpty', false, array('messages' => 'Please enter role type.')); $roletype->addValidator("regex", true, array('pattern' => '/^[a-zA-Z]+?$/', 'messages' => array('regexNotMatch' => 'Please enter only alphabets.'))); $roletype->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_roles', 'field' => 'roletype', 'exclude' => 'id != "' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive != 0'))); $roletype->getValidator('Db_NoRecordExists')->setMessage('Role type already exists.'); $roletype->addValidators(array(array('StringLength', false, array('min' => 3, 'max' => 25, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Role type must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Role type must contain at least %min% characters.'))))); $roledescription = new Zend_Form_Element_Textarea('roledescription'); $roledescription->setAttrib('rows', 10); $roledescription->setAttrib('cols', 50); $roledescription->setAttrib('maxlength', '100'); $roledescription->setAttrib('title', 'Role description'); $levelid = new Zend_Form_Element_Hidden('levelid'); $levelid->addFilter(new Zend_Filter_StringTrim()); $levelid->setRequired(true); $levelid->addValidator('NotEmpty', false, array('messages' => 'Please select level.')); $istimeActive = Zend_Controller_Front::getInstance()->getRequest()->getParam('istimeactive'); $prev_cnt = new Zend_Form_Element_Hidden('prev_cnt'); $prev_cnt->setRequired(true); if ($istimeActive) { $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges other than time management.')); } else { $prev_cnt->addValidator('NotEmpty', false, array('messages' => 'Please select privileges.')); } $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $url = "'roles/saveupdate/format/json'"; $dialogMsg = "''"; $toggleDivId = "''"; $jsFunction = "'redirecttocontroller(\\'roles\\');'"; $submit->setOptions(array('onclick' => "saveDetails({$url},{$dialogMsg},{$toggleDivId},{$jsFunction});")); $this->addElements(array($id, $rolename, $roletype, $roledescription, $levelid, $submit, $prev_cnt)); $this->setElementDecorators(array('ViewHelper')); }
public function init() { $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $tipo = new Zend_Form_Element_Hidden('tipo'); $tipo->setValue('Monetario'); $valor = new Zend_Form_Element_Text('valor'); $valor->setLabel('Valor')->setRequired(true)->addValidator('NotEmpty'); $submit = new Zend_Form_Element_Submit('salvar'); $this->addElements(array($id, $tipo, $valor, $submit)); }
public function init() { $this->setName('Item'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $nome = new Zend_Form_Element_Text('nome'); $nome->setLabel('Nome')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $this->addElements(array($id, $nome, $submit)); }
public function init() { /* Form Elements & Other Definitions Here ... */ $submit = new Zend_Form_Element_Submit('submit', array('class' => 'btn btn-default')); $cancel = new Zend_Form_Element_Submit('cancel', array('class' => 'btn btn-default')); $id = new Zend_Form_Element_Hidden('id'); // Указываем, что данные в этом элементе фильтруются как число int $id->addFilter('Int')->removeDecorator('label')->removeDecorator('element'); // Добавляем все созданные элементы к форме. $this->addElements(array($id, $submit, $cancel)); }
public function init() { $this->setName('Requisito'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $tarefa = new Zend_Form_Element_Select('tarefa'); $tarefa->setLabel('Tarefa')->setRequired(true)->addValidator('NotEmpty'); foreach ($this->tarefas as $t) { $tarefa->addMultiOption($t->getId(), $t->getNome()); } $this->addElements(array($id, $tarefa)); }
public function init() { $this->setMethod('post'); $fadm_id_fase = new Zend_Form_Element_Hidden('fa_id'); $fadm_id_fase->addFilter('Int')->removeDecorator('Label')->removeDecorator('HtmlTag'); $fadm_ds_fase = new Zend_Form_Element_Text('fa_descricao'); $fadm_ds_fase->setLabel('Descrição:')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Alnum', false, true)->addValidator('StringLength', false, array(5, 100)); $fadm_ic_dcto_ativa = new Zend_Form_Element_Radio('fa_situacao'); $fadm_ic_dcto_ativa->setLabel('Fase documento?')->setRequired(true)->setMultiOptions(array('1' => 'Sim', '0' => 'Não')); $submit = new Zend_Form_Element_Submit('Salvar'); $this->addElements(array($fadm_id_fase, $fadm_ds_fase, $fadm_ic_dcto_ativa, $submit)); }