✏️ 正在编辑: Indicador.php
路径:
/srv/systems_dir/yuppiecred/application/forms/Indicador.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Form_Indicador extends Form_Corretor { /** @var Model_DbTable_Corretor */ private $table; public function init() { $this->table = table('corretor'); $this->setName('f_save_indicador'); $this->addElement('hidden', 'id', [ 'class' => 'invisivel' ]); $this->addElement('text', 'id2', [ 'label' => 'ID:', 'disabled' => 'disabled' ]); $this->addElementWith('data_cadastro', $this->getOptions('Data Cadastro: ')) ->addElementWith('data_ultima_atualizacao', $this->getOptions('Data Atualização: ')) ->setDisableds(['data_cadastro', 'data_ultima_atualizacao']); $this->getElement('data_cadastro') ->addDecorator('Label', ['tag' => 'dt', 'tagClass' => 'clear']); $this->addDadosOperacionais(); $this->addDadosPessoais(); $this->addDadosEndereco(); $this->addDadosBancarios(); $this->addDadosContato(); $this->addDadosAcesso(); $this->removeDisplayGroupLabels(); $this->initButtons(); $this->addElement('hidden', 'grupo_acesso', ['class' => 'invisivel','value' => 5]); $this->addElement('hidden', 'rota_id', ['class' => 'invisivel','value' => 0]); $this->addElement('hidden', 'bloquear_pagamento', ['class' => 'invisivel','value' => 0]); $this->addElement('hidden', 'permitir_sinc_yuppies', ['class' => 'invisivel','value' => 0]); $this->addElement('hidden', 'nivel_esteira', ['class' => 'invisivel','value' => 0]); $this->addElement('hidden', 'tipo_venda', ['class' => 'invisivel','value' => 0]); } protected function addDadosOperacionais() { $select = new Zend_Form_Element_Select('empresa_id'); $select->setLabel('Empresa') ->setRequired(true) ->addMultiOptions(Core_Combos::getEmpresasOptions()) ->setAttrib('style', "width: 100%;"); $this->addElement($select); $select = new Zend_Form_Element_Select('grupo_comissao'); $select->setLabel('Grupo Comissão:') ->addMultiOptions(Core_Combos::getGruposComissaoOptions()) ->setAttrib('style', "width: 100%;"); $this->addElement($select); $this->addDisplayGroup([ 'empresa_id', 'grupo_comissao', ], 'dados-operacionais', ['legend' => 'Dados Operacionais']); } protected function addDadosPessoais() { $this->addElement('text', 'nome', [ 'label' => 'Nome / Razão Social:', 'size' => 35, 'required' => true ]); $this->addElement('text', 'apelido', [ 'label' => 'Apelido / Fantasia:', 'size' => 35 ]); $this->addElement('text', 'cpf', [ 'label' => 'CPF/CNPJ:', 'onkeypress' => 'mascara(this, soNumeros)', 'maxlength' => 14, 'onchange' => 'validCpfIndicador(value)', 'required' => true, ]); $this->addElement('text', 'responsavel', [ 'label' => 'Sócio administrador:', 'size' => 35, ]); $this->getElement('responsavel') ->addDecorator('Label', ['tag' => 'dt', 'tagClass' => 'clear']); $this->addElement('text', 'cpf_responsavel', [ 'label' => 'CPF Sócio:', 'onkeypress' => 'mascara(this, soNumeros)', 'maxlength' => 11, ]); $this->addElement('text', 'rg', [ 'label' => 'RG:', ]); $this->addElement('text', 'nome_mae', [ 'label' => 'Mãe:', 'size' => 35 ]); $this->addElement('text', 'orgao_expedidor', [ 'label' => 'Órgão:', ]); $this->addElement('text', 'data_nascimento', [ 'label' => 'Data Nascimento:', 'onkeypress' => 'mascara(this, data)', 'maxlength' => 10, 'size' => 11, 'validators' => array( new Validators_DataNascimento() ) ]); $this->addSelect('estado_civil', 'Estado Civil:', [ '' => '', 'SOLTEIRO' => 'SOLTEIRO(A)', 'CASADO' => 'CASADO(A)', 'DESQUITADO' => 'DESQUITADO(A)', 'DIVORCIADO' => 'DIVORCIADO(A)', 'VIUVO' => 'VIUVO(A)', 'OUTROS' => 'OUTROS' ]); $this->addSelect('nacionalidade', 'Nacionalidade:', [ 'BRASILEIRO' => 'BRASILEIRO(A)', 'ESTRANGEIRO' => 'ESTRANGEIRO(A)' ]); $this->addElement('text', 'profissao', [ 'label' => 'Profissão:' ]); $this->addElement('textarea', 'obs', [ 'label' => 'Observação:', 'rows' => 5, 'cols' => 35 ]); $this->addDisplayGroup([ 'nome', 'apelido', 'cpf', 'responsavel', 'cpf_responsavel', 'rg', 'nome_mae', 'orgao_expedidor', 'data_nascimento', 'estado_civil', 'nacionalidade', 'profissao', 'obs' ], 'dados-pessoais', ['legend' => 'Dados Pessoais']); } protected function addDadosAcesso() { $this->addElement('text', 'login', [ 'label' => 'Login:', 'size' => 35, ]); $this->addElement('password', 'senha', [ 'label' => 'Senha:', 'size' => 35, ]); $this->addElement('text', 'ip', [ 'label' => 'IP de Acesso:', 'validators' => [new Zend_Validate_Ip()], 'size' => 35, ]); $this->addElement('checkbox', 'mudar_senha', [ 'label' => 'Mudar Senha', 'description' => 'Solicitar uma nova senha no próximo acesso' ]); $this->addElement('checkbox', 'corretor_desativado', [ 'label' => 'Indicador desativado', 'description' => 'Desativar e bloquear o acesso do indicador' ]); $this->addElement('hidden', 'data_temporario_app', []); $this->addDisplayGroup([ 'login', 'senha', 'ip', 'mudar_senha', 'corretor_desativado', 'data_temporario_app', ], 'dados-acesso', ['legend' => 'Dados de acesso']); } protected function initButtons() { $this->addElement('button', 'btn_back', [ 'label' => 'Voltar', 'class' => 'bt_back', 'onclick' => "window.location='" . $this->getView()->baseUrl('indicador') . "'" ]); $this->addElement('submit', 'btn_save', [ 'label' => 'Salvar', 'class' => 'bt_save' ]); $this->addElement('button', 'btn_new', [ 'label' => 'Novo Cadastro', 'class' => 'bt_new', 'onclick' => "window.location='" . $this->getView()->baseUrl('indicador/save') . "'" ]); $this->addDisplayGroup( ['btn_back', 'btn_save', 'btn_new'], 'buttons' ); } public function isValid($data) { $result2 = true; if (!isset($data['id']) || empty($data['id'])) { $validator = new Zend_Validate_Db_NoRecordExists([ 'table' => 'vw_corretores', 'field' => 'login' ]); $this->getElement('login')->addValidator($validator); } $result = Core_Form::isValid($data); if ($data['id']) { $corretor = $this->table->findByLogin($data['login']); if (is_object($corretor) && !empty($corretor->login) && !empty($corretor->id) && $corretor->id != $data['id']) { $this->getElement('login')->addError('O login informado já está em uso.'); $result2 = false; } } if (isset($data['cpf']) && $data['cpf']) { $cpfCnpj = String_Refatorar::soNumeros($data['cpf']); if (strlen($cpfCnpj) <= 11) { $this->getElement('cpf')->setValidators([new Validators_Cpf()]); } else { $this->getElement('cpf')->setValidators([new Validators_Cnpj()]); } } return ($result && $result2); } }
💾 保存文件
← 返回文件管理器