source: trunk/admin/modules/Elezioni/ele.php@ 258

Last change on this file since 258 was 258, checked in by roby, 6 years ago
File size: 13.2 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 menu */
9/* Amministrazione */
10/************************************************************************/
11
12if (!defined('ADMIN_FILE')) {
13 die ("You can't access this file directly...");
14}
15if (!ini_get("register_globals")) {
16 $php_ver = phpversion();
17 $php_ver = explode(".", $php_ver);
18 $phpver = "$php_ver[0]$php_ver[1]";
19 if ($phpver >= 41) {
20 $PHP_SELF = $_SERVER['PHP_SELF'];
21 }
22}
23global $dbi;
24$aid=$_SESSION['aid'];
25#$dbi=$_SESSION['dbi'];
26$id_comune=$_SESSION['id_comune'];
27$prefix=$_SESSION['prefix'];
28$currentlang=$_SESSION['lang'];
29$bgcolor1=$_SESSION['bgcolor1'];
30$bgcolor2=$_SESSION['bgcolor2'];
31$bgcolor1='#e7e7e7';
32$param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
33
34if (!isset($id_cons_gen)) if (isset($param['id_cons_gen'])) $id_cons_gen=$param['id_cons_gen'];else $id_cons_gen='0';
35$perms=ChiSei($id_cons_gen);
36
37##modifica
38if ($perms>128){
39 if (isset($param['id_comune']) && intval($param['id_comune'])>0) {
40 $id_comune=intval($param['id_comune']);
41 $_SESSION['id_comune']=$id_comune;
42 }
43}
44include_once("modules/Elezioni/query.sql");
45
46$row=setconsultazione(); $tipo_cons=$row[0]; $descr_cons=$row[1];$id_cons_gen=$row[2];
47$row=tipocons(); $genere=$row[0];$votog=$row[1];$votol=$row[2];$votoc=$row[3];$conscirc=$row[4];
48
49if (!$perms) $perms=ChiSei($id_cons_gen);
50 //include("modules/Elezioni/language/lang-$currentlang.php");
51 //**************************************************************************
52 // ELE
53 //**************************************************************************
54
55
56function ele() {
57
58 global $espandi, $aid, $bgcolor1, $bgcolor2,$bgcolor5, $prefix, $dbi, $offset, $min,$descr_cons, $id_cons_gen,$tipo_cons,$genere,$op,$id_comune,$perms,$id_cons,$votog,$votol,$votoc,$votocirc,$tema,$fascia;
59
60 include ("header.php");
61# include("modules/Elezioni/testa.php");
62 //immagine bullet
63 $bullet="<img src=\"temi/$tema/images/bullet.gif\" alt =\" \" align=\"left\" border=\"0\">";
64 $bullet_red="<img src=\"temi/$tema/images/bullet_red.gif\" alt =\" \" align=\"left\" border=\"0\">";
65 $bgcolor1='#e7e7e7';
66 $row=descr_comune();$descr_comu=$row['descrizione'];
67
68 $row=daticonscom();
69 if (isset($row['fascia'])) $fascia=$row['fascia'];
70 else
71 $fascia=0;
72 $otable= "<table bgcolor=\"$bgcolor1\" width=\"100%\" cellpadding=\"0\" cellspacing=\"2\" BORDER=\"0\">\n <tr><td>&nbsp;&nbsp;&nbsp;</td><td valign=\"top\" align=\"left\">";
73 $otable1= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"2\" BORDER=\"0\">\n <tr><td valign=\"top\" width=\"180\">";
74 $ctable= "</td></tr></table>";
75$currentlang=$_SESSION['lang'];
76
77
78
79 echo "<form name=\"scelta\" action=\"admin.php\">";
80 echo $otable;
81 echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?id_cons_gen=\">";
82 echo "<input type=\"hidden\" name=\"op\" value=\"ele\">";
83###########################
84$row=elenco_cons();
85
86
87##################################
88 echo "<font size=-1><b>"._SCELTA_CONS.":</b> </font><select name=\"id_cons_gen\" onChange=\"top.location.href=this.form.pag_cons.value+this.form.id_cons_gen.options[this.form.id_cons_gen.selectedIndex].value;return false\">";
89
90 foreach ($row as $riga)
91 {
92 $id=$riga[0];$descrizione=$riga[1];$gen2=$riga[2];$idgen=$riga[3];$chiusa=$riga[4];
93# while(list() = mysql_fetch_row($res)) {
94 if (($chiusa==0) OR ($perms>32)) {
95 if (($idgen==$id_cons_gen or !$id_cons_gen)) {
96 $sel = "selected";
97 $genere=$gen2;
98 $id_cons_gen=$idgen;
99 } else {
100 $sel = "";
101 }
102 echo "<option value=\"$idgen\" $sel>$descrizione";
103 }
104 }
105 echo "</select>";
106 // controllo delle opzioni utilizzabili: sono quelle che hanno genitori in quella precedente
107 // esempio si possono inserire i candidati solo se prima sono state inserite le liste
108 $sql="select count(0) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons";
109 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrcirco=$row[0];}
110 catch(PDOException $e) {$nrcirco=0; }
111 $sql="select count(0) from ".$prefix."_ele_sede where id_cons=$id_cons";
112 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrsede=$row[0];}
113 catch(PDOException $e) {$nrsede=0; }
114 $sql="select count(0) from ".$prefix."_ele_gruppo where id_cons=$id_cons";
115 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrgruppo=$row[0];}
116 catch(PDOException $e) {$nrgruppo=0; }
117 $sql = "select count(0) from ".$prefix."_ele_lista where id_cons=$id_cons";
118 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrlista=$row[0];}
119 catch(PDOException $e) {$nrlista=0; }
120 $sql = "SELECT sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons";
121 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH); $nraff=$row[0];}
122 catch(PDOException $e) {$nraff=0; }
123 if ($genere==0) $tmpval='voti_ref'; else $tmpval='sezioni';
124 $sql = "SELECT sum(validi) from ".$prefix."_ele_$tmpval where id_cons=$id_cons";
125 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrvoti=$row[0];}
126 catch(PDOException $e) {$nrvoti=0; }
127 unset($row);
128 if ($perms==256) // il superuser puo' scegliere il comune su cui lavorare
129 {
130 $row=elenco_comuni();
131 echo "<select name=\"id_comune\" onChange=\"top.location.href=this.form.pag_cons.value+$id_cons_gen+'&amp;id_comune='+this.form.id_comune.options[this.form.id_comune.selectedIndex].value;return false\"><option value=\"\">";
132 foreach($row as $riga)
133 {
134 $id=$riga[0];$descrizione=$riga[1];
135 $sel=($id == $id_comune) ? "selected":"";
136 echo "<option value=\"$id\" $sel>$descrizione";
137 }
138 }
139 echo "</select>";
140 echo $ctable;
141 echo "</form>";
142
143
144 echo "<br>";
145
146 echo $otable1;
147 echo "<table width=\"180\" align=\"left\"><tr><td><table>";
148 echo "<tr align=\"left\" bgcolor=\"$bgcolor1\"><td valign=\"top\" align=\"left\" width=\"150\" colspan=\"2\">
149 <a href=\"admin.php?op=$op&amp;id_cons_gen=$id_cons_gen&amp;help=1\">$bullet"._HELP."</a>
150 </td></tr>";
151
152 if ($perms>128) {
153
154
155# <a href=\"admin.php?op=inscollegi&amp;id_cons_gen=$id_cons_gen\">$bullet"._COLLEGI."</a><br>
156
157 echo "
158 <tr align=\"left\" bgcolor=\"$bgcolor1\">
159 <td valign=\"top\" align=\"center\" bgcolor=\"#000000\" rowspan=\"3\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._SUPER."
160
161 </b></font></font>
162
163 </td>
164<td valign=\"top\" align=\"left\" width=\"150\">
165
166
167 <a href=\"admin.php?op=configurazione&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONFIGURAZIONE."</a><br>";
168 if($op=="configurazione" || $op=="widget" || $op=="plugin"){
169 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - <a href=\"admin.php?op=widget&amp;id_cons_gen=$id_cons_gen\"> "._WIDGET."</a>";
170 echo "<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - "._PLUGINS."";
171 echo "<hr>";
172 }
173 echo "
174 <a href=\"admin.php?op=constipi&amp;id_cons_gen=$id_cons_gen\">$bullet"._TIPO_ADM."</a><br>
175 <a href=\"admin.php?op=confconsiglio&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONFCONS."</a>
176 </td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
177 <a href=\"admin.php?op=inscomuni&amp;id_cons_gen=$id_cons_gen\">$bullet"._DEFCOMUNE."</a><br>
178 <a href=\"admin.php?op=oper_admin&amp;id_cons_gen=$id_cons_gen\">$bullet"._AMMINISTRATORI."</a>
179 </td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
180 <a href=\"admin.php?op=consultazione&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONSULTAZIONE_ADM."</a><br>
181
182 <a href=\"admin.php?op=rec_add_aff&amp;id_cons_gen=$id_cons_gen\">$bullet"._AFFLUENZE."</a><br>
183 <a href=\"admin.php?op=associazioni&amp;id_cons_gen=$id_cons_gen\">$bullet"._INSCOMUNE."</a><br>
184 <a href=\"http://www.eleonline.it/portal/segnala.php?tmp=test123\" target=\"_blank\">$bullet_red <b>"._SEGNALA."</b></a>
185 </td></tr>";
186# <a href=\"admin.php?op=backup&amp;id_cons_gen=$id_cons_gen\">$bullet"._BACKUP."</a><br>
187# <a href=\"admin.php?op=restore&amp;id_cons_gen=$id_cons_gen\">$bullet"._RESTORE."</a>
188
189 }
190// Amministrazione locale solo superuser e adminuser
191 if ($perms>16 and ! $espandi) {
192 echo "
193 <tr bgcolor=\"$bgcolor1\">
194 <td valign=\"top\" align=\"center\" bgcolor=\"#000000\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._ADMIN."
195
196 </b></font></font>
197
198 </td>
199 <td valign=\"top\">";
200 if ($perms>32) {
201 echo "<a href=\"admin.php?op=cons_comuni&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONSULTAZIONI."</a><br>
202 <a href=\"admin.php?op=scarica&amp;id_cons_gen=$id_cons_gen\">$bullet"._SCARICA."</a><br>";
203# if($nrgruppo==0 and $nrlista==0)
204 echo "<a href=\"admin.php?op=importa&amp;id_cons_gen=$id_cons_gen\">$bullet"._IMPORTA."</a><br>";
205 echo "<a href=\"admin.php?op=operatori&amp;id_cons_gen=$id_cons_gen\">$bullet"._OPERATORI."</a> <br><a href=\"admin.php?op=permessi&amp;id_cons_gen=$id_cons_gen\">$bullet"._PERMESSI."</a> <br>";
206 }
207 echo "<a href=\"admin.php?op=come&amp;vai=come&amp;id_cons_gen=$id_cons_gen\">$bullet "._COME."</a> <br>
208 <a href=\"admin.php?op=numeri&amp;vai=numeri&amp;id_cons_gen=$id_cons_gen\">$bullet "._NUMERI."</a> <br>
209 <a href=\"admin.php?op=servizi&amp;vai=servizi&amp;id_cons_gen=$id_cons_gen\">$bullet "._SERVIZI."</a> <br>
210 <a href=\"admin.php?op=link&amp;vai=link&amp;id_cons_gen=$id_cons_gen\">$bullet "._LINK."</a> <br>
211 <a href=\"admin.php?op=circo&amp;id_cons_gen=$id_cons_gen\">
212
213 $bullet"._CIRCO."</a> <br>";
214 if ($nrcirco){
215 echo "<a href=\"admin.php?op=sede&amp;id_cons_gen=$id_cons_gen\">$bullet "._SEDE."</a> <br>";
216 if ($nrsede){
217 echo "<a href=\"admin.php?op=sezione&amp;id_cons_gen=$id_cons_gen\">$bullet "._SEZIONE."</a><br>";
218 }
219 }
220 if ($genere!=4) { //gestisce gruppi if ($tipo_cons!=8){ $genere!=2 and
221 echo "<a href=\"admin.php?op=gruppo&amp;id_cons_gen=$id_cons_gen\">$bullet "._GRUPPO."</a><br>";
222 }
223
224 if ($genere>2 or $genere==1){ ####prova
225 if ($genere==4 or $nrgruppo){ // or $tipo_cons==10 or $tipo_cons==11){
226 echo "
227 <a href=\"admin.php?op=lista&amp;id_cons_gen=$id_cons_gen\">$bullet "._LISTA."</a> <br>";
228 if ($genere>2){ ####prova
229 if ($nrlista){
230 echo "<a href=\"admin.php?op=candidato&amp;id_cons_gen=$id_cons_gen\">$bullet"._CANDIDATO."</a> <br>";
231 }else{
232 echo "$bullet "._CANDIDATO." ";
233 }
234 }
235 }else{
236 echo "
237 $bullet"._LISTA." <br>";
238 echo "$bullet "._CANDIDATO." <br>";
239
240 }
241
242 }
243
244 echo "</td></tr>";
245 }
246
247
248 //Amministrazione normale operatore
249 echo "<tr bgcolor=\"$bgcolor1\">
250 <td valign=\"top\" align=\"center\" bgcolor=\"#000000\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._OPER."
251
252 </b></font></font>
253
254 </td>
255 <td valign=\"top\" width=\"150\">";
256 if ($op!='consultazione' and $perms>0 and $nrcirco and ($nrlista or $nrgruppo)) {
257 echo "<a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;do=spoglio\">$bullet "._GEST." "._SPOGLIO."</a><br>";
258 if ($nraff) {
259 echo "<a href=\"admin.php?op=controllo_votanti&amp;id_cons_gen=$id_cons_gen\">$bullet "._STATO." "._AFFLUENZE."</a><br>";
260 }else{
261 echo "<img src=\"modules/Elezioni/images/site.gif\" alt =\" \" align=\"center\" border=\"0\"> "._STATO." "._AFFLUENZE."<br>";
262 }
263 if ($nrvoti) {
264 echo "<a href=\"admin.php?op=controllo_voti&amp;id_cons_gen=$id_cons_gen\">$bullet "._STATO." "._VOTI."</a><br>";
265 }else{
266 echo "<img src=\"modules/Elezioni/images/site.gif\" alt =\" \" align=\"middle\" border=\"0\"> "._STATO." "._VOTI."<br>";
267 }
268 echo "<a href=\"admin.php?op=riepilogo&amp;id_cons_gen=$id_cons_gen\">$bullet "._RIEPILOGO."</a><br>";
269 if($tipo_cons==18 or $tipo_cons==19)
270 echo "<a href=\"admin.php?op=riepilogovoti&amp;id_cons_gen=$id_cons_gen\">$bullet Tabella dei Totali </a><br>";
271 }
272
273
274 echo "<br><a href=\"admin.php?op=cambiopwd&amp;id_cons_gen=$id_cons_gen\">$bullet"._CAMBIOPWD."</a><br>";
275
276 if (file_exists("../client/modules.php"))
277 echo "<hr><a href=\"../client/modules.php?id_comune=$id_comune&amp;id_cons_gen=$id_cons_gen\" target=\"_blank\">$bullet Guarda il sito</a><br><hr>";
278
279 //echo "<hr /><a href=\"../client/modules.php\" target=\"_blank\">$bullet Guarda il sito</a><br /><hr />";
280 echo "<a href=\"admin.php?op=logout\">$bullet "._ESCI.$_SESSION['aid']."</a>";
281 echo "</td></tr></table>";
282 // continua la tabella su ele.voti con le sezioni
283 // altrimenti inizia la tabella centrale
284
285 if ($op!="voti")
286 echo "</td></tr></table></td><td valign=\"top\" align=left>";
287
288}
289
290 switch ($op){
291 case "ele":
292 ele();
293 global $language;
294 include("language/$currentlang/ele.html");
295 echo"</td></tr></table>";
296 include("footer.php");
297
298 break;
299
300 }
301
302
303?>
Note: See TracBrowser for help on using the repository browser.