Beispiel #1
0
 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');
 }
Beispiel #2
0
 public function __construct($data, $sodu, $tongno)
 {
     $val = new Zend_Validate_NotEmpty();
     $num = new Zend_Validate_Digits();
     $date = new Zend_Validate_Date(array('format' => 'dd/MM/yyyy'));
     if ($val->isValid($data['tenhoadon']) == false) {
         $this->messages[] = "Tên Hóa Đơn không được trống";
     }
     if ($val->isValid($data['tienthanhtoan']) == false) {
         $this->messages[] = "Tiền thanh toán được trống";
     } else {
         if ($num->isValid($data['tienthanhtoan']) == false) {
             $this->messages[] = "Tiền thanh toán phải là số";
         } else {
             if ($data['tienthanhtoan'] > $sodu) {
                 $this->messages[] = "Tiền thanh toán phải nhỏ hơn số dư";
             } else {
                 if ($data['tienthanhtoan'] > $tongno) {
                     $this->messages[] = "Tiền thanh toán không lớn hơn số nợ";
                 } else {
                     if ($data['tienthanhtoan'] < 0) {
                         $this->messages[] = "Tiền thanh toán phải là số dương";
                     }
                 }
             }
         }
     }
     if ($date->isValid($data['ngaythanhtoan']) == false) {
         $this->messages[] = "Ngày thanh toán không đúng";
     }
 }
 public function __construct($data)
 {
     $val = new Zend_Validate_NotEmpty();
     $num = new Zend_Validate_Digits();
     if ($val->isValid($data['ten']) == false) {
         $this->messages[] = "Tên nhà cung cấp không được trống";
     }
     if ($num->isValid($data['sdt']) == false) {
         $this->messages[] = "Số điện thoại phải là số";
     }
     if ($val->isValid($data['sdt']) == false) {
         $this->messages[] = "Số điện thoại không được trống";
     }
     if ($num->isValid($data['fax']) == false) {
         $this->messages[] = "Số fax phải là số";
     }
     if ($val->isValid($data['fax']) == false) {
         $this->messages[] = "Số fax không được trống";
     }
     if (array_key_exists('no', $data)) {
         if ($num->isValid($data['no']) == false) {
             $this->messages[] = "Nợ phải là số";
         }
         if ($val->isValid($data['no']) == false) {
             $this->messages[] = "Nợ không được trống";
         }
     }
 }
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $element = new Zend_Form_Element_Text('login');
     $element->setLabel('Login')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le login est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $validator = new Zend_Validate_StringLength();
     $validator->setMax(40);
     $element->addValidator($validator);
     $filter = new Zend_Filter_StringTrim();
     $element->addFilter($filter);
     $this->addElement($element);
     $element = new Zend_Form_Element_Password('password');
     $element->setLabel('Mot de passe')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le mot de passe est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $validator = new Zend_Validate_StringLength();
     $validator->setMax(40);
     $element->addValidator($validator);
     $filter = new Zend_Filter_StringTrim();
     $element->addFilter($filter);
     $this->addElement($element);
 }
Beispiel #5
0
 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');
 }
Beispiel #6
0
 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');
 }
Beispiel #7
0
 public function init()
 {
     $this->setMethod('post');
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setRequired(true);
     $passwordElement->setLabel('New Password:'******'confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(true);
     $confirmPasswordElement->setLabel('Confirm New Password:'******'Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $this->addElement('select', 'security_question', array('label' => 'Security Question', 'required' => true, 'multiOptions' => array(0 => 'Please select'), 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false)))));
     $this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => true, 'filters' => array('StringTrim'), 'attribs' => array('data-ctfilter' => 'yes')));
     $this->addElement('hidden', 'instruction', array('required' => false));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Save', 'class' => 'button'));
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors', array('HtmlTag', array('tag' => 'div'))));
     // Set up the decorator on the form and add in decorators which are removed
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_section one-col'))->addDecorator('Form');
     $element = $this->getElement('submit');
     $element->removeDecorator('label');
     // Remove the label from the submit button
 }
