index.php
5.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/**********************************************************************************
Sistema e-SIC Livre: sistema de acesso a informação baseado na lei de acesso.
Copyright (C) 2014 Prefeitura Municipal do Natal
Este programa é software livre; você pode redistribuí-lo e/ou
modificá-lo sob os termos da Licença GPL2.
***********************************************************************************/
include("../inc/autenticar.php");
checkPerm("LSTUSR");
include "../inc/topo.php";
include("../inc/paginacaoPorPostIni.php");
$filtro = "";
if (($_REQUEST['acao']))
{
$nome = $_REQUEST["nome"];
$login = $_REQUEST["login"];
$matricula = $_REQUEST["matricula"];
$cpfusuario = $_REQUEST["cpfusuario"];
$idsecretaria = $_REQUEST["idsecretaria"];
$status = $_REQUEST["status"];
if(!empty($nome)) $filtro.= " and usuario.nome like '%$nome%'";
if(!empty($login)) $filtro.= " and usuario.login like '%$login%'";
if(!empty($matricula)) $filtro.= " and usuario.matricula = '$matricula'";
if(!empty($cpfusuario)) $filtro.= " and usuario.cpfusuario = '$cpfusuario'";
if(!empty($status)) $filtro.= " and usuario.status = '$status'";
if(!empty($idsecretaria)) $filtro.= " and usuario.idsecretaria = '$idsecretaria'";
}
$sql = "select usuario.*, sigla
from sis_usuario usuario, sis_secretaria secretaria
where usuario.idsecretaria = secretaria.idsecretaria $filtro ";
$rs = execQueryPag($sql);
?>
<script>
function mudarStatus(id,status)
{
document.location = "ativacao.php?idusuario="+id+"&status="+status;
}
</script>
<h1>Cadastro de Usuários</h1>
<br><br>
<form action="index.php" method="post">
<fieldset style="width: 80%;">
<legend>Buscar:</legend>
<table class="lista">
<tr>
<td>Nome:</td>
<td>
<input type="text" name="nome" value="<?php echo $nome?>" maxlength="50" size="20" />
Login:
<input type="text" name="login" value="<?php echo $login?>" maxlength="50" size="20" />
CPF:
<input type="text" name="cpfusuario" value="<?php echo $cpfusuario?>" maxlength="11" size="12" />
Matricula:
<input type="text" name="matricula" value="<?php echo $matricula?>" maxlength="6" size="8" />
</td>
</tr>
<tr>
<td>Status:</td>
<td>
<select name="status">
<option value="">--status--</option>
<option value="A" <?php echo ($status=="A")?"selected":""; ?>>Ativo</option>
<option value="I" <?php echo ($status=="I")?"selected":""; ?>>Inativo</option>
</select>
SIC:
<select name="idsecretaria">
<option value="">--sic--</option>
<?php
$rsSec = execQuery("select * from sis_secretaria order by sigla");
while($registro = mysql_fetch_array($rsSec)){
?>
<option value="<?php echo $registro["idsecretaria"]; ?>" <?php echo ($idsecretaria==$registro["idsecretaria"])?"selected":""; ?>>
<?php echo $registro["sigla"]; ?>
</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<br>
<input type="submit" class="botaoformulario" value="Buscar" name="acao" />
<input type="button" class="botaoformulario" onClick="document.location = 'cadastro.php';" value="Adicionar">
</td>
</tr>
</table>
</fieldset>
<br>
<table class="tabLista">
<tr>
<th></th>
<th>Codigo</th>
<th>Usuário</th>
<th>CPF</th>
<th>Matricula</th>
<th>Login</th>
<th>SIC</th>
<th>Status</th>
</tr>
<?php
$cor = false;
while($registro = mysql_fetch_array($rs)){
$click = "editar('".$registro["idusuario"]."')";
if($cor)
$corLinha = "#dddddd";
else
$corLinha = "#ffffff";
$cor = !$cor;
?>
<tr onMouseOver="this.style.backgroundColor = getCorSelecao(true);" onMouseOut="this.style.backgroundColor = '<?php echo $corLinha;?>';" style="background-color:<?php echo $corLinha;?>;cursor:pointer; cursor:hand; ">
<td><img src="../img/drop.png" title="Excluir Registro" onClick="apagar('<?php echo $registro["idusuario"]; ?>');"/></td>
<td onClick="<?php echo $click;?>"><?php echo $registro["idusuario"];?></td>
<td onClick="<?php echo $click;?>"><?php echo destacaBusca($registro["nome"],$nome); ?></td>
<td onClick="<?php echo $click;?>"><?php echo destacaBusca($registro["cpfusuario"],$cpfusuario); ?></td>
<td onClick="<?php echo $click;?>"><?php echo destacaBusca($registro["matricula"],$matricula); ?></td>
<td onClick="<?php echo $click;?>"><?php echo $registro["login"]; ?></td>
<td onClick="<?php echo $click;?>"><?php echo $registro["sigla"]; ?></td>
<td align="center"><input type="button" value="<?php echo ($registro["status"]=="A")?"Ativo - Clique para Desativar":"Inativo - Clique para Ativar";?>" onClick="javascript:mudarStatus('<?php echo $registro["idusuario"];?>','<?php echo ($registro["status"]=="A")?"I":"A";?>');"/></td>
</tr>
<?php
} ?>
<tr>
<td align="right" colspan="8">
<?php include("../inc/paginacaoPorPostFim.php");?>
</td>
<tr>
<tr>
<td colspan="8" align="center">
<input type="button" class="botaoformulario" onClick="document.location = 'cadastro.php';" value="Adicionar">
<input type="button" value="Voltar" class="botaoformulario" name="voltar" id="voltar" onclick="location.href='../inc/menu.php'" />
</td>
</tr>
</table>
</form>
<?php
include "../inc/rodape.php";
?>