source: trunk/client/modules/Elezioni/menu.php

Last change on this file was 268, checked in by roby, 6 years ago

Adeguamento del programma alla gestione del Rosatellum. Comprende un aggiornamento del db per l'inserimento dei nuovi tipi di consultazione per camera e senato.
Chi ha creato nuovi tipi personalizzati di consultazione non deve applicare la patch al db ma aggiungere autonomamente anche queste due tipologie.
Come sempre si consiglia di effettuare un backup del db prima di applicare la patch.

File size: 11.4 KB
Line 
1<?php
2/************************************************************************/
3/* Eleonline - Raccolta e diffusione dei dati elettorali */
4/* by Luciano Apolito & Roberto Gigli */
5/* http://www.eleonline.it */
6/* info@eleonline.it luciano@aniene.net rgigli@libero.it */
7/************************************************************************/
8
9if (!defined('MODULE_FILE')) {
10 die ("You can't access this file directly...");
11}
12
13/************************
14Funzione Menu a cascata
15*************************/
16
17
18 // definizione variabile per button 'ok' nei form per il noscript
19 $button="<br /><object><noscript><div><input name=\"vai\" type=\"image\" src=\"modules/Elezioni/images/ok2.jpg\" alt=\"ok\" title=\"ok\" /></div></noscript></object>";
20
21 $sqlcomu="select descrizione,fascia from ".$prefix."_ele_comuni where id_comune=$id_comune";
22 $rescomu= mysql_query("$sqlcomu",$dbi);
23 list($descr_com,$fascia)=mysql_fetch_row($rescomu);
24
25
26
27 // inizio tabella
28 echo "<table class=\"table-main\"><tr>";
29 echo "<td >
30 <form id=\"m\" method=\"post\" action=\"modules.php\">
31 <div><label class=\"blu\" for=\"m\">
32 <input type=\"hidden\" name=\"name\" value=\"Elezioni\" />
33
34
35 <select name=\"op\" class=\"moduloform\" onclick=\"javascript:top.location.href='modules.php?name=Elezioni&amp;op='+this.options[this.options.selectedIndex].value\">";
36
37
38 echo "<option value=\"gruppo\" type=\"hidden\" > Home </option>";
39
40
41
42
43 echo "</select>$button</label></div></form>
44 </td>";
45
46 /***********************************
47 Scelta Comune
48 ***********************************/
49
50 if ($multicomune=='1')
51 {
52 $sqlcomu="select t1.id_comune,t1.descrizione,count(0) from ".$prefix."_ele_comuni as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_comune=t2.id_comune and t2.chiusa<2 group by t1.id_comune,t1.descrizione order by t1.descrizione asc";
53
54 $rescomu= mysql_query("$sqlcomu",$dbi);
55 $esiste_multi=mysql_num_rows($rescomu);
56 if ($esiste_multi>=1) {
57 echo " <td>
58 <form id=\"comuni\" method=\"post\" action=\"modules.php\">
59 <div><label class=\"blu\" for=\"comuni\">
60 <input type=\"hidden\" name=\"name\" value=\"Elezioni\" />
61 <input type=\"hidden\" name=\"op\" value=\"gruppo\" />
62 <input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\" />
63 <input type=\"hidden\" name=\"info\" value=\"$info\" />
64 <input type=\"hidden\" name=\"pag\" value=\"/modules.php?id_cons_gen=\" />
65 <input type=\"hidden\" name=\"file\" value=\"index\" />
66 <select name=\"op\" class=\"moduloform\" onchange=\"javascript:top.location.href='modules.php?name=Elezioni&amp;op=gruppo&amp;file=index&amp;id_comune='+this.options[this.options.selectedIndex].value\">
67 ";
68
69 while (list($id,$descrizione,)=mysql_fetch_row($rescomu)){
70 $sel=($id == $id_comune) ? "selected=\"selected\"":"";
71 echo "<option value=\"$id\" $sel >$descrizione</option>";
72 }
73
74 echo "</select>$button</label></div></form></td>";
75 }
76 } // fine scelta comune
77
78
79
80 /***********************************
81 Scelta Consultazione
82 ***********************************/
83
84
85 echo "<td >";
86 $res = mysql_query("SELECT t1.id_cons_gen,t1.descrizione FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune='$id_comune' and t2.chiusa!='2' order by t1.data_fine desc" , $dbi);
87 $esiste=mysql_num_rows($res);
88 //se esiste consultazione fa vedere i dati
89 if ($esiste>=1) {
90 echo "
91 <form id=\"consultazione\" method=\"post\" action=\"modules.php\">
92 <div><label for=\"consultazione\" class=\"blu\">
93 <input id=\"modulo\" type=\"hidden\" name=\"name\" value=\"Elezioni\" />
94 <input type=\"hidden\" name=\"op\" value=\"gruppo\" />
95 <input type=\"hidden\" name=\"minsez\" value=\"$minsez\" />
96 <input type=\"hidden\" name=\"offsetsez\" value=\"$offsetsez\" />
97 <input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\" />
98 <input type=\"hidden\" name=\"prima\" value=\"1\" />
99 <select name=\"id_cons_gen\" class=\"moduloform\" onchange=\"javascript:top.location.href='modules.php?op=gruppo&amp;name=Elezioni&amp;id_comune=$id_comune&amp;file=index&amp;id_cons_gen='+this.options[this.options.selectedIndex].value\">";
100
101 while(list($id,$descrizione) = mysql_fetch_row($res)) {
102
103 $sel = ($id == $id_cons_gen) ? "selected=\"selected\"":"";
104 echo "<option value=\"$id\" $sel >$descrizione</option>";
105 }
106
107 echo "</select>$button</label></div></form></td>";
108
109
110
111
112
113
114 /***********************************
115 Scelta Info
116 ***********************************/
117
118 echo "<td>";
119
120
121 echo "
122 <form id=\"info\" method=\"post\" action=\"modules.php\">
123 <div><label class=\"blu\" for=\"info\">
124 <input type=\"hidden\" name=\"name\" value=\"Elezioni\" />
125 <input type=\"hidden\" name=\"op\" value=\"come\" />
126 <input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\" />
127 <input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\" />
128 <input type=\"hidden\" name=\"file\" value=\"index\" />
129 <select name=\"op\" class=\"moduloform\" onchange=\"javascript:top.location.href='modules.php?id_cons_gen=$id_cons_gen&amp;name=Elezioni&amp;op=come&amp;id_comune=$id_comune&amp;file=index&amp;info='+this.options[this.options.selectedIndex].value\">";
130
131 echo "<option value=\"\" >----- "._INFO."</option>";
132
133 $temp = array('confronti'=>'','come'=>'','numeri'=>'','servizi'=>'','link'=>'','dati'=>'','affluenze_sez'=>'','votanti'=>'');
134 $temp[$info]='selected="selected"';
135 echo "<option value=\"confronti\" ".$temp['confronti']." >"._CONFRONTI."</option>";
136 echo "<option value=\"come\" ".$temp['come']." >"._COME."</option>";
137 echo "<option value=\"numeri\" ".$temp['numeri']." >"._NUMERI."</option>";
138 echo "<option value=\"servizi\" ".$temp['servizi']." >"._SERVIZI."</option>";
139 echo "<option value=\"link\" ".$temp['link']." >"._LINK."</option>";
140 echo "<option value=\"dati\" ".$temp['dati']." >"._DATI."</option>";
141 // tolte per circo da mettere bene
142 echo "<option value=\"affluenze_sez\" ".$temp['affluenze_sez']." >"._AFFLUENZE."</option>";
143 echo "<option value=\"votanti\" ".$temp['votanti']." >"._VOTANTI."</option>";
144
145 echo "</select>$button
146 </label></div></form></td>";
147 unset ($temp);
148 /***********************************
149 Scelta Dati
150 ***********************************/
151 $res = mysql_query("SELECT count(0) FROM ".$prefix."_ele_circoscrizione where id_cons='$id_cons' ", $dbi);
152 list($num_circ) = mysql_fetch_row($res);
153
154 echo "<td>";
155
156 echo "<form id=\"risultati\" method=\"post\" action=\"modules.php\">
157 <div><label class=\"blu\" for=\"risultati\">"; //._RISULTATI;
158 echo "<input type=\"hidden\" name=\"name\" value=\"Elezioni\" />
159 <input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\" />
160 <input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\" />
161 <input type=\"hidden\" name=\"file\" value=\"index\" />
162 <select name=\"op\" class=\"moduloform\" onchange=\"javascript:top.location.href='modules.php?id_cons_gen=$id_cons_gen&amp;name=Elezioni&amp;id_comune=$id_comune&amp;file=index&amp;op='+this.options[this.options.selectedIndex].value\">";
163
164 echo "<option value=\"\" >----- "._RISULTATI."</option>";
165 $temp = array('gruppo_circo'=>'','gruppo_sezione'=>'','lista_circo'=>'','lista_sezione'=>'','candidato_circo'=>'','candidato_sezione'=>'','consiglieri'=>'');
166 $temp[$op]='selected="selected"';
167
168 if ($genere!=4) {
169 if (!$circo and $num_circ>1)
170 echo "<option value=\"gruppo_circo\" ".$temp['gruppo_circo'].">".substr(_GRUPPO." "._PER." "._CIRCO,0,33)."</option>";
171 echo "<option value=\"gruppo_sezione\" ".$temp['gruppo_sezione'].">".substr(_GRUPPO." "._PER." "._SEZIONI,0,33)."</option>";
172 }
173 if (!$votol and $fascia>$limite){ // si vota per la lista
174 if ($genere>2) {
175 if (!$circo and $num_circ>1)
176 echo "<option value=\"lista_circo\" ".$temp['lista_circo']." >".substr(_LISTA." "._PER." "._CIRCO,0,33)."</option>";
177 echo "<option value=\"lista_sezione\" ".$temp['lista_sezione']." >".substr(_LISTA." "._PER." "._SEZIONI,0,33)."</option>";
178 }
179
180 }
181
182 if ($genere>3 and !$votoc) {
183 if (!$votoc){
184 if(!$circo and $num_circ>1)
185 echo "<option value=\"candidato_circo\" ".$temp['candidato_circo']." >".substr(_CONSI." "._PER." "._CIRCO,0,33)."</option>";
186 echo "<option value=\"candidato_sezione\" ".$temp['candidato_sezione']." >".substr(_CONSI." "._PER." "._SEZIONI,0,33)."</option>";
187
188 }
189 }
190 $resc = mysql_query("SELECT chiusa FROM ".$prefix."_ele_cons_comune where id_cons='$id_cons'" , $dbi);
191 list($chiusa)=mysql_fetch_row($resc);
192 if ($hondt>=1 and $chiusa==1) {
193 echo "<option value=\"consiglieri\" ".$temp['consiglieri']." >"._CALCONS."</option>";
194
195
196 }
197 echo "</select>$button
198 </label></div></form></td>";
199 unset ($temp);
200
201
202 /***********************************
203 Scelta Grafici
204 ***********************************/
205
206 echo "<td >";
207
208 $temp = array('affluenze_graf'=>'','graf_votanti'=>'','graf_gruppo'=>'','graf_lista'=>'','graf_candidato'=>'');
209 if(!isset($visgralista))
210 $temp[$op]='selected="selected"';
211 else $temp['graf_lista']='selected="selected"';
212 # <div><label class=\"blu\" for=\"grafici\">"._GRAFICI."
213
214 echo "<form id=\"grafici\" method=\"post\" action=\"modules.php\">
215 <div><label class=\"blu\" for=\"grafici\">
216 <input type=\"hidden\" name=\"name\" value=\"Elezioni\" />
217 <input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\" />
218 <input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\" />
219 <input type=\"hidden\" name=\"file\" value=\"index\" />
220 <select name=\"op\" class=\"moduloform\" onchange=\"javascript:top.location.href='modules.php?id_cons_gen=$id_cons_gen&amp;name=Elezioni&amp;id_comune=$id_comune&amp;file=index&amp;op='+this.options[this.options.selectedIndex].value\">";
221 echo "<option value=\"\" >----- "._GRAFICI."</option>";
222
223 echo "<option value=\"affluenze_graf\" ".$temp['affluenze_graf']." >"._AFFLUENZE."</option>";
224 echo "<option value=\"graf_votanti\" ".$temp['graf_votanti']." >"._VOTI."</option>";
225#inutile if($genere!=4 || $tipo_cons==8)
226 echo "<option value=\"graf_gruppo\" ".$temp['graf_gruppo']." >"._GRUPPO."</option>";
227 if(($genere==5 or $genere==3) and $fascia>$limite)
228 echo "<option value=\"graf_lista&amp;visgralista=1\" ".$temp['graf_lista'].">"._LISTA."</option>";
229 if ($genere>3){
230 if (!$circo && !$votog && !$votoc)
231 echo "<option value=\"graf_candidato\" ".$temp['graf_candidato']." >"._CONSI."</option>";
232 }
233 unset ($temp);
234
235 echo "</select>$button
236 </label></div></form></td>";
237
238 } // fine verifica esistenza consultazione : variabile $esiste
239
240
241
242 ################ tema #####
243 if ($tema_on=="1"){
244 echo "<td>";
245 include("modules/Elezioni/tema.php");
246 echo "</td>";
247 }
248
249
250 echo "</tr></table>";
251
252
253
254?>
Note: See TracBrowser for help on using the repository browser.