Beispiel #8
0
 /**
  * @group ZF-11267
  * If we pass in a validator instance that has a preset custom message, this
  * message should be used.
  */
 function testIfCustomMessagesOnValidatorInstancesCanBeUsed()
 {
     // test with a Digits validator
     require_once 'Zend/Validate/Digits.php';
     require_once 'Zend/Validate/NotEmpty.php';
     $data = array('field1' => 'invalid data');
     $customMessage = 'Hey, that\'s not a Digit!!!';
     $validator = new Zend_Validate_Digits();
     $validator->setMessage($customMessage, 'notDigits');
     $this->assertFalse($validator->isValid('foo'), 'standalone validator thinks \'foo\' is a valid digit');
     $messages = $validator->getMessages();
     $this->assertSame($messages['notDigits'], $customMessage, 'stanalone validator does not have custom message');
     $validators = array('field1' => $validator);
     $input = new Zend_Filter_Input(null, $validators, $data);
     $this->assertFalse($input->isValid(), 'invalid input is valid');
     $messages = $input->getMessages();
     $this->assertSame($messages['field1']['notDigits'], $customMessage, 'The custom message is not used');
     // test with a NotEmpty validator
     $data = array('field1' => '');
     $customMessage = 'You should really supply a value...';
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage($customMessage, 'isEmpty');
     $this->assertFalse($validator->isValid(''), 'standalone validator thinks \'\' is not empty');
     $messages = $validator->getMessages();
     $this->assertSame($messages['isEmpty'], $customMessage, 'stanalone NotEmpty validator does not have custom message');
     $validators = array('field1' => $validator);
     $input = new Zend_Filter_Input(null, $validators, $data);
     $this->assertFalse($input->isValid(), 'invalid input is valid');
     $messages = $input->getMessages();
     $this->assertSame($messages['field1']['isEmpty'], $customMessage, 'For the NotEmpty validator the custom message is not used');
 }
 public function setPassword($password)
 {
     $valid = new Zend_Validate_NotEmpty();
     if ($valid->isValid($password)) {
         $this->_set('password', md5($password));
     }
 }
Beispiel #10
0
 public function __construct($data)
 {
     $val = new Zend_Validate_NotEmpty();
     $num = new Zend_Validate_Digits();
     $date = new Zend_Validate_Date(array('format' => 'dd/MM/yyyy'));
     if ($val->isValid($data['tendonhang']) == false) {
         $this->messages[] = "Tên đơn hàng không được trống";
     }
     if ($date->isValid($data['ngaydathang']) == false) {
         $this->messages[] = "Ngày đặt hàng không đúng";
     }
     if ($val->isValid($data['tiendathang']) == false) {
         $this->messages[] = "Tiền đặt hàng Không được trống";
     }
     if ($num->isValid($data['tiendathang']) == false) {
         $this->messages[] = "Tiền đặt hàng phải là số";
     }
     if ($num->isValid($data['sometvai']) == false) {
         $this->messages[] = "Số mét vải phải là số";
     }
     if ($val->isValid($data['sometvai']) == false) {
         $this->messages[] = "Số mét vải Không được trống";
     }
     if (array_key_exists('makhachhang', $data)) {
         if ($num->isValid($data['makhachhang']) == false) {
             $this->messages[] = "Mã khách hàng phải là số";
         }
         if ($val->isValid($data['makhachhang']) == false) {
             $this->messages[] = "Mã khách hàng không được trống";
         }
     }
 }
