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

Last change on this file was 407, checked in by roby, 2 months ago
  • ADMIN

-- aggiunto il controllo per la visualizzazione della proiezione del consiglio comunale
-- bloccato l'inserimento dati nelle consultazioni chiuse

  • CLIENT

-- in tema bsitalia: sistemato il fondo giallo nel blocco sezioni scrutinate
-- sistemato il pdf dell'elenco affluenze
-- sistemato il link per il passaggio da mobile a desktop

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