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

Last change on this file since 345 was 344, checked in by roby, 4 years ago

Segue modifiche per la compatibilità php7.x

File size: 6.8 KB
Line 
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;
18global $dbi;
19$aid=$_SESSION['aid'];
20$prefix=$_SESSION['prefix'];
21if (isset($_GET['do'])) $do=$_GET['do']; else $do='';
22
23$id_cons_gen=$_GET['id_cons_gen'];
24$perms=ChiSei(0);
25if ($perms!=256) die("Non hai i permessi per inserire dati!");
26if (isset($_GET['aid2'])) $aid2=addslashes($param['aid2']); else $aid2='';
27if (isset($_GET['id_sede'])) $id_sede=intval($_GET['id_sede']); else $id_sede='';
28if (isset($_GET['id_comune2'])) $id_comune2=intval($_GET['id_comune2']); else $id_comune2='';
29if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']); else $id_cons_gen='';
30
31
32$sql="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' ";
33$res = $dbi->prepare("$sql");
34$res->execute();
35list($tipo_cons) = $res->fetch(PDO::FETCH_NUM);
36
37$hiddenInfo = "<input type=\"hidden\" name=\"min\" value=\"$min\">";
38
39
40/******************************************************/
41/*Funzione di visualizzazione globale */
42/******************************************************/
43//crea la pagina delle affluenze
44function all() {
45 global $bgcolor1, $bgcolor2, $prefix,$aid2,$perms,$id_sede,$id_comune2,$id_cons_gen;
46 $aid=$_SESSION['aid'];
47 $dbi=$_SESSION['dbi'];
48 $prefix=$_SESSION['prefix'];
49
50 OpenTable();
51
52 $sql="SELECT id_comune,permessi FROM ".$prefix."_ele_operatori where id_cons='0' and aid='$aid' and id_comune='0'";
53 $resmod = $dbi->prepare("$sql");
54 $resmod->execute();
55 list ($id_comu,$permessi) = $resmod->fetch(PDO::FETCH_NUM);
56 if ($perms!=256)
57 {
58 Closetable();
59 return;
60 }
61 $sql="SELECT * FROM ".$prefix."_ele_operatori where id_cons=0 and id_comune>0";
62 $resmod = $dbi->prepare("$sql");
63 $resmod->execute();
64 echo "<table><tr></tr><hr><tr align=\"center\">";
65 echo "<td bgcolor=\"$bgcolor1\"><b>"._UTENTE."</b></td>"
66 ."<td bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>"
67 ."<td bgcolor=\"$bgcolor1\"><b>"._PERMESSI."</b></td>";
68 echo "<td bgcolor=\"$bgcolor1\"><b>"._FUNZIONI."</b></td></tr>";
69 echo "<form name=\"modello\" action=\"admin.php\">"
70 ."<input type=\"hidden\" name=\"op\" value=\"oper_admin\">";
71 echo "<tr align=\"center\">";
72 if ($aid2) {
73 echo "<input type=\"hidden\" name=\"aid2\" value=\"$aid2\"><td align=\"center\" width=\"32\">$aid2</td>";
74 }else{
75 echo "<td align=\"center\" width=\"32\"><input name=\"aid2\"></td>";
76 }
77 $sql="SELECT id_comune, descrizione from ".$prefix."_ele_comuni";
78 $ressede = $dbi->prepare("$sql");
79 $ressede->execute();
80 echo "<td><select name=\"id_comune2\">";
81 echo "<option value=\"\">";
82 while(list($id,$descr)=$ressede->fetch(PDO::FETCH_NUM)){
83 $sel= ($id == $id_comune2) ? "selected":"";
84 $arr[$id]="$descr";
85 echo "<option value=\"$id\" $sel>$descr";
86 }
87 echo "</select></td>";
88 echo "<td align=\"center\" width=\"32\"><select name=\"permessi\">";
89 $sel0='';$sel64='';
90 if($permessi=='0') $sel0="selected";elseif($permessi=='64') $sel64="selected";
91 echo "<option value=\"\">";
92 echo "<option value=\"64\" $sel64>"._ATTIVO;
93 echo "<option value=\"0\" $sel0>"._SOSPESO."</td>";
94 echo "</select></td>";
95 echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">";
96 if ($aid2) {
97 echo "<input type=\"hidden\" name=\"do\" value=\"update\">";
98 echo "<td><input type=\"submit\" name=\"add\" value=\""._MODIFY."\"></td></tr></form>";
99 }else{
100 echo "<input type=\"hidden\" name=\"do\" value=\"add\">";
101 echo "<td><input type=\"submit\" name=\"add\" value=\""._ADD."\"></td></tr></form>";
102 }
103 $i=1;
104 while (list($id_cons2,$id_sede2,$id_comune2,$perm,$utente) = $resmod->fetch(PDO::FETCH_NUM)){ //elenco dei modelli inseriti
105 $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
106 echo "<form name=\"modello$i\" action=\"admin.php\">"
107 ."<input type=\"hidden\" name=\"op\" value=\"oper_admin\">";
108 echo "<input type=\"hidden\" name=\"id_comune2\" value=\"$id_comune2\">";
109 echo "<input type=\"hidden\" name=\"aid2\" value=\"$utente\">";
110 echo "<input type=\"hidden\" name=\"permessi\" value=\"$perm\">";
111 echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">";
112 echo "<td width=\"32\"><b>$utente</b></td>";
113 echo "<td width=\"32\"><b>".$arr[$id_comune2]."</b></td>";
114 if ($perm==64) {$perm_text=_ATTIVO;}else{$perm_text=_SOSPESO;}
115 echo "<td width=\"32\"><b>$perm_text</b></td>";
116 echo "</td><td nowrap>[<a
117 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\"
118 border=\"0\"> "._EDIT."</a>]";
119 echo "</tr></form>";
120 $i++;
121 }
122 echo "</table>";
123 CloseTable();
124}
125
126function oper_admin() {
127 global $bgcolor1, $bgcolor2, $prefix, $dbi,$id_cons_gen;
128 $aid=$_SESSION['aid'];
129 $dbi=$_SESSION['dbi'];
130 $prefix=$_SESSION['prefix'];
131 $pwd=$_SESSION['pwd'];
132 $perms=ChiSei(0);
133 if ($perms==256) {
134 $aid2=$_GET['aid2'];
135 $do=$_GET['do'];
136 $id_comune2=$_GET['id_comune2'];
137 $permessi=$_GET['permessi'];
138 if ($do == "add") {
139 if ($aid2) {
140 $sql="insert into ".$prefix."_ele_operatori (id_cons,id_sede,id_comune,permessi,aid) values ('0','0','$id_comune2','$permessi','$aid2')";
141 $res = $dbi->prepare("$sql");
142 $res->execute();
143 Header("Location: admin.php?op=oper_admin&id_cons_gen=$id_cons_gen");
144 } else {
145 OpenTable();
146 echo "<center>"._GESTIONE." "._OPERATORI." aid=$aid2; ";
147 echo "<br><br><a href=\"admin.php?op=oper_admin&amp;id_cons_gen=$id_cons_gen\">"._IMM." "._OPERATORI."</a></center>";
148 CloseTable();
149 }
150 }else if ($do == "update") {
151 $sql="update ".$prefix."_ele_operatori set permessi='$permessi' where id_cons='0' and aid='$aid2' ";
152 $res = $dbi->prepare("$sql");
153 $res->execute();
154 Header("Location: admin.php?op=oper_admin&id_cons_gen=$id_cons_gen");
155 }
156 }else die("Non ci provare...");
157}
158
159//****************************
160// switch
161//****************************
162 if ($do!="")
163 oper_admin();
164 include("modules/Elezioni/funzionidata.php");
165 include("modules/Elezioni/ele.php");
166 ele();
167 all();
168 include("footer.php");
169
170?>
171
Note: See TracBrowser for help on using the repository browser.