Beispiel #11
0
 public function __construct($options = null)
 {
     $baseDir = $options['baseDir'];
     $pageID = $options['pageID'];
     parent::__construct($options);
     /****************************************/
     // PARAMETERS
     /****************************************/
     // select box category (Parameter #1)
     $blockCategory = new Zend_Form_Element_Select('Param1');
     $blockCategory->setLabel('Catégorie d\'évènement de ce bloc')->setAttrib('class', 'largeSelect');
     $categories = new Categories();
     $select = $categories->select()->setIntegrityCheck(false)->from('Categories')->join('CategoriesIndex', 'C_ID = CI_CategoryID')->where('C_ModuleID = ?', 7)->where('CI_LanguageID = ?', Zend_Registry::get("languageID"))->order('CI_Title');
     $categoriesArray = $categories->fetchAll($select);
     foreach ($categoriesArray as $category) {
         $blockCategory->addMultiOption($category['C_ID'], $category['CI_Title']);
     }
     // number of news to show in front-end (Parameter #2)
     $at_least_one = new Zend_Validate_GreaterThan('0');
     $at_least_one->setMessage('Vous devez afficher au moins un événement.');
     $not_null = new Zend_Validate_NotEmpty();
     $not_null->setMessage($this->getView()->getCibleText('validation_message_empty_field'));
     $blockNewsMax = new Zend_Form_Element_Text('Param2');
     $blockNewsMax->setLabel('Nombre d\'évènement à afficher')->setRequired(true)->setValue('1')->addValidator($not_null, true)->addValidator($at_least_one, true)->setAttrib('class', 'smallTextInput');
     // show the breif text in front-end (Parameter #3)
     $blockShowBrief = new Zend_Form_Element_Checkbox('Param3');
     $blockShowBrief->setLabel('Afficher le texte bref');
     $blockShowBrief->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     $this->addElements(array($blockCategory, $blockNewsMax, $blockShowBrief));
     $this->removeDisplayGroup('parameters');
     $this->addDisplayGroup(array('Param999', 'Param1', 'Param2', 'Param3'), 'parameters');
     $parameters = $this->getDisplayGroup('parameters');
     //$parameters->setLegend($this->_view->getCibleText('form_parameters_fieldset'));
 }
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     // TODO setMethod
     $element = new Zend_Form_Element_Text('prenom');
     $element->setLabel('Prénom')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le prénom est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $validator = new Zend_Validate_StringLength();
     $validator->setMax(40);
     $element->addValidator($validator);
     $filter = new Zend_Filter_StringTrim();
     $element->addFilter($filter);
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('nom');
     $element->setLabel('Nom')->setRequired();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Le nom est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
     $element->addValidator($validator);
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('email');
     $element->setLabel('Email');
     $this->addElement($element);
     $element = new Zend_Form_Element_Text('telephone');
     $element->setLabel('Téléphone');
     $this->addElement($element);
 }
 public function indexAction()
 {
     $emailValidator = new Zend_Validate_EmailAddress();
     $nameValidator = new Zend_Validate_NotEmpty(array(Zend_Validate_NotEmpty::STRING, Zend_Validate_NotEmpty::SPACE));
     $password1_Validator = new Zend_Validate();
     $password1_Validator->addValidator(new Zend_Validate_StringLength(array('min' => 6, 'max' => 12)))->addValidator(new Zend_Validate_Alnum());
     $password2_Validator = new Zend_Validate();
     $password2_Validator->addValidator(new Zend_Validate_StringLength(array('min' => 6, 'max' => 12)))->addValidator(new Zend_Validate_Alnum());
     $captcha = new Zend_Captcha_Image();
     $captcha->setName('captchaword')->setFont(APPLICATION_PATH . '/data/arial.ttf')->setFontSize(28)->setImgDir(APPLICATION_PATH . '/../public/img')->setImgUrl('/img')->setWordLen(5)->setDotNoiseLevel(20)->setExpiration(300);
     $request = $this->getRequest();
     $post = $request->getPost();
     // $passwordIdentical = new Zend_Validate_Identical(array('token' => $post['password1']));
     $messages = array();
     $error = array();
     $noValiError = true;
     if ($this->getRequest()->isPost()) {
         if (!$emailValidator->isValid($post['user-email'])) {
             $error['user-emailVali'] = '請輸入正確的Email帳號';
             $noValiError = false;
         }
         if (!$nameValidator->isValid($post['name'])) {
             $error['nameVali'] = '姓名必填';
             $noValiError = false;
         }
         if (!$password1_Validator->isValid($post['password1'])) {
             $error['password1_Vali'] = '1.密碼長度需介於6~12之間,而且只能使用數字、英文';
             $noValiError = false;
         }
         if (!$password2_Validator->isValid($post['password2'])) {
             $error['password2_Vali'] = '1.密碼長度需介於6~12之間,而且只能使用數字、英文';
             $noValiError = false;
         }
         if (isset($post['password1']) && isset($post['password2']) && !($post['password1'] == $post['password2'])) {
             $error['passwordIdentical'] = '2.密碼輸入不同';
             $noValiError = false;
         }
         if (!($post['agree'] == 1)) {
             $error['agreeVali'] = '需同意服務條款及隱私權政策,才可以註冊';
             $noValiError = false;
         }
         if (!$captcha->isValid($post['captchaword'])) {
             $error['captchawordVali'] = '認證碼輸入錯誤';
             $noValiError = false;
         }
         if ($noValiError) {
             // register process
             $this->_signup($post);
             $this->view->messages = $post;
             $this->redirect('index/index');
         } else {
             $this->_genCaptcha($captcha);
             $this->view->error = $error;
             $this->view->messages = $post;
         }
     } else {
         $this->_genCaptcha($captcha);
     }
 }
