当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form_Element_Textarea::addFilter方法代码示例

本文整理汇总了PHP中Zend_Form_Element_Textarea::addFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Textarea::addFilter方法的具体用法?PHP Zend_Form_Element_Textarea::addFilter怎么用?PHP Zend_Form_Element_Textarea::addFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form_Element_Textarea的用法示例。


在下文中一共展示了Zend_Form_Element_Textarea::addFilter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     $this->setName('send-tweet');
     $e = new Zend_Form_Element_Text('latitude');
     $e->setLabel('Latitude');
     $e->addFilter('StringTrim');
     $e->setAttrib('onblur', 'setMarkerFromForm()');
     $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/'));
     $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Latitude is not valid'), 'en'));
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('longitude');
     $e->setLabel('Longitude');
     $e->addFilter('StringTrim');
     $e->setAttrib('onblur', 'setMarkerFromForm()');
     $e->addValidator(new Zend_Validate_Regex('/[-+0-9.]/'));
     $e->setTranslator(new Zend_Translate_Adapter_Array(array('regexNotMatch' => 'Longitude is not valid'), 'en'));
     $this->addElement($e);
     $e = new Zend_Form_Element_Textarea('tweet');
     $e->setLabel('Tweet');
     $e->setRequired(true);
     $e->addFilter('StripTags');
     $e->addFilter('StringTrim');
     $e->addValidator(new Zend_Validate_StringLength(array('max' => 140)));
     $e->setTranslator(new Zend_Translate_Adapter_Array(array('isEmpty' => 'Please supply the message to be tweeted', 'stringLengthTooLong' => 'No more than 140 characters please!'), 'en'));
     $this->addElement($e);
     $e = new Zend_Form_Element_Submit('send');
     $e->setIgnore(true);
     $e->setLabel('Tweet!');
     $this->addElement($e);
 }
开发者ID:akrabat,项目名称:TweetGT,代码行数:30,代码来源:Tweet.php

示例2: _motivo

 protected function _motivo()
 {
     $e = new Zend_Form_Element_Textarea('motivo');
     $e->setLabel(_('Reason') . ':');
     $e->setRequired(true);
     $e->setAttrib('rows', 4);
     $e->setAttrib("data-parsley-required", "true");
     $e->setAttrib('placeholder', _('Describe why you want to change your e-mail address...'));
     $e->addFilter('StripTags');
     $e->addFilter('StringTrim');
     $e->addValidator('StringLength', false, array(10));
     $e->setAttrib('class', 'form-control');
     return $e;
 }
开发者ID:jovanepires,项目名称:sige,代码行数:14,代码来源:RequisitarMudarEmail.php

示例3: init

 public function init()
 {
     $media_library_model = new Cms_Model_MediaLibraries();
     $media_library = $media_library_model->getByPath($this->_attribs['media_library_path']);
     $title = new Zend_Form_Element_Text('title');
     $title->setLabel('Title');
     $title->setRequired(true);
     $title->addFilter('StringTrim');
     $title->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $this->addElement($title);
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('Description');
     $description->addFilter('StringTrim');
     $description->addValidator('Alnum', false, array('allowWhiteSpace' => true));
     $this->addElement($description);
     $original = new Zend_Form_Element_File('original');
     $original->addValidator('Count', false, 1);
     $original->addValidator('Extension', false, 'jpeg,jpg,png');
     $original->addFilter('Rename', $this->_attribs['file_name']);
     $original->setDestination(My_Utilities::getUploadMediaPathDiffSizes($this->_attribs['file_name'], $this->_attribs['media_library_path'], 'original'));
     $original->setLabel('Image:');
     $this->addElement($original);
     $submit = new Zend_Form_Element_Submit('save');
     $submit->setAttrib('class', 'btn btn-primary');
     $submit->setLabel('Potvrdi');
     $this->setAction('')->setMethod('post')->addElement($submit);
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setLabel('Cancel');
     $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black');
     $cancel->setAttrib("onClick", "window.location = window.location.origin+'/cms/medias/index/library_id/" . $media_library->id . "'");
     $this->addElement($cancel);
 }
