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

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