source: trunk/admin/modules/Elezioni/ele_operatori_admin.php@ 161

Last change on this file since 161 was 2, checked in by root, 15 years ago

importo il progetto

File size: 6.8 KB
RevLine 
[2]1<?php
2/************************************************************************/
3/* Eleonline - Raccolta e diffusione dei dati elettorali */
4/* by Roberto Gigli & Luciano Apolito */
5/* http://www.eleonline.it */
6/* info@eleonline.it luciano@aniene.net rgigli@libero.it */
7/************************************************************************/
8/* Modulo Amministratori */
9/* Amministrazione */
10/************************************************************************/
11if (!defined('ADMIN_FILE')) {
12 die ("You can't access this file directly...");
13}
14
15// Offset - visualizza il numero di elementi per pagina
16$offset=15;
17if (!isset($min)) $min=0;
18
19$aid=$_SESSION['aid'];
20$dbi=$_SESSION['dbi'];
21$prefix=$_SESSION['prefix'];
22if (isset($_GET['do'])) $do=$_GET['do']; else $do='';
23
24$id_cons_gen=$_GET['id_cons_gen'];
25$perms=ChiSei(0);
26if ($perms!=256) die("Non hai i permessi per inserire dati!");
27if (isset($_GET['aid2'])) get_magic_quotes_gpc() ? $aid2=$param['aid2']:$aid2=addslashes($param['aid2']); else $aid2='';
28if (isset($_GET['id_sede'])) $id_sede=intval($_GET['id_sede']); else $id_sede='';
29if (isset($_GET['id_comune2'])) $id_comune2=intval($_GET['id_comune2']); else $id_comune2='';
30if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']); else $id_cons_gen='';
31
32
33$res = mysql_query("SELECT t1.tipo_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t1.id_cons_gen='$id_cons_gen' " , $dbi);
34list($tipo_cons) = mysql_fetch_row($res);
35
36$hiddenInfo = "<input type=\"hidden\" name=\"min\" value=\"$min\">";
37
38
39/******************************************************/
40/*Funzione di visualizzazione globale */
41/******************************************************/
42//crea la pagina delle affluenze
43function all() {
44 global $bgcolor1, $bgcolor2, $prefix,$aid2,$perms,$id_sede,$id_comune2,$id_cons_gen;
45 $aid=$_SESSION['aid'];
46 $dbi=$_SESSION['dbi'];
47 $prefix=$_SESSION['prefix'];
48
49 OpenTable();
50
51 $resmod = mysql_query("SELECT id_comune,permessi FROM ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='0'", $dbi);
52 list ($id_comu,$permessi) = mysql_fetch_row($resmod);
53 if ($perms!=256)
54 {
55 Closetable();
56 return;
57 }
58 $resmod = mysql_query("SELECT * FROM ".$prefix."_ele_operatori where id_cons=0 and id_comune>0", $dbi);
59 echo "<table><tr></tr><hr><tr align=\"center\">";
60 echo "<td bgcolor=\"$bgcolor1\"><b>"._UTENTE."</b></td>"
61 ."<td bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>"
62 ."<td bgcolor=\"$bgcolor1\"><b>"._PERMESSI."</b></td>";
63 echo "<td bgcolor=\"$bgcolor1\"><b>"._FUNZIONI."</b></td></tr>";
64 echo "<form name=\"modello\" action=\"admin.php\">"
65 ."<input type=\"hidden\" name=\"op\" value=\"oper_admin\">";
66 echo "<tr align=\"center\">";
67 if ($aid2) {
68 echo "<input type=\"hidden\" name=\"aid2\" value=\"$aid2\"><td align=\"center\" width=\"32\">$aid2</td>";
69 }else{
70 echo "<td align=\"center\" width=\"32\"><input name=\"aid2\"></td>";
71 }
72 $ressede = mysql_query("SELECT id_comune, descrizione from ".$prefix."_ele_comuni", $dbi);
73 echo "<td><select name=\"id_comune2\">";
74 echo "<option value=\"\">";
75 while(list($id,$descr)=mysql_fetch_row($ressede)){
76 $sel= ($id == $id_comune2) ? "selected":"";
77 $arr[$id]="$descr";
78 echo "<option value=\"$id\" $sel>$descr";
79 }
80 echo "</select></td>";
81 echo "<td align=\"center\" width=\"32\"><select name=\"permessi\">";
82 $sel0='';$sel64='';
83 if($permessi=='0') $sel0="selected";elseif($permessi=='64') $sel64="selected";
84 echo "<option value=\"\">";
85 echo "<option value=\"64\" $sel64>"._ATTIVO;
86 echo "<option value=\"0\" $sel0>"._SOSPESO."</td>";
87 echo "</select></td>";
88 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">";
89 if ($aid2) {
90 echo "<input type=\"hidden\" name=\"do\" value=\"update\">";
91 echo "<td><input type=\"submit\" name=\"add\" value=\""._MODIFY."\"></td></tr></form>";
92 }else{
93 echo "<input type=\"hidden\" name=\"do\" value=\"add\">";
94 echo "<td><input type=\"submit\" name=\"add\" value=\""._ADD."\"></td></tr></form>";
95 }
96 $i=1;
97 while (list($id_cons2,$id_sede2,$id_comune2,$perm,$utente) = mysql_fetch_row($resmod)){ //elenco dei modelli inseriti
98 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
99 echo "<form name=\"modello$i\" action=\"admin.php\">"
100 ."<input type=\"hidden\" name=\"op\" value=\"oper_admin\">";
101 echo "<input type=\"hidden\" name=\"id_comune2\" value=\"$id_comune2\">";
102 echo "<input type=\"hidden\" name=\"aid2\" value=\"$utente\">";
103 echo "<input type=\"hidden\" name=\"permessi\" value=\"$perm\">";
104 echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">";
105 echo "<td width=\"32\"><b>$utente</b></td>";
106 echo "<td width=\"32\"><b>".$arr[$id_comune2]."</b></td>";
107 if ($perm==64) {$perm_text=_ATTIVO;}else{$perm_text=_SOSPESO;}
108 echo "<td width=\"32\"><b>$perm_text</b></td>";
109 echo "</td><td nowrap>[<a
110 href=\"admin.php?op=oper_admin&amp;aid2=$utente&amp;id_cons_gen=$id_cons_gen&amp;id_comune2=$id_comune2&amp;permessi=$perm\"><img align=\"center\" src=\"modules/Elezioni/images/edit.gif\"
111 border=\"0\"> "._EDIT."</a>]";
112 echo "</tr></form>";
113 $i++;
114 }
115 echo "</table>";
116 CloseTable();
117}
118
119function oper_admin() {
120 global $bgcolor1, $bgcolor2, $prefix, $dbi,$id_cons_gen;
121 $aid=$_SESSION['aid'];
122 $dbi=$_SESSION['dbi'];
123 $prefix=$_SESSION['prefix'];
124 $pwd=$_SESSION['pwd'];
125 $perms=ChiSei(0);
126 if ($perms==256) {
127 $aid2=$_GET['aid2'];
128 $do=$_GET['do'];
129 $id_comune2=$_GET['id_comune2'];
130 $permessi=$_GET['permessi'];
131 if ($do == "add") {
132 if ($aid2) {
133 $result = mysql_query("select * from ".$prefix."_ele_operatori where aid='$aid2'", $dbi);
134 $result = mysql_query("insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('0','0','$id_comune2','$permessi','$aid2')", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error());
135 Header("Location: admin.php?op=oper_admin&id_cons_gen=$id_cons_gen");
136 } else {
137 OpenTable();
138 echo "<center>"._GESTIONE." "._OPERATORI." aid=$aid2; ";
139 echo "<br><br><a href=\"admin.php?op=oper_admin&amp;id_cons_gen=$id_cons_gen\">"._IMM." "._OPERATORI."</a></center>";
140 CloseTable();
141 }
142 }else if ($do == "update") {
143 $result = mysql_query("update ".$prefix."_ele_operatori set permessi='$permessi' where id_cons='0' and aid='$aid2' ", $dbi) || die("<br><br>Errore di inserimento: ".mysql_error());
144 Header("Location: admin.php?op=oper_admin&id_cons_gen=$id_cons_gen");
145 }
146 }else die("Non ci provare...");
147}
148
149//****************************
150// switch
151//****************************
152 if ($do!="")
153 oper_admin();
154 include("modules/Elezioni/funzionidata.php");
155 include("modules/Elezioni/ele.php");
156 ele();
157 all();
158 include("footer.php");
159
160?>
161
Note: See TracBrowser for help on using the repository browser.