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

Last change on this file since 253 was 246, checked in by luc, 9 years ago

Corretti piccoli bug al tema Futura2

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