Beispiel #14
0
 public function check_empty($value)
 {
     $validator = new Zend_Validate_NotEmpty();
     if (!$validator->isValid($value) == true) {
         $error = "Enter you data";
         return $error;
     }
 }
Beispiel #15
0
 public function __construct($data)
 {
     $val = new Zend_Validate_NotEmpty();
     $num = new Zend_Validate_Digits();
     if ($val->isValid($data['tenloaisoi']) == false) {
         $this->messages[] = "Tên loại vải không được trống";
     }
 }
Beispiel #16
0
 public function __construct($data)
 {
     $val = new Zend_Validate_NotEmpty();
     $vl = new Admin_Model_User();
     if ($val->isValid($data['username']) == false) {
         $this->messages[] = "Username KO Null";
     }
 }
Beispiel #17
0
 /**
  * validate the body
  *
  * @param string  $body
  * @return boolean
  */
 private function validateBody($body)
 {
     $notEmptyValidator = new \Zend_Validate_NotEmpty();
     if (!$notEmptyValidator->isValid($body)) {
         $messages = array_values($notEmptyValidator->getMessages());
         $this->addError(new Error('body', $body, $messages));
         return false;
     }
     return true;
 }
Beispiel #18
0
	public function formValidator($form)
	{
		$emptyValidator = new Zend_Validate_NotEmpty();
		$emptyValidator->setMessage(General_Models_Text::$text_notEmpty);
		$form->getElement('username')->setAllowEmpty(false)
								->addValidator($emptyValidator);
		$form->getElement('password')->setAllowEmpty(false)
								->addValidator($emptyValidator);
		return $form;
	}
Beispiel #19
0
 public function __construct($data)
 {
     $val = new Zend_Validate_NotEmpty();
     $date = new Zend_Validate_Date(array('format' => 'dd/MM/yyyy'));
     if ($val->isValid($data['tendonxuat']) == false) {
         $this->messages[] = "Tên đơn xuất không được trống";
     }
     if ($date->isValid($data['ngayxuat']) == false) {
         $this->messages[] = "Ngày xuất không đúng";
     }
 }
 public function __construct($data)
 {
     $val = new Zend_Validate_NotEmpty();
     $num = new Zend_Validate_Digits();
     $date = new Zend_Validate_Date(array('format' => 'dd/MM/yyyy'));
     if ($val->isValid($data['socaynhuom']) == false) {
         $this->messages[] = "Tên lô nhuộm không được trống";
     }
     if ($date->isValid($data['ngaynhuom']) == false) {
         $this->messages[] = "Ngày nhuộm không đúng";
     }
 }
