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