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

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