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


PHP Zend_Form_Element_Select::addFilter方法代码示例

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


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

示例1: init

 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'))));
 }
开发者ID:bogdanmatra,项目名称:ibm-hackathon,代码行数:60,代码来源:Route.php

示例2: initIdPersonElement

 /**
  *
  */
 protected function initIdPersonElement()
 {
     $element = new \Zend_Form_Element_Select('id_person');
     $options = \Application\Query\PersonQuery::create()->find()->toCombo();
     $element->addMultiOptions($options);
     $element->setLabel($this->getTranslator()->_('IdPerson'));
     $element->addValidator($this->validator->getFor('id_person'));
     $element->addFilter($this->filter->getFor('id_person'));
     $element->setRequired(true);
     $this->addElement($element);
     $this->elements['id_person'] = $element;
 }
开发者ID:Eximagen,项目名称:sochi,代码行数:15,代码来源:UserForm.php

示例3: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('action', BASE_URL . 'shortlistedcandidates/edit');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'businessunits');
     $id = new Zend_Form_Element_Hidden('id');
     $selectionstatus = new Zend_Form_Element_Select('selectionstatus');
     $selectionstatus->setRequired(true)->addErrorMessage('Please change the candidate status.');
     $selectionstatus->addFilter('Int')->addValidator('NotEmpty', true, array('integer', 'zero'));
     $selectionstatus->setLabel('domain')->setMultiOptions(array('0' => 'Select status', '2' => 'Selected', '3' => 'Rejected'));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setAttrib('id', 'submitbutton');
     $submit->setLabel('Update');
     $this->addElements(array($id, $selectionstatus, $submit));
     $this->setElementDecorators(array('ViewHelper'));
 }
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:17,代码来源:shortlistedcandidates.php

示例4: init

 public function init()
 {
     $naoVazio = new Zend_Validate_NotEmpty();
     $categoriaTB = new Application_Model_DbTable_Categoria();
     $categorias = $categoriaTB->fetchAll(null, 'categoria');
     $array = array(0 => 'Selecione uma categoria');
     foreach ($categorias as $categoria) {
         $array[$categoria->idcategoria] = $categoria->categoria;
     }
     $idcategoria = new Zend_Form_Element_Select('idcategoria', array('label' => 'Categoria:', 'required' => true, 'multioptions' => $array));
     $idcategoria->addValidator($naoVazio);
     $filter = new Zend_Filter_Null();
     $idcategoria->addFilter($filter);
     $this->addElement($idcategoria);
     $titulo = new Zend_Form_Element_Text('titulo', array('label' => 'Titulo:', 'required' => true));
     $titulo->addValidator($naoVazio);
     $this->addElement($titulo);
     $texto = new Zend_Form_Element_Textarea('texto', array('label' => 'Texto:', 'required' => true));
     $texto->addValidator($naoVazio);
     $this->addElement($texto);
     $botao = new Zend_Form_Element_Submit('botao', array('label' => 'Salvar'));
     $this->addElement($botao);
 }
开发者ID:JoaoAntonioMaruti,项目名称:AulasUnipar2015,代码行数:23,代码来源:Post.php

示例5: _id_tipo_horario

 protected function _id_tipo_horario()
 {
     $e = new Zend_Form_Element_Select('id_tipo_horario');
     $e->setLabel('* Tipo Horário:');
     $e->setRequired();
     $e->addFilter('Int');
     $e->setAttrib('class', 'form-control');
     $model = new Admin_Model_TipoHorario();
     $rs = $model->getAdapter()->fetchAll("SELECT id_tipo_horario,\n            intervalo_minutos, TO_CHAR(horario_inicial, 'HH24:MI') as horario_inicial,\n            TO_CHAR(horario_final, 'HH24:MI') as horario_final\n            FROM tipo_horario ORDER BY id_tipo_horario");
     foreach ($rs as $item) {
         $descricao = "Intervalo de {$item['intervalo_minutos']} min.,\n                de {$item['horario_inicial']} até {$item['horario_final']}";
         $e->addMultiOptions(array($item['id_tipo_horario'] => $descricao));
     }
     $e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', '')));
     return $e;
 }
