Beispiel #1
0
 public function testEntityValidators()
 {
     // Recupera os objetos CoreExt_Validate
     $validators = $this->_entity->getDefaultValidatorCollection();
     $this->assertType('CoreExt_Validate_Numeric', $validators['aluno']);
     $this->assertType('CoreExt_Validate_Choice', $validators['responsavel']);
     $this->assertType('CoreExt_Validate_Numeric', $validators['user']);
     // Verifica se a opção 'choices' corresponde aos valores do Enum Responsavel.
     $responsavel = Transporte_Model_Responsavel::getInstance();
     $this->assertEquals($responsavel->getKeys(), $validators['responsavel']->getOption('choices'));
 }
 function Gerar()
 {
     $this->fexcluir = FALSE;
     $this->campoTabInicio('educar_cad', '', TRUE);
     $this->campoOculto('retorno', $this->retorno);
     $this->campoOculto('bloqueado', 1);
     if (is_int((int) $this->cpf) && !empty($this->cpf)) {
         $cpf = int2CPF($this->cpf);
     } else {
         $cpf = $this->cpf;
     }
     if (!$this->cod_aluno) {
         $this->campoAdicionaTab('CPF', $this->tab_habilitado);
         $opcoes = array('' => 'Pesquise a pessoa clicando na lupa ao lado');
         $this->campoCpf('cpf_', 'CPF', $cpf, FALSE, '<img border="0" onclick="pesquisa_valores_popless(\'educar_pesquisa_aluno_lst2.php?campo1=ref_idpes&campo3=cpf&campo4=cpf_\', \'nome\')" src="imagens/lupa.png">');
     }
     $this->campoOculto('ref_idpes', $this->ref_idpes);
     $this->campoAdicionaTab('Dados Pessoais', $this->tab_habilitado);
     if ($this->cod_aluno) {
         $obj_matricula = new clsPmieducarMatricula();
         $lst_matricula = $obj_matricula->lista(NULL, NULL, NULL, NULL, NULL, NULL, $this->cod_aluno);
     }
     if (!empty($this->ref_idpes)) {
         $obj_aluno = new clsPmieducarAluno();
         $lista_aluno = $obj_aluno->lista(NULL, NULL, NULL, NULL, NULL, $this->ref_idpes, NULL, NULL, NULL, NULL);
         if ($lista_aluno) {
             $det_aluno = array_shift($lista_aluno);
         }
     }
     if ($det_aluno['cod_aluno']) {
         $this->cod_aluno = $det_aluno['cod_aluno'];
         $this->ref_cod_aluno_beneficio = $det_aluno['ref_cod_aluno_beneficio'];
         $this->ref_cod_religiao = $det_aluno['ref_cod_religiao'];
         $this->caminho_foto = $det_aluno['caminho_foto'];
     }
     $this->campoOculto('cod_aluno', $this->cod_aluno);
     $this->campoOculto('ref_idpes', $this->ref_idpes);
     if ($this->ref_idpes != 'NULL') {
         if ($this->ref_idpes) {
             $obj_pessoa = new clsPessoaFj($this->ref_idpes);
             $det_pessoa = $obj_pessoa->detalhe();
             $obj_fisica = new clsFisica($this->ref_idpes);
             $det_fisica = $obj_fisica->detalhe();
             $obj_fisica_raca = new clsCadastroFisicaRaca($this->ref_idpes);
             $det_fisica_raca = $obj_fisica_raca->detalhe();
             $this->ref_cod_raca = $det_fisica_raca['ref_cod_raca'];
             $this->nome = $det_pessoa['nome'];
             $this->email = $det_pessoa['email'];
             $this->ideciv = $det_fisica['ideciv']->ideciv;
             $this->data_nascimento = dataToBrasil($det_fisica['data_nasc']);
             $this->cpf = $det_fisica['cpf'];
             $obj_documento = new clsDocumento($this->ref_idpes);
             $obj_documento_det = $obj_documento->detalhe();
             $this->ddd_fone_1 = $det_pessoa['ddd_1'];
             $this->fone_1 = $det_pessoa['fone_1'];
             $this->ddd_fone_2 = $det_pessoa['ddd_2'];
             $this->fone_2 = $det_pessoa['fone_2'];
             $this->ddd_fax = $det_pessoa['ddd_fax'];
             $this->fone_fax = $det_pessoa['fone_fax'];
             $this->ddd_mov = $det_pessoa['ddd_mov'];
             $this->fone_mov = $det_pessoa['fone_mov'];
             $this->email = $det_pessoa['email'];
             $this->url = $det_pessoa['url'];
             $this->sexo = $det_fisica['sexo'];
             $this->nacionalidade = $det_fisica['nacionalidade'];
             $this->idmun_nascimento = $det_fisica['idmun_nascimento']->idmun;
             $detalhe_pais_origem = $det_fisica['idpais_estrangeiro']->detalhe();
             $this->pais_origem = $detalhe_pais_origem['idpais'];
             $this->ref_idpes_responsavel = $det_fisica['idpes_responsavel'];
             $this->idpes_pai = $det_fisica['idpes_pai'];
             $this->idpes_mae = $det_fisica['idpes_mae'];
             $obj_aluno = new clsPmieducarAluno(NULL, NULL, NULL, NULL, NULL, $this->ref_idpes);
             $detalhe_aluno = $obj_aluno->detalhe();
             if ($detalhe_aluno) {
                 $this->nm_pai = $detalhe_aluno['nm_pai'];
                 $this->nm_mae = $detalhe_aluno['nm_mae'];
             }
             $obj_endereco = new clsPessoaEndereco($this->ref_idpes);
             if ($obj_endereco_det = $obj_endereco->detalhe()) {
                 $this->isEnderecoExterno = 0;
                 $this->id_cep = $obj_endereco_det['cep']->cep;
                 $this->id_bairro = $obj_endereco_det['idbai']->idbai;
                 $this->id_logradouro = $obj_endereco_det['idlog']->idlog;
                 $this->numero = $obj_endereco_det['numero'];
                 $this->letra = $obj_endereco_det['letra'];
                 $this->complemento = $obj_endereco_det['complemento'];
                 $this->andar = $obj_endereco_det['andar'];
                 $this->apartamento = $obj_endereco_det['apartamento'];
                 $this->bloco = $obj_endereco_det['bloco'];
                 $this->ref_idtlog = $obj_endereco_det['idtlog'];
                 $this->nm_bairro = $obj_endereco_det['bairro'];
                 $this->nm_logradouro = $obj_endereco_det['logradouro'];
                 $this->cep_ = int2CEP($this->id_cep);
             } else {
                 $obj_endereco = new clsEnderecoExterno($this->ref_idpes);
                 if ($obj_endereco_det = $obj_endereco->detalhe()) {
                     $this->isEnderecoExterno = 1;
                     $this->id_cep = $obj_endereco_det['cep'];
                     $this->cidade = $obj_endereco_det['cidade'];
                     $this->nm_bairro = $obj_endereco_det['bairro'];
                     $this->nm_logradouro = $obj_endereco_det['logradouro'];
                     $this->id_bairro = NULL;
                     $this->id_logradouro = NULL;
                     $this->numero = $obj_endereco_det['numero'];
                     $this->letra = $obj_endereco_det['letra'];
                     $this->complemento = $obj_endereco_det['complemento'];
                     $this->andar = $obj_endereco_det['andar'];
                     $this->apartamento = $obj_endereco_det['apartamento'];
                     $this->bloco = $obj_endereco_det['bloco'];
                     $this->ref_idtlog = $this->idtlog = $obj_endereco_det['idtlog']->idtlog;
                     $this->ref_sigla_uf = $this->ref_sigla_uf_ = $obj_endereco_det['sigla_uf']->sigla_uf;
                     $this->cep_ = int2CEP($this->id_cep);
                 }
             }
             $this->zona_localizacao = $obj_endereco_det['zona_localizacao'];
         }
     }
     if ($this->isEnderecoExterno == 0) {
         $obj_bairro = new clsBairro($this->id_bairro);
         $this->cep_ = int2CEP($this->id_cep);
         $obj_bairro_det = $obj_bairro->detalhe();
         if ($obj_bairro_det) {
             $this->nm_bairro = $obj_bairro_det["nome"];
         }
         $obj_log = new clsLogradouro($this->id_logradouro);
         $obj_log_det = $obj_log->detalhe();
         if ($obj_log_det) {
             $this->nm_logradouro = $obj_log_det["nome"];
             $this->ref_idtlog = $obj_log_det["idtlog"]->idtlog;
             $obj_mun = new clsMunicipio($obj_log_det["idmun"]);
             $det_mun = $obj_mun->detalhe();
             if ($det_mun) {
                 $this->cidade = ucfirst(strtolower($det_mun["nome"]));
             }
             $this->ref_sigla_uf = $this->ref_sigla_uf_ = $det_mun['sigla_uf']->sigla_uf;
         }
         $obj_bairro = new clsBairro($obj_endereco_det["ref_idbai"]);
         $obj_bairro_det = $obj_bairro->detalhe();
         if ($obj_bairro_det) {
             $this->nm_bairro = $obj_bairro_det["nome"];
         }
     }
     $this->campoTexto('nome', 'Nome', $this->nome, 30, 100, TRUE);
     if ($this->cpf && $this->ref_idpes) {
         if (!$this->cpf) {
             $this->campoRotulo('cpf_2', 'CPF', $this->cpf);
         } else {
             $this->campoRotulo('cpf_2', 'CPF', int2CPF($this->cpf));
         }
     } else {
         if (!$this->cpf) {
             $this->campoCpf('cpf_2', 'CPF', $this->cpf);
             $this->campoOculto('sem_cpf', 1);
         } else {
             $this->campoCpf('cpf_2', 'CPF', int2CPF($this->cpf), FALSE);
         }
     }
     $this->campoData('data_nascimento', 'Data de Nascimento', $this->data_nascimento, TRUE);
     $lista = array('' => 'Selecione', 'F' => 'Feminino', 'M' => 'Masculino');
     $this->campoLista('sexo', 'Sexo', $lista, $this->sexo);
     $obj_estado_civil = new clsEstadoCivil();
     $obj_estado_civil_lista = $obj_estado_civil->lista();
     $lista_estado_civil = array('' => 'Selecione');
     if ($obj_estado_civil_lista) {
         foreach ($obj_estado_civil_lista as $estado_civil) {
             $lista_estado_civil[$estado_civil['ideciv']] = $estado_civil['descricao'];
         }
     }
     $this->campoLista('ideciv', 'Estado Civil', $lista_estado_civil, $this->ideciv);
     $obj_religiao = new clsPmieducarReligiao();
     $obj_religia_lista = $obj_religiao->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
     $lista_religiao = array('NULL' => 'Selecione');
     if ($obj_religia_lista) {
         foreach ($obj_religia_lista as $religiao) {
             $lista_religiao[$religiao["cod_religiao"]] = $religiao["nm_religiao"];
         }
     }
     $this->campoLista('ref_cod_religiao', 'Religi&atilde;o', $lista_religiao, $this->ref_cod_religiao, '', FALSE, '', '', '', FALSE);
     $opcoes_raca = array('' => 'Selecione');
     $obj_raca = new clsCadastroRaca();
     $lst_raca = $obj_raca->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, TRUE);
     if ($lst_raca) {
         foreach ($lst_raca as $raca) {
             $opcoes_raca[$raca['cod_raca']] = $raca['nm_raca'];
         }
     }
     $this->campoLista('ref_cod_raca', 'Ra&ccedil;a', $opcoes_raca, $this->ref_cod_raca, '', FALSE, '', '', '', FALSE);
     $this->campoQuebra2('#224488');
     if ($this->idpes_pai) {
         $obj_pessoa_pai = new clsPessoaFj($this->idpes_pai);
         $det_pessoa_pai = $obj_pessoa_pai->detalhe();
         if ($det_pessoa_pai) {
             $this->nm_pai = $det_pessoa_pai['nome'];
             // cpf
             $obj_cpf = new clsFisica($this->idpes_pai);
             $det_cpf = $obj_cpf->detalhe();
             if ($det_cpf['cpf']) {
                 $this->cpf_pai = int2CPF($det_cpf['cpf']);
             }
         }
     }
     if ($this->idpes_mae) {
         $obj_pessoa_mae = new clsPessoaFj($this->idpes_mae);
         $det_pessoa_mae = $obj_pessoa_mae->detalhe();
         if ($det_pessoa_mae) {
             $this->nm_mae = $det_pessoa_mae['nome'];
             //cpf
             $obj_cpf = new clsFisica($this->idpes_mae);
             $det_cpf = $obj_cpf->detalhe();
             if ($det_cpf['cpf']) {
                 $this->cpf_mae = int2CPF($det_cpf['cpf']);
             }
         }
     }
     $this->campoTexto('nm_pai', 'Nome do Pai', $this->nm_pai, 30, 255, FALSE);
     $this->campoCpf('cpf_pai', 'CPF pai', $this->cpf_pai, FALSE, $this->cpf_pai ? '' : ' &nbsp; &nbsp; (preencher sempre que possível)');
     $this->campoTexto('nm_mae', 'Nome da M&atilde;e', $this->nm_mae, 30, 255, FALSE);
     $this->campoCpf('cpf_mae', 'CPF mãe', $this->cpf_mae, FALSE, $this->cpf_mae ? '' : ' &nbsp; &nbsp; (preencher sempre que possível)');
     $lista = array('' => 'Responsável');
     if ($this->ref_idpes_responsavel != 'NULL') {
         $obj_pessoa_resp = new clsPessoaFj($this->ref_idpes_responsavel);
         $det_pessoa_resp = $obj_pessoa_resp->detalhe();
         if ($det_pessoa_resp) {
             $lista[$det_pessoa_resp['idpes']] = $det_pessoa_resp['nome'];
         }
     }
     $parametros = new clsParametrosPesquisas();
     $parametros->setSubmit(0);
     $parametros->adicionaCampoSelect('ref_idpes_responsavel', 'idpes', 'nome');
     $parametros->setPessoa('F');
     $parametros->setPessoaNovo('S');
     $parametros->setPessoaCPF('N');
     $parametros->setPessoaTela('frame');
     $parametros->setCodSistema(1);
     $this->campoListaPesq('ref_idpes_responsavel', 'Responsavel', $lista, $this->ref_idpes_responsavel, 'pesquisa_pessoa_lst.php', '', FALSE, '', '', NULL, NULL, '', FALSE, $parametros->serializaCampos(), FALSE);
     $this->campoQuebra2('#224488');
     if ($this->tipo_responsavel) {
         if ($this->nm_pai) {
             $this->tipo_responsavel = 'p';
         } elseif ($this->nm_mae) {
             $this->tipo_responsavel = 'm';
         } elseif ($this->ref_idpes_responsavel) {
             $this->tipo_responsavel = 'r';
         }
     }
     $opcoes = array('p' => 'Pai', 'm' => 'M&atilde;e', 'r' => 'Respons&aacute;vel');
     $this->campoRadio('tipo_responsavel', 'Respons&aacute;vel', $opcoes, $this->tipo_responsavel);
     $this->campoQuebra2('#224488');
     $disabled = $this->isEnderecoExterno ? FALSE : TRUE;
     $this->campoOculto('isEnderecoExterno', $this->isEnderecoExterno);
     $urlPesquisaCep = 'educar_pesquisa_cep_log_bairro.php?' . 'campo1=nm_bairro&campo2=id_bairro&campo3=id_cep&campo4=nm_logradouro&' . 'campo5=id_logradouro&campo6=ref_sigla_uf&campo7=cidade&' . 'campo8=ref_idtlog_&campo9=isEnderecoExterno&campo10=cep_&' . 'campo11=ref_sigla_uf_&campo12=ref_idtlog&campo13=id_cidade&' . 'campo14=zona_localizacao';
     $urlPesquisaCep = sprintf("<img id='lupa' src=\"imagens/lupa.png\" border=\"0\" onclick=\"showExpansivel( 500,500, '<iframe name=\\'miolo\\' id=\\'miolo\\' frameborder=\\'0\\' height=\\'100%%\\' width=\\'500\\' marginheight=\\'0\\' marginwidth=\\'0\\' src=\\'%s\\'></iframe>');\">", $urlPesquisaCep);
     $this->campoCep('cep_', 'CEP', $this->cep_, TRUE, '-', $urlPesquisaCep, $disabled);
     $this->campoTexto('cidade', 'Cidade', $this->cidade, 30, 255, TRUE, FALSE, TRUE, '', '', '', '', $disabled);
     $obj_uf = new clsUf(FALSE, FALSE, 1);
     $lst_uf = $obj_uf->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'sigla_uf');
     $array_uf = array('' => 'Selecione um estado');
     foreach ($lst_uf as $uf) {
         $array_uf[$uf['sigla_uf']] = $uf['nome'];
     }
     $this->campoLista('ref_sigla_uf_', ' &nbsp; Estado', $array_uf, $this->ref_sigla_uf, '', FALSE, '', '', $disabled);
     $this->campoTexto('nm_bairro', 'Bairro', $this->nm_bairro, 30, 255, TRUE, FALSE, FALSE, '', '', '', '', $disabled);
     $tipo_logradouro_array = array('' => 'Tipo de Logradouro');
     $obj_tipo_logradouro = new clsTipoLogradouro();
     $obj_tipo_logradouro_lista = $obj_tipo_logradouro->lista();
     if ($obj_tipo_logradouro_lista) {
         foreach ($obj_tipo_logradouro_lista as $key => $tipo_log) {
             $tipo_logradouro_array[$tipo_log["idtlog"]] = $tipo_log["descricao"];
         }
     }
     $this->campoLista('ref_idtlog', 'Logradouro', $tipo_logradouro_array, $this->ref_idtlog, '', TRUE, '', '', $this->isEnderecoExterno ? FALSE : TRUE, TRUE);
     $this->campoTexto('nm_logradouro', 'Logradouro', $this->nm_logradouro, 30, 255, TRUE, FALSE, FALSE, '', '', '', '', $disabled);
     $zl = App_Model_ZonaLocalizacao::getInstance();
     $this->campoLista('zona_localizacao', 'Zona Localização', $zl->getEnums(), $this->zona_localizacao, FALSE, FALSE, FALSE, FALSE, $disabled);
     $this->campoNumero('numero', 'N&uacute;mero', $this->numero, 4, 6, FALSE, '', '', FALSE, FALSE, TRUE);
     $this->campoTexto('letra', ' &nbsp; Letra', $this->letra, 4, 1, FALSE);
     $this->campoTexto('complemento', 'Complemento', $this->complemento, 30, 50, FALSE);
     $this->campoTexto('bloco', 'Bloco', $this->bloco, 30, 50, FALSE);
     $this->campoNumero('andar', 'Andar', $this->andar, 4, 2, FALSE, '', '', FALSE, FALSE, TRUE);
     $this->campoNumero('apartamento', ' &nbsp; Apartamento', $this->apartamento, 4, 6, FALSE);
     $this->campoLista('nacionalidade', 'Nacionalidade', $lista_nacionalidade, $this->nacionalidade, 'tmpObj = document.getElementById("pais_origem"); if(this.value != 1) { tmpObj.disabled = false; } else { tmpObj.selectedIndex = 27; tmpObj.disabled = true; }', TRUE, '', '', '', FALSE);
     $lista_mun_nasc = array('NULL' => 'Selecione a cidade');
     $obj_mun_nasc = new clsMunicipio($this->idmun_nascimento);
     $det_mun_nasc = $obj_mun_nasc->detalhe();
     if ($det_mun_nasc["nome"]) {
         $lista_mun_nasc[$det_mun_nasc["idmun"]] = $det_mun_nasc["nome"];
     }
     $this->campoListaPesq('idmun_nascimento', 'Naturalidade', $lista_mun_nasc, $this->idmun_nascimento, 'educar_pesquisa_municipio_lst.php?campo1=idmun_nascimento', '', FALSE, '', '', NULL, NULL, '', TRUE);
     $this->nacionalidade = $this->nacionalidade ? $this->nacionalidade : 1;
     $lista_nacionalidade = array('NULL' => 'Selecione', '1' => 'Brasileiro', '2' => 'Naturalizado Brasileiro', '3' => 'Estrangeiro');
     $this->campoLista('nacionalidade', 'Nacionalidade', $lista_nacionalidade, $this->nacionalidade, 'tmpObj = document.getElementById("pais_origem"); if(this.value != 1) { tmpObj.disabled = false; } else { tmpObj.selectedIndex = 27; tmpObj.disabled = true; }', TRUE, '', '', '', FALSE);
     $lista_pais_origem = array('NULL' => 'País de origem');
     $obj_pais = new clsPais();
     $obj_pais_lista = $obj_pais->lista(NULL, NULL, NULL, '', '', 'nome asc');
     if ($obj_pais_lista) {
         foreach ($obj_pais_lista as $key => $pais) {
             $lista_pais_origem[$pais['idpais']] = $pais['nome'];
         }
     }
     // se a nacionalidade for "BRASILEIRO" seleciona o brasil e deixa inativo
     $this->pais_origem = $this->nacionalidade == 1 ? 1 : $this->pais_origem;
     $this->campoLista('pais_origem', ' &nbsp; País de Origem', $lista_pais_origem, $this->pais_origem, '', '', '', '', $this->nacionalidade == 1, FALSE);
     $this->campoQuebra2('#224488');
     // Transporte escolar
     $transporteMapper = new Transporte_Model_AlunoDataMapper();
     $transporte = NULL;
     try {
         $transporte = $transporteMapper->find(array($this->cod_aluno));
     } catch (Exception $e) {
     }
     $bit = App_Model_SimNao::getInstance();
     $this->campoLista('transporte_aluno', 'Transporte', $bit->getEnums(), !is_null($transporte) ? 1 : 0, 'transporteResponsavel();');
     $responsavel = Transporte_Model_Responsavel::getInstance();
     $this->campoLista('transporte_responsavel', 'Responsável', $responsavel->getEnums(), !is_null($transporte) ? $transporte->get('responsavel') : 0);
     $this->campoQuebra2('#224488');
     $obj_beneficio = new clsPmieducarAlunoBeneficio();
     $obj_beneficio_lista = $obj_beneficio->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
     $lista_beneficio = array('NULL' => 'Selecione');
     if ($obj_beneficio_lista) {
         foreach ($obj_beneficio_lista as $beneficio) {
             $lista_beneficio[$beneficio['cod_aluno_beneficio']] = $beneficio['nm_beneficio'];
         }
     }
     $this->campoLista('ref_cod_aluno_beneficio', 'Benef&iacute;cio', $lista_beneficio, $this->ref_cod_aluno_beneficio, '', FALSE, '', '', FALSE, FALSE);
     $lista_analfabeto = array(1 => 'N&atilde;o', 0 => 'Sim');
     $this->campoLista('analfabeto', 'Alfabetizado', $lista_analfabeto, $this->analfabeto, '', FALSE, '', '', FALSE, FALSE);
     $this->campoNumero('ddd_fone_1', 'Telefone', $this->ddd_fone_1, 1, 3, FALSE, '', '', FALSE, FALSE, TRUE);
     $this->campoNumero('fone_1', 'Telefone', $this->fone_1, 11, 11);
     $this->campoNumero('ddd_mov', 'Celular', $this->ddd_mov, 1, 3, FALSE, '', '', FALSE, FALSE, TRUE);
     $this->campoNumero('fone_mov', 'Celular', $this->fone_mov, 11, 11);
     $this->campoEmail('email', 'Email', $this->email, 30, 255, FALSE);
     if (!empty($this->caminho_foto)) {
         $this->campoRotulo('foto_antiga_', 'Arquivo', sprintf('
       <img src="arquivos/educar/aluno/small/%s" border="0">
         <a href="javascript:void(0);" onclick="document.getElementById(\'foto_excluida\').value=1; setVisibility(\'tr_foto_antiga_\', false); setVisibility(\'tr_foto\', true);"><img src="imagens/nvp_bola_xis.gif" border="0"></a>', $this->caminho_foto));
     }
     $this->campoOculto('foto_excluida', 0);
     $this->campoArquivo('foto', 'Foto', '', '20', '', FALSE);
     $this->campoOculto('id_bairro', $this->id_bairro);
     $this->campoOculto('id_cep', $this->id_cep);
     $this->campoOculto('id_logradouro', $this->id_logradouro);
     $this->campoOculto('id_cidade', $this->id_cidade);
     $this->campoOculto('ref_idtlog_', $this->ref_idtlog);
     $this->campoOculto('ref_sigla_uf', $this->ref_sigla_uf);
     $this->campoTexto('nome', 'Nome', $this->nome, 30, 100, TRUE);
     if ($this->cpf && $this->ref_idpes) {
         if (!$this->cpf) {
             $this->campoRotulo('cpf_2', 'CPF', $this->cpf);
         } else {
             $this->campoRotulo('cpf_2', 'CPF', int2CPF($this->cpf));
         }
     } else {
         if (!$this->cpf) {
             $this->campoOculto('sem_cpf', 1);
         }
     }
     $this->campoData('data_nascimento', 'Data de Nascimento', $this->data_nascimento, TRUE);
     $lista = array('' => 'Selecione', 'F' => 'Feminino', 'M' => 'Masculino');
     $this->campoLista('sexo', 'Sexo', $lista, $this->sexo);
     $obj_estado_civil = new clsEstadoCivil();
     $obj_estado_civil_lista = $obj_estado_civil->lista();
     $lista_estado_civil = array('' => 'Selecione');
     if ($obj_estado_civil_lista) {
         foreach ($obj_estado_civil_lista as $estado_civil) {
             $lista_estado_civil[$estado_civil['ideciv']] = $estado_civil['descricao'];
         }
     }
     $this->campoLista('ideciv', 'Estado Civil', $lista_estado_civil, $this->ideciv);
     $obj_religiao = new clsPmieducarReligiao();
     $obj_religia_lista = $obj_religiao->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
     $lista_religiao = array('NULL' => 'Selecione');
     if ($obj_religia_lista) {
         foreach ($obj_religia_lista as $religiao) {
             $lista_religiao[$religiao['cod_religiao']] = $religiao['nm_religiao'];
         }
     }
     $this->campoLista('ref_cod_religiao', 'Religi&atilde;o', $lista_religiao, $this->ref_cod_religiao, '', FALSE, '', '', '', FALSE);
     $opcoes_raca = array('' => 'Selecione');
     $obj_raca = new clsCadastroRaca();
     $lst_raca = $obj_raca->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, TRUE);
     if ($lst_raca) {
         foreach ($lst_raca as $raca) {
             $opcoes_raca[$raca['cod_raca']] = $raca['nm_raca'];
         }
     }
     $this->campoLista('ref_cod_raca', 'Ra&ccedil;a', $opcoes_raca, $this->ref_cod_raca, '', FALSE, '', '', '', FALSE);
     $this->campoQuebra2('#224488');
     if ($this->idpes_pai) {
         $obj_pessoa_pai = new clsPessoaFj($this->idpes_pai);
         $det_pessoa_pai = $obj_pessoa_pai->detalhe();
         if ($det_pessoa_pai) {
             $this->nm_pai = $det_pessoa_pai['nome'];
             // cpf
             $obj_cpf = new clsFisica($this->idpes_pai);
             $det_cpf = $obj_cpf->detalhe();
             if ($det_cpf['cpf']) {
                 $this->cpf_pai = int2CPF($det_cpf['cpf']);
             }
         }
     }
     if ($this->idpes_mae) {
         $obj_pessoa_mae = new clsPessoaFj($this->idpes_mae);
         $det_pessoa_mae = $obj_pessoa_mae->detalhe();
         if ($det_pessoa_mae) {
             $this->nm_mae = $det_pessoa_mae['nome'];
             // cpf
             $obj_cpf = new clsFisica($this->idpes_mae);
             $det_cpf = $obj_cpf->detalhe();
             if ($det_cpf['cpf']) {
                 $this->cpf_mae = int2CPF($det_cpf['cpf']);
             }
         }
     }
     $this->campoTexto('nm_pai', 'Nome do Pai', $this->nm_pai, 30, 255, FALSE);
     $this->campoCpf('cpf_pai', 'CPF pai', $this->cpf_pai, FALSE, $this->cpf_pai ? '' : ' &nbsp; &nbsp; (preencher sempre que possível)');
     $this->campoTexto('nm_mae', 'Nome da M&atilde;e', $this->nm_mae, 30, 255, FALSE);
     $this->campoCpf('cpf_mae', 'CPF mãe', $this->cpf_mae, FALSE, $this->cpf_mae ? '' : ' &nbsp; &nbsp; (preencher sempre que possível)');
     $lista = array('' => 'Responsável');
     if ($this->ref_idpes_responsavel != 'NULL') {
         $obj_pessoa_resp = new clsPessoaFj($this->ref_idpes_responsavel);
         $det_pessoa_resp = $obj_pessoa_resp->detalhe();
         if ($det_pessoa_resp) {
             $lista[$det_pessoa_resp['idpes']] = $det_pessoa_resp['nome'];
         }
     }
     $parametros = new clsParametrosPesquisas();
     $parametros->setSubmit(0);
     $parametros->adicionaCampoSelect('ref_idpes_responsavel', 'idpes', 'nome');
     $parametros->setPessoa('F');
     $parametros->setPessoaNovo('S');
     $parametros->setPessoaCPF('N');
     $parametros->setPessoaTela('frame');
     $parametros->setCodSistema(1);
     $this->campoListaPesq('ref_idpes_responsavel', 'Responsavel', $lista, $this->ref_idpes_responsavel, 'pesquisa_pessoa_lst.php', '', FALSE, '', '', NULL, NULL, '', FALSE, $parametros->serializaCampos(), FALSE);
     $this->campoQuebra2('#224488');
     if (!$this->tipo_responsavel) {
         if ($this->nm_pai) {
             $this->tipo_responsavel = 'p';
         } elseif ($this->nm_mae) {
             $this->tipo_responsavel = 'm';
         } elseif ($this->ref_idpes_responsavel) {
             $this->tipo_responsavel = 'r';
         }
     }
     $opcoes = array('' => 'Sem Responsável', 'p' => 'Pai', 'm' => 'M&atilde;e', 'r' => 'Respons&aacute;vel');
     $this->campoRadio('tipo_responsavel', 'Respons&aacute;vel', $opcoes, $this->tipo_responsavel);
     $this->campoQuebra2('#224488');
     $disabled = $this->isEnderecoExterno ? FALSE : TRUE;
     $this->campoOculto('isEnderecoExterno', $this->isEnderecoExterno);
     $this->campoCep('cep_', 'CEP', $this->cep_, TRUE, '-', $urlPesquisaCep, $disabled);
     $this->campoTexto('cidade', 'Cidade', $this->cidade, 30, 255, TRUE, FALSE, TRUE, '', '', '', '', $disabled);
     $obj_uf = new clsUf(FALSE, FALSE, 1);
     $lst_uf = $obj_uf->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'sigla_uf');
     $array_uf = array('' => 'Selecione um estado');
     foreach ($lst_uf as $uf) {
         $array_uf[$uf['sigla_uf']] = $uf['nome'];
     }
     $this->campoLista('ref_sigla_uf_', ' &nbsp; Estado', $array_uf, $this->ref_sigla_uf, '', FALSE, '', '', $disabled);
     $this->campoTexto('nm_bairro', 'Bairro', $this->nm_bairro, 30, 255, TRUE, FALSE, FALSE, '', '', '', '', $disabled);
     $tipo_logradouro_array = array('' => 'Tipo de Logradouro');
     $obj_tipo_logradouro = new clsTipoLogradouro();
     $obj_tipo_logradouro_lista = $obj_tipo_logradouro->lista();
     if ($obj_tipo_logradouro_lista) {
         foreach ($obj_tipo_logradouro_lista as $key => $tipo_log) {
             $tipo_logradouro_array[$tipo_log['idtlog']] = $tipo_log['descricao'];
         }
     }
     $this->campoLista('ref_idtlog', 'Logradouro', $tipo_logradouro_array, $this->ref_idtlog, '', TRUE, '', '', $this->isEnderecoExterno ? FALSE : TRUE, TRUE);
     $this->campoTexto('nm_logradouro', 'Logradouro', $this->nm_logradouro, 30, 255, TRUE, FALSE, FALSE, '', '', '', '', $disabled);
     $this->campoNumero('numero', 'N&uacute;mero', $this->numero, 4, 6, FALSE, '', '', FALSE, FALSE, TRUE);
     $this->campoTexto('letra', ' &nbsp; Letra', $this->letra, 4, 1, FALSE);
     $this->campoTexto('complemento', 'Complemento', $this->complemento, 30, 50, FALSE);
     $this->campoTexto('bloco', 'Bloco', $this->bloco, 30, 50, FALSE);
     $this->campoNumero('andar', 'Andar', $this->andar, 4, 2, FALSE, '', '', FALSE, FALSE, TRUE);
     $this->campoNumero('apartamento', ' &nbsp; Apartamento', $this->apartamento, 4, 6, FALSE);
     $lista_mun_nasc = array('NULL' => 'Selecione a cidade');
     $obj_mun_nasc = new clsMunicipio($this->idmun_nascimento);
     $det_mun_nasc = $obj_mun_nasc->detalhe();
     if ($det_mun_nasc['nome']) {
         $lista_mun_nasc[$det_mun_nasc['idmun']] = $det_mun_nasc['nome'];
     }
     $this->campoListaPesq('idmun_nascimento', 'Naturalidade', $lista_mun_nasc, $this->idmun_nascimento, 'educar_pesquisa_municipio_lst.php?campo1=idmun_nascimento', '', FALSE, '', '', NULL, NULL, '', TRUE);
     $this->nacionalidade = $this->nacionalidade ? $this->nacionalidade : 1;
     $lista_nacionalidade = array('NULL' => 'Selecione', '1' => 'Brasileiro', '2' => 'Naturalizado Brasileiro', '3' => 'Estrangeiro');
     $this->campoLista('nacionalidade', 'Nacionalidade', $lista_nacionalidade, $this->nacionalidade, "tmpObj = document.getElementById('pais_origem'); if (this.value!=1) { tmpObj.disabled = false; } else { tmpObj.selectedIndex = 27; tmpObj.disabled = true; }", TRUE, '', '', '', FALSE);
     $lista_pais_origem = array('NULL' => 'País de origem');
     $obj_pais = new clsPais();
     $obj_pais_lista = $obj_pais->lista(null, null, null, '', '', 'nome asc');
     if ($obj_pais_lista) {
         foreach ($obj_pais_lista as $key => $pais) {
             $lista_pais_origem[$pais['idpais']] = $pais['nome'];
         }
     }
     // se a nacionalidade for "BRASILEIRO" seleciona o brasil e deixa inativo
     $this->pais_origem = $this->nacionalidade == 1 ? 1 : $this->pais_origem;
     $this->campoLista('pais_origem', ' &nbsp; País de Origem', $lista_pais_origem, $this->pais_origem, '', '', '', '', $this->nacionalidade == 1, FALSE);
     $this->campoQuebra2('#224488');
     $obj_beneficio = new clsPmieducarAlunoBeneficio();
     $obj_beneficio_lista = $obj_beneficio->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
     $lista_beneficio = array('NULL' => "Selecione");
     if ($obj_beneficio_lista) {
         foreach ($obj_beneficio_lista as $beneficio) {
             $lista_beneficio[$beneficio['cod_aluno_beneficio']] = $beneficio['nm_beneficio'];
         }
     }
     $this->campoLista('ref_cod_aluno_beneficio', 'Benef&iacute;cio', $lista_beneficio, $this->ref_cod_aluno_beneficio, '', FALSE, '', '', FALSE, FALSE);
     $lista_analfabeto = array(1 => 'N&atilde;o', 0 => 'Sim');
     $this->campoLista('analfabeto', 'Alfabetizado', $lista_analfabeto, $this->analfabeto, '', FALSE, '', '', FALSE, FALSE);
     $this->campoNumero('ddd_fone_1', 'Telefone', $this->ddd_fone_1, 1, 3, FALSE, '', '', FALSE, FALSE, TRUE);
     $this->campoNumero('fone_1', 'Telefone', $this->fone_1, 11, 11);
     $this->campoNumero('ddd_mov', 'Celular', $this->ddd_mov, 1, 3, FALSE, '', '', FALSE, FALSE, TRUE);
     $this->campoNumero('fone_mov', 'Celular', $this->fone_mov, 11, 11);
     $this->campoEmail('email', 'Email', $this->email, 30, 255, FALSE);
     if (!empty($this->caminho_foto)) {
         $this->campoRotulo('foto_antiga_', 'Arquivo', sprintf('<img src="arquivos/educar/aluno/small/%s" border="0"> <a href="javascript:void(0);" onclick="document.getElementById(\'foto_excluida\').value=1; setVisibility(\'tr_foto_antiga_\', false); setVisibility(\'tr_foto\',true);"> <img src="imagens/nvp_bola_xis.gif" border="0"></a>', $this->caminho_foto));
     }
     $this->campoArquivo('foto', 'Foto', '', '20', '', FALSE);
     $this->campoOculto('id_bairro', $this->id_bairro);
     $this->campoOculto('id_cep', $this->id_cep);
     $this->campoOculto('id_logradouro', $this->id_logradouro);
     $this->campoOculto('id_cidade', $this->id_cidade);
     $this->campoOculto('ref_idtlog_', $this->ref_idtlog);
     $this->campoOculto('ref_sigla_uf', $this->ref_sigla_uf);
     $this->campoOculto('cpf', $this->cpf);
     $this->campoAdicionaTab('Deficiência', $this->tab_habilitado);
     if ($this->ref_idpes) {
         $obj_deficiencia_pessoa = new clsCadastroFisicaDeficiencia();
         $obj_deficiencia_pessoa_lista = $obj_deficiencia_pessoa->lista($this->ref_idpes);
     }
     if ($this->inc != 2 && !$this->exc) {
         if ($obj_deficiencia_pessoa_lista) {
             $deficiencia_pessoa = array();
             foreach ($obj_deficiencia_pessoa_lista as $deficiencia) {
                 $obj_def = new clsCadastroDeficiencia($deficiencia['ref_cod_deficiencia']);
                 $det_def = $obj_def->detalhe();
                 $deficiencia_pessoa[$deficiencia['ref_cod_deficiencia']] = $det_def['nm_deficiencia'];
             }
             $deficiencia_aluno = array();
             $deficiencia_aluno = $deficiencia_pessoa;
         }
     }
     $obj_deficiencias = new clsCadastroDeficiencia();
     $lista_deficiencias = $obj_deficiencias->lista();
     $lista = array('' => 'Selecione');
     if ($lista_deficiencias) {
         foreach ($lista_deficiencias as $deficiencia) {
             $lista[$deficiencia['cod_deficiencia']] = $deficiencia['nm_deficiencia'];
         }
     }
     $oculto = $tabela = '';
     if ($deficiencia_aluno) {
         foreach ($deficiencia_aluno as $indice => $valor) {
             $cor_fundo = $cor_fundo == '#D1DADF' ? '#E4E9ED' : '#D1DADF';
             $tabela .= "<tr id=\"tr_{$indice}\" bgcolor=\"{$cor_fundo}\" style=\"padding-right: 10px;\">";
             $tabela .= "<td>{$valor}</td>";
             $tabela .= "<td align=\"right\" style=\"padding-right: 10px;\">";
             $tabela .= "<img border=\"0\" onclick=\"excluirLinhaDeficiencia({$indice})\"\n                      style=\"cursor: pointer;\" src=\"imagens/banco_imagens/excluirrr.gif\"\n                      title=\"Excluir\">";
             $tabela .= "</td></tr>";
             $oculto .= "<input type=\"hidden\" id=\"oc_defic[{$indice}]\" name=\"oc_defic[{$indice}]\" value=\"{$indice}\">";
         }
     }
     $this->campoLista('ref_cod_pessoa_deficiencia', 'Defici&ecirc;ncia', $lista, $this->ref_cod_pessoa_deficiencia, '', FALSE, '', '', FALSE, $obrigatorio);
     $this->campoRotulo('incluir2', 'Incluir defici&ecirc;ncia', "<a href='#' onclick=\"adicionaDeficiencia();\"><img src='imagens/banco_imagens/entrada2.gif' title='Incluir' border=0></a>");
     $this->campoRotulo("tab_defic", "Deficiências", "<table id='tabela_deficiencia' cellspacing='0' cellpadding='2'><tbody>{$tabela}</tbody></table><div id='ocultos_defic'>{$oculto}</div>");
     $this->campoOculto('inc', '');
     $this->campoOculto('exc', '');
     $this->campoAdicionaTab('Outros Dados', $this->tab_habilitado);
     if ($this->ref_idpes) {
         $ObjDocumento = new clsDocumento($this->ref_idpes);
         $detalheDocumento = $ObjDocumento->detalhe();
         $this->rg = $detalheDocumento['rg'];
         if ($detalheDocumento['data_exp_rg']) {
             $this->data_exp_rg = date('d/m/Y', strtotime(substr($detalheDocumento['data_exp_rg'], 0, 19)));
         }
         $this->sigla_uf_exp_rg = $detalheDocumento['sigla_uf_exp_rg'];
         $this->tipo_cert_civil = $detalheDocumento['tipo_cert_civil'];
         $this->num_termo = $detalheDocumento['num_termo'];
         $this->num_livro = $detalheDocumento['num_livro'];
         $this->num_folha = $detalheDocumento['num_folha'];
         if ($detalheDocumento['data_emissao_cert_civil']) {
             $this->data_emissao_cert_civil = date('d/m/Y', strtotime(substr($detalheDocumento['data_emissao_cert_civil'], 0, 19)));
         }
         $this->sigla_uf_cert_civil = $detalheDocumento['sigla_uf_cert_civil'];
         $this->cartorio_cert_civil = $detalheDocumento['cartorio_cert_civil'];
         $this->num_cart_trabalho = $detalheDocumento['num_cart_trabalho'];
         $this->serie_cart_trabalho = $detalheDocumento['serie_cart_trabalho'];
         if ($detalheDocumento['data_emissao_cart_trabalho']) {
             $this->data_emissao_cart_trabalho = date("d/m/Y", strtotime(substr($detalheDocumento['data_emissao_cart_trabalho'], 0, 19)));
         }
         $this->sigla_uf_cart_trabalho = $detalheDocumento['sigla_uf_cart_trabalho'];
         $this->num_tit_eleitor = $detalheDocumento['num_tit_eleitor'];
         $this->zona_tit_eleitor = $detalheDocumento['zona_tit_eleitor'];
         $this->secao_tit_eleitor = $detalheDocumento['secao_tit_eleitor'];
         $this->idorg_exp_rg = $detalheDocumento['idorg_exp_rg'];
     }
     $objUf = new clsUf();
     $listauf = $objUf->lista();
     $listaEstado = array('0' => 'Selecione');
     if ($listauf) {
         foreach ($listauf as $uf) {
             $listaEstado[$uf['sigla_uf']] = $uf['sigla_uf'];
         }
     }
     $objOrgaoEmissorRg = new clsOrgaoEmissorRg();
     $listaOrgaoEmissorRg = $objOrgaoEmissorRg->lista();
     $listaOrgao = array('0' => 'Selecione');
     if ($listaOrgaoEmissorRg) {
         foreach ($listaOrgaoEmissorRg as $orgaoemissor) {
             $listaOrgao[$orgaoemissor['idorg_rg']] = $orgaoemissor['sigla'];
         }
     }
     $this->campoOculto('idpes', $this->idpes);
     $this->campoTexto('rg', 'Rg', $this->rg, '10', '10', FALSE);
     $this->campoData('data_exp_rg', 'Data Expedição RG', $this->data_exp_rg, FALSE);
     $this->campoLista('idorg_exp_rg', 'Órgão Expedição RG', $listaOrgao, $this->idorg_exp_rg, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
     $this->campoLista('sigla_uf_exp_rg', 'Estado Expedidor', $listaEstado, $this->sigla_uf_exp_rg, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
     $lista_tipo_cert_civil = array();
     $lista_tipo_cert_civil['0'] = 'Selecione';
     $lista_tipo_cert_civil[91] = 'Nascimento';
     $lista_tipo_cert_civil[92] = 'Casamento';
     $this->campoLista('tipo_cert_civil', 'Tipo Certificado Civil', $lista_tipo_cert_civil, $this->tipo_cert_civil, NULL, NULL, NULL, NULL, NULL, FALSE);
     $this->campoTexto('num_termo', 'Termo', $this->num_termo, '8', '8', FALSE);
     $this->campoTexto('num_livro', 'Livro', $this->num_livro, '8', '8', FALSE);
     $this->campoTexto('num_folha', 'Folha', $this->num_folha, '4', '4', FALSE);
     $this->campoData('data_emissao_cert_civil', 'Emissão Certidão Civil', $this->data_emissao_cert_civil, FALSE);
     $this->campoLista('sigla_uf_cert_civil', 'Sigla Certidão Civil', $listaEstado, $this->sigla_uf_cert_civil, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
     $this->campoMemo('cartorio_cert_civil', 'Cartório', $this->cartorio_cert_civil, '35', '4', FALSE, FALSE);
     $this->campoTexto('num_tit_eleitor', 'Título de Eleitor', $this->num_tit_eleitor, '13', '13', FALSE);
     $this->campoTexto('zona_tit_eleitor', 'Zona', $this->zona_tit_eleitor, '4', '4', FALSE);
     $this->campoTexto('secao_tit_eleitor', 'Seção', $this->secao_tit_eleitor, '10', '10', FALSE);
     // Adiciona uma aba com dados do Inep/Educacenso caso aluno tenha código Inep.
     if (isset($this->cod_aluno)) {
         $alunoMapper = new Educacenso_Model_AlunoDataMapper();
         $alunoInep = NULL;
         try {
             $alunoInep = $alunoMapper->find(array('aluno' => $this->cod_aluno));
         } catch (Exception $e) {
         }
         if ($alunoInep) {
             $this->campoAdicionaTab('Educacenso/Inep', $this->tab_habilitado);
             $this->campoRotulo('_inep_cod_aluno', 'Código do aluno no Educacenso/Inep', $alunoInep->alunoInep);
             if (isset($alunoInep->nomeInep)) {
                 $this->campoRotulo('_inep_nome_aluno', 'Nome do aluno no Educacenso/Inep', $alunoInep->nomeInep);
             }
         }
     }
     $this->campoTabFim();
 }
Beispiel #3
0
 public function getDefaultValidatorCollection()
 {
     require_once 'Transporte/Model/Responsavel.php';
     $responsavel = Transporte_Model_Responsavel::getInstance();
     return array('aluno' => new CoreExt_Validate_Numeric(), 'responsavel' => new CoreExt_Validate_Choice(array('choices' => $responsavel->getKeys())), 'user' => new CoreExt_Validate_Numeric());
 }