Viewing file: usuario_pesq.php (17.06 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
#############################################################################
# Nome: usuario_pesq.php #
# System: Irpen #
# Criado por: Breno Henrique Vivarelli #
# Empresa: Netnigro #
# E-mail: breno@netnigro.com.br #
# Descrição: Formulário de pesquisa 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");
if (isset($_REQUEST["btnPesquisar"])) {
//Inicialização de variáveis
$sql_aux = "";
$ordem_condicao = 0;
//********************************************************** PARÂMETROS DE PESQUISA **************************************************************//
//Por perfil
if (isset($_REQUEST["cboPerfil"])) {
$cod_perfil = $_REQUEST["cboPerfil"];
$nome_perfil = $_REQUEST["hddNomePerfil"];
if ($cod_perfil != "T") {
PreparaCondicaoSQL($ordem_condicao, $sql_aux);
$sql_aux .= "c1.CON_Perfil_DR = $cod_perfil ";
}
}
//Por nome
if (!empty($_REQUEST["txtNome"])) {
$nome = $_REQUEST["txtNome"];
PreparaCondicaoSQL($ordem_condicao, $sql_aux);
$sql_aux .= "c1.CON_Descricao LIKE '%$nome%' ";
}
//Por nome do tabelião, caso o perfil selecionado se ofício
if (!empty($_REQUEST["txtNomeTabeliao"])) {
$nome_tabeliao = $_REQUEST["txtNomeTabeliao"];
PreparaCondicaoSQL($ordem_condicao, $sql_aux);
$sql_aux .= "c2.CON_Descricao LIKE '%$nome_tabeliao%' ";
}
//Por cidade
if ($_REQUEST["cboCidade"] != "") {
$cod_cidade = $_REQUEST["cboCidade"];
PreparaCondicaoSQL($ordem_condicao, $sql_aux);
$sql_aux .= "CID_RowID = $cod_cidade ";
}
//Por CPF
if (!empty($_REQUEST["txtCPF"])) {
$cpf = $_REQUEST["txtCPF"];
PreparaCondicaoSQL($ordem_condicao, $sql_aux);
$sql_aux .= "c1.CON_CPF = '$cpf' ";
}
//Por e-mail
if (!empty($_REQUEST["txtEmail"])) {
$email = $_REQUEST["txtEmail"];
PreparaCondicaoSQL($ordem_condicao, $sql_aux);
$sql_aux .= "c1.CON_Email = '$email' ";
}
//Por status do usuário no sistema
if (isset($_REQUEST["cboAtivoSN"])) {
$ativoSN = $_REQUEST["cboAtivoSN"];
if ($ativoSN != "T") {
PreparaCondicaoSQL($ordem_condicao, $sql_aux);
$sql_aux .= "c1.CON_AtivoSN = '$ativoSN' ";
}
}
//Ordenação do resultado
$sql_aux .= " ORDER BY c1.CON_Descricao ";
//********************************************************** PARÂMETROS DE PESQUISA **************************************************************//
//Executa a query de pesquisa
if (strcmp($nome_perfil, "Ofício") == 0) { //Perfil Ofício
$sql_usuario = LISTA_USUARIOS_OFICIO . $sql_aux;
} else { //Outros Perfis
$sql_aux = str_replace("CON", "USU", $sql_aux);
$sql_usuario = LISTA_USUARIOS_INTERNO . $sql_aux;
}
$rs_usuario = $conexao->query($sql_usuario);
}
?>
<!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" />
<!--[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.form.js"></script>
<script type="text/javascript" src="usuario_pesq.js"></script>
<!-- <script src="scripts/delay.js" language="JavaScript"></script> -->
<style type="text/css">
.style1 {
color: #666666;
font-weight: bold;
}
.lista_usuarios {
font-size: 7pt;
}
.lista_usuarios .header {
font-size: 9pt;
font-weight: bold;
background-color: #CCCCCC;
}
.lista_usuarios .coluna1 {
text-align: left;
width: 40%;
}
.lista_usuarios .coluna2 {
text-align: right;
width: 0%;
display: none;
}
.lista_usuarios .coluna3 {
text-align: left;
width: 30%;
}
.lista_usuarios .coluna4 {
text-align: center;
width: 15%;
}
.lista_usuarios .coluna5 {
text-align: center;
width: 15%;
}
.sem_lista {
text-align: center;
font-weight: bold;
color: red;
}
.resultado {
width: 100%;
text-align: center;
}
</style>
</head>
<body>
<div id="wrap">
<?php include "../topo_gestao.php"; ?>
<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>PESQUISA DE USUÁRIOS</h2>
<div id="linha_h2">
</div>
<form name="frmPesqUsuario" id="frmPesqUsuario" action="usuario_pesq.php" method="get">
<input type="hidden" name="hddNomePerfil" id="hddNomePerfil">
<table width="98%" border="0">
<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 colspan="2" align="right" valign="top">
<label>
<a href="usuario_cad.php">| Cadastrar Novo Usuário |</a>
</label>
</td>
</tr>
<tr>
<td width="21%" align="right" valign="top">
Perfil:
</td>
<td width="79%" align="left" valign="top">
<select name="cboPerfil" id="cboPerfil">
<option value="T">Todos</option>
<?php
$sql_perfil = LISTA_PERFIS;
$rs_perfil = $conexao->query($sql_perfil);
while ($perfil = $rs_perfil->fetch_array()) {
?>
<option value="<?= $perfil['PFL_RowID']; ?>"><?= $perfil['PFL_Nome']; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top">
Nome do Usuário:
</td>
<td align="left" valign="top">
<input name="txtNome" type="text" id="txtNome" size="50" />
</td>
</tr>
<tr id="tabeliao">
<td align="right" valign="top">
Nome do Tabelião:
</td>
<td align="left" valign="top">
<input name="txtNomeTabeliao" type="text" id="txtNomeTabeliao" size="50" />
</td>
</tr>
<tr id="cidades">
<td width="21%" align="right" valign="top">
Cidade:
</td>
<td width="79%" 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 ((isset($_POST["cboCidade"])) && ($cod_cidade == $cidade['CID_RowID'])) {
$seleciona = "selected";
}
?>
<option value="<?= $cidade['CID_RowID']; ?>" <?= $seleciona; ?>><?= $cidade['CID_Descricao']; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td align="right" valign="top">
CPF:
</td>
<td align="left" valign="top">
<input name="txtCPF" type="text" id="txtCPF" size="14" maxlength="14" />
</td>
</tr>
<tr>
<td align="right" valign="top">
E-mail:
</td>
<td align="left" valign="top">
<input name="txtEmail" type="text" id="txtEmail" size="30" />
</td>
</tr>
<tr>
<td align="right" valign="top">
Situação:
</td>
<td align="left" valign="top">
<select name="cboAtivoSN" id="cboAtivoSN">
<option value="T">Todos</option>
<option value="S" selected="selected">Ativo</option>
<option value="N">Inativo</option>
</select>
</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
</td>
</tr>
<tr>
<td align="center" valign="top" colspan="2">
<input type="submit" name="btnPesquisar" id="btnPesquisar" value="Pesquisar" />
<input type="button" name="btnLimpar" id="btnLimpar" value="Limpar" />
<input type="button" name="btnVoltar" id="btnVoltar" value="Voltar" />
</td>
</tr>
<tr>
<td align="left" valign="top">
</td>
<td align="left" valign="top">
</td>
</tr>
</table>
<?php
if (isset($_REQUEST["btnPesquisar"])) {
?>
<table class="resultado" width="98%" border="0">
<tr>
<td align="left" valign="top" colspan="2">
<h3>USUÁRIOS</h3>
</td>
</tr>
<tr>
<td>
<?php
if ($rs_usuario->num_rows > 0) {
?>
<table class="lista_usuarios" width="100%" align="center" border="0" cellspacing="0" cellpadding="0">
<tr class="header">
<td class="coluna1">Nome</td>
<td class="coluna2">Ofício</td>
<td class="coluna3">E-mail</td>
<td class="coluna4">Situação</td>
<td class="coluna5">Alterar</td>
</tr>
<?php
$num_linha = 1;
while ($usuario = $rs_usuario->fetch_array()) {
if ($num_linha % 2 == 0) {
$class_linha = "linha_par";
} else {
$class_linha = "linha_impar";
}
?>
<tr class="<?= $class_linha; ?>">
<td class="coluna1">
<?= $usuario["CON_Descricao"]; ?>
</td>
<td class="coluna2">
<?= $usuario["CON_Oficio_DR"]; ?>
</td>
<td class="coluna3">
<?= $usuario["CON_Email"]; ?>
</td>
<td class="coluna4">
<?php
if ($usuario["CON_AtivoSN"] == "S") {
echo "<span class='ativo'>Ativo</span>";
} else {
echo "<span class='inativo'>Inativo</span>";
}
?>
</td>
<td class="coluna5">
<a href="usuario_cad.php?acao=U&tipo=<?= $cod_perfil ?>&cod_usuario=<?= $usuario["CON_RowID"]; ?>"><img src="<?= ICONES; ?>alterar.jpg" alt="Alterar" border="0"></a>
</td>
</tr>
<?php
$num_linha++;
}
?>
</table>
<?php
} else {
?>
<p class="sem_lista">Não foram encontrados resultados para os parâmetros especificados.</p>
<?php
}
?>
</td>
</tr>
</table>
<?php
}
?>
</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>
<?php
if ((isset($_GET["msg"])) && (!empty($_GET["msg"]))) {
$msg = $_GET["msg"];
?>
<script type="text/javascript">
alert("<?= $msg; ?>")
</script>
<?php
}
?>
|