Beispiel #21
0
 public function __construct($data)
 {
     $val = new Zend_Validate_NotEmpty();
     $num = new Zend_Validate_Digits();
     //  $kh = new Model_Khachhang();
     if ($val->isValid($data['tenmau']) == false) {
         $this->messages[] = "Tên màu không được trống";
     }
     if ($val->isValid($data['congthuc']) == false) {
         $this->messages[] = "Công thức được trống";
     }
 }
 /**
  * @param array $output
  * @return bool
  */
 public function validate(&$output = array())
 {
     /** @var $helper Open_Gallery_Helper_Data */
     $helper = Mage::helper('open_gallery');
     $result = true;
     $validator = new Zend_Validate_NotEmpty();
     if (!$validator->isValid($this->getData('title'))) {
         $output[] = $helper->__("Category title can't be empty.");
         $result = false;
     }
     return $result;
 }
Beispiel #23
0
 public function init()
 {
     // Set request method
     $this->setMethod('post');
     // Email entry
     $this->addElement('span', 'email', array('label' => 'Email address', 'required' => false, 'filters' => array('StringTrim'), 'class' => 'formvalue', 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your email address'))))));
     // Modify email error messages & add validator
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
     $this->getElement('email')->addValidator($emailValidator);
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setRequired(true);
     $passwordElement->setLabel('Create your password');
     $passwordElement->setOptions(array('data-noAjaxValidate' => '1'));
     $passwordElement->addValidator(new Zend_Validate_PasswordStrength());
     $validator = new Zend_Validate_Identical();
     $validator->setToken('confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(true);
     $confirmPasswordElement->setLabel('Re-enter password');
     $confirmPasswordElement->setOptions(array('data-noAjaxValidate' => '1'));
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $securityQuestionModel = new Datasource_Core_SecurityQuestion();
     $securityQuestionOptions = array(0 => '- Please Select -');
     foreach ($securityQuestionModel->getOptions() as $option) {
         $securityQuestionOptions[$option['id']] = $option['question'];
     }
     $this->addElement('select', 'security_question', array('label' => 'Security Question', 'required' => false, 'multiOptions' => $securityQuestionOptions, 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false)))));
     /* Value no longer mandatory, Redmine #11873
             $questionElement = $this->getElement('security_question');
             $validator = new Zend_Validate_GreaterThan(array('min'=> 0));
             $validator->setMessage('You must select a security question');
             $questionElement->addValidator($validator);
     */
     $this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => false, 'filters' => array('StringTrim')));
     // Set custom subform decorator - this is the default and gets overridden by view scripts in the tenants' and landlords' Q&Bs
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/register.phtml'))));
     // Set element decorators
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
     // Grab view and add the client-side password validation JavaScript into the page head
     $view = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view');
     $view->headScript()->appendFile('/assets/common/js/passwordValidation.js', 'text/javascript');
 }
 /**
  * Returns true if and only if $value meets the validation requirements
  *
  *
  *
  * @param  mixed $value
  * @return boolean
  * @throws Zend_Validate_Exception If validation of $value is impossible
  */
 public function isValid($value, $context = null)
 {
     if (is_array($this->_elements)) {
         $notEmpty = new Zend_Validate_NotEmpty();
         foreach ($this->_elements as $name) {
             if (isset($context[$name]) && $notEmpty->isValid($context[$name])) {
                 return true;
             }
         }
     }
     $this->_error(self::ALL_EMPTY);
     return false;
 }