开发者ID:zelimirus,项目名称:yard,代码行数:32,代码来源:Medias.php

示例4: init

 public function init()
 {
     $this->setName('manufacturer');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $column = new Zend_Form_Element_Text('column');
     $column->setRequired(true)->addFilter('Int')->addValidator('NotEmpty');
     $text = new Zend_Form_Element_Textarea('text');
     $text->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('cols', '20')->setAttrib('rows', '5');
     $width = new Zend_Form_Element_Text('width');
     $width->addFilter('Int');
     $this->addElements(array($id, $column, $text, $width));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:dewawi,项目名称:dewawi,代码行数:14,代码来源:Footer.php

示例5: __construct

 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = true;
     parent::__construct($options);
     // email
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $email = new Zend_Form_Element_Text('email');
     $this->setAttrib('class', 'zendFormNewsletter');
     $email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'stdTextInput');
     $this->addElement($email);
     //unsubscription reason
     $reason = new Zend_Form_Element_Select('reason');
     $this->setAttrib('class', 'zendFormNewsletter');
     $reason->setLabel($this->getView()->getCibleText('form_label_unsubscribe_reason'))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'reasonSelect', 'id' => ''))))->setAttrib('class', 'stdSelect');
     $selectoptions = array();
     $oRef = new ReferencesObject();
     $options = $oRef->getRefByType('unsubscrArg');
     foreach ($options as $option) {
         $value = $option['R_TypeRef'] . '-' . $option['R_ID'];
         $selectoptions[$option['R_ID']] = $option['RI_Value'];
     }
     $reason->addMultiOptions($selectoptions);
     $reason->addMultiOption(0, 'Autre');
     $this->addElement($reason);
     //unsubscription reason
     $reasonOther = new Zend_Form_Element_Textarea('reasonOther');
     $this->setAttrib('class', 'zendFormNewsletter');
     $reasonOther->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'reasonOther hidden', 'id' => ''))))->setAttrib('class', 'reasonTextarea');
     $this->addElement($reasonOther);
     $unsubscribeButton = new Zend_Form_Element_Submit('unsubscribe');
     $unsubscribeButton->setLabel($this->getView()->getCibleText('newsletter_title_desabonnement_text'))->setAttrib('id', 'unsubmitSave')->setAttrib('class', 'unsubscribeButton1')->removeDecorator('Label')->removeDecorator('DtDdWrapper');
     $this->addElement($unsubscribeButton);
     $this->addDisplayGroup(array('unsubscribe'), 'actions');
     $actions = $this->getDisplayGroup('actions');
     $this->setDisplayGroupDecorators(array('formElements', 'fieldset', array(array('outerHtmlTag' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd-unsubscribe-button'))));
     $requiredFields = new Zend_Form_Element_Hidden('RequiredFields');
     $requiredFields->setLabel('<span class="field_required">*</span>' . $this->getView()->getCibleText('form_field_required_label') . '<br /><br />');
     $requiredFields->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_required_fields'))));
     $this->addElement($requiredFields);
     $this->setDecorators(array('FormElements', 'Form'));
 }
开发者ID:anunay,项目名称:stentors,代码行数:42,代码来源:FormNewsletterUnsubscription.php

示例6: init

 /**
  * Inicializace formulare
  *
  */
 public function init()
 {
     $this->setMethod(self::METHOD_POST);
     // ################## FIRST COLUMN ###################
     // datum pohovoru
     $elem = new Zend_Form_Element_Text('datum_pohovoru');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', array('form-control', 'date-picker'));
     $elem->setAttrib('placeholder', 'Pick a date…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'datum_pohovoru');
     // Multi select (perzonalista – pokročilé informace)
     $elem = new Zend_Form_Element_Multiselect('perzonalista_informace');
     $elem->removeDecorator('Label');
     $elem->setAttrib('placeholder', 'Pick an interviewers…');
     $elem->setAttrib('class', 'form-control');
     $this->addElement($elem, 'perzonalista_informace');
     // vzdělání
     $elem = new Zend_Form_Element_Text('vzdelani');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Education…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'vzdelani');
     // motivace
     $elem = new Zend_Form_Element_Textarea('motivace');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Motivation…');
     $elem->setAttrib('rows', '1');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'motivace');
     // preferovaná práce
     $elem = new Zend_Form_Element_Textarea('preferovana_prace');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Kind of work preferred…');
     $elem->setAttrib('rows', '1');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'preferovana_prace');
     // ambice
     $elem = new Zend_Form_Element_Textarea('ambice');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Ambitions…');
     $elem->setAttrib('rows', '1');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'ambice');
     // jazyky
     $elem = new Zend_Form_Element_Text('jazyky');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Languages…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'jazyky');
     // cestování
     $elem = new Zend_Form_Element_Text('cestovani');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Travelling…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'cestovani');
     // ################## SECOND COLUMN ###################
     // plusy_minusy
     $elem = new Zend_Form_Element_Textarea('plusy_minusy');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Pluses/Minuses…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'plusy_minusy');
     // zkusenosti_v_tymu
     $elem = new Zend_Form_Element_Textarea('zkusenosti_v_tymu');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Team work experience…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'zkusenosti_v_tymu');
     // pracovni_misto
     $elem = new Zend_Form_Element_Textarea('pracovni_misto');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Domain/Areas of work…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'pracovni_misto');
     // knowhow
     $elem = new Zend_Form_Element_Textarea('knowhow');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Skills and technologies…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'knowhow');
     // dalsi_informace
