Commit 4c953573345d21cd6d13e287839b4a395c951750
1 parent
f1fb556e
Exists in
master
by Eriksen: Corrigido caracteres com encoding incorreto
Showing
1 changed file
with
399 additions
and
306 deletions
Show diff stats
ieducar/intranet/meusdados.php
@@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
31 | * @version $Id$ | 31 | * @version $Id$ |
32 | */ | 32 | */ |
33 | 33 | ||
34 | -$desvio_diretorio = ""; | 34 | +$desvio_diretorio = ''; |
35 | require_once 'include/clsBase.inc.php'; | 35 | require_once 'include/clsBase.inc.php'; |
36 | require_once 'include/clsCadastro.inc.php'; | 36 | require_once 'include/clsCadastro.inc.php'; |
37 | require_once 'include/clsBanco.inc.php'; | 37 | require_once 'include/clsBanco.inc.php'; |
@@ -48,313 +48,406 @@ class clsIndex extends clsBase | @@ -48,313 +48,406 @@ class clsIndex extends clsBase | ||
48 | 48 | ||
49 | class indice extends clsCadastro | 49 | class indice extends clsCadastro |
50 | { | 50 | { |
51 | - 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; | ||
52 | - 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; | ||
53 | - | ||
54 | - var $confere_senha; | ||
55 | - | ||
56 | - function Inicializar() | ||
57 | - { | ||
58 | - $retorno = "Novo"; | ||
59 | - @session_start(); | ||
60 | - | ||
61 | - if ( @$_SESSION['id_pessoa'] ) | ||
62 | - { | ||
63 | - $this->p_cod_pessoa_fj = @$_SESSION['id_pessoa']; | ||
64 | - $objPessoa = new clsPessoaFj(); | ||
65 | - $db = new clsBanco(); | ||
66 | - $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}" ); | ||
67 | - if ($db->ProximoRegistro()) | ||
68 | - { | ||
69 | - 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(); | ||
70 | - 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" ); | ||
71 | - $objFisica = new clsPessoaFisica(); | ||
72 | - list( $this->p_sexo ) = $objFisica->queryRapida( $this->p_cod_pessoa_fj, "sexo" ); | ||
73 | - $this->fexcluir = false; | ||
74 | - $retorno = "Editar"; | ||
75 | - // define os niveis ate o setor escolhido (para que os campos ja venham preenchidos corretamente) | ||
76 | - if( $this->ref_cod_setor ) | ||
77 | - { | ||
78 | - $objSetor = new clsSetor(); | ||
79 | - $niveis = $objSetor->getNiveis( $this->ref_cod_setor ); | ||
80 | - for( $i = 0; $i < count( $niveis ); $i++ ) | ||
81 | - { | ||
82 | - $nm_var = "setor_$i"; | ||
83 | - $this->$nm_var = $niveis[$i]; | ||
84 | - } | ||
85 | - } | ||
86 | - } | ||
87 | - } | ||
88 | - | ||
89 | - $this->url_cancelar = "index.php"; | ||
90 | - | ||
91 | - $this->nome_url_cancelar = "Cancelar"; | ||
92 | - | ||
93 | - return $retorno; | ||
94 | - } | ||
95 | - | ||
96 | - function null2empityStr( $vars ) | ||
97 | - { | ||
98 | - foreach ( $vars AS $key => $valor ) | ||
99 | - { | ||
100 | - $valor .= ""; | ||
101 | - if( $valor == "NULL" ) | ||
102 | - { | ||
103 | - $vars[$key] = ""; | ||
104 | - } | ||
105 | - } | ||
106 | - return $vars; | ||
107 | - } | ||
108 | - | ||
109 | - function Gerar() | ||
110 | - { | ||
111 | - @session_start(); | ||
112 | - $this->campoOculto( "p_cod_pessoa_fj", $this->p_cod_pessoa_fj ); | ||
113 | - $this->cod_pessoa_fj = $this->p_cod_pessoa_fj; | ||
114 | - | ||
115 | - 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 ) ); | ||
116 | - | ||
117 | - $this->p_ddd_telefone_1 = ( $this->p_ddd_telefone_1 == null ) ? "": $this->p_ddd_telefone_1; | ||
118 | - $this->p_ddd_telefone_2 = ( $this->p_ddd_telefone_2 == null ) ? "": $this->p_ddd_telefone_2; | ||
119 | - $this->p_ddd_telefone_3 = ( $this->p_ddd_telefone_3 == null ) ? "": $this->p_ddd_telefone_3; | ||
120 | - | ||
121 | - $this->campoRotulo( "nome", "Nome", $this->p_nm_pessoa ); | ||
122 | - | ||
123 | - // Detalhes do Endere�o | ||
124 | - $objTipoLog = new clsTipoLogradouro(); | ||
125 | - $listaTipoLog = $objTipoLog->lista(); | ||
126 | - $listaTLog = array(""=>"Selecione"); | ||
127 | - if($listaTipoLog) | ||
128 | - { | ||
129 | - foreach ($listaTipoLog as $tipoLog) { | ||
130 | - $listaTLog[$tipoLog['idtlog']] = $tipoLog['descricao']; | ||
131 | - } | ||
132 | - } | ||
133 | - | ||
134 | - $objUf = new clsUf(); | ||
135 | - $listauf = $objUf->lista(); | ||
136 | - $listaEstado = array(""=>"Selecione"); | ||
137 | - if($listauf) | ||
138 | - { | ||
139 | - foreach ($listauf as $uf) { | ||
140 | - $listaEstado[$uf['sigla_uf']] = $uf['sigla_uf']; | ||
141 | - } | ||
142 | - } | ||
143 | - | ||
144 | - $this->campoOculto( "idbai", $this->idbai ); | ||
145 | - $this->campoOculto( "idlog", $this->idlog ); | ||
146 | - if(is_numeric($this->cep)) | ||
147 | - { | ||
148 | - $this->cep = int2CEP($this->cep); | ||
149 | - } | ||
150 | - $this->campoOculto( "cep", $this->cep ); | ||
151 | - $this->campoOculto( "ref_sigla_uf", $this->sigla_uf); | ||
152 | - $this->campoOculto( "ref_idtlog", $this->idtlog); | ||
153 | - $this->campoOculto( "id_cidade", $this->cidade); | ||
154 | - | ||
155 | - if($this->idlog && $this->idbai && $this->cep && $this->cod_pessoa_fj) | ||
156 | - { | ||
157 | - //$this->campoCep("cep_","CEP", int2CEP( $this->cep ),true,"-"," <img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f('pesquisa_cep.php', 'enderecos')\" style=\"cursor: hand;\">",true); | ||
158 | - $this->campoCep("cep_", "CEP", $this->cep, true, "-", " <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=\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep&campo4=logradouro&campo5=idlog&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog&campo9=isEnderecoExterno&campo10=cep_&campo11=sigla_uf&campo12=idtlog&campo13=id_cidade\'></iframe>');\">", $disabled); | ||
159 | - | ||
160 | - $this->campoLista("sigla_uf","Estado",$listaEstado,$this->sigla_uf,false,false,false,false,true); | ||
161 | - $this->campoTextoInv( "cidade", "Cidade", $this->cidade, "50", "255", false ); | ||
162 | - $this->campoTextoInv( "bairro", "Bairro", $this->bairro, "50", "255", false ); | ||
163 | - $this->campoLista("idtlog","Tipo Logradouro",$listaTLog,$this->idtlog,false,false,false,false,true); | ||
164 | - $this->campoTextoInv( "logradouro", "Logradouro", $this->logradouro, "50", "255", false ); | ||
165 | - $this->campoTexto( "complemento", "Complemento", $this->complemento, "22", "20", false ); | ||
166 | - $this->campoTexto( "numero", "Número", $this->numero, "10", "10", true ); | ||
167 | - $this->campoTexto( "letra", "Letra", $this->letra, "1", "1", false ); | ||
168 | - $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", false); | ||
169 | - $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", false); | ||
170 | - $this->campoTexto("andar", "Andar", $this->andar, "2","2", false); | ||
171 | - } | ||
172 | - elseif($this->cod_pessoa_fj && $this->cep) | ||
173 | - { | ||
174 | - //$this->campoCep("cep_","CEP",int2CEP( $this->cep ),true,"-"," <img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f('pesquisa_cep.php', 'enderecos')\" style=\"cursor: hand;\">",false); | ||
175 | - $this->campoCep("cep_", "CEP", $this->cep, true, "-", " <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=\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep&campo4=logradouro&campo5=idlog&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog&campo9=isEnderecoExterno&campo10=cep_&campo11=sigla_uf&campo12=idtlog&campo13=id_cidade\'></iframe>');\">", $disabled); | ||
176 | - | ||
177 | - | ||
178 | - $this->campoLista("sigla_uf","Estado",$listaEstado,$this->sigla_uf); | ||
179 | - $this->campoTexto( "cidade", "Cidade", $this->cidade, "50", "255", false ); | ||
180 | - $this->campoTexto( "bairro", "Bairro", $this->bairro, "50", "255", false ); | ||
181 | - $this->campoLista("idtlog","Tipo Logradouro",$listaTLog,$this->idtlog); | ||
182 | - $this->campoTexto( "logradouro", "Logradouro", $this->logradouro, "50", "255", false ); | ||
183 | - $this->campoTexto( "complemento", "Complemento", $this->complemento, "22", "20", false ); | ||
184 | - $this->campoTexto( "numero", "Número", $this->numero, "10", "10", false ); | ||
185 | - $this->campoTexto( "letra", "Letra", $this->letra, "1", "1", false ); | ||
186 | - $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", false); | ||
187 | - $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", false); | ||
188 | - $this->campoTexto("andar", "Andar", $this->andar, "2","2", false); | ||
189 | - } | ||
190 | - else | ||
191 | - { | ||
192 | - //$this->campoCep("cep_","CEP",int2CEP( $this->cep ),true,"-"," <img src=\"imagens/lupa.png\" border=\"0\" onclick=\"pesquisa_valores_f('pesquisa_cep.php', 'enderecos')\" style=\"cursor: hand;\">",true); | ||
193 | - $this->campoCep("cep_", "CEP", $this->cep, true, "-", " <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=\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep&campo4=logradouro&campo5=idlog&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog&campo9=isEnderecoExterno&campo10=cep_&campo11=sigla_uf&campo12=idtlog&campo13=id_cidade\'></iframe>');\">", $disabled); | ||
194 | - | ||
195 | - $this->campoLista("sigla_uf","Estado",$listaEstado,$this->sigla_uf,false,false,false,false,true); | ||
196 | - $this->campoTextoInv( "cidade", "Cidade", $this->cidade, "50", "255", true ); | ||
197 | - $this->campoTextoInv( "bairro", "Bairro", $this->bairro, "50", "20", true ); | ||
198 | - $this->campoLista("idtlog","Tipo Logradouro",$listaTLog,$this->idtlog,false,false,false,false,true); | ||
199 | - $this->campoTextoInv( "logradouro", "Logradouro", $this->logradouro, "50", "255",true ); | ||
200 | - $this->campoTextoInv( "complemento", "Complemento", $this->complemento, "22", "20", false ); | ||
201 | - $this->campoTextoInv( "numero", "N�mero", $this->numero, "10", "10", false ); | ||
202 | - $this->campoTextoInv( "letra", "Letra", $this->letra, "1", "1", false ); | ||
203 | - $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", false); | ||
204 | - $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", false); | ||
205 | - $this->campoTexto("andar", "Andar", $this->andar, "2","2", false); | ||
206 | - } | ||
207 | - | ||
208 | - $this->campoTexto( "p_ddd_telefone_1", "DDD Telefone 1", $this->p_ddd_telefone_1, "2", "2", false ); | ||
209 | - $this->campoTexto( "p_telefone_1", "Telefone 1", $this->p_telefone_1, "10", "15", false ); | ||
210 | - $this->campoTexto( "p_ddd_telefone_2", "DDD Telefone 2", $this->p_ddd_telefone_2, "2", "2", false ); | ||
211 | - $this->campoTexto( "p_telefone_2", "Telefone", $this->p_telefone_2, "10", "15", false ); | ||
212 | - $this->campoTexto( "p_ddd_telefone_mov", "DDD Celular", $this->p_ddd_telefone_mov, "2", "2", false ); | ||
213 | - $this->campoTexto( "p_telefone_mov", "Celular", $this->p_telefone_mov, "10", "15", false ); | ||
214 | - $this->campoTexto( "p_ddd_telefone_fax", "DDD Fax", $this->p_ddd_telefone_fax, "2", "2", false ); | ||
215 | - $this->campoTexto( "p_telefone_fax", "Fax", $this->p_telefone_fax, "10", "15", false ); | ||
216 | - | ||
217 | - $this->campoTexto( "p_http", "Site", $this->p_http, "50", "255", false ); | ||
218 | - $this->campoTexto( "p_email", "E-mail", $this->p_email, "50", "255", false ); | ||
219 | - | ||
220 | - $lista_sexos = array(); | ||
221 | - $lista_sexos[""] = "Escolha uma opção..."; | ||
222 | - $lista_sexos["M"] = "Masculino"; | ||
223 | - $lista_sexos["F"] = "Feminino"; | ||
224 | - $this->campoLista( "p_sexo", "Sexo", $lista_sexos, $this->p_sexo); | ||
225 | - | ||
226 | - if (empty($_SESSION['convidado'])) | ||
227 | - { | ||
228 | - $this->campoSenha( "f_senha", "Senha", $this->f_senha, false); | ||
229 | - $this->campoOculto( "confere_senha", $this->f_senha ); | ||
230 | - } | ||
231 | - $dba = new clsBanco(); | ||
232 | - $opcoes = array(); | ||
233 | - $dba->Consulta( "SELECT cod_funcionario_vinculo, nm_vinculo FROM funcionario_vinculo ORDER BY nm_vinculo ASC" ); | ||
234 | - while ( $dba->ProximoRegistro() ) | ||
235 | - { | ||
236 | - list( $cod, $nome ) = $dba->Tupla(); | ||
237 | - $opcoes[$cod] = $nome; | ||
238 | - } | ||
239 | - $this->campoLista( "ref_cod_funcionario_vinculo", "Vínculo", $opcoes, $this->ref_cod_funcionario_vinculo); | ||
240 | - | ||
241 | - $this->campoTexto( "f_ramal", "Ramal", $this->f_ramal, "10", "20", false ); | ||
242 | - | ||
243 | - $this->campoRotulo("documentos","Documentos","<a href='#' onclick=\" openPage('adicionar_documentos_cad.php?idpes={$this->p_cod_pessoa_fj}','400','400','yes', '10','10'); \"><img src='imagens/nvp_bot_ad_doc.png' border='0'></a>"); | ||
244 | - | ||
245 | - } | ||
246 | - | ||
247 | - function Editar() | ||
248 | - { | ||
249 | - @session_start(); | ||
250 | - $pessoaFj = $_SESSION['id_pessoa']; | ||
251 | - session_write_close(); | ||
252 | - | ||
253 | - $objPessoa = new clsPessoa_( $pessoaFj, false, false, $this->p_http, false, $pessoaFj, date( "Y-m-d H:i:s", time() ), $this->p_email ); | ||
254 | - $objPessoa->edita(); | ||
255 | - | ||
256 | - $objFisica = new clsFisica( $pessoaFj, false, $this->p_sexo ); | ||
257 | - $objFisica->edita(); | ||
258 | - | ||
259 | - $objTelefone = new clsPessoaTelefone( $pessoaFj); | ||
260 | - $objTelefone->excluiTodos(); | ||
261 | - $objTelefone = new clsPessoaTelefone( $pessoaFj, 1, str_replace( "-", "", $this->p_telefone_1 ), $this->p_ddd_telefone_1 ); | ||
262 | - $objTelefone->cadastra(); | ||
263 | - $objTelefone = new clsPessoaTelefone( $pessoaFj, 2, str_replace( "-", "", $this->p_telefone_2 ), $this->p_ddd_telefone_2 ); | ||
264 | - $objTelefone->cadastra(); | ||
265 | - $objTelefone = new clsPessoaTelefone( $pessoaFj, 3, str_replace( "-", "", $this->p_telefone_mov ), $this->p_ddd_telefone_mov ); | ||
266 | - $objTelefone->cadastra(); | ||
267 | - $objTelefone = new clsPessoaTelefone( $pessoaFj, 4, str_replace( "-", "", $this->p_telefone_fax ), $this->p_ddd_telefone_fax ); | ||
268 | - $objTelefone->cadastra(); | ||
269 | - if($this->cep && $this->idbai && $this->idlog) | ||
270 | - { | ||
271 | - $objEndereco = new clsPessoaEndereco( $pessoaFj ); | ||
272 | - $objEndereco2 = new clsPessoaEndereco($pessoaFj,$this->cep,$this->idlog,$this->idbai,$this->numero,$this->complemento,false,$this->letra, $this->bloco, $this->apartamento, $this->andar); | ||
273 | - if( $objEndereco->detalhe() ) | ||
274 | - { | ||
275 | - $objEndereco2->edita(); | ||
276 | - } | ||
277 | - else | ||
278 | - { | ||
279 | - $objEndereco2->cadastra(); | ||
280 | - } | ||
281 | - $objPessoa = new clsPessoaFj(); | ||
282 | - 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" ); | ||
283 | - } | ||
284 | - else | ||
285 | - { | ||
286 | - $this->cep_ = idFederal2int($this->cep_); | ||
287 | - $objEnderecoExterno = new clsEnderecoExterno( $pessoaFj ); | ||
288 | - $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); | ||
289 | - if( $objEnderecoExterno->detalhe() ) | ||
290 | - { | ||
291 | - $objEnderecoExterno2->edita(); | ||
292 | - } | ||
293 | - else | ||
294 | - { | ||
295 | - $objEnderecoExterno2->cadastra(); | ||
296 | - } | ||
297 | - } | ||
298 | - // verifica o maior setor selecionado | ||
299 | - for( $i = 0; $i < 5; $i++ ) | ||
300 | - { | ||
301 | - $varNm = "setor_$i"; | ||
302 | - if( $this->$varNm ) | ||
303 | - { | ||
304 | - $setor = $this->$varNm; | ||
305 | - } | ||
306 | - } | ||
307 | - if( $setor ) | ||
308 | - { | ||
309 | - $sql = " ref_cod_setor_new = '{$setor}', "; | ||
310 | - } | ||
311 | - | ||
312 | - if ($this->f_senha != $this->confere_senha) | ||
313 | - { | ||
314 | - // | ||
315 | - $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}"; | ||
316 | - } | ||
317 | - else | ||
318 | - { | ||
319 | - if (empty($_SESSION['convidado'])) | ||
320 | - { | ||
321 | - $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}"; | ||
322 | - } | ||
323 | - else | ||
324 | - { | ||
325 | - $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}"; | ||
326 | - } | ||
327 | - } | ||
328 | - $db = new clsBanco(); | ||
329 | - | ||
330 | - //$db->Consulta( $sql_pessoa ); | ||
331 | - $db->Consulta( $sql_funcionario ); | ||
332 | - | ||
333 | - if (empty($_SESSION['convidado'])) | ||
334 | - { | ||
335 | - if( ! $_POST["reloading"] ) | ||
336 | - { | ||
337 | - //echo "<script>document.location='index.php';</script>"; | ||
338 | - } | ||
339 | - } | ||
340 | - else | ||
341 | - { | ||
342 | - if($_SESSION['motivo_visita'] == 'atualizar_cadastro_e_email') | ||
343 | - { | ||
344 | - echo "<script>document.location='solicita_email.php';</script>"; | ||
345 | - }else | ||
346 | - { | ||
347 | - echo "<script>document.location='insmess_cad.php';</script>"; | ||
348 | - } | ||
349 | - } | ||
350 | - header('Location: index.php'); | ||
351 | - return true; | ||
352 | - } | ||
353 | 51 | ||
52 | + public | ||
53 | + $p_cod_pessoa_fj, | ||
54 | + $p_nm_pessoa, | ||
55 | + $p_id_federal, | ||
56 | + $idtlog, | ||
57 | + $p_endereco, | ||
58 | + $p_cep, | ||
59 | + $p_ref_bairro, | ||
60 | + $p_ddd_telefone_1, | ||
61 | + $p_telefone_1, | ||
62 | + $p_ddd_telefone_2, | ||
63 | + $p_telefone_2, | ||
64 | + $p_ddd_telefone_mov, | ||
65 | + $p_telefone_mov, | ||
66 | + $p_ddd_telefone_fax, | ||
67 | + $p_telefone_fax, | ||
68 | + $p_email, | ||
69 | + $p_http, | ||
70 | + $p_tipo_pessoa, | ||
71 | + $p_sexo, | ||
72 | + $f_matricula, | ||
73 | + $f_senha, | ||
74 | + $f_ativo, | ||
75 | + $f_ref_sec, | ||
76 | + $f_ramal, | ||
77 | + $f_ref_dept, | ||
78 | + $f_ref_setor, | ||
79 | + $ref_cod_funcionario_vinculo, | ||
80 | + $bloco, | ||
81 | + $apartamento, | ||
82 | + $andar, | ||
83 | + $ref_cod_setor = NULL; | ||
84 | + | ||
85 | + public $confere_senha; | ||
86 | + | ||
87 | + public function Inicializar() | ||
88 | + { | ||
89 | + $retorno = "Novo"; | ||
90 | + session_start(); | ||
91 | + | ||
92 | + if (isset($_SESSION['id_pessoa'])) { | ||
93 | + $this->p_cod_pessoa_fj = $_SESSION['id_pessoa']; | ||
94 | + $objPessoa = new clsPessoaFj(); | ||
95 | + $db = new clsBanco(); | ||
96 | + $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}"); | ||
97 | + | ||
98 | + if ($db->ProximoRegistro()) { | ||
99 | + list($this->f_matricula, $this->f_senha, $this->f_ativo, $this->f_ramal, | ||
100 | + $this->f_ref_setor, $this->ref_cod_funcionario_vinculo, $this->ref_cod_setor) = $db->Tupla(); | ||
101 | + | ||
102 | + list($this->p_nm_pessoa, $this->p_id_federal, $this->p_endereco, $this->p_cep, | ||
103 | + $this->p_ref_bairro, $this->p_ddd_telefone_1, $this->p_telefone_1, | ||
104 | + $this->p_ddd_telefone_2, $this->p_telefone_2, $this->p_ddd_telefone_mov, | ||
105 | + $this->p_telefone_mov, $this->p_ddd_telefone_fax, $this->p_telefone_fax, | ||
106 | + $this->p_email, $this->p_http, $this->p_tipo_pessoa, $this->cidade, | ||
107 | + $this->bairro, $this->logradouro, $this->cep, $this->idlog, $this->idbai, | ||
108 | + $this->idtlog, $this->sigla_uf, $this->complemento, $this->numero, $this->letra, | ||
109 | + $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"); | ||
110 | + | ||
111 | + $objFisica = new clsPessoaFisica(); | ||
112 | + list($this->p_sexo) = $objFisica->queryRapida($this->p_cod_pessoa_fj, "sexo"); | ||
113 | + | ||
114 | + $this->fexcluir = FALSE; | ||
115 | + $retorno = "Editar"; | ||
116 | + | ||
117 | + // define os niveis ate o setor escolhido (para que os campos ja venham preenchidos corretamente) | ||
118 | + if ($this->ref_cod_setor) { | ||
119 | + $objSetor = new clsSetor(); | ||
120 | + $niveis = $objSetor->getNiveis($this->ref_cod_setor); | ||
121 | + | ||
122 | + for ($i = 0; $i < count($niveis); $i++) { | ||
123 | + $nm_var = "setor_$i"; | ||
124 | + $this->$nm_var = $niveis[$i]; | ||
125 | + } | ||
126 | + } | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + $this->url_cancelar = 'index.php'; | ||
131 | + $this->nome_url_cancelar = 'Cancelar'; | ||
132 | + | ||
133 | + return $retorno; | ||
134 | + } | ||
135 | + | ||
136 | + public function null2empityStr($vars) | ||
137 | + { | ||
138 | + foreach ($vars as $key => $valor) { | ||
139 | + $valor .= ""; | ||
140 | + if ($valor == "NULL") { | ||
141 | + $vars[$key] = ""; | ||
142 | + } | ||
143 | + } | ||
144 | + | ||
145 | + return $vars; | ||
146 | + } | ||
147 | + | ||
148 | + public function Gerar() | ||
149 | + { | ||
150 | + session_start(); | ||
151 | + $this->campoOculto('p_cod_pessoa_fj', $this->p_cod_pessoa_fj); | ||
152 | + $this->cod_pessoa_fj = $this->p_cod_pessoa_fj; | ||
153 | + | ||
154 | + list ($this->p_ddd_telefone_1, $this->p_ddd_telefone_2, | ||
155 | + $this->p_ddd_telefone_fax, $this->p_ddd_telefone_mov) = | ||
156 | + $this->null2empityStr(array($this->p_ddd_telefone_1, $this->p_ddd_telefone_2, $this->p_ddd_telefone_fax, $this->p_ddd_telefone_mov)); | ||
157 | + | ||
158 | + $this->p_ddd_telefone_1 = ($this->p_ddd_telefone_1 == NULL) ? '' : $this->p_ddd_telefone_1; | ||
159 | + $this->p_ddd_telefone_2 = ($this->p_ddd_telefone_2 == NULL) ? '' : $this->p_ddd_telefone_2; | ||
160 | + $this->p_ddd_telefone_3 = ($this->p_ddd_telefone_3 == NULL) ? '' : $this->p_ddd_telefone_3; | ||
161 | + | ||
162 | + $this->campoRotulo("nome", "Nome", $this->p_nm_pessoa); | ||
163 | + | ||
164 | + // Detalhes do endereço | ||
165 | + $objTipoLog = new clsTipoLogradouro(); | ||
166 | + $listaTipoLog = $objTipoLog->lista(); | ||
167 | + $listaTLog = array(""=>"Selecione"); | ||
168 | + | ||
169 | + if ($listaTipoLog) { | ||
170 | + foreach ($listaTipoLog as $tipoLog) { | ||
171 | + $listaTLog[$tipoLog['idtlog']] = $tipoLog['descricao']; | ||
172 | + } | ||
173 | + } | ||
174 | + | ||
175 | + $objUf = new clsUf(); | ||
176 | + $listauf = $objUf->lista(); | ||
177 | + $listaEstado = array('' => "Selecione"); | ||
178 | + if ($listauf) { | ||
179 | + foreach ($listauf as $uf) { | ||
180 | + $listaEstado[$uf['sigla_uf']] = $uf['sigla_uf']; | ||
181 | + } | ||
182 | + } | ||
183 | + | ||
184 | + $this->campoOculto('idbai', $this->idbai); | ||
185 | + $this->campoOculto('idlog', $this->idlog); | ||
186 | + | ||
187 | + if (is_numeric($this->cep)) { | ||
188 | + $this->cep = int2CEP($this->cep); | ||
189 | + } | ||
190 | + | ||
191 | + $this->campoOculto('cep', $this->cep); | ||
192 | + $this->campoOculto('ref_sigla_uf', $this->sigla_uf); | ||
193 | + $this->campoOculto('ref_idtlog', $this->idtlog); | ||
194 | + $this->campoOculto('id_cidade', $this->cidade); | ||
195 | + | ||
196 | + if ($this->idlog && $this->idbai && $this->cep && $this->cod_pessoa_fj) | ||
197 | + { | ||
198 | + $this->campoCep("cep_", "CEP", $this->cep, TRUE, "-", " <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=\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep&campo4=logradouro&campo5=idlog&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog&campo9=isEnderecoExterno&campo10=cep_&campo11=sigla_uf&campo12=idtlog&campo13=id_cidade\'></iframe>');\">", $disabled); | ||
199 | + | ||
200 | + $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf, | ||
201 | + FALSE, FALSE, FALSE, FALSE, TRUE); | ||
202 | + | ||
203 | + $this->campoTextoInv("cidade", "Cidade", $this->cidade, "50", "255", FALSE); | ||
204 | + | ||
205 | + $this->campoTextoInv("bairro", "Bairro", $this->bairro, "50", "255", FALSE); | ||
206 | + | ||
207 | + $this->campoLista("idtlog","Tipo Logradouro", $listaTLog,$this->idtlog, | ||
208 | + FALSE, FALSE, FALSE, FALSE, TRUE); | ||
209 | + | ||
210 | + $this->campoTextoInv("logradouro", "Logradouro", $this->logradouro, "50", "255", FALSE); | ||
211 | + | ||
212 | + $this->campoTexto("complemento", "Complemento", $this->complemento, "22", "20", FALSE); | ||
213 | + | ||
214 | + $this->campoTexto("numero", "Número", $this->numero, "10", "10", TRUE); | ||
215 | + | ||
216 | + $this->campoTexto("letra", "Letra", $this->letra, "1", "1", FALSE); | ||
217 | + | ||
218 | + $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", FALSE); | ||
219 | + | ||
220 | + $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", FALSE); | ||
221 | + | ||
222 | + $this->campoTexto("andar", "Andar", $this->andar, "2","2", FALSE); | ||
223 | + } | ||
224 | + elseif ($this->cod_pessoa_fj && $this->cep) | ||
225 | + { | ||
226 | + $this->campoCep("cep_", "CEP", $this->cep, TRUE, "-", " <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=\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep&campo4=logradouro&campo5=idlog&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog&campo9=isEnderecoExterno&campo10=cep_&campo11=sigla_uf&campo12=idtlog&campo13=id_cidade\'></iframe>');\">", $disabled); | ||
227 | + | ||
228 | + $this->campoLista("sigla_uf","Estado",$listaEstado,$this->sigla_uf); | ||
229 | + | ||
230 | + $this->campoTexto("cidade", "Cidade", $this->cidade, "50", "255", FALSE); | ||
231 | + | ||
232 | + $this->campoTexto("bairro", "Bairro", $this->bairro, "50", "255", FALSE); | ||
233 | + | ||
234 | + $this->campoLista("idtlog","Tipo Logradouro",$listaTLog,$this->idtlog); | ||
235 | + | ||
236 | + $this->campoTexto("logradouro", "Logradouro", $this->logradouro, "50", "255", FALSE); | ||
237 | + | ||
238 | + $this->campoTexto("complemento", "Complemento", $this->complemento, "22", "20", FALSE); | ||
239 | + | ||
240 | + $this->campoTexto("numero", "Número", $this->numero, "10", "10", FALSE); | ||
241 | + | ||
242 | + $this->campoTexto("letra", "Letra", $this->letra, "1", "1", FALSE); | ||
243 | + | ||
244 | + $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", FALSE); | ||
245 | + | ||
246 | + $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", FALSE); | ||
247 | + | ||
248 | + $this->campoTexto("andar", "Andar", $this->andar, "2","2", FALSE); | ||
249 | + } | ||
250 | + else | ||
251 | + { | ||
252 | + $this->campoCep("cep_", "CEP", $this->cep, TRUE, "-", " <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=\'educar_pesquisa_cep_log_bairro.php?campo1=bairro&campo2=idbai&campo3=cep&campo4=logradouro&campo5=idlog&campo6=ref_sigla_uf&campo7=cidade&campo8=ref_idtlog&campo9=isEnderecoExterno&campo10=cep_&campo11=sigla_uf&campo12=idtlog&campo13=id_cidade\'></iframe>');\">", $disabled); | ||
253 | + | ||
254 | + $this->campoLista("sigla_uf", "Estado", $listaEstado, $this->sigla_uf, FALSE, | ||
255 | + FALSE, FALSE, FALSE, TRUE); | ||
256 | + | ||
257 | + $this->campoTextoInv("cidade", "Cidade", $this->cidade, "50", "255", TRUE); | ||
258 | + | ||
259 | + $this->campoTextoInv("bairro", "Bairro", $this->bairro, "50", "20", TRUE); | ||
260 | + | ||
261 | + $this->campoLista("idtlog", "Tipo Logradouro", $listaTLog, $this->idtlog, | ||
262 | + FALSE, FALSE, FALSE, FALSE, TRUE); | ||
263 | + | ||
264 | + $this->campoTextoInv("logradouro", "Logradouro", $this->logradouro, "50", "255", TRUE); | ||
265 | + | ||
266 | + $this->campoTextoInv("complemento", "Complemento", $this->complemento, "22", "20", FALSE); | ||
267 | + | ||
268 | + $this->campoTextoInv("numero", "Número", $this->numero, "10", "10", FALSE); | ||
269 | + | ||
270 | + $this->campoTextoInv("letra", "Letra", $this->letra, "1", "1", FALSE); | ||
271 | + | ||
272 | + $this->campoTexto("bloco", "Bloco", $this->bloco, "20","20", FALSE); | ||
273 | + | ||
274 | + $this->campoTexto("apartamento", "Apartamento", $this->apartamento, "6","6", FALSE); | ||
275 | + | ||
276 | + $this->campoTexto("andar", "Andar", $this->andar, "2","2", FALSE); | ||
277 | + } | ||
278 | + | ||
279 | + $this->campoTexto("p_ddd_telefone_1", "DDD Telefone 1", | ||
280 | + $this->p_ddd_telefone_1, "2", "2", FALSE); | ||
281 | + | ||
282 | + $this->campoTexto("p_telefone_1", "Telefone 1", $this->p_telefone_1, | ||
283 | + "10", "15", FALSE); | ||
284 | + | ||
285 | + $this->campoTexto("p_ddd_telefone_2", "DDD Telefone 2", | ||
286 | + $this->p_ddd_telefone_2, "2", "2", FALSE); | ||
287 | + | ||
288 | + $this->campoTexto("p_telefone_2", "Telefone", $this->p_telefone_2, "10", | ||
289 | + "15", FALSE); | ||
290 | + | ||
291 | + $this->campoTexto("p_ddd_telefone_mov", "DDD Celular", $this->p_ddd_telefone_mov, | ||
292 | + "2", "2", FALSE); | ||
293 | + | ||
294 | + $this->campoTexto("p_telefone_mov", "Celular", $this->p_telefone_mov, "10", | ||
295 | + "15", FALSE); | ||
296 | + | ||
297 | + $this->campoTexto("p_ddd_telefone_fax", "DDD Fax", $this->p_ddd_telefone_fax, | ||
298 | + "2", "2", FALSE); | ||
299 | + | ||
300 | + $this->campoTexto("p_telefone_fax", "Fax", $this->p_telefone_fax, "10", "15", | ||
301 | + FALSE); | ||
302 | + | ||
303 | + $this->campoTexto("p_http", "Site", $this->p_http, "50", "255", FALSE); | ||
304 | + | ||
305 | + $this->campoTexto("p_email", "E-mail", $this->p_email, "50", "255", FALSE); | ||
306 | + | ||
307 | + $lista_sexos = array(); | ||
308 | + $lista_sexos[''] = 'Escolha uma opção...'; | ||
309 | + $lista_sexos['M'] = 'Masculino'; | ||
310 | + $lista_sexos['F'] = 'Feminino'; | ||
311 | + $this->campoLista("p_sexo", "Sexo", $lista_sexos, $this->p_sexo); | ||
312 | + | ||
313 | + if (empty($_SESSION['convidado'])) { | ||
314 | + $this->campoSenha("f_senha", "Senha", $this->f_senha, FALSE); | ||
315 | + $this->campoOculto("confere_senha", $this->f_senha); | ||
316 | + } | ||
317 | + | ||
318 | + $dba = new clsBanco(); | ||
319 | + $opcoes = array(); | ||
320 | + $dba->Consulta("SELECT cod_funcionario_vinculo, nm_vinculo FROM funcionario_vinculo ORDER BY nm_vinculo ASC"); | ||
321 | + | ||
322 | + while ($dba->ProximoRegistro()) { | ||
323 | + list($cod, $nome) = $dba->Tupla(); | ||
324 | + $opcoes[$cod] = $nome; | ||
325 | + } | ||
326 | + | ||
327 | + $this->campoLista("ref_cod_funcionario_vinculo", "Vínculo", $opcoes, | ||
328 | + $this->ref_cod_funcionario_vinculo); | ||
329 | + | ||
330 | + $this->campoTexto("f_ramal", "Ramal", $this->f_ramal, "10", "20", FALSE); | ||
331 | + | ||
332 | + $this->campoRotulo("documentos", "Documentos", "<a href='#' onclick=\" openPage('adicionar_documentos_cad.php?idpes={$this->p_cod_pessoa_fj}','400','400','yes', '10','10'); \"><img src='imagens/nvp_bot_ad_doc.png' border='0'></a>"); | ||
333 | + } | ||
334 | + | ||
335 | + public function Editar() | ||
336 | + { | ||
337 | + session_start(); | ||
338 | + $pessoaFj = $_SESSION['id_pessoa']; | ||
339 | + session_write_close(); | ||
340 | + | ||
341 | + $objPessoa = new clsPessoa_($pessoaFj, FALSE, FALSE, $this->p_http, FALSE, | ||
342 | + $pessoaFj, date("Y-m-d H:i:s", time()), $this->p_email); | ||
343 | + | ||
344 | + $objPessoa->edita(); | ||
345 | + | ||
346 | + $objFisica = new clsFisica($pessoaFj, FALSE, $this->p_sexo); | ||
347 | + $objFisica->edita(); | ||
348 | + | ||
349 | + $objTelefone = new clsPessoaTelefone($pessoaFj); | ||
350 | + $objTelefone->excluiTodos(); | ||
351 | + | ||
352 | + $objTelefone = new clsPessoaTelefone($pessoaFj, 1, str_replace("-", "", $this->p_telefone_1), $this->p_ddd_telefone_1); | ||
353 | + $objTelefone->cadastra(); | ||
354 | + | ||
355 | + $objTelefone = new clsPessoaTelefone($pessoaFj, 2, str_replace("-", "", $this->p_telefone_2), $this->p_ddd_telefone_2); | ||
356 | + $objTelefone->cadastra(); | ||
357 | + | ||
358 | + $objTelefone = new clsPessoaTelefone($pessoaFj, 3, str_replace("-", "", $this->p_telefone_mov), $this->p_ddd_telefone_mov); | ||
359 | + $objTelefone->cadastra(); | ||
360 | + | ||
361 | + $objTelefone = new clsPessoaTelefone($pessoaFj, 4, str_replace("-", "", $this->p_telefone_fax), $this->p_ddd_telefone_fax); | ||
362 | + $objTelefone->cadastra(); | ||
363 | + | ||
364 | + if ($this->cep && $this->idbai && $this->idlog) { | ||
365 | + $objEndereco = new clsPessoaEndereco( $pessoaFj ); | ||
366 | + $objEndereco2 = new clsPessoaEndereco($pessoaFj,$this->cep,$this->idlog,$this->idbai,$this->numero,$this->complemento,FALSE,$this->letra, $this->bloco, $this->apartamento, $this->andar); | ||
367 | + if( $objEndereco->detalhe() ) | ||
368 | + { | ||
369 | + $objEndereco2->edita(); | ||
370 | + } | ||
371 | + else { | ||
372 | + $objEndereco2->cadastra(); | ||
373 | + } | ||
374 | + | ||
375 | + $objPessoa = new clsPessoaFj(); | ||
376 | + list($this->cidade, $this->bairro, $this->logradouro, $this->cep, | ||
377 | + $this->idtlog, $this->sigla_uf, $this->bloco, $this->apartamento, $this->andar) = | ||
378 | + $objPessoa->queryRapida($pessoaFj, "cidade", "bairro", "logradouro", | ||
379 | + "cep", "idtlog", "sigla_uf", "bloco", "apartamento", "andar"); | ||
380 | + } | ||
381 | + else { | ||
382 | + $this->cep_ = idFederal2int($this->cep_); | ||
383 | + $objEnderecoExterno = new clsEnderecoExterno($pessoaFj); | ||
384 | + $objEnderecoExterno2 = new clsEnderecoExterno($pessoaFj, "1", $this->idtlog, | ||
385 | + $this->logradouro, $this->numero, $this->letra, $this->complemento, | ||
386 | + $this->bairro, $this->cep_, $this->cidade, $this->sigla_uf, FALSE, | ||
387 | + $this->bloco, $this->apartamento, $this->andar); | ||
388 | + | ||
389 | + if ($objEnderecoExterno->detalhe()) { | ||
390 | + $objEnderecoExterno2->edita(); | ||
391 | + } | ||
392 | + else { | ||
393 | + $objEnderecoExterno2->cadastra(); | ||
394 | + } | ||
395 | + } | ||
396 | + | ||
397 | + // Verifica o maior setor selecionado | ||
398 | + for ($i = 0; $i < 5; $i++) { | ||
399 | + $varNm = "setor_$i"; | ||
400 | + if ($this->$varNm) { | ||
401 | + $setor = $this->$varNm; | ||
402 | + } | ||
403 | + } | ||
404 | + if ($setor) { | ||
405 | + $sql = " ref_cod_setor_new = '{$setor}', "; | ||
406 | + } | ||
407 | + | ||
408 | + if ($this->f_senha != $this->confere_senha) { | ||
409 | + $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}"; | ||
410 | + } | ||
411 | + else { | ||
412 | + if (empty($_SESSION['convidado'])) { | ||
413 | + $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}"; | ||
414 | + } | ||
415 | + else { | ||
416 | + $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}"; | ||
417 | + } | ||
418 | + } | ||
419 | + | ||
420 | + $db = new clsBanco(); | ||
421 | + | ||
422 | + $db->Consulta($sql_funcionario); | ||
423 | + | ||
424 | + if (empty($_SESSION['convidado'])) { | ||
425 | + if (! $_POST["reloading"]) { | ||
426 | + } | ||
427 | + } | ||
428 | + else { | ||
429 | + if ($_SESSION['motivo_visita'] == 'atualizar_cadastro_e_email') { | ||
430 | + echo "<script>document.location='solicita_email.php';</script>"; | ||
431 | + } | ||
432 | + else { | ||
433 | + echo "<script>document.location='insmess_cad.php';</script>"; | ||
434 | + } | ||
435 | + } | ||
436 | + | ||
437 | + header('Location: index.php'); | ||
438 | + return TRUE; | ||
439 | + } | ||
354 | } | 440 | } |
355 | 441 | ||
442 | + | ||
443 | +// Instancia objeto de página | ||
356 | $pagina = new clsIndex(); | 444 | $pagina = new clsIndex(); |
445 | + | ||
446 | +// Instancia objeto de conteúdo | ||
357 | $miolo = new indice(); | 447 | $miolo = new indice(); |
358 | -$pagina->addForm( $miolo ); | ||
359 | -$pagina->MakeAll(); | ||
360 | -?> | ||
361 | \ No newline at end of file | 448 | \ No newline at end of file |
449 | + | ||
450 | +// Atribui o conteúdo à página | ||
451 | +$pagina->addForm($miolo); | ||
452 | + | ||
453 | +// Gera o código HTML | ||
454 | +$pagina->MakeAll(); | ||
362 | \ No newline at end of file | 455 | \ No newline at end of file |