Beispiel #25
0
 /**
  * Initialise the form
  * 
  * @todo Validation
  * @return void 
  */
 public function init()
 {
     // Set request method
     $this->setMethod('POST');
     // Add title element
     $this->addElement('select', 'title', array('label' => 'Title', 'required' => true, 'multiOptions' => TenantsInsuranceQuote_Form_Subforms_PersonalDetails::$titles, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your title', 'notEmptyInvalid' => 'Please select your title')))), 'class' => 'form-control'));
     // Add first name element
     $this->addElement('text', 'first_name', array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your first name', 'notEmptyInvalid' => 'Please enter your first name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'First name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)'))), 'class' => 'form-control'));
     // Add last name element
     $this->addElement('text', 'last_name', array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your last name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Last name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)'))), 'class' => 'form-control'));
     // Email element
     $this->addElement('text', 'email', array('label' => 'Email Address', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Email address is required')))), 'class' => 'form-control'));
     // Modify email error messages & add validator
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
     $this->getElement('email')->addValidator($emailValidator);
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password', array('validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Password is required')))), 'class' => 'form-control'));
     $passwordElement->setRequired(true);
     $passwordElement->setLabel('Password');
     $passwordElement->setAttribs(array('class' => 'form-control'));
     $passwordElement->addValidator(new Zend_Validate_PasswordStrength());
     $validator = new Zend_Validate_Identical();
     $validator->setToken('confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(true);
     $confirmPasswordElement->setLabel('Confirm Password');
     $confirmPasswordElement->setAttribs(array('class' => 'form-control'));
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $this->addElement('select', 'security_question', array('label' => 'Security Question', 'required' => true, 'multiOptions' => array('' => 'Please select'), 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Security question is required')))), 'class' => 'form-control'));
     $this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Security answer is required')))), 'class' => 'form-control'));
     $this->addElement('hidden', 'refno', array('required' => false, 'class' => 'noalt'));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Register', 'class' => 'btn btn-primary pull-right'));
     // Set up the element decorators
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors'));
     // Set up the decorator on the form and add in decorators which are removed
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_section'))->addDecorator('Form');
     // Remove the label from the submit button
     $element = $this->getElement('submit');
     $element->removeDecorator('label');
     $this->getElement('refno')->removeDecorator('HtmlTag');
 }
Beispiel #26
0
 public function init()
 {
     // валидаторы
     $alnum = new Zend_Validate_Alnum();
     $alnum->setMessage($this->messageAlnum);
     $notEmpty = new Zend_Validate_NotEmpty();
     $notEmpty->setMessage($this->notEmpty, "isEmpty");
     // создаем форму
     $this->setName('interview');
     $this->setAttribs(array('method' => "post", "class" => "form-horizontal"));
     $this->setDecorators(array('FormElements', 'Form'));
     $this->createFormElements($this, $this->elementsForm());
     return $this;
 }
 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');
 }
 /**
  * Initialise the form
  * 
  * @todo Validation
  * @return void 
  */
 public function init()
 {
     // Set request method
     $this->setMethod('POST');
     // Add title element
     $this->addElement('text', 'title', array('label' => 'Title'));
     // Add first name element
     $this->addElement('text', 'first_name', array('label' => 'First name'));
     // Add last name element
     $this->addElement('text', 'last_name', array('label' => 'Last name'));
     $this->addElement('password', 'existing_password', array('required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control'));
     // Email element
     $this->addElement('text', 'email', array('label' => 'Email Address'));
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setRequired(false);
     // New password is not required to update options
     $passwordElement->addValidator(new Zend_Validate_PasswordStrength());
     $passwordElement->setAttribs(array('class' => 'form-control'));
     $validator = new Zend_Validate_Identical();
     $validator->setToken('confirm_password');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement->addValidator($validator);
     $this->addElement($passwordElement);
     //The confirm password element.
     $confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
     $confirmPasswordElement->setRequired(false);
     // New password is not required to update options
     $confirmPasswordElement->setAttribs(array('class' => 'form-control'));
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessage('Please confirm your password');
     $confirmPasswordElement->addValidator($validator);
     $this->addElement($confirmPasswordElement);
     // Security question & answer
     $this->addElement('select', 'security_question', array('required' => true, 'multiOptions' => array(0 => 'Please select'), 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))), 'class' => 'form-control'));
     $this->addElement('text', 'security_answer', array('required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control'));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'btn btn-primary pull-right', 'label' => 'Save'));
     // Set up the element decorators
     $this->setElementDecorators(array('ViewHelper', 'Label', 'Errors', array('HtmlTag', array('tag' => 'div'))));
     // Set up the decorator on the form and add in decorators which are removed
     $this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_section one-col'))->addDecorator('Form');
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/edit-account.phtml'))));
     // Remove the label from the submit button
     $element = $this->getElement('submit');
     $element->removeDecorator('label');
 }
