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


PHP Zend_Validate_NotEmpty::setType方法代码示例

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


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

示例1: init

 public function init()
 {
     // Verifica se o campo select esta com o valor null
     $required = new Zend_Validate_NotEmpty();
     $required->setType($required->getType() | Zend_Validate_NotEmpty::STRING | Zend_Validate_NotEmpty::ZERO);
     $data_now = new Zend_Date();
     $options_sim_nao = array('Não', 'Sim');
     $options_categoria = array('Alto padrão' => 'Alto padrão', 'Médio padrão' => 'Médio padrão', 'Econômico' => 'Econômico');
     $options_empty = array('');
     $options_tipo = array('0' => '--- Selecione uma opção ---', '1' => 'Apartamento', '2' => 'Casa');
     $this->addElement('text', 'nome', array('label' => 'Nome', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(12)));
     $this->addElement('text', 'logradouro', array('label' => 'Logradouro', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     $this->addElement('select', 'categoria', array('label' => 'Categoria', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_categoria, 'decorators' => $this->setColSize(3)));
     $this->addElement('select', 'tipo', array('label' => 'Tipo de empreendimento', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_tipo, 'decorators' => $this->setColSize(3), 'validators' => array($required)));
     $this->addElement('select', 'cad_corretagem', array('label' => 'Cad. Corretagem Mediação', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_sim_nao, 'decorators' => $this->setColSize(3)));
     $this->addElement('text', 'incorporadora', array('label' => 'Proprietario(a)', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     $this->addElement('hidden', 'unidades', array('label' => '', 'decorators' => $this->setColSize(1)));
     $this->addElement('hidden', 'created_user_id', array('value' => CURRENT_USER_ID, 'decorators' => $this->setColSize(1)));
     $this->addElement('hidden', 'last_user_id', array('value' => CURRENT_USER_ID, 'decorators' => $this->setColSize(1)));
     $this->addElement('hidden', 'locked', array('value' => CURRENT_USER_ID, 'decorators' => $this->setColSize(1)));
     $this->addElement('hidden', 'locked_by', array('value' => CURRENT_USER_ID, 'decorators' => $this->setColSize(1)));
     $this->addElement('submit', 'Enviar', array('label' => 'Enviar', 'ignore' => 'true', 'class' => 'btn btn-success pull-right', 'decorators' => $this->setColSize(12, false)));
     $this->setDecorators(array('FormElements', array(array('in' => 'HtmlTag'), array('tag' => 'div', 'class' => 'row')), 'Form', array('HtmlTag', array('tag' => 'div', 'class' => 'panel panel-body panel-default'))));
     $this->setAttrib('class', 'form');
     $this->setAttrib('id', 'empreendimento');
     $this->setMethod('post');
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:27,代码来源:Empreendimento.php

示例2: init

 public function init()
 {
     // Verifica se o campo select esta com o valor null
     $required = new Zend_Validate_NotEmpty();
     $required->setType($required->getType() | Zend_Validate_NotEmpty::STRING | Zend_Validate_NotEmpty::ZERO);
     $data_now = new Zend_Date();
     $options_estado_civil = array('-- Selecione --', 'casado' => 'Casado', 'solteiro' => 'Solteiro', 'divorciado' => 'Divorciado', 'viuvo' => 'Viuvo');
     $options_empty = array('-- Selecione --');
     $options_meio_comunicacao = array('-- Selecione --', 'Telefone' => 'Telefone', 'Tv' => 'TV', 'Local' => 'Pass. no Local', 'Radio' => 'Rádio', 'Faixas' => 'Faixas', 'Email' => 'Email', 'Panfletagem' => 'Panfletagem', 'Mala direta' => 'Mala direta', 'Indicação' => 'Indicação', 'Internet' => 'Internet', 'Jornal' => 'Jornal', 'Outdoor' => 'Outdoor', 'Outros' => 'Outros');
     $options_renda = array('-- Selecione --', 'formal' => 'Formal', 'informal' => 'Informal', 'mista' => 'Mista');
     $options_sim_nao = array('Não', 'Sim');
     $this->addElement('hidden', 'data', array('value' => $data_now->toString('YYYY-MM-dd'), 'decorators' => $this->setColSize(12)));
     // Adicionando tag HTML usando description do elemento
     $this->addElement('hidden', 'data_desc', array('ignore' => true, 'decorators' => array(array('Description', array('escape' => false, 'tag' => 'div', 'class' => "col-xs-2 pull-right")))));
     // Adicionando tag HTML usando description do elemento
     $this->addElement('hidden', 'header3', array('description' => '<h3>FICHA DE ATENDIMENTO AO CLIENTE</h3>', 'ignore' => true, 'decorators' => array(array('Description', array('escape' => false, 'tag' => 'div', 'class' => "col-xs-12")))));
     $this->addElement('text', 'nome', array('label' => 'Nome', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     $this->addElement('text', 'cpf', array('label' => 'CPF', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(3)));
     $this->addElement('select', 'estado_civil', array('label' => 'Estado Civil', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_estado_civil, 'validators' => array($required), 'decorators' => $this->setColSize(3)));
     $this->addElement('text', 'email', array('label' => 'E-mail', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     $this->addElement('text', 'data_nasc', array('label' => 'Data de Nascimento', 'required' => false, 'description' => '<span class="glyphicon glyphicon-calendar"></span>', 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(3, true, true)));
     // Adicionando tag HTML usando description do elemento
     $this->addElement('hidden', 'hr_filiacao', array('description' => '<h3>FILIAÇÃO</h3>', 'ignore' => true, 'decorators' => array(array('Description', array('escape' => false, 'tag' => 'div', 'class' => "col-xs-12")))));
     $this->addElement('text', 'filiacao_pai', array('label' => 'Pai', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     $this->addElement('text', 'filiacao_mae', array('label' => 'Mãe', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     // Adicionando tag HTML usando description do elemento
     $this->addElement('hidden', 'hr_end', array('description' => '<hr/>', 'ignore' => true, 'decorators' => array(array('Description', array('escape' => false, 'tag' => 'div', 'class' => "col-xs-12")))));
     $this->addElement('text', 'cep', array('label' => 'CEP', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(3)));
     $this->addElement('text', 'endereco', array('label' => 'Endereço', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(9)));
     $this->addElement('text', 'bairro', array('label' => 'Bairro', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     $this->addElement('select', 'estado', array('label' => 'Estado', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_empty, 'validators' => array($required), 'decorators' => $this->setColSize(6)));
     $this->addElement('select', 'cidade', array('label' => 'Cidade', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_empty, 'validators' => array($required), 'decorators' => $this->setColSize(6)));
     $this->addElement('text', 'fone_resid', array('label' => 'Fone Resid.', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(4)));
     $this->addElement('text', 'fone_com', array('label' => 'Fone Com.', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(4)));
     $this->addElement('text', 'fone_cel', array('label' => 'Celular', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(4)));
     // Adicionando tag HTML usando description do elemento
     $this->addElement('hidden', 'hr_contato', array('description' => '<hr/>', 'ignore' => true, 'decorators' => array(array('Description', array('escape' => false, 'tag' => 'div', 'class' => "col-xs-12")))));
     $this->addElement('text', 'empresa_trabalha', array('label' => 'Empresa na qual trabalha', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize()));
     $this->addElement('text', 'profissao', array('label' => 'Profissão', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     $this->addElement('text', 'cargo', array('label' => 'Cargo', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     $this->addElement('text', 'renda_familiar', array('label' => 'Renda Familiar', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(6)));
     $this->addElement('select', 'renda', array('label' => 'Renda', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_renda, 'validators' => array($required), 'decorators' => $this->setColSize(6)));
     $this->addElement('select', 'fgts', array('label' => 'FGTS', 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_sim_nao, 'decorators' => $this->setColSize(3)));
     $this->addElement('select', 'fgts_tres_anos', array('label' => 'Mais de 3 anos', 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_sim_nao, 'decorators' => $this->setColSize(3)));
     $this->addElement('text', 'saldo_fgts', array('label' => 'Saldo FGTS', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(3)));
     $this->addElement('text', 'valor_entrada', array('label' => 'Valor de entrada', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(3)));
     // Adicionando tag HTML usando description do elemento
     $this->addElement('hidden', 'header3_atendimento', array('description' => '<h3>SOBRE O ATENDIEMENTO</h3>', 'ignore' => true, 'decorators' => array(array('Description', array('escape' => false, 'tag' => 'div', 'class' => "col-xs-12")))));
     $this->addElement('select', 'meio_comunicacao', array('label' => 'Meio de Comunicação', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_meio_comunicacao, 'validators' => array($required), 'decorators' => $this->setColSize()));
     $this->addElement('textarea', 'observacoes', array('label' => 'Observações', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'form-control', 'cols' => 80, 'rows' => 5, 'decorators' => $this->setColSize()));
     $this->addElement('hidden', 'created_user_id', array('value' => CURRENT_USER_ID, 'decorators' => $this->setColSize(12)));
     $this->addElement('hidden', 'last_user_id', array('value' => CURRENT_USER_ID, 'decorators' => $this->setColSize(12)));
     $this->addElement('hidden', 'locked', array('value' => CURRENT_USER_ID, 'decorators' => $this->setColSize(12)));
     $this->addElement('hidden', 'locked_by', array('value' => CURRENT_USER_ID, 'decorators' => $this->setColSize(12)));
     $this->addElement('submit', 'Enviar', array('label' => 'Enviar', 'ignore' => 'true', 'class' => 'btn btn-success pull-right', 'decorators' => $this->setColSize(12, false)));
     $this->setDecorators(array('FormElements', array(array('in' => 'HtmlTag'), array('tag' => 'div', 'class' => 'row')), 'Form', array('HtmlTag', array('tag' => 'div', 'class' => 'panel panel-body panel-default'))));
     $this->setAttrib('class', 'form');
     $this->setAttrib('id', 'ficha-atendimento');
     $this->setMethod('post');
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:60,代码来源:CadastroCliente.php

示例3: init

 public function init()
 {
     // Verifica se o campo select esta com o valor null
     $required = new Zend_Validate_NotEmpty();
     $required->setType($required->getType() | Zend_Validate_NotEmpty::INTEGER | Zend_Validate_NotEmpty::ZERO);
     // Pega a lista de perfis no banco de dados na tabela #__perfis
     $perfis = new Application_Model_Usuarios();
     $lista_options = $perfis->getPerfis();
     $options_perfil = array("-- Selecione --");
     foreach ($lista_options as $option) {
         $options_perfil[$option->id] = $option->role;
     }
     $this->addElement('text', 'nome', array('label' => 'Nome', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control'));
     $this->addElement('text', 'email', array('label' => 'Email', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control'));
     $this->addElement('select', 'id_perfil', array('label' => 'Perfil', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options_perfil, 'validators' => array($required)));
     $this->addElement('select', 'acesso', array('label' => 'Habilitado', 'required' => true, 'class' => 'form-control', 'multiOptions' => array('0' => 'não', '1' => 'sim')))->setDefault('acesso', '0');
     $this->addElement('password', 'password', array('label' => 'Senha', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'autocomplete' => 'off', 'validators' => array(array('StringLength', false, array('min' => 4, 'max' => 10)))));
     $this->addElement('password', 'confirm', array('label' => 'Confirma Senha', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'validators' => array(array('identical', false, array('token' => 'password')))));
     $submit = $this->addElement('submit', 'Cadastrar', array('class' => 'btn btn-primary btn-md'));
     $this->setElementDecorators(array('ViewHelper', 'Errors', 'Label', 'Description', array('HtmlTag', array('tag' => 'div', 'class' => 'form-group'))), array('Cadastrar'), false);
     $this->setElementDecorators(array('ViewHelper', 'Errors', 'Description', array('HtmlTag', array('tag' => 'div', 'class' => 'form-group'))), array('Cadastrar'), true);
     $this->setDecorators(array('FormElements', 'Form', array('HtmlTag', array('tag' => 'div', 'class' => 'panel panel-body panel-default'))));
     $this->setAttrib('id', 'add_usuario');
     $this->setAttrib('class', 'form');
     $this->setMethod('post');
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:26,代码来源:AddUsuario.php

示例4: testSettingFalseType

 /**
  * Ensures that the validator follows expected behavior
  *
  * @return void
  */
 public function testSettingFalseType()
 {
     try {
         $this->_validator->setType(true);
         $this->fail();
     } catch (Zend_Exception $e) {
         $this->assertContains('Unknown', $e->getMessage());
     }
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:14,代码来源:NotEmptyTest.php

示例5: init

 public function init()
 {
     // Verifica se o campo select esta com o valor null
     $required = new Zend_Validate_NotEmpty();
     $required->setType($required->getType() | Zend_Validate_NotEmpty::STRING | Zend_Validate_NotEmpty::ZERO);
     $data_now = new Zend_Date();
     $this->addElement('hidden', 'parcelas', array('Label' => '', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'decorators' => $this->setColSize(12)));
     $this->addElement('hidden', 'id_proposta', array('value' => '', 'decorators' => $this->setColSize(12)));
     $this->addElement('hidden', 'last_user_id', array('value' => CURRENT_USER_ID, 'decorators' => $this->setColSize(12)));
     $this->setDecorators(array('FormElements', array(array('in' => 'HtmlTag'), array('tag' => 'div', 'class' => 'row')), 'Form', array('HtmlTag', array('tag' => 'div', 'class' => 'panel panel-body panel-default'))));
     $this->setAttrib('class', 'form');
     $this->setAttrib('id', 'condicoes-pagamento');
     $this->setMethod('post');
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:14,代码来源:CondicoesPagamento.php

示例6: editAction

 public function editAction()
 {
     $request = $this->getRequest();
     $cid = $request->getParam('cid');
     $id = $request->getParam('id');
     $model = new Application_Model_Propostas();
     $modelCliente = new Application_Model_Clientes();
     $documentos = new Application_Model_Documentos();
     $form = new Application_Form_Proposta();
     if (!in_array(CURRENT_USER_ROLE, array('Corretor', 'Financeiro'))) {
         $users = new Application_Model_Usuarios();
         $db = Zend_Db_Table::getDefaultAdapter();
         $result = $db->fetchAll($users->selectAll());
         $options = array();
         $required = new Zend_Validate_NotEmpty();
         $required->setType($required->getType() | Zend_Validate_NotEmpty::STRING | Zend_Validate_NotEmpty::ZERO);
         foreach ($result as $key => $value) {
             $options[$value['id']] = $value['nome'] . ' - ' . $value['role'];
         }
         $form->addElement('select', 'created_user_id', array('label' => 'Usuário', 'title' => 'Mude usuário responsável pela proposta', 'required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control', 'multiOptions' => $options, 'validators' => array($required), 'decorators' => $form->setColSize(4)));
     }
     if ($request->isPost() && $form->isValid($request->getPost())) {
         $data = $request->getPost();
         if ($id == 0) {
             unset($data['id']);
             if ($model->insert($data)) {
                 $this->_FlashMessenger->setNamespace($this->_controllerName)->addMessage('Proposta adicionada com sucesso!');
                 $this->view->message_type = 'alert-success';
                 $this->redirect($this->_controllerName . '/edit/id/' . $model->lastInserId() . '/cid/' . $cid);
             }
         } else {
             if ($model->update($id, $data)) {
                 $this->view->messages = array('Atualziado com sucesso!');
                 $this->view->message_type = 'alert-success';
             } else {
                 $this->view->messages = array('Sem alterações!');
                 $this->view->message_type = 'alert-info';
             }
         }
     } else {
         $dataProposta = $model->selectById($id);
         // Verificando se ja existe uma proposta
         if ($dataProposta) {
             $data = $dataProposta;
             if (!empty($data['dados_extras'])) {
                 $dadosExtras = json_decode($data['dados_extras'], true);
                 $data = array_merge($data, $dadosExtras);
                 unset($data['dados_extras']);
             }
         } else {
             $data = $modelCliente->selectById($cid);
             $dadosExtras = json_decode($data['dados_cliente'], true);
             $data = array_merge($data, $dadosExtras);
             // removendo id de quem criou a ficha do cliente
             $data['created_user_id'] = CURRENT_USER_ID;
         }
     }
     $model->lockRow($data['id'], CURRENT_USER_ID, 1);
     // Verifica se esta bloquedo
     $is_locked = $this->_acl_model->checkLocked($data['locked'], $data['locked_by']);
     if ($is_locked) {
         $this->view->messages = array('Item bloqueado para edição');
         $this->view->hide = true;
         $this->view->form = '';
         return false;
     }
     // Verifica sem tem permissão pra acessar o conteudo.
     $is_autorized = $this->_acl_model->autorized($data['created_user_id'], $this->_ids);
     if (!$is_autorized) {
         $this->view->messages = array('Sem permissão de acesso');
         $this->view->barTitle = 'Editando Proposta';
         $this->view->form = '';
         return false;
     }
     // Pega Condições de pagamento
     $condicoes = $model->selectCondicoesPagamento($id);
     if ($condicoes) {
         $this->view->sinal = $condicoes['sinal'];
         $this->view->parcelas = json_decode($condicoes['parcelas'], true);
     }
     // Pega todos os arquivos relacinados ao cliente
     $this->view->anexos = $documentos->readDir(PUBLIC_PATH . DIRECTORY_SEPARATOR . 'uploads', $id);
     $this->view->documentos = $documentos;
     $this->view->barTitle = "Editando Proposta :: " . $data['nome'];
     $this->view->form = $form;
     $this->view->data = $data;
     $form->populate($data);
 }
开发者ID:Dinookys,项目名称:zend_app,代码行数:88,代码来源:PropostasController.php

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