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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
<?php if (($_SESSION['asso']=='asso_siv')) { ?>
<script language= 'javascript'> <!-- function aviso(vagas){ if(confirm ('Deseja realmente excluir? ')) { location.href="<?php echo $_SERVER['PHP_SELF'];?>?excluir=ok&id="+vagas; } else { return false; } } //--> </script>
<link href="../admin/css/corpo.css" rel="stylesheet" type="text/css" /> </head>
<body> <?php include_once("../_private/conectar.php"); include_once("itens.php");
function alterar_estado ($id, $estado) { global $id; global $estado; global $autor;
if (($estado=='s') || ($estado =='S')){ $mudar = 'n'; }else{ $mudar='s'; } $alterar = mysql_query("update vagas set publicado='$mudar' where idvagas='$id' and autor='$autor'") or die ("erro ao alterar estado"); }
function excluir () { $id_vagas = $_GET['id']; global $autor; $query_excluir = mysql_query("delete from vagas where idvagas='$id_vagas' and autor=$autor") or die ("Erro ao selecionar"); }
function publicado ($valor) { global $imgp_np; global $img_p;
if (($valor == 's') || ($valor == 'S')){ echo $img_p; }else{ echo $imgp_np; } }
$autor =$_SESSION['id_asso'];
$id= $_GET['id']; $estado = $_GET['est'];
if ($_GET['cont']=='pub'){ alterar_estado ($id, $estado); }
if ($_GET['excluir']=='ok'){ excluir(); }
$selecionar = "SELECT idvagas, funcao, publicado, data_criacao,qtde FROM vagas where autor='$autor' order by idvagas desc"; $sel_cont = "SELECT COUNT(idvagas) as total from vagas where autor='$autor'"; $sql = mysql_query($selecionar) or die("erro ao selecionar"); $total = mysql_num_rows($sql); $sql_cont= mysql_query($sel_cont) or die("erro ao selecionar"); $row_cont=mysql_fetch_assoc($sql_cont); $count=$row_cont["total"]; //COMEÇA A PAGINAÇAO // if (isset($_GET['qtde'])){ $showrecs = $_GET['qtde']; }else{ $showrecs =30; } $pagerange = 10; $page = @$_GET["page"]; if (!isset($page)) $page = 1; if ($count % $showrecs != 0) { $pagecount = intval($count / $showrecs) + 1; } else { $pagecount = intval($count / $showrecs); } $startrec = $showrecs * ($page - 1); if ($startrec < $count) { if (!@mysql_data_seek($res, $startrec)){ echo ''; }; } $reccount = min($showrecs * $page, $count); ?> <?php function showpagenav($page, $pagecount) { ?> <table width="684" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#F0F0F0"><table width="260" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#F0F0F0"> <tr valign="middle"> <?php if ($page > 1) { ?> <td align="right"><table width="65" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20" align="center" valign="middle" class="bt_prev"> </td> <td width="60" class="bt_dir"><a href="<?php $_SERVER['PHP_SELF'] ?>?p=11&page=<?php echo $page - 1 ?><?php if(isset($_GET['qtde'])){ echo '&qtde='.$_GET['qtde']; }?><?php if (isset($_GET['id'])){ echo "&id=".$_GET['id']; }else{ echo ''; }?>">Anterior</a></td> </tr> </table></td> <?php } else {?> <td align="right"><table width="65" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20" align="center" valign="middle" class="bt_prev"> </td> <td width="60" class="bt_dir">Anterior</td> </tr> </table></td> <?php } global $startrec; global $pagerange; global $reccount; global $total; if ($pagecount > 1) { if ($pagecount % $pagerange != 0) { $rangecount = intval($pagecount / $pagerange) + 1; } else { $rangecount = intval($pagecount / $pagerange); } for ($i = 1; $i < $rangecount + 1; $i++) { $startpage = (($i - 1) * $pagerange) + 1; $count = min($i * $pagerange, $pagecount); if ((($page >= $startpage) && ($page <= ($i * $pagerange)))) { for ($j = $startpage; $j < $count + 1; $j++) { if ($j == $page) { ?> <td class="bt_nav"><font size="2" face="Arial, Helvetica, sans-serif"><b><?php echo $j ?></b></font></td> <?php } else { ?> <td class="bt_nav"><font size="2" face="Arial, Helvetica, sans-serif"><a href="<?php $_SERVER['PHP_SELF'] ?>?p=11&page=<?php echo $j ?><?php if(isset($_GET['qtde'])){ echo '&qtde='.$_GET['qtde']; }?><?php if (isset($_GET['id'])){ echo "&id=".$_GET['id']; }else{ echo ''; }?>"><?php echo $j ?></a></font></td> <?php } } } else { ?> <td class="bt_nav"><font size="2" face="Arial, Helvetica, sans-serif"><a href="<?php $_SERVER['PHP_SELF'] ?>?p=11&page=<?php echo $startpage ?><?php if(isset($_GET['qtde'])){ echo '&qtde='.$_GET['qtde']; }?><?php if (isset($_GET['id'])){ echo "&id=".$_GET['id']; }else{ echo ''; }?>"><?php echo $startpage ."..." .$count ?></a></font></td> <?php } } } ?> <?php if ($page < $pagecount) { ?> <td align="left"> <table width="80" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="middle" class="bt_left"><a href="<?php $_SERVER['PHP_SELF'] ?>?p=11&page=<?php echo $page + 1 ?><?php if(isset($_GET['qtde'])){ echo '&qtde='.$_GET['qtde']; }?><?php if (isset($_GET['id'])){ echo "&id=".$_GET['id']; }else{ echo ''; }?>">Próxima</a></td> <td class="bt_next"> </td> </tr> </table></td> <?php } else {?> <td align="left"> <table width="80" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" valign="middle" class="bt_left">Próxima</td> <td class="bt_next"> </td> </tr> </table></td> <?php } ?> </tr> </table></td> </tr> <tr> <td bgcolor="#FFFFFF"> <table width="684" border="0" align="center" cellpadding="4" cellspacing="1" class="bt_registros"> <tr><td> Registros mostrados <?php echo $startrec + 1 ?> - <?php echo $reccount ?> de <?php echo $total ?></td> </tr> </table> </td> </tr> </table> <?php } ?> <table width="684" border="0" cellpadding="0" cellspacing="0" class="class_tit"> <tr> <td width="5%" height="16" align="center"> </td> <td width="77%" style="vertical-align: middle;">LISTA DE VAGAS</td> <td width="18%" align="right"><table width="195" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="44%" height="16" align="center" valign="middle"><a href="cadastrar_vagas.php"><img src="images/novo.png" width="55" height="50" class="imagem" /></a></td> <td width="30%"><a href="principal.php"><img src="images/voltar.jpg" width="55" height="50" class="imagem" /></a></td> <td width="30%"> </td> </tr> </table></td> </tr> </table> <br /> <table width="684" border="0" cellpadding="0" cellspacing="1" class="borda"> <tr class="t_tit"> <td width="3%">#</td> <td width="8%">Ação</td> <td width="52%">Vaga</td> <td width="9%">Qtde</td> <td width="12%">Data Inclusão</td> <td width="9%">Publicado</td> <td width="7%">ID</td> </tr> <?php if ($total > 0) { for ($i = $startrec; $i < $reccount; $i++) { $dados = mysql_fetch_assoc($sql); $style = "trbranco"; if ($i % 2 != 0) { $style = "trcinza"; } $contador= $i+1; $dtn = explode("-", $dados['data_criacao']); $data = $dtn[2] . '/' . $dtn[1] . '/' . $dtn[0];
?> <tr class="<?php echo $style ?>"> <td align="center" class="colun" ><?php echo $contador?></td> <td align="center" class="colun"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <a href="editar_vagas.php?id=<?php echo $dados['idvagas']?>" > <img src="images/editar.png" alt="Editar" width="21" height="22" border="0" class="imagembt" title="Editar"/></a></td> <td><a href="#" onclick="aviso('<?php echo $dados['idvagas']?>');"><img src="images/delete.png" title="Excluir" alt="Excluir" width="21" height="22" border="0" class="imagembt" /></a></td> </tr> </table></td> <td class="colun"><?php echo $dados['funcao']; ?></td> <td align="center" class="colun"><?php echo $dados['qtde']; ?></td> <td align="center" class="colun"><?php echo $data; ?></td> <td align="center" class="colun"> <a href="<?php $_SERVER['PHP_SELF'];?>?p=11&cont=pub&id=<?php echo $dados['idvagas']?>&est=<?php echo $dados['publicado']?> " > <?php echo publicado($dados['publicado']);?></a></td> <td align="center" class="colun"><?php echo $dados['idvagas']; ?></td> </tr> <?php } while ($dados = mysql_fetch_assoc($sql)); }else{?> <tr> <td colspan="7"> Nao há registros </td></tr> <?php } ?> </table> <?php showpagenav($page, $pagecount); ?>
<?php } else { print("<script language='javascript'>window.location ='index.php?login=no'</script>"); } ?>
|