source: trunk/client/temi/Futura2/index.php@ 268

Last change on this file since 268 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: 17.9 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
9$nometema=$tema;
10require_once("class/db/db.php"); //classe db
11global $tema,$id_comune,$descr_cons,$genere,$tipo_cons,$multicomune;
12
13# colore tema mobile
14
15
16include("temi/$tema/config.php");
17
18#if($colortheme=='')$colortheme="c";
19# descrizione comune
20if(!$id_comune or $id_comune=='') $id_comune=$siteistat;
21$res = $db->sql_query("SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ");
22list($descr_com) = $db->sql_fetchrow($res);
23
24
25####################################
26function testata(){
27####################################
28
29global $op,$tema,$db,$nometema,$file,$bgcolor,$sitename,$dbi,$prefix,$blocco,$lang,$siteistat,$id_cons_gen,$descr_cons,$minsez,$offsetsez,$multicomune,$id_comune,$multicomune,$rss,$colortheme,$descr_com;
30
31include("temi/$tema/function_theme.php");
32
33$numerodisezioni=numerodisezioni();
34
35$logo= "<img src=\"modules.php?name=Elezioni&amp;file=foto&amp;id_comune=".$id_comune."\" alt=\"logo\" width=\"70\" align=\"left\"/>";
36
37$res = $db->sql_query("SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ");
38 list($descr_com) = $db->sql_fetchrow($res);
39 $descr_com =stripslashes($descr_com);
40
41echo '
42<div data-role="page" data-theme="a">
43 <div data-role="header" data-position="inline">';
44
45 /*
46 if($op!="gruppo")
47 echo '<a href="#" onClick="javascript:history.back()" data-role="button" data-icon="arrow-left">indietro</a>';
48 else echo '<a href="modules.php?tema=facebook" target="_blank" data-icon="off" data-role="button">Vers Web</a>';
49 */
50 //
51 # se aperta o sezioni scrutinate
52 # se non Ú il menu di config o about sceglie elezione
53 if($numerodisezioni[0]>0 and $op!="conf_mob" and $op!="about"){
54 echo '<a href="#" data-role="button">sezioni <img src="modules/Elezioni/grafici/ledex1.php?sez='.$numerodisezioni[0].'&max='.$numerodisezioni[1].'" /></a><h2></h2>';
55 }else{
56 echo '<h2>Elezioni on line</h2>';
57 }
58
59 echo '<a href="modules.php?name=Elezioni&op=about&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-theme="c" data-icon="user">About</a>';
60
61
62####### menu in alto
63# definizione attivo
64
65
66if($op=="gruppo" ) $active_home=" class=\"ui-btn-active\""; else $active_home='';
67if($op=="informazioni" || $op=="dati_generali" || $op=="come_si_vota" || $op=="numeri_mob" || $op=="servizi_mob") $active_info=" class=\"ui-btn-active\""; else $active_info='';
68if($op=="risultati" || $op=="affluenze_all" || $op=="gruppo_mob" || $op=="candidato_mob" || $op=="liste_mob" || $op=="votanti_mob") $active_ris=" class=\"ui-btn-active\""; else $active_ris='';
69if($op=="conf_mob" ) $active_conf=" class=\"ui-btn-active\""; else $active_conf='';
70if($op=="grafica_mob" ) $active_graf=" class=\"ui-btn-active\""; else $active_graf='';
71
72
73
74echo ' <div data-role="navbar">
75 <ul>
76 <li><a href="modules.php?id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'?" data-icon="home" data-theme="'.$colortheme.'" '.$active_home.' >Home</a></li>
77 <li><a href="modules.php?op=informazioni&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-icon="file" data-theme="'.$colortheme.'" '.$active_info.' >Info</a></li>
78 <li><a href="modules.php?op=risultati&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-icon="list" data-theme="'.$colortheme.'" '.$active_ris.' >Risultati</a></li>
79 <li><a href="modules.php?op=grafica_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'"" data-icon="th-large" data-theme="'.$colortheme.'" '.$active_graf.'>Grafica</a></li>
80 <li><a href="modules.php?op=conf_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-icon="cogs" data-theme="'.$colortheme.'" '.$active_conf.' >Opzioni</a></li>
81 </ul>
82 </div>
83</div>';
84
85
86# se non Ú il menu di config o about sceglie elezione
87if($op!="conf_mob" and $op!="about"){
88 echo'<div data-role="fieldcontain" style="text-align:center;">
89 <span style="text-align:center;width:100%;height:110px;background-color:#fff;color:#000;">'.$logo.' Comune di '.$descr_com.'</span>';
90
91
92
93 $res = $db->sql_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" );
94 $esiste=$db->sql_numrows($res);
95
96 echo " <form method=\"post\" action=\"modules.php\">
97<label for=\"consultazione\">
98
99 <input id=\"modulo\" type=\"hidden\" name=\"name\" value=\"Elezioni\" />
100 <input type=\"hidden\" name=\"prima\" value=\"1\" />
101 <select name=\"id_cons_gen\" id=\"select-choice-a\"
102 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\">";
103
104 while(list($id,$descrizione) = $db->sql_fetchrow($res)) {
105 $descrizione=substr(str_replace("+"," ",$descrizione),0,30);
106 $sel = ($id == $id_cons_gen) ? "selected=\"selected\"":"";
107 echo "<option style=\"font-size:12px;\" value=\"$id\" $sel >$descrizione</option>";
108 }
109
110 echo '</select></label></form>
111
112 </div>';
113} # fine form scelta elezioni
114
115
116
117if($op=="gruppo")home();// leggi il file config.php
118elseif($op=="informazioni")info();
119elseif($op=="affluenze")affluenze();
120elseif($op=="dati_generali")dati_generali();
121elseif($op=="risultati")risultati();
122elseif($op=="grafica_mob")grafica_mob();
123elseif($op=="come_si_vota")come_si_vota();
124elseif($op=="numeri_mob")numeri_mob();
125elseif($op=="servizi_mob")servizi_mob();
126elseif($op=="affluenze_all")affluenze_all();
127elseif($op=="gruppo_mob")gruppo_mob();
128elseif($op=="candidato_mob")candidato_mob();
129elseif($op=="liste_mob")liste_mob();
130elseif($op=="votanti_mob")votanti_mob();
131elseif($op=="conf_mob")conf_mob();
132elseif($op=="about")about();
133elseif($op=="grafvotanti_mob")grafvotanti_mob();
134elseif($op=="grafgruppo")grafgruppo();
135elseif($op=="grafsezione")grafsezione();
136
137footer_mon();
138
139die();
140}
141
142
143function footer_mon(){
144global $id_comune,$id_cons_gen,$tema,$colortheme,$rss;
145
146echo '
147<div data-role="footer" data-theme="a" style="marig:0 auto; text-align:center;">
148 <div data-role="footer" data-position="inline" data-icon="cogs">';
149
150 echo ' <h5><a href="http://www.eleonline.it" target="_blank">Eleonline</a> <span style="font-size:12px;"> di luciano apolito & roberto gigli</span></h5></div>';
151
152if($tema=="Futura2")
153 //echo'<a href="backtoapp.html" data-rel="external" data-ajax="false">Chiudi</a>'; // per l'app precedente non piu usata
154 echo '&nbsp;<a href="modules.php?name=Elezioni&tema=facebook&nocell=1" data-rel="external" data-ajax="false" >Versione Desktop</a>';
155else
156 echo '&nbsp;<a href="modules.php?name=Elezioni&tema=facebook&desktop=1" data-rel="external" data-ajax="false" >Versione Desktop</a>';
157 echo'</div>';
158}
159
160
161
162#######################################
163####################################### inizio funzioni menu
164#######################################
165
166
167
168############################ menu home page
169function home(){
170global $id_comune,$id_cons_gen,$tema,$colortheme;
171//include("temi/$tema/config.php");
172
173echo '<div data-role="content" data-theme="a">
174<a href="modules.php?op=informazioni&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">Informazioni Elettorali</a>
175<!-- <a href="modules.php?op=affluenze&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="heart">Ultima Affluenza</a> -->
176<a href="modules.php?op=risultati&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">Risultati Elettorali</a>
177</div>';
178echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
179 //graf_gruppo_mob();
180 echo "</ul>";
181echo '';
182
183}
184
185
186
187
188
189############################### menu informazioni
190function info(){
191global $id_comune,$id_cons_gen,$colortheme;
192echo '
193<div data-role="content" data-theme="a">
194<a href="modules.php?op=dati_generali&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">
195Dati Generali</a>
196<a href="modules.php?op=come_si_vota&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">
197Come si Vota</a>
198<a href="modules.php?op=numeri_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">
199Numeri Utili</a>
200<a href="modules.php?op=servizi_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">
201Servizi Utili</a>
202</div>
203';
204
205}
206
207####################################### menu risultati
208function risultati(){
209global $id_comune,$id_cons_gen,$genere,$tipo_cons,$colortheme,$votoc;
210echo '<div data-role="content" data-theme="'.$colortheme.'">
211<a href="modules.php?op=affluenze_all&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">Affluenze</a>
212<a href="modules.php?op=votanti_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">Votanti</a>
213<a href="modules.php?op=gruppo_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">'._GRUPPO.'</a>';
214
215 if($genere==3 OR $genere==5)
216 echo '<a href="modules.php?op=liste_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" " data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">'._LISTA.'</a>';
217 if(($genere==3 OR $genere==5) and !$votoc)
218 echo '<a href="modules.php?op=candidato_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" " data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">'._CANDIDATO.'</a>';
219
220
221echo'</div>
222';
223
224}
225
226####################################### menu grafica
227function grafica_mob(){
228global $id_comune,$id_cons_gen,$genere,$tipo_cons,$colortheme;
229echo '<div data-role="content" data-theme="'.$colortheme.'">
230
231<a href="modules.php?op=grafsezione&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">Elenco Sezioni scrutinate</a>
232
233<a href="modules.php?op=affluenze&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">Grafica Affluenze</a>
234<a href="modules.php?op=grafvotanti_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">Grafica Votanti</a>';
235/*
236<a href="modules.php?op=grafgruppo&grafica=0&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">'._GRUPPO.'</a>';
237
238 if($genere==3 OR $genere==5)
239 echo '<a href="modules.php?op=liste_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" " data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">'._LISTA.'</a>';
240 if(($genere==3 OR $genere==5) and $tipo_cons!="1" or $tipo_cons>="11")
241 echo '<a href="modules.php?op=candidato_mob&id_comune='.$id_comune.'&id_cons_gen='.$id_cons_gen.'" " data-role="button" data-theme="'.$colortheme.'" data-icon="arrow-right" data-iconpos="right">'._CANDIDATO.'</a>';
242*/
243
244echo'</div>';
245
246
247}
248
249
250#######################################
251####################################### inizio funzioni visualizzazione
252#######################################
253
254
255# affluenza unica x grafica
256function affluenze(){
257 global $tema;
258 affluenza_unica();
259 grafica_mob();
260}
261
262# votanti x menu grafica
263
264function grafvotanti_mob(){
265 global $tema,$db,$prefix,$colortheme;
266 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
267
268 votanti_mobile();
269 echo "</ul>";
270 grafica_mob();
271
272}
273
274# gruppo per menu grafica
275function grafgruppo(){
276 global $tema,$db,$prefix,$colortheme;
277 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
278 graf_gruppo_mob();
279 echo "</ul>";
280 grafica_mob();
281
282}
283
284# gruppo per menu grafica
285function grafsezione(){
286 global $tema,$db,$prefix,$colortheme;
287 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
288 graf_sezioni();
289 echo "</ul>";
290 grafica_mob();
291
292}
293
294
295
296
297############ menu informazioni
298############
299
300function dati_generali(){
301 global $tema,$colortheme;
302 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
303
304 dati_mob_fun();
305 echo "</ul>";
306 info();
307}
308
309function come_si_vota(){
310 global $tema,$colortheme;
311 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
312 come_mob("come");
313 echo "</ul>";
314 info();
315}
316
317function numeri_mob(){
318 global $tema,$colortheme;
319 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
320 come_mob("numeri");
321 echo "</ul>";
322 info();
323}
324
325function servizi_mob(){
326 global $tema,$colortheme;
327 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
328 come_mob("servizi");
329 echo "</ul>";
330 info();
331}
332
333
334
335
336
337######## menu risultati
338########
339
340function affluenze_all(){
341 global $tema,$colortheme;
342 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
343
344 affluenze_mob();
345 echo "</ul>";
346 risultati();
347}
348
349function votanti_mob(){
350 global $tema,$db,$prefix,$colortheme;
351 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
352 votanti_tabella();
353 risultati();
354 echo "</ul>";
355}
356
357
358# risultati semplici gruppo
359function gruppo_mob(){
360 global $tema,$colortheme;
361 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
362 graf_gruppo_mob();
363 //graf_risultati();
364 echo "</ul>";
365 risultati();
366}
367
368function liste_mob(){
369 global $tema,$colortheme;
370 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
371 //echo '<div data-role="content" data-theme="a"><p>';
372 graf_liste_mob();
373 echo "</ul>";
374 risultati();
375}
376
377
378function candidato_mob(){
379 global $tema,$colortheme;
380 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
381 graf_candidato_mob();
382 echo "</ul>";
383 risultati();
384}
385
386
387function conf_mob(){
388###############################################
389# scelta comune in caso di multicomune tema
390global $multicomune,$tema,$prefix,$db,$colortheme,$id_cons_gen,$info,$id_comune,$rss;
391
392echo "<center>
393 <div data-role=\"fieldcontain\" style=\"margin:0 auto;text-align:center;\">
394 <form method=\"post\" action=\"modules.php\">";
395
396
397
398if ($multicomune=='1')
399 {
400
401 $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";
402
403 $rescomu= $db->sql_query($sqlcomu);
404 $esiste_multi=$db->sql_numrows($rescomu);
405 if ($esiste_multi>=1) {
406
407 echo " <input type=\"hidden\" name=\"id_comune\" value=\"$id_comune\" />
408 <input type=\"hidden\" name=\"id_cos_gen\" value=\"$id_cons_gen\" />
409 <input type=\"hidden\" name=\"op\" value=\"gruppo\" />
410 <select name=\"id_comune\" data-native-menu=\"false\">
411 <option>Scegli il comune</option>";
412
413 while (list($id,$descrizione,)=mysql_fetch_row($rescomu)){
414 // $sel=($id == $id_comune) ? "selected=\"selected\"":"";
415 echo "<option value=\"$id\" $sel >$descrizione</option>";
416 }
417
418 echo "</select>";
419 }
420 }
421
422### colore tema
423# colore del tema
424# la variabile rss, non usta in questo tema, Ú stata presa in prestito per determinare il colore del tema
425
426 echo "<select name=\"rss\" data-native-menu=\"false\" > ";
427 echo "<option>Scegli il colore del tema</option>";
428 echo "<option value=\"2\" $selez >Blu</option>";
429 echo "<option value=\"3\" $selez >Rosso</option>";
430 echo "<option value=\"4\" $selez >Verde</option>";
431 echo "<option value=\"5\" $selez >Ciano</option>";
432 echo "<option value=\"6\" $selez >Giallo</option>";
433 echo "<option value=\"7\" $selez >Grigio</option>";
434 echo '</select><p>
435 <fieldset class="ui-grid-a" >
436 <div class="ui-block-b" style=width:100%;><button type="submit" data-theme="'.$colortheme.'">Conferma</button></div></fieldset>
437 </p></form></div></center>';
438}
439
440function about(){
441###############################################
442# scelta comune in caso di multicomune tema
443global $tema,$db,$prefix,$colortheme,$id_comune,$descr_com;
444
445 echo '<ul data-role="listview" data-inset="true" data-divider-theme="'.$colortheme.'">';
446 echo "<li style=\"text-align:center;\" data-role=\"list-divider\" data-icon=\"arrow-up\" >";
447 echo "<b>About e Credits</b></li>";
448 echo "<div data-role=\"content\" data-theme=\"$colortheme\">";
449 echo "<a href=\"http://www.eleonline.it\">
450 <img src=\"temi/$tema/images/mobile.jpg\" align=\"left\">EleONLine</a><br/>
451
452 Software Open Source per ogni elezione<br/>
453 di <a href=\"mailto:luciano@linuxap.it\">Luciano Apolito</a> &
454 <a href=\"mailto:rgigli@libero.it\">Roberto Gigli</a><br/>
455 <i>stai usando lo \"Smartphone theme <b>FUTURA n.2</b>\"<br/>
456 </div>";
457 echo "<li style=\"text-align:center;\" data-role=\"list-divider\" data-icon=\"arrow-up\" >";
458 echo "<b>Gruppo di Lavoro Comune di $descr_com</b></li></ul>";
459 include ("pagine/gruppo.html");
460 //echo "</div>aaa";
461
462
463
464}
465
466?>
Note: See TracBrowser for help on using the repository browser.