开发者ID:jovanepires,项目名称:sige,代码行数:16,代码来源:Encontro.php

示例6: __construct

 public function __construct($options = null, $data = null, $contentId = 0, $contentType = 'problem', $lang = 'en')
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $this->setDisableLoadDefaultDecorators(true);
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form')->removeDecorator('DtDdWrapper');
     $this->setName('add_content_form');
     $this->setAction($baseUrl . '/' . $lang . '/content/edit/' . $contentId);
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $this->setAttrib('enctype', 'multipart/form-data');
     // Content header input form element
     $header = new Zend_Form_Element_Text('content_header');
     $header->setValue($data['content_header'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-header"))->setDecorators(array('FormElementDecorator'));
     // if ($data['published_cnt']) { // Disable editing of header if data is already published
     //	$header->setAttrib('readonly', true);
     // }
     // Content keywords input form element
     $keywords = new Zend_Form_Element_Text('content_keywords');
     $keywords->addFilter('StringtoLower')->setValue($data['content_keywords'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long'))), array('Regex', true, array('/^[\\p{L}0-9, ]*$/'))))->setLabel($translate->_("content-add-keywords"))->setDescription($translate->_("content-add-keywords-help-text"))->setDecorators(array('FormElementDecorator'));
     $content_type = new Zend_Form_Element_Hidden('content_type');
     $content_type->setValue($data['content_type'])->setDecorators(array('FormHiddenElementDecorator'));
     // Content lead text input form element
     $textlead = new Zend_Form_Element_Textarea('content_textlead');
     $textlead->setValue($data['content_textlead'])->setRequired(true)->setAttrib('class', 'textlead')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 320, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-textlead"))->setDescription($translate->_("content-add-textlead-help-text"))->setDecorators(array('FormElementDecorator'));
     // Content text input form element
     $text = new Zend_Form_Element_Textarea('content_text');
     $text->setValue($data['content_text'])->setAttrib('class', 'textbody')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(0, 4000, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooShort' => 'content-add-field-too-short', 'stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-text"))->setDescription($translate->_('content-add-' . $contentType . '-textbody-help-text'))->setDecorators(array('FormOptionalElementDecorator'));
     // Content keywords input form element
     $related_companies = new Zend_Form_Element_Text('content_related_companies');
     $related_companies->setRequired(false)->addValidators(array(array('StringLength', true, array(0, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-related_companies"))->setDescription($translate->_("content-add-related_companies-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
     // Problem research question input form element
     $research = new Zend_Form_Element_Text('content_research');
     $research->setValue($data['content_research'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-research"))->setDescription($translate->_("content-add-research-help-text"))->setDecorators(array('FormElementDecorator'));
     // Future info opportunity
     $opportunity = new Zend_Form_Element_Text('content_opportunity');
     $opportunity->setValue($data['content_opportunity'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-opportunity"))->setDescription($translate->_("content-add-opportunity-help-text"))->setDecorators(array('FormElementDecorator'));
     // Future info threat
     $threat = new Zend_Form_Element_Text('content_threat');
     $threat->setValue($data['content_threat'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-threat"))->setDescription($translate->_("content-add-threat-help-text"))->setDecorators(array('FormElementDecorator'));
     // Idea/solution in one sentence
     $solution = new Zend_Form_Element_Text('content_solution');
     $solution->setValue($data['content_solution'])->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-solution"))->setDecorators(array('FormElementDecorator'));
     // File upload
     $file = new Zend_Form_Element_File('content_file_upload');
     $file->setDestination('../www/upload')->removeDecorator('DtDdWrapper')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'png,gif,jpg,jpeg,doc,zip,xls,mpp,pdf,wmv,avi,mkv,mov,mpeg,mp4,divx,flv,ogg,3gp');
     $file->setLabel($translate->_("content-add-upload-file"))->setDescription($translate->_("content-add-file-upload-help-text"))->setDecorators(array('UploadDecorator'))->setAttrib("onchange", "multiFile(this, '" . $translate->_("content-add-file-delete-file-button") . "');");
     $uploadedFilesBoxes = new Zend_Form_Element_MultiCheckbox('uploadedFiles');
     $uploadedFilesBoxes->setMultiOptions($data['filenames'])->setRequired(false)->setDecorators(array('FormElementDecorator'))->setLabel($translate->_('content-add-file-delete-files-label'));
     // References
     $references = new Zend_Form_Element_Textarea('content_references');
     $references->setValue($data['content_references'])->setAttrib('class', 'textlead')->addValidators(array(array('StringLength', true, array(0, 2000, 'encoding' => 'UTF-8', 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-references"))->setDescription($translate->_("content-add-references-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
     // Language select form element
     $language = new Zend_Form_Element_Select('content_language');
     $language->addFilter('StringtoLower')->setLabel($translate->_("content-add-language"))->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['languages']);
     // Future info classification
     $finfoClasses = new Zend_Form_Element_Select('content_finfo_class');
     $finfoClasses->setLabel($translate->_("content-add-finfo-classification"))->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['FutureinfoClasses']);
     /*
     		// Industry select form element
     		$industry = new Zend_Form_Element_Select('content_industry');
     		$industry->addFilter('StringtoLower')
             ->setValue($data['industryIds'][0])
             ->setLabel($translate->_("content-view-industry-classification"))
     				->setDecorators(array('FormElementDecorator'))
     				->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/division/industry/'+this.value, 
                         'content_division_div', this.value);")
     				->setMultiOptions($data['Industries']);	
     
     		$division = new Zend_Form_Element_Select('content_division');
     		$division->addFilter('StringtoLower')
             ->setValue($data['industryIds'][1])
     				->setDecorators(array('FormElementDecorator'))
             ->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/group/division/'+this.value, 
                         'content_group_div', this.value);")
     				->setMultiOptions($data['Divisions'])
             ->setRegisterInArrayValidator(false);
     		
     		$group = new Zend_Form_Element_Select('content_group');
     		$group->addFilter('StringtoLower')
             ->setValue($data['industryIds'][2])
     				->setDecorators(array('FormElementDecorator'))
             ->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/class/group/'+this.value, 
                         'content_class_div', this.value);")
     				->setMultiOptions($data['Groups'])
             ->setRegisterInArrayValidator(false);
     				
     		$class = new Zend_Form_Element_Select('content_class');
     		$class->addFilter('StringtoLower')
             ->setValue($data['industryIds'][3])
     				->setDecorators(array('FormElementDecorator'))
     				->setMultiOptions($data['Classes'])
             ->setRegisterInArrayValidator(false);
     */
     $innovation = new Zend_Form_Element_Select('innovation_type');
     $innovation->setLabel($translate->_("content-view-innovationtype-classification"))->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['InnovationTypes']);
     // Used for track button clicks
     $hidden_content_publish = new Zend_Form_Element_Hidden('content_publish');
     $hidden_content_publish->setDecorators(array('FormHiddenElementDecorator'));
     $hidden_content_save = new Zend_Form_Element_Hidden('content_save');
//.........这里部分代码省略.........
开发者ID:jannev,项目名称:site,代码行数:101,代码来源:EditContentForm.php

示例7: __construct

 public function __construct($options = null, $data = null, $lang = 'en', $contentType = 'problem')
 {
     parent::__construct($options);
     $translate = Zend_Registry::get('Zend_Translate');
     $baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
     $this->setDisableLoadDefaultDecorators(true);
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div'))->addDecorator('Form')->removeDecorator('DtDdWrapper');
     $this->setName('add_content_form');
     //$this->setName('contentAdd');
     $this->setAction($baseUrl . '/' . $lang . '/content/add/' . $contentType);
     $this->addElementPrefixPath('Oibs_Decorators', 'Oibs/Decorators/', 'decorator');
     $this->setAttrib('enctype', 'multipart/form-data');
     /**
      * 
      * Form Elements
      * 
      */
     // Language, Select
     $language = new Zend_Form_Element_Select('content_language');
     $language->addFilter('StringtoLower')->setLabel($translate->_("content-add-language"))->setRequired(true)->setDecorators(array('FormElementDecorator'))->setMultiOptions($data['languages']);
     // Header, input
     $header = new Zend_Form_Element_Text('content_header');
     $header->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setDescription($translate->_("content-add-headline-help-text"))->setLabel($translate->_("content-add-header"))->setDecorators(array('FormElementDecorator'));
     // Keywords, input
     $keywords = new Zend_Form_Element_Text('content_keywords');
     $keywords->addFilter('StringToLower')->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 120, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long'))), array('Regex', true, array('/^[\\p{L}0-9, ]*$/'))))->setLabel($translate->_("content-add-keywords"))->setDescription($translate->_("content-add-keywords-help-text"))->setDecorators(array('FormElementDecorator'));
     // Content type, Hidden
     $content_type = new Zend_Form_Element_Hidden('content_type');
     $content_type->setValue($data['content_type'])->setDecorators(array('FormHiddenElementDecorator'));
     // Used for track button clicks
     $hidden_content_publish = new Zend_Form_Element_Hidden('content_publish');
     $hidden_content_publish->setDecorators(array('FormHiddenElementDecorator'));
     $hidden_content_save = new Zend_Form_Element_Hidden('content_save');
     $hidden_content_save->setDecorators(array('FormHiddenElementDecorator'));
     // Related content, Hidden
     $content_relatesto_id = new Zend_Form_Element_Hidden('content_relatesto_id');
     $content_relatesto_id->setValue($data['content_relatesto_id'])->setDecorators(array('FormHiddenElementDecorator'));
     // Lead, Textarea
     $textlead = new Zend_Form_Element_Textarea('content_textlead');
     $textlead->setRequired(true)->setAttrib('class', 'textlead')->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 320, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-textlead"))->setDescription($translate->_("content-add-textlead-help-text"))->setDecorators(array('FormElementDecorator'));
     // Body, Textarea
     $text = new Zend_Form_Element_Textarea('content_text');
     $text->setAllowEmpty(true)->setAttrib('class', 'textbody')->addValidators(array(array('StringLength', true, array(0, 4000, 'messages' => array('stringLengthTooShort' => 'content-add-field-too-short', 'stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-text"))->setDescription($translate->_('content-add-' . $contentType . '-textbody-help-text'))->setDecorators(array('FormOptionalElementDecorator'));
     // Related companies, Input
     $related_companies = new Zend_Form_Element_Text('content_related_companies');
     $related_companies->setRequired(false)->addValidators(array(array('StringLength', true, array(0, 120, 'messages' => array('stringLengthTooLong' => 'content-add-field-too-long')))))->setLabel($translate->_("content-add-related_companies"))->setDescription($translate->_("content-add-related_companies-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
     // Problem research question, Input
     $research = new Zend_Form_Element_Text('content_research');
     $research->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-research"))->setDescription($translate->_("content-add-research-help-text"))->setDecorators(array('FormElementDecorator'));
     // Future info opportunity, Input
     $opportunity = new Zend_Form_Element_Text('content_opportunity');
     $opportunity->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-opportunity"))->setDescription($translate->_("content-add-opportunity-help-text"))->setDecorators(array('FormElementDecorator'));
     // Future info threat, Input
     $threat = new Zend_Form_Element_Text('content_threat');
     $threat->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-threat"))->setDescription($translate->_("content-add-threat-help-text"))->setDecorators(array('FormElementDecorator'));
     // Idea/solution in one sentence, Input
     $solution = new Zend_Form_Element_Text('content_solution');
     $solution->setRequired(true)->addValidators(array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'content-add-field-empty'))), array('StringLength', true, array(1, 140, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-solution"))->setDecorators(array('FormElementDecorator'));
     // File upload, File
     $file = new Zend_Form_Element_File('content_file_upload');
     $file->setDestination('../www/upload')->removeDecorator('DtDdWrapper')->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'png,gif,jpg,jpeg,doc,zip,xls,mpp,pdf,wmv,avi,mkv,mov,mpeg,mp4,divx,flv,ogg,3gp');
     $file->setLabel($translate->_("content-add-upload-file"))->setDescription($translate->_("content-add-file-upload-help-text"))->setDecorators(array('UploadDecorator'))->setAttrib("onchange", "multiFile(this, '" . $translate->_("content-add-file-delete-file-button") . "');");
     // References, Textarea
     $references = new Zend_Form_Element_Textarea('content_references');
     $references->setAttrib('class', 'textlead')->addValidators(array(array('StringLength', true, array(0, 2000, 'messages' => array('stringLengthTooLong' => 'field-too-long')))))->setLabel($translate->_("content-add-references"))->setDescription($translate->_("content-add-references-help-text"))->setDecorators(array('FormOptionalElementDecorator'));
     /*
             
             // Future info classification, Select
             $finfoClasses = new Zend_Form_Element_Select('content_finfo_class');
             $finfoClasses->addFilter('StringtoLower')
                     ->setLabel($translate->_("content-add-finfo-classification"))
     				->setDecorators(array('FormElementDecorator'))
     				->setMultiOptions($data['FutureinfoClasses']);
             
     		// Industry, Select
     		$industry = new Zend_Form_Element_Select('content_industry');
             $industry->addFilter('StringtoLower')
                     ->setLabel($translate->_("content-view-industry-classification"))
                     ->setDecorators(array('FormElementDecorator'))
                     // This should probably be converted to use jquery
                     ->setAttrib('onchange', "getItems('".$baseUrl."/".$lang."/content/division/industry/'+this.value, 
                                 'content_division_div', this.value);")
                     ->setMultiOptions($data['Industries']);    
             
             // Division, Select
             $division = new Zend_Form_Element_Select('content_division');
             $division->addFilter('StringtoLower')
                     ->setDecorators(array('FormElementDecorator'))
                     ->setMultiOptions($data['Divisions'])
                     ->setRegisterInArrayValidator(false);
             
             // Group, Select
             $group = new Zend_Form_Element_Select('content_group');
             $group->addFilter('StringtoLower')
                     ->setDecorators(array('FormElementDecorator'))
                     ->setMultiOptions($data['Groups'])
                     ->setRegisterInArrayValidator(false);
     
             // Class, Select
             $class = new Zend_Form_Element_Select('content_class');
//.........这里部分代码省略.........
开发者ID:jaakkop,项目名称:site,代码行数:101,代码来源:AddContentForm.php

示例8: __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

示例9: init

 public function init()
 {
     $this->setMethod('post');
     $this->setAttrib('id', 'formid');
     $this->setAttrib('name', 'frm_sinterview_rounds');
     $id = new Zend_Form_Element_Hidden('id');
     $req_id = new Zend_Form_Element_Select("req_id");
     $req_id->setRegisterInArrayValidator(false);
     $req_id->setRequired(true);
     $req_id->setAttrib("class", "formDataElement");
     $req_id->addValidator('NotEmpty', false, array('messages' => 'Please select requisition id.'));
     $req_id->setAttrib('title', 'Interviewer');
     $req_id->setAttrib('onchange', 'displayParticularCandidates(this,"")');
     $candidate_name = new Zend_Form_Element_Select('candidate_name');
     $candidate_name->setAttrib('title', 'Candidate Name');
     $candidate_name->addFilter(new Zend_Filter_StringTrim());
     $candidate_name->setRequired(true);
     $candidate_name->addValidator('NotEmpty', false, array('messages' => 'Please select candidate.'));
     $candidate_name->addMultiOption('', 'Select candidate');
     $candidate_name->setRegisterInArrayValidator(false);
     $interviewer_id = new Zend_Form_Element_Select("interviewer_id");
     $interviewer_id->setRegisterInArrayValidator(false);
     $interviewer_id->setAttrib("class", "formDataElement");
     $interviewer_id->setAttrib('title', 'Interviewer');
     $interview_mode = new Zend_Form_Element_Select("interview_mode");
     $interview_mode->setRegisterInArrayValidator(true);
     $interview_mode->setAttrib("class", "formDataElement");
     $interview_mode->addMultiOptions(array('' => 'Select Interview Type', 'In person' => 'In person', 'Phone' => 'Phone', 'Video conference' => 'Video conference'));
     $interview_mode->setAttrib('title', 'Interview Type');
     $int_location = new Zend_Form_Element_Text('int_location');
     $int_location->setAttrib('maxLength', 100);
     $int_location->setAttrib('title', 'Location');
     $int_location->addFilter(new Zend_Filter_StringTrim());
     $job_title = new Zend_Form_Element_Text('job_title');
     $job_title->setAttrib('readonly', 'readonly');
     $country = new Zend_Form_Element_Select('country');
     $country->setLabel('country');
     $country->setAttrib('onchange', 'displayParticularState_normal(this,"state","state","city")');
     $country->setRegisterInArrayValidator(false);
     $countryModal = new Default_Model_Countries();
     $countriesData = $countryModal->fetchAll('isactive=1', 'country');
     $country->addMultiOption('', 'Select country');
     foreach ($countriesData->toArray() as $data) {
         $country->addMultiOption(trim($data['country_id_org']), $data['country']);
     }
     $state = new Zend_Form_Element_Select('state');
     $state->setAttrib('onchange', 'displayParticularCity_normal(this,"city","city","")');
     $state->setRegisterInArrayValidator(false);
     $state->addMultiOption('', 'Select State');
     $city = new Zend_Form_Element_Select('city');
     $city->setAttrib('class', 'selectoption');
     $city->setAttrib('onchange', 'displayCityCode(this)');
     $city->setRegisterInArrayValidator(false);
     $city->addMultiOption('', 'Select City');
     $interview_time = new Zend_Form_Element_Text('interview_time');
     $interview_time->setAttrib('title', 'Interview Time');
     $interview_time->setAttrib('readonly', 'readonly');
     $interview_time->setAttrib('onfocus', 'this.blur()');
     $interview_time->setAttrib('class', 'time');
     $interview_time->addFilter(new Zend_Filter_StringTrim());
     $interview_date = new Zend_Form_Element_Text('interview_date');
     $interview_date->setAttrib('readonly', 'readonly');
     $interview_date->setAttrib('onfocus', 'this.blur()');
     $interview_date->setAttrib('title', 'Interview Date');
     $interview_date->addFilter(new Zend_Filter_StringTrim());
     $interview_round = new Zend_Form_Element_Text('interview_round');
     $interview_round->setAttrib('title', 'Interview Round');
     $interview_round->addFilter(new Zend_Filter_StringTrim());
     $interview_round->setAttrib('maxlength', 45);
     $interview_feedback = new Zend_Form_Element_Textarea('interview_feedback');
     $interview_feedback->setAttrib('rows', 10);
     $interview_feedback->setAttrib('cols', 50);
     $interview_feedback->setAttrib('maxlength', 300);
     $interview_feedback->setAttrib('title', 'Feedback.');
     $interview_comments = new Zend_Form_Element_Textarea('interview_comments');
     $interview_comments->setAttrib('rows', 10);
     $interview_comments->setAttrib('cols', 50);
     $interview_comments->setAttrib('maxlength', 300);
     $interview_comments->setAttrib('title', 'Comments.');
     $round_status = new Zend_Form_Element_Select('round_status');
     $round_status->setRegisterInArrayValidator(false);
     $round_status->setLabel('Round status');
     $round_status->addMultiOptions(array('' => 'Select status', 'Schedule for next round' => 'Schedule for next round', 'Qualified' => 'Qualified', 'Selected' => 'Selected', 'Disqualified' => 'Disqualified', 'Incompetent' => 'Incompetent', 'Ineligible' => 'Ineligible', 'Candidate no show' => 'Candidate no show'));
     $hid_round_status_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('hid_round_status', null);
     $interview_status = new Zend_Form_Element_Select('interview_status');
     $interview_status->setLabel('Interview status')->setMultiOptions(array('' => 'Select status', 'In process' => 'In process', 'Completed' => 'Complete', 'On hold' => 'On hold'));
     $interview_status->setRegisterInArrayValidator(false);
     $cand_status = new Zend_Form_Element_Select('cand_status');
     $cand_status->setLabel('Candidate status')->setMultiOptions(array('' => 'Select status'));
     $cand_status->setRegisterInArrayValidator(false);
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
     }
     $intrvid_val = Zend_Controller_Front::getInstance()->getRequest()->getParam('intrvid', null);
     if ($loginuserGroup == MANAGER_GROUP || $loginuserGroup == EMPLOYEE_GROUP || $loginuserGroup == SYSTEMADMIN_GROUP || ($loginuserGroup == HR_GROUP || $loginuserGroup == MANAGEMENT_GROUP) && $intrvid_val == $loginUserId) {
         $round_status->setRequired(true);
         $round_status->addValidator('NotEmpty', false, array('messages' => 'Please select status.'));
         $interview_comments->setRequired(true);
//.........这里部分代码省略.........
开发者ID:rajbrt,项目名称:sentrifugo,代码行数:101,代码来源:Interviewrounds.php

示例10: getForm

 public function getForm()
 {
     $form = new Zend_Form();
     $form->setName($this->poClass . "_form");
     $schema = $this->schema->getSchema();
     foreach ($this->getEditableProperties() as $propertyName => $property) {
         $methodName = 'get' . ucfirst($propertyName) . 'Element';
         if (method_exists($this, $methodName)) {
             $form->addElement($this->{$methodName}());
             continue;
         }
         $dbField = $schema[$this->poDef->table]->fields[$property->columnName];
         $dbType = $dbField->type;
         switch ($dbType) {
             case 'integer':
             case 'timestamp':
             case 'boolean':
                 $element = new Zend_Form_Element_Text($propertyName);
                 $element->addValidator('allnum');
                 $element->addFilter('int');
                 break;
             case 'float':
             case 'decimal':
                 $element = new Zend_Form_Element_Text($propertyName);
                 break;
             case 'blob':
             case 'clob':
                 $element = new Zend_Form_Element_Textarea($propertyName);
                 break;
             case 'text':
             case 'time':
             case 'date':
             default:
                 $element = new Zend_Form_Element_Text($propertyName);
                 break;
         }
         if (list($relatedClassName, $relationDef) = $this->isFK($property->columnName)) {
             $element = new Zend_Form_Element_Select($propertyName);
             $pos = ezcPersistentSessionInstance::get();
             $q = $pos->createFindQuery($relatedClassName);
             $this->queryHook($q);
             $list = $pos->find($q, $relatedClassName);
             $element->options = $list;
             $element->addFilter('int');
         }
         if (!$this->isNullProperty($property->columnName, $this->poDef->table)) {
             $element->setRequired(true)->addValidator('NotEmpty');
         }
         $element->setLabel($propertyName);
         $form->addElement($element);
     }
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Submit');
     $form->addElement($submit);
     $form->clearDecorators();
     $form->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => '<ul>'))->addDecorator('Form');
     $form->setElementDecorators(array(array('ViewHelper'), array('Errors'), array('Description'), array('Label', array('separator' => ' ')), array('HtmlTag', array('tag' => 'li', 'class' => 'element-group'))));
     // buttons do not need labels
     $submit->setDecorators(array(array('ViewHelper'), array('Description'), array('HtmlTag', array('tag' => 'li', 'class' => 'submit-group'))));
     $form->setView(new Zend_View());
     return $form;
 }
开发者ID:jpic,项目名称:ezc-framework-apps,代码行数:62,代码来源:admin.php


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