//.........这里部分代码省略.........
开发者ID:cngroupdk,项目名称:InterviewMe_Tym1,代码行数:101,代码来源:AdvancedInformationsForm.php

示例7: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'timemanagement/clients/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'addOrEditClients');
     $id = new Zend_Form_Element_Hidden('id');
     $clientname = new Zend_Form_Element_Text('client_name');
     $clientname->setLabel("Client");
     $clientname->setAttrib('maxLength', 50);
     $clientname->addFilter(new Zend_Filter_StringTrim());
     $clientname->setRequired(TRUE);
     $clientname->addValidator('NotEmpty', false, array('messages' => 'Please enter client name.'));
     $clientname->addValidator("regex", true, array('pattern' => '/^(?![0-9]*$)[a-zA-Z0-9.,&\\(\\)\\/\\-_\' ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid client name.')));
     $phonenumber = new Zend_Form_Element_Text('phone_no');
     $phonenumber->addFilter(new Zend_Filter_StringTrim());
     $phonenumber->setAttrib('maxLength', 15);
     $phonenumber->setLabel("Phone Number");
     $phonenumber->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Phone number must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Phone number must contain at least %min% characters.')))));
     $phonenumber->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9-]+$/i', 'messages' => array('regexNotMatch' => 'Please enter a valid phone number.')))));
     $emailaddress = new Zend_Form_Element_Text("email");
     $emailaddress->setRequired(FALSE);
     //$emailaddress->addValidator('NotEmpty', false, array('messages' => 'Please enter email.'));
     $emailaddress->addValidator("regex", true, array('pattern' => '/^(?!.*\\.{2})[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid email.')));
     $emailaddress->setLabel("Email");
     $emailaddress->setAttrib("class", "formDataElement");
     $pointofcontact = new Zend_Form_Element_Text('poc');
     $pointofcontact->setAttrib('maxLength', 90);
     $pointofcontact->setLabel("Point of Contact");
     $pointofcontact->addFilter(new Zend_Filter_StringTrim());
     $pointofcontact->setRequired(TRUE);
     $pointofcontact->addValidator('NotEmpty', false, array('messages' => 'Please enter point of contact.'));
     $pointofcontact->addValidator("regex", true, array('pattern' => '/^(?![0-9]*$)[a-zA-Z.0-9\\-_\' ?]+$/', 'messages' => array('regexNotMatch' => 'Please enter a valid point of contact.')));
     $address = new Zend_Form_Element_Textarea('address');
     $address->setAttrib('maxLength', 180);
     $address->setLabel("Address");
     $address->addFilter(new Zend_Filter_StringTrim());
     $country = new Zend_Form_Element_Select('country_id');
     $country->setLabel('Country');
     $country->setRequired(FALSE);
     //$country->addValidator('NotEmpty', false, array('messages' => 'Please select country.'));
     $country->setAttrib('onchange', 'getStates()');
     $countryModal = new Timemanagement_Model_Countries();
     $countriesData = $countryModal->fetchAll('is_active=1', 'country_name');
     $country->addMultiOption('', 'Select country');
     foreach ($countriesData->toArray() as $data) {
         $country->addMultiOption($data['id'], utf8_encode($data['country_name']));
     }
     $country->setRegisterInArrayValidator(false);
     $state = new Zend_Form_Element_Select('state_id');
     $state->setLabel('State');
     $state->setAttrib('class', 'selectoption');
     $state->setRegisterInArrayValidator(false);
     $state->addMultiOption('', 'Select State');
     $state->setRequired(FALSE);
     //$state->addValidator('NotEmpty', false, array('messages' => 'Please select state.'));
     $fax = new Zend_Form_Element_Text('fax');
     $fax->addFilter(new Zend_Filter_StringTrim());
     $fax->setAttrib('maxLength', 15);
     $fax->setLabel("Fax");
     $fax->addValidators(array(array('StringLength', false, array('min' => 10, 'max' => 15, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Fax number must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Fhone number must contain at least %min% characters.')))));
     $fax->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[0-9-]+$/i', 'messages' => array('regexNotMatch' => 'Please enter a valid fax number.')))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Save');
     $this->addElements(array($id, $clientname, $country, $state, $address, $pointofcontact, $emailaddress, $phonenumber, $submit, $fax));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:68,代码来源:Clients.php

示例8: buildForm

 /**
  * Строит форму
  * 
  * @param array $fields Массив данных о полях формы
  * 
  * @return Zend_Form
  */
 public function buildForm($fields)
 {
     $form = Phorm_Form::makeForm();
     foreach ($fields as $data) {
         $fieldname = "field_" . $data["fieldid"];
         switch ($data["fieldtype"]) {
             /**
              * Однострочное текстовое поле
              */
             case "Text":
                 $field = new Zend_Form_Element_Text($fieldname);
                 // Типы валидаторов
                 if ($data["fieldvalidators"] == "Email") {
                     $field->addValidator("EmailAddress", true, array("messages" => array("emailAddressInvalid" => $this->_translate->_("Неверно указан email"), "emailAddressInvalidHostname" => $this->_translate->_("Неверно указан email"), "emailAddressInvalidMxRecord" => $this->_translate->_("Неверно указан email"), "emailAddressInvalidSegment" => $this->_translate->_("Неверно указан email"), "emailAddressDotAtom" => $this->_translate->_("Неверно указан email"), "emailAddressQuotedString" => $this->_translate->_("Неверно указан email"), "emailAddressInvalidLocalPart" => $this->_translate->_("Неверно указан email"), "emailAddressLengthExceeded" => $this->_translate->_("Неверно указан email"), "emailAddressInvalidFormat" => $this->_translate->_("Неверный формат"))));
                 } elseif ($data["fieldvalidators"] == "Date") {
                     $field->addValidator("Date", true, array("messages" => array("dateInvalid" => $this->_translate->_("Неверная дата"), "dateInvalidDate" => $this->_translate->_("Неверная дата"), "dateFalseFormat" => $this->_translate->_("Неверная дата"))));
                 } elseif ($data["fieldvalidators"] == "Int") {
                     $field->addValidator("Int", true, array("messages" => array("notInt" => $this->_translate->_("Значение должно быть числом"), "intInvalid" => $this->_translate->_("Значение должно быть числом"))));
                 } elseif ($data["fieldvalidators"] == "Hostname") {
                     $field->addValidator("Hostname", true, array("messages" => array("hostnameInvalid" => $this->_translate->_("Неверный адрес"), "hostnameIpAddressNotAllowed" => $this->_translate->_("Неверный адрес"), "hostnameUnknownTld" => $this->_translate->_("Неверный адрес"), "hostnameDashCharacter" => $this->_translate->_("Неверный адрес"), "hostnameInvalidHostnameSchema" => $this->_translate->_("Неверный адрес"), "hostnameUndecipherableTld" => $this->_translate->_("Неверный адрес"), "hostnameInvalidHostname" => $this->_translate->_("Неверный адрес"), "hostnameInvalidLocalName" => $this->_translate->_("Неверный адрес"), "hostnameLocalNameNotAllowed" => $this->_translate->_("Неверный адрес"), "hostnameCannotDecodePunycode" => $this->_translate->_("Неверный адрес"))));
                 }
                 // Если разрешен HTML
                 if ($data["htmlallowed"] == "yes") {
                     $field->addFilter("StringTrim");
                 } else {
                     $field->addFilter("StripTags");
                 }
                 break;
                 /**
                  * Многострочное текстовое поле
                  */
             /**
              * Многострочное текстовое поле
              */
             case "Textarea":
                 $field = new Zend_Form_Element_Textarea($fieldname);
                 // Если разрешен HTML
                 if ($data["htmlallowed"] == "yes") {
                     $field->addFilter("StringTrim");
                 } else {
                     $field->addFilter("StripTags");
                 }
                 break;
                 /**
                  * Чекбокс
                  */
             /**
              * Чекбокс
              */
             case "Checkbox":
                 $field = new Zend_Form_Element_Checkbox($fieldname);
                 break;
                 /**
                  * Радиоточка
                  */
             /**
              * Радиоточка
              */
             case "Radio":
                 $field = new Zend_Form_Element_Radio($fieldname);
                 break;
                 /**
                  * Список
                  */
             /**
              * Список
              */
             case "Select":
                 $field = new Zend_Form_Element_Select($fieldname);
                 $haystack = array();
                 $optionsdata = explode("\n", $data["optionsdata"]);
                 foreach ($optionsdata as $k => $v) {
                     $haystack[$k] = trim($v);
                 }
                 $field->addMultiOption("", $this->_translate->_("---Выберите---"));
                 foreach ($haystack as $value) {
                     $field->addMultiOption($value, $value);
                 }
                 $haystack[$this->_translate->_("---Выберите---")] = "";
                 $field->addValidator("InArray", true, array("haystack" => $haystack, "messages" => array("notInArray" => $this->_translate->_("Не выбрано ни одного значения"))));
                 break;
                 /**
                  * Список с множественным выбором
                  */
             /**
              * Список с множественным выбором
              */
             case "Multiselect":
                 $field = new Zend_Form_Element_Multiselect($fieldname);
                 $haystack = array();
                 $optionsdata = explode("\n", $data["optionsdata"]);
                 foreach ($optionsdata as $k => $v) {
                     $haystack[$k] = trim($v);
//.........这里部分代码省略.........
开发者ID:ei-grad,项目名称:phorm,代码行数:101,代码来源:Forms.php

示例9: __construct

 /**
  * @author code generate
  * @return mixed
  */
 public function __construct($option = array())
 {
     $userId = new Zend_Form_Element_Hidden('TutorId');
     $userId->setDecorators(array('ViewHelper'));
     $this->addElement($userId);
     $birthDay = new Zend_Form_Element_Text('Birthday');
     $birthDay->setLabel('Ngày sinh *');
     $birthDay->addFilter('StringTrim');
     $birthDay->setRequired(true);
     $birthDay->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $birthDay->addValidator('stringLength', false, array(2, 50, "messages" => "Ngày sinh dài tối đa 50 ký tự"));
     $this->addElement($birthDay);
     $gender = new Zend_Form_Element_Select('Gender');
     $gender->setLabel('Giới tính *');
     $gender->addFilter('StringTrim');
     $gender->setRequired(true);
     $gender->setMultiOptions(array('1' => 'Nam', '0' => 'Nữ'));
     $gender->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $gender->setSeparator('');
     $gender->setValue("1");
     $this->addElement($gender);
     $email = new Zend_Form_Element_Text('Email');
     $email->setLabel('Email *');
     $email->addFilter('StringTrim');
     $email->setRequired(true);
     $email->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $email->addValidator(new Zend_Validate_Db_NoRecordExists("Tutors", "Email"));
     $email->addValidator('EmailAddress', true);
     $email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => "Email không phù hợp")));
     $this->addElement($email);
     $userName = new Zend_Form_Element_Text('UserName');
     $userName->setLabel('Họ tên *');
     $userName->addFilter('StringTrim');
     $userName->setRequired(true);
     $userName->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $userName->addValidator('stringLength', false, array(2, 50, "messages" => "Họ tên dài tối đa 2-50 ký tự"));
     $this->addElement($userName);
     $address = new Zend_Form_Element_Text('Address');
     $address->setLabel('Địa chỉ *');
     $address->addFilter('StringTrim');
     $address->setRequired(true);
     $address->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $userName->addValidator('stringLength', false, array(1, 100, "messages" => "Địa chỉ dài tối đa 100 ký tự"));
     $this->addElement($address);
     $phone = new Zend_Form_Element_Text('Phone');
     $phone->setLabel('Điện thoại *');
     $phone->addFilter('StringTrim');
     $phone->setRequired(true);
     $phone->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $phone->addValidator('stringLength', false, array(6, 50, "messages" => "Điện thoại dài tối đa 6-50 ký tự"));
     $this->addElement($phone);
     $required = new Zend_Validate_NotEmpty();
     $required->setType($required->getType() | Zend_Validate_NotEmpty::INTEGER | Zend_Validate_NotEmpty::ZERO);
     $level = new Zend_Form_Element_Select('Level');
     $level->setLabel('Trình độ *');
     $level->addFilter('StringTrim');
     $level->addValidator('Int');
     $level->setRequired(true);
     $level->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $level->addValidators(array($required));
     $level->setMultiOptions(unserialize(TUTOR_LEVELS));
     $this->addElement($level);
     $university = new Zend_Form_Element_Text('University');
     $university->setLabel('Trường tốt nghiệp *');
     $university->addFilter('StringTrim');
     $university->setRequired(true);
     $university->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $university->addValidator('stringLength', false, array(1, 100, "messages" => "Trường tố nghiệp dài tối đa 100 ký tự"));
     $this->addElement($university);
     $subject = new Zend_Form_Element_Text('Subject');
     $subject->setLabel('Chuyên ngành *');
     $subject->addFilter('StringTrim');
     $subject->setRequired(true);
     $subject->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $subject->addValidator('stringLength', false, array(1, 100, "messages" => "Chuyên ngành dài tối đa 100 ký tự"));
     $this->addElement($subject);
     $experienceYears = new Zend_Form_Element_Select('ExperienceYears');
     $experienceYears->setLabel('Số Năm Kinh Nghiệm *');
     $experienceYears->addFilter('StringTrim');
     $experienceYears->setRequired(false);
     $experienceYears->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $options = unserialize(EXPERIENCE_YEAR);
     //$experienceYears->addMultiOptions(array_combine($options, $options));
     $experienceYears->setMultiOptions(unserialize(EXPERIENCE_YEAR));
     $this->addElement($experienceYears);
     $career = new Zend_Form_Element_Select('Career');
     $career->setLabel('Hiện tại là *');
     $career->addFilter('StringTrim');
     $career->addValidator('Int');
     $career->setRequired(true);
     $career->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $career->setMultiOptions(unserialize(TUTOR_CAREERS));
     $this->addElement($career);
     $careerLocation = new Zend_Form_Element_Text('CareerLocation');
     $careerLocation->setLabel('Nơi Công Tác ( Giáo hoặc Giảng Viên ) *');
     $careerLocation->addFilter('StringTrim');
//.........这里部分代码省略.........
开发者ID:hocondoimeo,项目名称:giasu-tam.com,代码行数:101,代码来源:Tutors.php


注:本文中的Zend_Form_Element_Textarea::addFilter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。