From 4c953573345d21cd6d13e287839b4a395c951750 Mon Sep 17 00:00:00 2001 From: Eriksen Costa Paixão Date: Fri, 17 Jul 2009 18:59:37 +0000 Subject: [PATCH] by Eriksen: Corrigido caracteres com encoding incorreto --- ieducar/intranet/meusdados.php | 705 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 1 file changed, 399 insertions(+), 306 deletions(-) diff --git a/ieducar/intranet/meusdados.php b/ieducar/intranet/meusdados.php index 2c3493e..542a168 100755 --- a/ieducar/intranet/meusdados.php +++ b/ieducar/intranet/meusdados.php @@ -31,7 +31,7 @@ * @version $Id$ */ -$desvio_diretorio = ""; +$desvio_diretorio = ''; require_once 'include/clsBase.inc.php'; require_once 'include/clsCadastro.inc.php'; require_once 'include/clsBanco.inc.php'; @@ -48,313 +48,406 @@ class clsIndex extends clsBase class indice extends clsCadastro { - var $p_cod_pessoa_fj, $p_nm_pessoa, $p_id_federal, $idtlog, $p_endereco, $p_cep, $p_ref_bairro, $p_ddd_telefone_1, $p_telefone_1, $p_ddd_telefone_2, $p_telefone_2, $p_ddd_telefone_mov, $p_telefone_mov, $p_ddd_telefone_fax, $p_telefone_fax, $p_email, $p_http, $p_tipo_pessoa, $p_sexo; - var $f_matricula, $f_senha, $f_ativo, $f_ref_sec, $f_ramal, $f_ref_dept, $f_ref_setor, $ref_cod_funcionario_vinculo, $bloco, $apartamento, $andar, $ref_cod_setor; - - var $confere_senha; - - function Inicializar() - { - $retorno = "Novo"; - @session_start(); - - if ( @$_SESSION['id_pessoa'] ) - { - $this->p_cod_pessoa_fj = @$_SESSION['id_pessoa']; - $objPessoa = new clsPessoaFj(); - $db = new clsBanco(); - $db->Consulta( "SELECT f.matricula, f.senha, f.ativo, f.ramal, f.ref_cod_setor, f.ref_cod_funcionario_vinculo, f.ref_cod_setor_new FROM funcionario f WHERE f.ref_cod_pessoa_fj={$this->p_cod_pessoa_fj}" ); - if ($db->ProximoRegistro()) - { - list($this->f_matricula, $this->f_senha, $this->f_ativo, $this->f_ramal, $this->f_ref_setor, $this->ref_cod_funcionario_vinculo, $this->ref_cod_setor ) = $db->Tupla(); - list($this->p_nm_pessoa, $this->p_id_federal, $this->p_endereco, $this->p_cep, $this->p_ref_bairro, $this->p_ddd_telefone_1, $this->p_telefone_1, $this->p_ddd_telefone_2, $this->p_telefone_2, $this->p_ddd_telefone_mov, $this->p_telefone_mov, $this->p_ddd_telefone_fax, $this->p_telefone_fax, $this->p_email, $this->p_http, $this->p_tipo_pessoa, $this->cidade, $this->bairro, $this->logradouro, $this->cep, $this->idlog, $this->idbai, $this->idtlog, $this->sigla_uf, $this->complemento, $this->numero, $this->letra, $this->bloco, $this->apartamento, $this->andar ) = $objPessoa->queryRapida($this->p_cod_pessoa_fj, "nome", "cpf", "endereco", "cep", "bairro", "ddd_1", "fone_1", "ddd_2", "fone_2", "ddd_mov", "fone_mov", "ddd_fax", "fone_fax", "email", "url", "tipo", "cidade", "bairro", "logradouro", "cep", "idlog", "idbai", "idtlog", "sigla_uf", "complemento", "numero", "letra", "bloco", "apartamento", "andar" ); - $objFisica = new clsPessoaFisica(); - list( $this->p_sexo ) = $objFisica->queryRapida( $this->p_cod_pessoa_fj, "sexo" ); - $this->fexcluir = false; - $retorno = "Editar"; - // define os niveis ate o setor escolhido (para que os campos ja venham preenchidos corretamente) - if( $this->ref_cod_setor ) - { - $objSetor = new clsSetor(); - $niveis = $objSetor->getNiveis( $this->ref_cod_setor ); - for( $i = 0; $i < count( $niveis ); $i++ ) - { - $nm_var = "setor_$i"; - $this->$nm_var = $niveis[$i]; - } - } - } - } - - $this->url_cancelar = "index.php"; - - $this->nome_url_cancelar = "Cancelar"; - - return $retorno; - } - - function null2empityStr( $vars ) - { - foreach ( $vars AS $key => $valor ) - { - $valor .= ""; - if( $valor == "NULL" ) - { - $vars[$key] = ""; - } - } - return $vars; - } - - function Gerar() - { - @session_start(); - $this->campoOculto( "p_cod_pessoa_fj", $this->p_cod_pessoa_fj ); - $this->cod_pessoa_fj = $this->p_cod_pessoa_fj; - - list ($this->p_ddd_telefone_1, $this->p_ddd_telefone_2, $this->p_ddd_telefone_fax, $this->p_ddd_telefone_mov) = $this->null2empityStr( array( $this->p_ddd_telefone_1, $this->p_ddd_telefone_2, $this->p_ddd_telefone_fax, $this->p_ddd_telefone_mov ) ); - - $this->p_ddd_telefone_1 = ( $this->p_ddd_telefone_1 == null ) ? "": $this->p_ddd_telefone_1; - $this->p_ddd_telefone_2 = ( $this->p_ddd_telefone_2 == null ) ? "": $this->p_ddd_telefone_2; - $this->p_ddd_telefone_3 = ( $this->p_ddd_telefone_3 == null ) ? "": $this->p_ddd_telefone_3; - - $this->campoRotulo( "nome", "Nome", $this->p_nm_pessoa ); - - // Detalhes do Endere�o - $objTipoLog = new clsTipoLogradouro(); - $listaTipoLog = $objTipoLog->lista(); - $listaTLog = array(""=>"Selecione"); - if($listaTipoLog) - { - foreach ($listaTipoLog as $tipoLog) { - $listaTLog[$tipoLog['idtlog']] = $tipoLog['descricao']; - } - } - - $objUf = new clsUf(); - $listauf = $objUf->lista(); - $listaEstado = array(""=>"Selecione"); - if($listauf) - { - foreach ($listauf as $uf) { - $listaEstado[$uf['sigla_uf']] = $uf['sigla_uf']; - } - } - - $this->campoOculto( "idbai", $this->idbai ); - $this->campoOculto( "idlog", $this->idlog ); - if(is_numeric($this->cep)) - { - $this->cep = int2CEP($this->cep); - } - $this->campoOculto( "cep", $this->cep ); - $this->campoOculto( "ref_sigla_uf", $this->sigla_uf); - $this->campoOculto( "ref_idtlog", $this->idtlog); - $this->campoOculto( "id_cidade", $this->cidade); - - if($this->idlog && $this->idbai && $this->cep && $this->cod_pessoa_fj) - { - //$this->campoCep("cep_","CEP", int2CEP( $this->cep ),true,"-"," ",true); - $this->campoCep("cep_", "CEP", $this->cep, true, "-", " ');\">", $disabled); - - $this->campoLista("sigla_uf","Estado",$listaEstado,$this->sigla_uf,false,false,false,false,true); - $this->campoTextoInv( "cidade", "Cidade", $this->cidade, "50", "255", false ); - $this->campoTextoInv( "bairro", "Bairro", $this->bairro, "50", "255", false ); - $this->campoLista("idtlog","Tipo Logradouro",$listaTLog,$this->idtlog,false,false,false,false,true); - $this->campoTextoInv( "logradouro", "Logradouro", $this->logradouro, "50", "255", false ); - $this->campoTexto( "complemento", "Complemento", $this->complemento, "22", "20", false ); - $this->campoTexto( "numero", "Número", $this->numero, "10", "10", true ); - $this->campoTexto( "letra", "Letra", $this->letra, "1", "1", false ); - $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", false); - $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", false); - $this->campoTexto("andar", "Andar", $this->andar, "2","2", false); - } - elseif($this->cod_pessoa_fj && $this->cep) - { - //$this->campoCep("cep_","CEP",int2CEP( $this->cep ),true,"-"," ",false); - $this->campoCep("cep_", "CEP", $this->cep, true, "-", " ');\">", $disabled); - - - $this->campoLista("sigla_uf","Estado",$listaEstado,$this->sigla_uf); - $this->campoTexto( "cidade", "Cidade", $this->cidade, "50", "255", false ); - $this->campoTexto( "bairro", "Bairro", $this->bairro, "50", "255", false ); - $this->campoLista("idtlog","Tipo Logradouro",$listaTLog,$this->idtlog); - $this->campoTexto( "logradouro", "Logradouro", $this->logradouro, "50", "255", false ); - $this->campoTexto( "complemento", "Complemento", $this->complemento, "22", "20", false ); - $this->campoTexto( "numero", "Número", $this->numero, "10", "10", false ); - $this->campoTexto( "letra", "Letra", $this->letra, "1", "1", false ); - $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", false); - $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", false); - $this->campoTexto("andar", "Andar", $this->andar, "2","2", false); - } - else - { - //$this->campoCep("cep_","CEP",int2CEP( $this->cep ),true,"-"," ",true); - $this->campoCep("cep_", "CEP", $this->cep, true, "-", " ');\">", $disabled); - - $this->campoLista("sigla_uf","Estado",$listaEstado,$this->sigla_uf,false,false,false,false,true); - $this->campoTextoInv( "cidade", "Cidade", $this->cidade, "50", "255", true ); - $this->campoTextoInv( "bairro", "Bairro", $this->bairro, "50", "20", true ); - $this->campoLista("idtlog","Tipo Logradouro",$listaTLog,$this->idtlog,false,false,false,false,true); - $this->campoTextoInv( "logradouro", "Logradouro", $this->logradouro, "50", "255",true ); - $this->campoTextoInv( "complemento", "Complemento", $this->complemento, "22", "20", false ); - $this->campoTextoInv( "numero", "N�mero", $this->numero, "10", "10", false ); - $this->campoTextoInv( "letra", "Letra", $this->letra, "1", "1", false ); - $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", false); - $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", false); - $this->campoTexto("andar", "Andar", $this->andar, "2","2", false); - } - - $this->campoTexto( "p_ddd_telefone_1", "DDD Telefone 1", $this->p_ddd_telefone_1, "2", "2", false ); - $this->campoTexto( "p_telefone_1", "Telefone 1", $this->p_telefone_1, "10", "15", false ); - $this->campoTexto( "p_ddd_telefone_2", "DDD Telefone 2", $this->p_ddd_telefone_2, "2", "2", false ); - $this->campoTexto( "p_telefone_2", "Telefone", $this->p_telefone_2, "10", "15", false ); - $this->campoTexto( "p_ddd_telefone_mov", "DDD Celular", $this->p_ddd_telefone_mov, "2", "2", false ); - $this->campoTexto( "p_telefone_mov", "Celular", $this->p_telefone_mov, "10", "15", false ); - $this->campoTexto( "p_ddd_telefone_fax", "DDD Fax", $this->p_ddd_telefone_fax, "2", "2", false ); - $this->campoTexto( "p_telefone_fax", "Fax", $this->p_telefone_fax, "10", "15", false ); - - $this->campoTexto( "p_http", "Site", $this->p_http, "50", "255", false ); - $this->campoTexto( "p_email", "E-mail", $this->p_email, "50", "255", false ); - - $lista_sexos = array(); - $lista_sexos[""] = "Escolha uma opção..."; - $lista_sexos["M"] = "Masculino"; - $lista_sexos["F"] = "Feminino"; - $this->campoLista( "p_sexo", "Sexo", $lista_sexos, $this->p_sexo); - - if (empty($_SESSION['convidado'])) - { - $this->campoSenha( "f_senha", "Senha", $this->f_senha, false); - $this->campoOculto( "confere_senha", $this->f_senha ); - } - $dba = new clsBanco(); - $opcoes = array(); - $dba->Consulta( "SELECT cod_funcionario_vinculo, nm_vinculo FROM funcionario_vinculo ORDER BY nm_vinculo ASC" ); - while ( $dba->ProximoRegistro() ) - { - list( $cod, $nome ) = $dba->Tupla(); - $opcoes[$cod] = $nome; - } - $this->campoLista( "ref_cod_funcionario_vinculo", "Vínculo", $opcoes, $this->ref_cod_funcionario_vinculo); - - $this->campoTexto( "f_ramal", "Ramal", $this->f_ramal, "10", "20", false ); - - $this->campoRotulo("documentos","Documentos","p_cod_pessoa_fj}','400','400','yes', '10','10'); \">"); - - } - - function Editar() - { - @session_start(); - $pessoaFj = $_SESSION['id_pessoa']; - session_write_close(); - - $objPessoa = new clsPessoa_( $pessoaFj, false, false, $this->p_http, false, $pessoaFj, date( "Y-m-d H:i:s", time() ), $this->p_email ); - $objPessoa->edita(); - - $objFisica = new clsFisica( $pessoaFj, false, $this->p_sexo ); - $objFisica->edita(); - - $objTelefone = new clsPessoaTelefone( $pessoaFj); - $objTelefone->excluiTodos(); - $objTelefone = new clsPessoaTelefone( $pessoaFj, 1, str_replace( "-", "", $this->p_telefone_1 ), $this->p_ddd_telefone_1 ); - $objTelefone->cadastra(); - $objTelefone = new clsPessoaTelefone( $pessoaFj, 2, str_replace( "-", "", $this->p_telefone_2 ), $this->p_ddd_telefone_2 ); - $objTelefone->cadastra(); - $objTelefone = new clsPessoaTelefone( $pessoaFj, 3, str_replace( "-", "", $this->p_telefone_mov ), $this->p_ddd_telefone_mov ); - $objTelefone->cadastra(); - $objTelefone = new clsPessoaTelefone( $pessoaFj, 4, str_replace( "-", "", $this->p_telefone_fax ), $this->p_ddd_telefone_fax ); - $objTelefone->cadastra(); - if($this->cep && $this->idbai && $this->idlog) - { - $objEndereco = new clsPessoaEndereco( $pessoaFj ); - $objEndereco2 = new clsPessoaEndereco($pessoaFj,$this->cep,$this->idlog,$this->idbai,$this->numero,$this->complemento,false,$this->letra, $this->bloco, $this->apartamento, $this->andar); - if( $objEndereco->detalhe() ) - { - $objEndereco2->edita(); - } - else - { - $objEndereco2->cadastra(); - } - $objPessoa = new clsPessoaFj(); - list( $this->cidade, $this->bairro, $this->logradouro, $this->cep, $this->idtlog, $this->sigla_uf, $this->bloco, $this->apartamento, $this->andar ) = $objPessoa->queryRapida($pessoaFj, "cidade", "bairro", "logradouro", "cep", "idtlog", "sigla_uf", "bloco", "apartamento", "andar" ); - } - else - { - $this->cep_ = idFederal2int($this->cep_); - $objEnderecoExterno = new clsEnderecoExterno( $pessoaFj ); - $objEnderecoExterno2 = new clsEnderecoExterno( $pessoaFj,"1",$this->idtlog,$this->logradouro,$this->numero,$this->letra,$this->complemento,$this->bairro,$this->cep_,$this->cidade,$this->sigla_uf,false, $this->bloco, $this->apartamento, $this->andar); - if( $objEnderecoExterno->detalhe() ) - { - $objEnderecoExterno2->edita(); - } - else - { - $objEnderecoExterno2->cadastra(); - } - } - // verifica o maior setor selecionado - for( $i = 0; $i < 5; $i++ ) - { - $varNm = "setor_$i"; - if( $this->$varNm ) - { - $setor = $this->$varNm; - } - } - if( $setor ) - { - $sql = " ref_cod_setor_new = '{$setor}', "; - } - - if ($this->f_senha != $this->confere_senha) - { - // - $sql_funcionario = "UPDATE funcionario SET senha=md5('{$this->f_senha}'), data_troca_senha = NOW(), ref_cod_funcionario_vinculo='{$this->ref_cod_funcionario_vinculo}', $sql ramal='{$this->f_ramal}', ref_ref_cod_pessoa_fj='{$pessoaFj}', tempo_expira_senha = 30 WHERE ref_cod_pessoa_fj={$this->p_cod_pessoa_fj}"; - } - else - { - if (empty($_SESSION['convidado'])) - { - $sql_funcionario = "UPDATE funcionario SET $sql ramal='{$this->f_ramal}', ref_cod_funcionario_vinculo='{$this->ref_cod_funcionario_vinculo}', ref_ref_cod_pessoa_fj='{$pessoaFj}' WHERE ref_cod_pessoa_fj={$this->p_cod_pessoa_fj}"; - } - else - { - $sql_funcionario = "UPDATE funcionario SET $sql ramal='{$this->f_ramal}', ref_ref_cod_pessoa_fj='{$pessoaFj}' WHERE ref_cod_pessoa_fj={$this->p_cod_pessoa_fj}"; - } - } - $db = new clsBanco(); - - //$db->Consulta( $sql_pessoa ); - $db->Consulta( $sql_funcionario ); - - if (empty($_SESSION['convidado'])) - { - if( ! $_POST["reloading"] ) - { - //echo ""; - } - } - else - { - if($_SESSION['motivo_visita'] == 'atualizar_cadastro_e_email') - { - echo ""; - }else - { - echo ""; - } - } - header('Location: index.php'); - return true; - } + public + $p_cod_pessoa_fj, + $p_nm_pessoa, + $p_id_federal, + $idtlog, + $p_endereco, + $p_cep, + $p_ref_bairro, + $p_ddd_telefone_1, + $p_telefone_1, + $p_ddd_telefone_2, + $p_telefone_2, + $p_ddd_telefone_mov, + $p_telefone_mov, + $p_ddd_telefone_fax, + $p_telefone_fax, + $p_email, + $p_http, + $p_tipo_pessoa, + $p_sexo, + $f_matricula, + $f_senha, + $f_ativo, + $f_ref_sec, + $f_ramal, + $f_ref_dept, + $f_ref_setor, + $ref_cod_funcionario_vinculo, + $bloco, + $apartamento, + $andar, + $ref_cod_setor = NULL; + + public $confere_senha; + + public function Inicializar() + { + $retorno = "Novo"; + session_start(); + + if (isset($_SESSION['id_pessoa'])) { + $this->p_cod_pessoa_fj = $_SESSION['id_pessoa']; + $objPessoa = new clsPessoaFj(); + $db = new clsBanco(); + $db->Consulta("SELECT f.matricula, f.senha, f.ativo, f.ramal, f.ref_cod_setor, f.ref_cod_funcionario_vinculo, f.ref_cod_setor_new FROM funcionario f WHERE f.ref_cod_pessoa_fj={$this->p_cod_pessoa_fj}"); + + if ($db->ProximoRegistro()) { + list($this->f_matricula, $this->f_senha, $this->f_ativo, $this->f_ramal, + $this->f_ref_setor, $this->ref_cod_funcionario_vinculo, $this->ref_cod_setor) = $db->Tupla(); + + list($this->p_nm_pessoa, $this->p_id_federal, $this->p_endereco, $this->p_cep, + $this->p_ref_bairro, $this->p_ddd_telefone_1, $this->p_telefone_1, + $this->p_ddd_telefone_2, $this->p_telefone_2, $this->p_ddd_telefone_mov, + $this->p_telefone_mov, $this->p_ddd_telefone_fax, $this->p_telefone_fax, + $this->p_email, $this->p_http, $this->p_tipo_pessoa, $this->cidade, + $this->bairro, $this->logradouro, $this->cep, $this->idlog, $this->idbai, + $this->idtlog, $this->sigla_uf, $this->complemento, $this->numero, $this->letra, + $this->bloco, $this->apartamento, $this->andar) = $objPessoa->queryRapida($this->p_cod_pessoa_fj, "nome", "cpf", "endereco", "cep", "bairro", "ddd_1", "fone_1", "ddd_2", "fone_2", "ddd_mov", "fone_mov", "ddd_fax", "fone_fax", "email", "url", "tipo", "cidade", "bairro", "logradouro", "cep", "idlog", "idbai", "idtlog", "sigla_uf", "complemento", "numero", "letra", "bloco", "apartamento", "andar"); + + $objFisica = new clsPessoaFisica(); + list($this->p_sexo) = $objFisica->queryRapida($this->p_cod_pessoa_fj, "sexo"); + + $this->fexcluir = FALSE; + $retorno = "Editar"; + + // define os niveis ate o setor escolhido (para que os campos ja venham preenchidos corretamente) + if ($this->ref_cod_setor) { + $objSetor = new clsSetor(); + $niveis = $objSetor->getNiveis($this->ref_cod_setor); + + for ($i = 0; $i < count($niveis); $i++) { + $nm_var = "setor_$i"; + $this->$nm_var = $niveis[$i]; + } + } + } + } + + $this->url_cancelar = 'index.php'; + $this->nome_url_cancelar = 'Cancelar'; + + return $retorno; + } + + public function null2empityStr($vars) + { + foreach ($vars as $key => $valor) { + $valor .= ""; + if ($valor == "NULL") { + $vars[$key] = ""; + } + } + + return $vars; + } + + public function Gerar() + { + session_start(); + $this->campoOculto('p_cod_pessoa_fj', $this->p_cod_pessoa_fj); + $this->cod_pessoa_fj = $this->p_cod_pessoa_fj; + + list ($this->p_ddd_telefone_1, $this->p_ddd_telefone_2, + $this->p_ddd_telefone_fax, $this->p_ddd_telefone_mov) = + $this->null2empityStr(array($this->p_ddd_telefone_1, $this->p_ddd_telefone_2, $this->p_ddd_telefone_fax, $this->p_ddd_telefone_mov)); + + $this->p_ddd_telefone_1 = ($this->p_ddd_telefone_1 == NULL) ? '' : $this->p_ddd_telefone_1; + $this->p_ddd_telefone_2 = ($this->p_ddd_telefone_2 == NULL) ? '' : $this->p_ddd_telefone_2; + $this->p_ddd_telefone_3 = ($this->p_ddd_telefone_3 == NULL) ? '' : $this->p_ddd_telefone_3; + + $this->campoRotulo("nome", "Nome", $this->p_nm_pessoa); + + // Detalhes do endereço + $objTipoLog = new clsTipoLogradouro(); + $listaTipoLog = $objTipoLog->lista(); + $listaTLog = array(""=>"Selecione"); + + if ($listaTipoLog) { + foreach ($listaTipoLog as $tipoLog) { + $listaTLog[$tipoLog['idtlog']] = $tipoLog['descricao']; + } + } + + $objUf = new clsUf(); + $listauf = $objUf->lista(); + $listaEstado = array('' => "Selecione"); + if ($listauf) { + foreach ($listauf as $uf) { + $listaEstado[$uf['sigla_uf']] = $uf['sigla_uf']; + } + } + + $this->campoOculto('idbai', $this->idbai); + $this->campoOculto('idlog', $this->idlog); + + if (is_numeric($this->cep)) { + $this->cep = int2CEP($this->cep); + } + + $this->campoOculto('cep', $this->cep); + $this->campoOculto('ref_sigla_uf', $this->sigla_uf); + $this->campoOculto('ref_idtlog', $this->idtlog); + $this->campoOculto('id_cidade', $this->cidade); + + if ($this->idlog && $this->idbai && $this->cep && $this->cod_pessoa_fj) + { + $this->campoCep("cep_", "CEP", $this->cep, TRUE, "-", " ');\">", $disabled); + + $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf, + FALSE, FALSE, FALSE, FALSE, TRUE); + + $this->campoTextoInv("cidade", "Cidade", $this->cidade, "50", "255", FALSE); + + $this->campoTextoInv("bairro", "Bairro", $this->bairro, "50", "255", FALSE); + + $this->campoLista("idtlog","Tipo Logradouro", $listaTLog,$this->idtlog, + FALSE, FALSE, FALSE, FALSE, TRUE); + + $this->campoTextoInv("logradouro", "Logradouro", $this->logradouro, "50", "255", FALSE); + + $this->campoTexto("complemento", "Complemento", $this->complemento, "22", "20", FALSE); + + $this->campoTexto("numero", "Número", $this->numero, "10", "10", TRUE); + + $this->campoTexto("letra", "Letra", $this->letra, "1", "1", FALSE); + + $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", FALSE); + + $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", FALSE); + + $this->campoTexto("andar", "Andar", $this->andar, "2","2", FALSE); + } + elseif ($this->cod_pessoa_fj && $this->cep) + { + $this->campoCep("cep_", "CEP", $this->cep, TRUE, "-", " ');\">", $disabled); + + $this->campoLista("sigla_uf","Estado",$listaEstado,$this->sigla_uf); + + $this->campoTexto("cidade", "Cidade", $this->cidade, "50", "255", FALSE); + + $this->campoTexto("bairro", "Bairro", $this->bairro, "50", "255", FALSE); + + $this->campoLista("idtlog","Tipo Logradouro",$listaTLog,$this->idtlog); + + $this->campoTexto("logradouro", "Logradouro", $this->logradouro, "50", "255", FALSE); + + $this->campoTexto("complemento", "Complemento", $this->complemento, "22", "20", FALSE); + + $this->campoTexto("numero", "Número", $this->numero, "10", "10", FALSE); + + $this->campoTexto("letra", "Letra", $this->letra, "1", "1", FALSE); + + $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", FALSE); + + $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", FALSE); + + $this->campoTexto("andar", "Andar", $this->andar, "2","2", FALSE); + } + else + { + $this->campoCep("cep_", "CEP", $this->cep, TRUE, "-", " ');\">", $disabled); + + $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf, FALSE, + FALSE, FALSE, FALSE, TRUE); + + $this->campoTextoInv("cidade", "Cidade", $this->cidade, "50", "255", TRUE); + + $this->campoTextoInv("bairro", "Bairro", $this->bairro, "50", "20", TRUE); + + $this->campoLista("idtlog", "Tipo Logradouro", $listaTLog, $this->idtlog, + FALSE, FALSE, FALSE, FALSE, TRUE); + + $this->campoTextoInv("logradouro", "Logradouro", $this->logradouro, "50", "255", TRUE); + + $this->campoTextoInv("complemento", "Complemento", $this->complemento, "22", "20", FALSE); + + $this->campoTextoInv("numero", "Número", $this->numero, "10", "10", FALSE); + + $this->campoTextoInv("letra", "Letra", $this->letra, "1", "1", FALSE); + + $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", FALSE); + + $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", FALSE); + + $this->campoTexto("andar", "Andar", $this->andar, "2","2", FALSE); + } + + $this->campoTexto("p_ddd_telefone_1", "DDD Telefone 1", + $this->p_ddd_telefone_1, "2", "2", FALSE); + + $this->campoTexto("p_telefone_1", "Telefone 1", $this->p_telefone_1, + "10", "15", FALSE); + + $this->campoTexto("p_ddd_telefone_2", "DDD Telefone 2", + $this->p_ddd_telefone_2, "2", "2", FALSE); + + $this->campoTexto("p_telefone_2", "Telefone", $this->p_telefone_2, "10", + "15", FALSE); + + $this->campoTexto("p_ddd_telefone_mov", "DDD Celular", $this->p_ddd_telefone_mov, + "2", "2", FALSE); + + $this->campoTexto("p_telefone_mov", "Celular", $this->p_telefone_mov, "10", + "15", FALSE); + + $this->campoTexto("p_ddd_telefone_fax", "DDD Fax", $this->p_ddd_telefone_fax, + "2", "2", FALSE); + + $this->campoTexto("p_telefone_fax", "Fax", $this->p_telefone_fax, "10", "15", + FALSE); + + $this->campoTexto("p_http", "Site", $this->p_http, "50", "255", FALSE); + + $this->campoTexto("p_email", "E-mail", $this->p_email, "50", "255", FALSE); + + $lista_sexos = array(); + $lista_sexos[''] = 'Escolha uma opção...'; + $lista_sexos['M'] = 'Masculino'; + $lista_sexos['F'] = 'Feminino'; + $this->campoLista("p_sexo", "Sexo", $lista_sexos, $this->p_sexo); + + if (empty($_SESSION['convidado'])) { + $this->campoSenha("f_senha", "Senha", $this->f_senha, FALSE); + $this->campoOculto("confere_senha", $this->f_senha); + } + + $dba = new clsBanco(); + $opcoes = array(); + $dba->Consulta("SELECT cod_funcionario_vinculo, nm_vinculo FROM funcionario_vinculo ORDER BY nm_vinculo ASC"); + + while ($dba->ProximoRegistro()) { + list($cod, $nome) = $dba->Tupla(); + $opcoes[$cod] = $nome; + } + + $this->campoLista("ref_cod_funcionario_vinculo", "Vínculo", $opcoes, + $this->ref_cod_funcionario_vinculo); + + $this->campoTexto("f_ramal", "Ramal", $this->f_ramal, "10", "20", FALSE); + + $this->campoRotulo("documentos", "Documentos", "p_cod_pessoa_fj}','400','400','yes', '10','10'); \">"); + } + + public function Editar() + { + session_start(); + $pessoaFj = $_SESSION['id_pessoa']; + session_write_close(); + + $objPessoa = new clsPessoa_($pessoaFj, FALSE, FALSE, $this->p_http, FALSE, + $pessoaFj, date("Y-m-d H:i:s", time()), $this->p_email); + + $objPessoa->edita(); + + $objFisica = new clsFisica($pessoaFj, FALSE, $this->p_sexo); + $objFisica->edita(); + + $objTelefone = new clsPessoaTelefone($pessoaFj); + $objTelefone->excluiTodos(); + + $objTelefone = new clsPessoaTelefone($pessoaFj, 1, str_replace("-", "", $this->p_telefone_1), $this->p_ddd_telefone_1); + $objTelefone->cadastra(); + + $objTelefone = new clsPessoaTelefone($pessoaFj, 2, str_replace("-", "", $this->p_telefone_2), $this->p_ddd_telefone_2); + $objTelefone->cadastra(); + + $objTelefone = new clsPessoaTelefone($pessoaFj, 3, str_replace("-", "", $this->p_telefone_mov), $this->p_ddd_telefone_mov); + $objTelefone->cadastra(); + + $objTelefone = new clsPessoaTelefone($pessoaFj, 4, str_replace("-", "", $this->p_telefone_fax), $this->p_ddd_telefone_fax); + $objTelefone->cadastra(); + + if ($this->cep && $this->idbai && $this->idlog) { + $objEndereco = new clsPessoaEndereco( $pessoaFj ); + $objEndereco2 = new clsPessoaEndereco($pessoaFj,$this->cep,$this->idlog,$this->idbai,$this->numero,$this->complemento,FALSE,$this->letra, $this->bloco, $this->apartamento, $this->andar); + if( $objEndereco->detalhe() ) + { + $objEndereco2->edita(); + } + else { + $objEndereco2->cadastra(); + } + + $objPessoa = new clsPessoaFj(); + list($this->cidade, $this->bairro, $this->logradouro, $this->cep, + $this->idtlog, $this->sigla_uf, $this->bloco, $this->apartamento, $this->andar) = + $objPessoa->queryRapida($pessoaFj, "cidade", "bairro", "logradouro", + "cep", "idtlog", "sigla_uf", "bloco", "apartamento", "andar"); + } + else { + $this->cep_ = idFederal2int($this->cep_); + $objEnderecoExterno = new clsEnderecoExterno($pessoaFj); + $objEnderecoExterno2 = new clsEnderecoExterno($pessoaFj, "1", $this->idtlog, + $this->logradouro, $this->numero, $this->letra, $this->complemento, + $this->bairro, $this->cep_, $this->cidade, $this->sigla_uf, FALSE, + $this->bloco, $this->apartamento, $this->andar); + + if ($objEnderecoExterno->detalhe()) { + $objEnderecoExterno2->edita(); + } + else { + $objEnderecoExterno2->cadastra(); + } + } + + // Verifica o maior setor selecionado + for ($i = 0; $i < 5; $i++) { + $varNm = "setor_$i"; + if ($this->$varNm) { + $setor = $this->$varNm; + } + } + if ($setor) { + $sql = " ref_cod_setor_new = '{$setor}', "; + } + + if ($this->f_senha != $this->confere_senha) { + $sql_funcionario = "UPDATE funcionario SET senha=md5('{$this->f_senha}'), data_troca_senha = NOW(), ref_cod_funcionario_vinculo='{$this->ref_cod_funcionario_vinculo}', $sql ramal='{$this->f_ramal}', ref_ref_cod_pessoa_fj='{$pessoaFj}', tempo_expira_senha = 30 WHERE ref_cod_pessoa_fj={$this->p_cod_pessoa_fj}"; + } + else { + if (empty($_SESSION['convidado'])) { + $sql_funcionario = "UPDATE funcionario SET $sql ramal='{$this->f_ramal}', ref_cod_funcionario_vinculo='{$this->ref_cod_funcionario_vinculo}', ref_ref_cod_pessoa_fj='{$pessoaFj}' WHERE ref_cod_pessoa_fj={$this->p_cod_pessoa_fj}"; + } + else { + $sql_funcionario = "UPDATE funcionario SET $sql ramal='{$this->f_ramal}', ref_ref_cod_pessoa_fj='{$pessoaFj}' WHERE ref_cod_pessoa_fj={$this->p_cod_pessoa_fj}"; + } + } + + $db = new clsBanco(); + + $db->Consulta($sql_funcionario); + + if (empty($_SESSION['convidado'])) { + if (! $_POST["reloading"]) { + } + } + else { + if ($_SESSION['motivo_visita'] == 'atualizar_cadastro_e_email') { + echo ""; + } + else { + echo ""; + } + } + + header('Location: index.php'); + return TRUE; + } } + +// Instancia objeto de página $pagina = new clsIndex(); + +// Instancia objeto de conteúdo $miolo = new indice(); -$pagina->addForm( $miolo ); -$pagina->MakeAll(); -?> \ No newline at end of file + +// Atribui o conteúdo à página +$pagina->addForm($miolo); + +// Gera o código HTML +$pagina->MakeAll(); \ No newline at end of file -- libgit2 0.21.2