Beispiel #29
0
 public function init()
 {
     $this->setMethod('post');
     $this->setAttribs(array('id' => 'login_form', 'class' => 'login_form'));
     // Username
     $label = 'Username';
     $validators = array();
     $validator = new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING);
     $validator->setMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "{$label} is required and must not be empty"));
     $validators[] = $validator;
     $min = 4;
     $max = 20;
     $validator = new Zend_Validate_StringLength(array('min' => $min, 'max' => $max));
     $validator->setMessages(array(Zend_Validate_StringLength::INVALID => "{$label} contains invalid type data", Zend_Validate_StringLength::TOO_SHORT => "{$label} must be at least {$min} characters", Zend_Validate_StringLength::TOO_LONG => "{$label} must be less than {$max} characters"));
     $validators[] = $validator;
     $element = new Zend_Form_Element_Text('username', array('required' => true, 'label' => "{$label}", 'filters' => array(new Zend_Filter_StringTrim()), 'validators' => $validators));
     $this->addElement($element);
     // Password
     $label = 'Password';
     $validators = array();
     $validator = new Zend_Validate_NotEmpty();
     $validator->setMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "{$label} is required and must not be empty"));
     $validators[] = $validator;
     $min = 4;
     $max = 20;
     $validator = new Zend_Validate_StringLength(array('min' => $min, 'max' => $max));
     $validator->setMessages(array(Zend_Validate_StringLength::INVALID => "{$label} contains invalid type data", Zend_Validate_StringLength::TOO_SHORT => "{$label} must be at least {$min} characters", Zend_Validate_StringLength::TOO_LONG => "{$label} must be less than {$max} characters"));
     $validators[] = $validator;
     $element = new Zend_Form_Element_Password('password', array('required' => true, 'label' => "{$label}", 'filters' => array(new Zend_Filter_StringTrim()), 'validators' => $validators));
     $this->addElement($element);
     // Submit Button
     $label = 'Login';
     $element = new Zend_Form_Element_Submit('submit_button', array('label' => "{$label}", 'ignore' => true, 'class' => 'proxy'));
     $decorators = array('ViewHelper', 'Errors');
     //$element->setDecorators($decorators);
     $this->addElement($element);
     // Hash
     //$element = new Zend_Form_Element_Hash('csrf_hash', array(
     //    'ignore' => true,
     //));
     //$decorators = array(
     //    'ViewHelper',
     //    array(array('input_wrapper' => 'HtmlTag'), array('tag' => 'div', 'style' => 'display: none;')),
     //);
     //$element->setDecorators($decorators);
     //$this->addElement($element);
 }
 public function __construct($data)
 {
     $val = new Zend_Validate_NotEmpty();
     $num = new Zend_Validate_Digits();
     //  $kh = new Model_Khachhang();
     if ($val->isValid($data['TenCTP']) == false) {
         $this->messages[] = "Cây thành phẩm không được trống";
     }
     if ($num->isValid($data['sometvai']) == false) {
         $this->messages[] = "Số mét vải phải là số";
     }
     if (array_key_exists('loaivai', $data)) {
         if ($val->isValid($data['loaivai']) == false) {
             $this->messages[] = "Vui lòng điền loại vải!";
         }
     }
 }