Viewing file: usuario_cad.php (31.84 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php ############################################################################# # Nome: usuario_cad.php # # System: Irpen # # Criado por: Breno Henrique Vivarelli # # Empresa: Netnigro # # E-mail: breno@netnigro.com.br # # Descrição: Formulário de Inclusão, alteração e inativação de usuários # # Histórico: # # . 03/06/2008 - Breno Henrique Vivarelli # # Criação da Página # #############################################################################
// Includes include("../../config/config.php"); include(INCLUDES . "conexaoBD.php"); include(INCLUDES . "sentencas_sql.php"); include(INCLUDES . "funcoes_uteis.php"); include(INCLUDES . "valida_usuario.inc.php");
// Verifica se o usuário está alterado os seus próprios dados $meus_dadosSN = "N"; $cod_perfil = $_SESSION["cod_perfil"];
//Busca o perfil do usuário $sql_aux = " WHERE PFL_RowID = $cod_perfil "; $sql_perfil = BUSCA_PERFIS . $sql_aux; $rs_perfil = $conexao->query($sql_perfil); $perfil = $rs_perfil->fetch_array(); $nome_perfil = $perfil["PFL_Nome"]; $tipo = 1; //Código do usuário if (isset($_GET["meus_dados"])) { $cod_usuario_aux = $_SESSION["cod_usuario"]; $meus_dadosSN = "S"; } elseif (isset($_GET["cod_usuario"])) { $cod_usuario_aux = $_GET["cod_usuario"]; }
if (isset($cod_usuario_aux)) { $_SESSION["link_voltar"] = "usuario_cad.php";//basename($_SERVER["HTTP_REFERER"]); $hddAcao = "U";
//Busca dados do usuário $sql_aux = " WHERE CON_RowID = $cod_usuario_aux "; if ((isset($_GET['tipo']) && $_GET['tipo'] == 2) || $cod_perfil == 2) { $tipo = 2; $sql_usuario = LISTA_USUARIOS . $sql_aux; } else { $tipo = isset($_GET['tipo'])?$_GET['tipo']:1; $sql_aux = str_replace("CON", "USU", $sql_aux); $sql_usuario = LISTA_USUARIOS_INTERNO . $sql_aux; } $rs_usuario = $conexao->query($sql_usuario); $usuario = $rs_usuario->fetch_array();
//Preenche campos do formulário com os valores do banco de dados $cod_oficio = $usuario["CON_Oficios_DR"]; $cod_perfil_usu = $usuario["CON_Perfil_DR"]; $tabeliaoSN = $usuario["CON_Tabeliao"]; $nome = $usuario["CON_Descricao"]; $cpf = $usuario["CON_CPF"]; $email = $usuario["CON_Email"]; $email2 = $usuario["CON_Email2"]; $ddd1 = ltrim($usuario["CON_DDD"], 0); $num_telefone1 = $usuario["CON_Fone"]; $ramal1 = ValidaValor($usuario["CON_Ramal"]); $ddd2 = ValidaValor($usuario["CON_DDD2"]); $num_telefone2 = ValidaValor($usuario["CON_Fone2"]); //$ramal2 = $usuario["USU_Ramal"]; $ddd_celular = ValidaValor($usuario["CON_DDDCelular"]); $num_celular = ValidaValor($usuario["CON_Celular"]); $data_nascimento = ValidaValor(FormataData($usuario["CON_Nascimento"], 'SCREEN')); $ativoSN = $usuario["CON_AtivoSN"]; $associadoSN = $usuario["CON_AssociadoSN"]; $senha = $usuario["CON_Senha"];
//Busca o perfil do usuário $sql_aux = " WHERE PFL_RowID = $cod_perfil_usu "; $sql_perfil = BUSCA_PERFIS . $sql_aux; $rs_perfil = $conexao->query($sql_perfil); $perfil = $rs_perfil->fetch_array(); $perfil_usuario = $perfil["PFL_Nome"];
//Busca código da cidade do ofÃcio if ($perfil_usuario == "Ofício") { $sql_aux = " WHERE OFI_RowID = $cod_oficio "; $sql_cidade = BUSCA_OFICIOS_CIDADE . $sql_aux; $rs_cidade = $conexao->query($sql_cidade); $cidade = $rs_cidade->fetch_array(); $cod_cidade = $cidade["CID_RowID"]; } } else { $hddAcao = "I"; $cod_usuario = ""; $nome = ""; $cpf = ""; $email = ""; $email2 = ""; $ddd1 = ""; $num_telefone1 = ""; $ramal1 = ""; $ddd2 = ""; $num_telefone2 = ""; //$ramal2 = ""; $ddd_celular = ""; $num_celular = ""; $data_nascimento = ""; $ativoSN = ""; $associadoSN = ""; }
if ($meus_dadosSN == "S") { $titulo_pagina = "DADOS PESSOAIS"; } else { $titulo_pagina = "CADASTRO DE USUÁRIOS"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Description" content="IRPEN"> <meta name="Keywords" content=""> <meta name="resource-type" content="document"> <meta name="classification" content="Internet"> <meta name="robots" content="all"> <meta name="rating" content="General"> <meta name="Author" content="Ninart! Solucoes para Web."> <meta name="language" content="pt-br"> <link rel="shortcut icon" href="imagens/favicon.gif" type="image/gif"> <link rel="stylesheet" href="<?= HOST; ?>css/irpen.css" type="text/css" /> <link rel="stylesheet" media="all" type="text/css" href="<?= HOST; ?>css/menu_dropline.css" /> <link type="text/css" href="<?= HOST; ?>css/jquery-ui/ui.all.css" rel="Stylesheet" /> <!--[if IE]> <link rel="stylesheet" media="all" type="text/css" href="css/menu_dropline_ie.css" /> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" media="all" type="text/css" href="css/menu_dropline_ie6.css" /> <![endif]--> <title>IRPEN | Instituto de Registro Civil de Pessoas Naturais do Paraná - 2008</title> <script type="text/javascript" src="<?= HOST; ?>includes/jquery-1.2.6.js"></script> <script type="text/javascript" src="<?= HOST; ?>includes/jquery.maskedinput-1.1.3.js"></script> <script type="text/javascript" src="<?= HOST; ?>includes/jquery-ui.js"></script> <script type="text/javascript" src="<?= HOST; ?>includes/ui.datepicker-pt-BR.js"></script> <script type="text/javascript" src="<?= HOST; ?>includes/jquery.form.js"></script> <script type="text/javascript" src="<?= HOST; ?>includes/cpf.js"></script> <script type="text/javascript" src="<?= HOST; ?>includes/util.js"></script> <script type="text/javascript" src="<?= HOST; ?>includes/email.js"></script> <script type="text/javascript" src="usuario_cad.js"></script> <!-- <script src="scripts/delay.js" language="JavaScript"></script> --> <style type="text/css"> .style1 { color: #666666; font-weight: bold; } </style> </head> <body> <div id="wrap">
<?php include "../topo_gestao.php"; ?>
<!-- content-wrap starts --> <div id="content-wrap"> <table width="100%" border="0"> <tr> <td align="left" valign="top" bgcolor="#FFFFFF" width="1%"> </td> <td align="left" valign="top">
<table width="100%" border="0"> <tr>
<td align="left" valign="top">
<h2><?= $titulo_pagina; ?></h2> <div id="linha_h2"> </div> <form action="usuario_grava.php" method="post" name="frmCadastroUsuario" id="frmCadastroUsuario"> <input type="hidden" name="hddAcao" id="hddAcao" value="<?= $hddAcao; ?>"> <input type="hidden" name="hddUsuario" id="hddUsuario" value="<?= $cod_usuario_aux; ?>"> <input type="hidden" name="hddMeusDadosSN" id="hddMeusDadosSN" value="<?= $meus_dadosSN; ?>"> <input type="hidden" name="tipo" value="<?= $tipo; ?>"> <table width="80%" border="0" align="center"> <tr> <td align="left" valign="top"> </td> </tr> <?php if ((isset($_GET["msg"])) && (!empty($_GET["msg"]))) { if ((isset($_GET["erro"])) && ($_GET["erro"] == "S")) { $class_msg = "msg_erro"; } else { $class_msg = "msg_ok"; } ?> <tr> <td align="left" colspan="2"> <p class="<?= $class_msg; ?>"><?= $_GET["msg"]; ?></p> <br /> </td> </tr> <?php } ?> <tr> <td align="left" valign="top" colspan="2"> <p class="aviso"> <span class="obrigatorio">*</span> Campos Obrigatórios </p> </td> </tr> <tr> <td width="33%" align="right" valign="top"> Perfil <span class="obrigatorio">*</span>: </td> <td width="67%" align="left" valign="top"> <?php if ((strcasecmp($nome_perfil, "ADMINISTRADOR") == 0) && ($meus_dadosSN == "N")) { ?> <select name="cboPerfil" id="cboPerfil"> <?php $sql_perfil = LISTA_PERFIS;
$rs_perfil = $conexao->query($sql_perfil); while ($perfil = $rs_perfil->fetch_array()) { $seleciona = ""; if ((!empty($cod_perfil_usu)) && ($cod_perfil_usu == $perfil['PFL_RowID'])) { $seleciona = "selected"; } ?> <option value="<?= $perfil['PFL_RowID']; ?>" <?= $seleciona; ?>> <?= $perfil['PFL_Nome']; ?> </option> <?php } ?> </select> <?php } else { ?> <input type="hidden" name="cboPerfil" id="cboPerfil" value="<?= $cod_perfil; ?>"> <?php echo $nome_perfil; } ?> </td> </tr> <?php if ($meus_dadosSN == "N") { ?> <tr id="cidades"> <td width="33%" align="right" valign="top"> Cidade <span class="obrigatorio">*</span>: </td> <td width="67%" align="left" valign="top"> <select name="cboCidade" id="cboCidade"> <option value="">Selecione...</option> <?php $sql_cidade = LISTA_CIDADES;
$rs_cidade = $conexao->query($sql_cidade); while ($cidade = $rs_cidade->fetch_array()) { $seleciona = ""; if ((!empty($cod_cidade)) && ($cod_cidade == $cidade['CID_RowID'])) { $seleciona = "selected"; } ?> <option value="<?= $cidade['CID_RowID']; ?>" <?= $seleciona; ?>> <?= $cidade['CID_Descricao']; ?> </option> <?php } ?> </select> </td> </tr> <tr id="oficios"> <td width="33%" align="right" valign="top"> Ofício <span class="obrigatorio">*</span>: </td> <td width="67%" align="left" valign="top"> <div id="combo_oficios"> <select name="cboOficio" id="cboOficio" disabled> <option value=""> << Selecione>> </option> </select> </div> <!-- <label> <?php if (isset($cod_cidade)) { ?> <select name="cboOficio" id="cboOficio"> <?php $sql_aux = " WHERE OFI_Cidades_DR = $cod_cidade "; $sql_oficio = BUSCA_OFICIOS_CIDADE . $sql_aux;
$rs_oficio = $conexao->query($sql_oficio); while ($oficio = $rs_oficio->fetch_array()) { $seleciona = ""; if ((!empty($cod_oficio)) && ($cod_oficio == $oficio['OFI_RowID'])) { $seleciona = "selected"; } ?> <option value="<?= $oficio['OFI_RowID']; ?>"><?= $oficio['OFI_Descricao']; ?></option> <?php } ?> </select> <?php } else { ?> <select name="cboOficio" id="cboOficio" disabled> <option value=""><< Selecione >></option> </select> <?php } ?> </label> --> </td> </tr> <tr id="tabeliao"> <td align="right" valign="top"> Tabelião <span class="obrigatorio">*</span>: </td> <td align="left" valign="top"> <input type="radio" name="rbtTabeliao" id="rbtTabeliao1" value="S" <?php if ((($hddAcao == "U") && ($tabeliaoSN == "S"))) { echo "checked"; } ?> /> <label for="rbtAtivo"> Sim </label> <input type="radio" name="rbtTabeliao" id="rbtTabeliao2" value="N" <?php if (($hddAcao == "I") || ($hddAcao == "U") && ($tabeliaoSN == "N")) { echo "checked"; } ?> /> <label for="rbtAtivo">Não</label> </td> </tr> <?php } ?> <tr> <td align="right" valign="top"> Nome <span class="obrigatorio">*</span>: </td> <td align="left" valign="top"> <input name="txtNome" type="text" id="txtNome" size="50" value="<?= $nome; ?>" /> </td> </tr> <tr> <td align="right" valign="top"> CPF: </td> <td align="left" valign="top"> <input name="txtCPF" type="text" id="txtCPF" size="16" maxlength="14" value="<?= $cpf; ?>" /> </td> </tr> <tr> <td align="right" valign="top"> Email <span class="obrigatorio">*</span>: </td> <td align="left" valign="top"> <input name="txtEmail" type="text" id="txtEmail" size="30" value="<?= $email; ?>" /> </td> </tr> <tr> <td align="right" valign="top"> Email 2: </td> <td align="left" valign="top"> <input name="txtEmail2" type="text" id="txtEmail2" size="50" value="<?= $email2; ?>" /> </td> </tr> <tr> <td align="right" valign="top"> DDD <span class="obrigatorio">*</span> + Telefone 1 <span class="obrigatorio">*</span> + Ramal: </td> <td align="left" valign="top"> <input name="txtDDD1" type="text" id="txtDDD1" size="2" maxlength="2" value="<?= $ddd1; ?>" /> <input name="txtNumTelefone1" type="text" id="txtNumTelefone1" size="11" maxlength="9" value="<?= $num_telefone1; ?>" /> <input name="txtRamal1" type="text" id="txtRamal1" size="10" value="<?= $ramal1; ?>" /> </td> </tr> <tr> <td align="right" valign="top"> DDD + Telefone 2 + Ramal: </td> <td align="left" valign="top"> <input name="txtDDD2" type="text" id="txtDDD2" size="2" maxlength="2" value="<?= $ddd2; ?>" /> <input name="txtNumTelefone2" type="text" id="txtNumTelefone2" size="11" maxlength="9" value="<?= $num_telefone2; ?>" /> <input name="txtRamal2" type="text" id="txtRamal2" size="10" value="<?= $ramal2; ?>" /> </td> </tr> <tr> <td align="right" valign="top"> DDD + Telefone Celular: </td> <td align="left" valign="top"> <input name="txtDDDCelular" type="text" id="txtDDDCelular" size="2" maxlength="2" value="<?= $ddd_celular; ?>" /> <input name="txtNumCelular" type="text" id="txtNumCelular" size="11" maxlength="9" value="<?= $num_celular; ?>" /> </td> </tr> <tr> <td align="right" valign="top"> Data de Nascimento <span class="obrigatorio">*</span>: </td> <td align="left" valign="top"> <input name="txtDataNascimento" type="text" id="txtDataNascimento" size="12" maxlength="10" value="<?= $data_nascimento; ?>" /> </td> </tr> <?php if ($meus_dadosSN == 'N') { ?> <tr id="associados"> <td align="right" valign="top"> Associado ao IRPEN <span class="obrigatorio">*</span>: </td> <td align="left" valign="top"> <input type="radio" name="rbtAssociadoSN" id="rbtAssociadoS" value="S" <?= ($hddAcao == "I" || ($hddAcao == "U" && $associadoSN == "S")) ? "checked" : '' ?> /> <label for="rbtAssociadoS">Sim</label> <input type="radio" name="rbtAssociadoSN" id="rbtAssociadoN" value="N" <?= ($hddAcao == "U" && $associadoSN == "N") ? "checked" : '' ?> /> <label for="rbtAssociadoN"> Não </label> </td> </tr> <?php } ?> <?php if ($meus_dadosSN == "S") /* || (strcasecmp($nome_perfil,"ADMINISTRADOR") == 0)) */ { ?> <tr> <td> </td> <td align="left"> <input name="ckbAlterarSenhaSN" id="ckbAlterarSenhaSN" type="checkbox" value="false" /> <label for="ckbUsuarioSN"> Deseja alterar a senha? </label> </td> </tr> <tr id="trSenha"> <td align="right" valign="top"> Senha <span class="obrigatorio">*</span>: </td> <td align="left" valign="top"> <input name="txtSenha" type="password" id="txtSenha" size="20" disabled /> </td> </tr> <tr id="trSenhaRepetida"> <td align="right" valign="top"> Redigite a Senha <span class="obrigatorio">*</span>: </td> <td align="left" valign="top"> <input name="txtSenhaRepetida" type="password" id="txtSenhaRepetida" size="20" disabled /> </td> </tr> <?php } ?> <tr> <td align="left" valign="top"> </td> <td align="left" valign="top"> </td> </tr> <tr> <td align="center" valign="top" colspan="2"> <label> <?php if ($hddAcao == "I") { $btnConfirmar = "Confirmar"; } else { $btnConfirmar = "Alterar"; if ((strcasecmp($nome_perfil, "ADMINISTRADOR") == 0) && ($meus_dadosSN == "N")) { if ($ativoSN == "S") { ?> <input type="submit" name="btnInativar" id="btnInativar" value="Inativar" /> <?php } else { ?> <input type="submit" name="btnAtivar" id="btnAtivar" value="Ativar" /> <?php } } } ?> <input type="submit" name="btnConfirmar" id="btnConfirmar" value="<?= $btnConfirmar; ?>" /> <input type="reset" name="btnLimpar" id="btnLimpar" value="Limpar" /> <input type="button" name="btnVoltar" id="btnVoltar" value="Voltar" onclick="javascript: history.go(-1);" /> </label> </td> </tr> </table> </form> </td>
</tr>
</table> <br /> </td>
</tr>
</table> </div> <div align="center"> <strong><br /> Rua Mal. Deodoro, 51 - Galeria Ritz - 18º Andar | Fone: (41) 3232-9811 | CEP 80.020-905 - Curitiba - Paraná</strong> <!-- content-wrap ends--> </div> <!-- footer starts --> <div id="footer-wrap"> </div> <div id="rodape"> </div> </div> </body>
</html>
|