source: trunk/client/modules/Elezioni/votanti.php@ 347

Last change on this file since 347 was 347, checked in by roby, 4 years ago

Aggiornamento per compatibilità con php7.4

File size: 19.7 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 ("Non puoi accedere al file direttamente...");
11}
12
13require_once('inc/hpdf5/autoload.php');
14use Spipu\Html2Pdf\Html2Pdf;
15use Spipu\Html2Pdf\Exception\Html2PdfException;
16use Spipu\Html2Pdf\Exception\ExceptionFormatter;
17
18$param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ?
19 $_GET : $_POST;
20
21$id_comune= (isset($param['id_comune'])) ? $param['id_comune']:$siteistat;
22if (isset($param['id_cons_gen'])) $id_cons_gen=intval($param['id_cons_gen']); else $id_cons_gen='';
23if (isset($param['op'])) $op=$param['op']; else $op='';
24if (isset($param['minsez'])) $minsez=intval($param['minsez']); else $minsez='';
25if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista='';
26if (isset($param['id_circ'])) $id_circ=intval($param['id_circ']); else $id_circ='';
27if (isset($param['csv'])) $csv=intval($param['csv']); else $csv='';
28if (isset($param['min'])) $min=intval($param['min']); else $min= 0;
29if (isset($param['orvert'])) $orvert=intval($param['orvert']); else $orvert='';
30if (isset($param['offset'])) $offset=intval($param['offset']); else $offset='';
31if (isset($param['offsetsez'])) $offsetsez=intval($param['offsetsez']); else $offsetsez='';
32if (isset($param['perc'])) $perc=$param['perc']; else $perc='';
33if (isset($param['info'])) $info=addslashes($param['info']); else $info='';
34if (isset($param['files'])) $files=addslashes($param['files']); else $files='';
35if (isset($param['voti_lista'])) $voti_lista=intval($param['voti_lista']); else $voti_lista= 0;
36if (isset($param['perc_lista'])) $perc_lista=$param['perc_lista']; else $perc_lista= 0;
37if (isset($param['lettera'])) $lettera=addslashes($param['lettera']); else $lettera='';
38if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='';
39if (isset($param['tipo_cons'])) $tipo_cons=intval($param['tipo_cons']); else $tipo_cons='';
40if (isset($param['xls'])) $xls=intval($param['xls']); else $xls='';
41if (isset($param['pdf'])) $pdf=intval($param['pdf']); else $pdf='';
42
43# anti-xss nov. 2009
44$id_comune=htmlentities($id_comune);
45$perc=floatval($perc);
46$perc_lista=floatval($perc_lista);
47$datipdf= htmlentities($datipdf);
48$op= htmlentities($op);
49$info= htmlentities($info);
50$files=htmlentities($files);
51$lettera=htmlentities($lettera);
52
53$id_comune=intval($id_comune);
54
55
56//$id_cons_gen=$_GET['id_cons_gen'];
57$sql="SELECT t1.tipo_cons,t3.genere,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2, ".$prefix."_ele_tipo as t3 where t1.tipo_cons=t3.tipo_cons and t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" ;
58 $res = $dbi->prepare("$sql");
59 $res->execute();
60
61list($tipo_cons,$genere,$id_cons) = $res->fetch(PDO::FETCH_NUM);
62
63if (isset($param['ops'])) $ops=$param['ops']; else $ops='';
64if (isset($param['pag'])) $pag=$param['pag']; else $pag=0;
65if (isset($param['num_ref'])) $num_ref=$param['num_ref'];
66if (isset($param['num_refs'])) $num_refs=$param['num_refs'];
67$bgcolor2='#cacaca';
68
69
70if (!IsSet($num_ref)) {
71 $num_ref=1;
72 $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons";
73 $resg = $dbi->prepare("$sql");
74 $resg->execute();
75
76 $num_refs= $resg->rowCount(); //quante pagine?
77 }
78
79
80
81//**************************************************************************
82// ELE
83//**************************************************************************
84//controllo_finale($id_cons);
85
86global $prefix, $dbi,$id_circ,$lang, $fascia, $limite, $votog;
87
88include_once("modules/Elezioni/language/lang-$lang.php");
89# testata
90
91if($csv==1){
92 include_once("modules/Elezioni/funzioni.php");
93
94 $sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
95 $res = $dbi->prepare("$sql");
96 $res->execute();
97
98 list($descr_com) = $res->fetch(PDO::FETCH_NUM);
99 $descr_com =stripslashes($descr_com);
100 $datipdf .= "<div style=\"margin:0px auto; text-align:center;\">";
101 $siteistat=$id_comune;
102 # salva sull'hardisk lo stemma del comune
103 $logo=verificasimbolo();
104 $immagine= "<img src=\"modules/Elezioni/images/$logo\" alt=\"logo\" align=\"left\"/>";
105
106
107
108
109
110 if($xls!=1) $datipdf .= "<table><tr><td>$immagine</td><td>";
111 $datipdf .= ""._COMUNE." $descr_com <br/>
112 "._RISULTA." "._CONSULTA."<br/>";
113 $datipdf .= "$descr_cons <br />"._DISCLAIMER."";
114 if($xls!=1) $datipdf .= "</td></tr></table>";
115 $datipdf .="</div>";
116
117
118$html = "<style type=\"text/css\">
119 <!--
120
121 .td-89 {
122 width: 89%;
123 border: 1px;
124 text-align: left;
125 }
126 .td-vuoto {
127
128 width: 100%;
129 border: 1px;
130 text-align: left;
131
132}
133
134
135 .td-5 {
136
137 margin: 0px 0 0 0px;
138 width: 5%;
139 /*border: none;*/
140 padding: 0px;
141
142 text-align: center;
143 }
144
145
146
147 .bggray {
148 background: #ffffff;
149 FONT-SIZE: 13px;
150 FONT-FAMILY: Helvetica;
151 border: 1px;
152 }
153
154 .bggray2 {
155 background: #EFEFEF;
156 FONT-SIZE: 13px;
157 FONT-FAMILY: Helvetica;
158 border: 1px;
159 }
160 -->
161 </style>";
162
163
164
165
166}
167
168
169
170
171
172
173
174
175
176
177
178 // icone stampa e grafici
179 if ($csv!=1){
180 if(isset($num_ref)) $curref="&amp;num_ref=$num_ref"; else $curref='';
181 if (!isset($html)) $html='';
182 $html .= "<div>
183 <a href=\"modules.php?name=Elezioni&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;op=graf_votanti\">
184 "._VER_GRAF." <img class=\"image\" src=\"modules/Elezioni/images/grafici.png\" alt=\"\" /></a>
185
186 <a href=\"modules.php?name=Elezioni&amp;op=come&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;info=votanti&amp;csv=1&amp;pag=$pag&amp;num_ref=$num_ref&amp;num_refs=$num_refs\">"._VER_STAMPA."
187
188
189 <img class=\"image\" src=\"modules/Elezioni/images/printer.png\" alt=\"\" /></a>
190
191 <a href=\"modules.php?name=Elezioni&amp;op=come&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;info=votanti&amp;xls=1&csv=1;&amp;pag=$pag&amp;num_ref=$num_ref&amp;num_refs=$num_refs\">
192
193
194 <img class=\"image\" src=\"modules/Elezioni/images/csv.gif\" alt=\"\" /></a>
195
196<a href=\"modules.php?name=Elezioni&amp;op=come&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;info=votanti&amp;pdf=1&csv=1;&amp;pag=$pag&amp;num_ref=$num_ref&amp;num_refs=$num_refs\">
197<a href=\"modules.php?name=Elezioni&amp;op=come&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;info=votanti&amp;pdf=1&csv=1;&amp;pag=$pag$curref\">
198 <img class=\"image\" src=\"modules/Elezioni/images/pdf.gif\" alt=\"\" /></a>
199
200
201 </div>";
202 }
203
204
205
206 $sql="SELECT sum(maschi),sum(femmine) FROM ".$prefix."_ele_sezioni where id_cons='$id_cons'";
207 $res = $dbi->prepare("$sql");
208 $res->execute();
209
210 list($totm,$totf) = $res->fetch(PDO::FETCH_NUM);
211 $totel=$totm+$totf;
212 if (!IsSet($pag)) {$pag=0;} //inizializza il numero di pagina
213 /*
214 if (!IsSet($num_ref)) {
215 $num_ref=1;
216 $resg = mysql_query("SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons", $dbi);
217 $num_refs= mysql_num_rows($resg); //quante pagine?
218 }
219 */
220 if(($genere!=4) and $pag==0){ //diverso da liste a piu' candidati
221 $ops=4; //gestione gruppi (anche liste uninominali)
222 }else{
223 $ops=3; //gestione liste
224 }
225
226 $sql="SELECT id_gruppo,num_gruppo from ".$prefix."_ele_gruppo where id_cons=$id_cons and num_gruppo=$num_ref";
227 $resg = $dbi->prepare("$sql");
228 $resg->execute();
229
230 list($idg,$numg) = $resg->fetch(PDO::FETCH_NUM);
231 $sql="SELECT id_sez,num_sez,t1.id_sede as id_sede,t2.id_circ as id_circ FROM ".$prefix."_ele_sezioni as t1,".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede order by num_sez ";
232 $res = $dbi->prepare("$sql");
233 $res->execute();
234
235 $max = $res->rowCount(); //quante sezioni?
236 $sql="SELECT id_sez,num_sez,t1.id_sede as id_sede,t2.id_circ as id_circ FROM ".$prefix."_ele_sezioni as t1,".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede order by num_sez ";
237 $res = $dbi->prepare("$sql");
238 $res->execute();
239
240 $num_sez = $res->rowCount(); //quante sezioni?
241 for ($i=1;$i<=$num_sez;$i++){
242 $sezione[$i]=$res->fetch(PDO::FETCH_BOTH); //inizializza l'array delle sezioni
243 $ar[$i]=0;
244 }
245 $tab3="_ele_voti_lista";
246 if ($genere>0) { //se non e' un referendum
247
248
249
250 if (!($genere==4) and $pag==0){ //se non e' una lista uninominale ed e' la prima pagina
251
252 $tab="SELECT 0,t2.id_sez,t2.num_sez,t2.validi,'0','0',t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,'0',t2.voti_nulli FROM ".$prefix."_ele_sezioni as t2 left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede) where t2.id_cons='$id_cons' and t2.validi+t2.nulli+t2.bianchi+t2.contestati>0 group by t2.id_sez order by t2.num_sez ";
253
254 }else{ // e' una lista uninominale o la seconda pagina
255
256
257
258 # voto disgiunto regione sicilia aggiunge il campo solo lista
259 if(isdisgiunto()){
260 $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,t1.solo_lista,t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0',t1.voti_nulli
261 FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez)
262 left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede)
263 where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons group by t2.id_sez order by t1.num_sez ";
264 }else{
265
266 $tab="SELECT '0',t1.id_sez,t1.num_sez,sum(t2.voti),t1.solo_gruppo,'0',t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t1.id_sede,'0',t1.voti_nulli
267 FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez)
268 left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede)
269 where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons group by t2.id_sez order by t1.num_sez ";
270 }
271 }
272
273
274
275 $riga1 = "";
276 if($pag==0)$riga1 .="<h2>"._DETTAGLIO." "._VOTIE."</h2>";
277 else $riga1 .="<h4>"._DETTAGLIO." "._VOTIE." "._ASOLA_LISTA."</h4>";
278
279 }else{ // e' un referendum --> t3.id_gruppo vuota per allineare il while (da rifare con array)
280 $tab="SELECT t1.id_gruppo,t1.id_sez,t2.num_sez,t1.si,t1.no,'0',t1.validi,t1.nulli,t1.bianchi,t1.contestati, t4.id_circ,t2.id_sede,t3.num_gruppo,'0'
281 FROM ".$prefix."_ele_voti_ref as t1 left join ".$prefix."_ele_sezioni as t2 on (t1.id_sez=t2.id_sez)
282 left join ".$prefix."_ele_gruppo as t3 on (t1.id_gruppo=t3.id_gruppo) left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede)
283 where t1.id_cons='$id_cons' and t1.id_gruppo='$idg' order by t2.num_sez ";
284 $riga1 = "<div style=\"margin:0px auto;text-align:center;\">";
285 $riga1 .="<h2>"._DETTAGLIO." "._VOTIE."</h2></div>";
286
287 $sql="select descrizione from ".$prefix."_ele_gruppo where id_gruppo='$idg'";
288 $des = $dbi->prepare("$sql");
289 $des->execute();
290
291 list($descrizione)=$des->fetch(PDO::FETCH_BOTH);
292 $riga1 .="<h4>$descrizione</h4>";
293 }
294 $sql="$tab ";
295 $res = $dbi->prepare("$sql");
296 $res->execute();
297
298 $num_scr = $res->rowCount();
299 //$riga2= "<div>"._SEZSCR." $num_scr su $num_sez</div>";//sezioni scrutinate
300
301 $riga2 = "<table style=\"border:1px solid #6A6A6A;\" summary=\"Tabella dei voti espressi\">";
302 $riga3 = "<tr class=\"bggray2\">
303 <td>"._SEZIONI."</td>
304 <td>"._VOTIU."</td>
305 <td>"._VOTID."</td>
306 <td>"._VOTIE."</td>"; //testata con nomi dei campi
307 if ($genere==0) { //se e' un referendum
308 $riga3 .= "<td>"._SI."</td><td>"._NO."</td>";
309 } elseif ((($genere==5) or ($genere==3)) and $pag==1){
310 $riga3 .= "<td>Voti "._LISTE."</td>";
311 if(isdisgiunto()){
312 $riga3 .= "<td>Voti "._PRESI."</td>";
313 $riga3 .= "<td>"._SOLO_LISTA."</td>";
314
315
316 } // voto disgiunto
317 if (!$votog) $riga3 .= "<td>"._ASOLO_GRUPPO."</td>";
318 }
319
320 $riga3 .= "<td>"._VALIDI."</td><td>"._NULLI."</td><td>"._BIANCHI."</td><td>"._CONTESTATI."</td>"
321 ."</tr>\n";
322 $sql="$tab ";
323 $res = $dbi->prepare("$sql");
324 $res->execute();
325
326 $num_scr = $res->rowCount();
327 $righe= "";
328 $scrutinate=1;
329 $tot_u=0;$tot_d=0;$tot_voti=0; $tot_si=0;$tot_no=0;$tot_validi=0;$tot_nulli=0;$tot_bianchi=0;$tot_contestati=0;
330 $tot_sololista=0;$tot_gruppo=0;
331 #$si e $no sono valide anche per voti lista e solo gruppo per i non referendum
332 while (list($id_gruppo,$id,$num,$si,$no,$sololista,$validi,$nulli,$bianchi,$contestati,$id_circ,$id_sede,$gruppo,$votinulli) = $res->fetch(PDO::FETCH_NUM)){
333 $nulli+=$votinulli;
334 // inserimento numeri di sez non scrutinate
335 while ($scrutinate < $num) {
336 $righe.= "<tr><td><span style=\"color: rgb(255, 0, 0);\">$scrutinate</span></td></tr>\n";
337 $scrutinate++;
338 }
339
340 # voti sindaco, gruppo o presidente
341 $tab5="SELECT sum(voti) FROM ".$prefix."_ele_voti_gruppo where id_cons='$id_cons' and id_sez='$id'";
342 $sql="$tab5";
343 $res3 = $dbi->prepare("$sql");
344 $res3->execute();
345
346 list($sindaco) = $res3->fetch(PDO::FETCH_NUM);
347
348
349 $scrutinate++;
350 // fine inserimento
351 $tab2="SELECT max(voti_donne),max(voti_uomini),max(voti_complessivi) FROM ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and id_sez='$id'";
352 if ($genere==0) $tab2 .= " and id_gruppo=$id_gruppo";
353 $sql=$tab2;
354 $res2 = $dbi->prepare("$sql");
355 $res2->execute();
356
357 list($votid,$votiu,$voti) = $res2->fetch(PDO::FETCH_NUM);
358// $voti=$votiu+$votid;
359 $tot_gruppo+=$sindaco;
360 $tot_u+=$votiu;
361 $tot_d+=$votid;
362 $tot_voti+=$voti;
363 $tot_si+=$si;
364 $tot_no+=$no;
365 $tot_validi+=$validi;
366 $tot_nulli+=$nulli;
367 $tot_bianchi+=$bianchi;
368 $tot_contestati+=$contestati;
369 $tot_sololista+=$sololista;
370 $righe .= "<tr class=\"bggray2\">
371 <td>$num</td>
372 <td>".number_format($votiu,0,',','.')."</td>
373 <td>".number_format($votid,0,',','.')."</td>
374 <td>".number_format($voti,0,',','.')."</td>";
375 if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){
376 $righe .= "<td>".number_format($si,0,',','.')."</td>";
377
378 if(isdisgiunto()){
379 $righe .= "<td>".number_format($sindaco,0,',','.')."</td>";
380 $righe .= "<td>".number_format($sololista,0,',','.')."</td>";
381 }
382 if (!$votog) $righe .= "<td>".number_format($no,0,',','.')."</td>";
383
384
385}
386
387
388 $righe .= "<td>".number_format($validi,0,',','.')."</td>
389
390 <td>$nulli</td>
391 <td>$bianchi</td>
392 <td>$contestati</td></tr>";
393 }
394 if ($num<$num_sez) {
395 for (;$scrutinate<=$num_sez;$scrutinate++) {
396 $righe .= "<tr><td>";
397 $righe .="<span style=\"color: rgb(255, 0, 0);\">$scrutinate</span></td></tr>";
398 }
399 }
400 $righet='';
401 if($num_scr){
402 $righet = "<tr class=\"bggray\">
403 <td ></td>
404 <td>"._VOTIU."</td>
405 <td>"._VOTID."</td>
406 <td>"._VOTIE."</td>"; //testata con nomi dei campi
407 if ($genere==0) { //se e' un referendum
408 $righet .= "<td>"._SI."</td><td>"._NO."</td>";
409 } elseif ((($genere==5) or ($genere==3)) and $pag==1){
410 $righet .= "<td>Voti "._LISTE."</td>";
411 if(isdisgiunto()){
412 $righet .= "<td>Voti "._PRESI."</td>";
413 $righet .= "<td>"._SOLO_LISTA."</td>";
414 } // voto disgiunto
415 if (!$votog) $righet .= "<td>"._ASOLO_GRUPPO."</td>";
416
417 }
418 if($totel==0) $totelrip="0.00"; else $totelrip=number_format($tot_voti*100/$totel,2);
419 if($totf==0) $totfrip="0.00"; else $totfrip=number_format($tot_d*100/$totf,2);
420 if($totm==0) $totmrip="0.00"; else $totmrip=number_format($tot_u*100/$totm,2);
421 $righet .= "<td>"._VALIDI."</td><td>"._NULLI."</td><td>"._BIANCHI."</td><td>"._CONTESTATI."</td>"
422 ."</tr>
423
424
425
426 <tr class=\"td-vuotoc\"><td><b>"._TOT."</b></td><td><b>".number_format($tot_u,0,',','.')."</b><br /><i>(".$totmrip."%)</i></td><td><b>".number_format($tot_d,0,',','.')."</b><br /><i>(".$totfrip."%)</i></td><td><b>".number_format($tot_voti,0,',','.')."</b><br /><i>(".$totelrip."%)</i></td>";
427
428 // se e' un referendum o una consultazione con raggruppamenti
429
430 if($tot_validi){
431 if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){
432 $righet .= "<td><b>".number_format($tot_si,0,',','.')."</b><br /><i>(".number_format($tot_si*100/$tot_validi,2)."%)</i></td>";
433
434 if(isdisgiunto()){
435 $righet .="<td><b>".number_format($tot_gruppo,0,',','.')."</b><br /><i>(".number_format($tot_gruppo*100/$tot_validi,2)."%)</i></td>";
436 $righet .="<td><b>".number_format($tot_sololista,0,',','.')."</b><br /><i>(".number_format($tot_sololista*100/$tot_validi,2)."%)</i></td>";
437 }
438
439
440 if(!$votog) $righet .="<td><b>".number_format($tot_no,0,',','.')."</b><br /><i>(".number_format($tot_no*100/$tot_validi,2)."%)</i></td>";
441 }
442
443
444 $righet .= "<td><b>".number_format($tot_validi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_validi*100/$tot_voti,2):'0.00')."%)</i></td><td><b>"
445 .number_format($tot_nulli,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0.00')."%)</i></td><td><b>".number_format($tot_bianchi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0.00')."%)</i></td><td><b>".number_format($tot_contestati,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0.00')."%)</i></td></tr>";
446 }else{
447 if ($genere==0 or ((($genere==5) or ($genere==3)) and $pag==1)){
448 $righet .= "<td><b>".number_format($tot_si,0,',','.')."</b><br /><i>(0.00%)</i></td><td><b>".number_format($tot_no,0,',','.')."</b><br /><i>(0.00%)</i></td>";}
449 $righet .= "<td><b>0</b><br /><i>(0.00%)</i></td><td><b>"
450 .number_format($tot_nulli,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_nulli*100/$tot_voti,2):'0,00')."%)</i></td><td><b>".number_format($tot_bianchi,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_bianchi*100/$tot_voti,2):'0,00')."%)</i></td><td><b>".number_format($tot_contestati,0,',','.')."</b><br /><i>(".($tot_voti ? number_format($tot_contestati*100/$tot_voti,2):'0,00')."%)</i></td></tr>";
451 }
452 }
453 $righe .= "</table>";
454 if(!isset($html)) $html='';
455 $html .= "$riga1";
456 $html .= $riga2."";
457 $html .= $righet;
458 $html .= $riga3;
459 $html .= $righe;
460
461
462 $html .="<div>";
463 if($genere==0){ //se e' referendum
464 if ($xls!='1' && $pdf!='1' && $csv!='1'){
465 #'Pagina precedente' e 'Pagina Successiva'
466 $cur=$num_ref;
467 if ($cur>1) {
468 $num_ref--;
469 $html .= "<a href=\"modules.php?name=Elezioni&amp;op=come&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;info=votanti&amp;num_ref=$num_ref&amp;num_refs=$num_refs&amp;csv=$csv&amp;xls=$xls&amp;pdf=$pdf\">";
470 $html .= "[ <b>"._PREV_MATCH."</b> ]</a>";
471 }
472 if ($cur<$num_refs) {
473 $cur++;
474 $html .= "<a href=\"modules.php?name=Elezioni&amp;op=come&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;info=votanti&amp;num_ref=$cur&amp;num_refs=$num_refs&amp;csv=$csv&amp;xls=$xls&amp;pdf=$pdf\">";
475
476 $html .= "[ <b>"._NEXT_MATCH."</b> ]</a>";
477 }
478}
479}
480if($genere==5 or $genere==3){ //se vi sono raggruppamenti
481 if($csv!=1 and $fascia>$limite){
482
483 $pag=($pag==0 ? 1:0);
484 $html .= "<a href=\"modules.php?name=Elezioni&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;op=come&amp;info=votanti&amp;pag=$pag&amp;csv=$csv\"><b>";
485 if($pag) $html .= _VOTIL;
486 //_CONTR_CONS;
487 else $html .= _VOTIE;
488 //_CONTR_ESPR;
489 $html .= "</b></a>";
490 }
491 }
492
493
494if($csv==1){
495 $data=date("d-m-y G:i");
496 $html .="<br/><div style=\"margin:0 auto;text-align:center;\"><i>Stampato: $data</i>";
497 $html .="<br/><i>Eleonline by l. apolito & r. gigli - www.eleonline.it</i></div>";
498 //$html .= $html;
499
500}
501$html .= "</div>";
502
503
504
505############### stampa
506if ($xls!='1' && $pdf!='1'){
507 echo "$datipdf $html";
508}elseif($xls=="1"){
509 $nomefile="votanti.xls";
510 header ("Content-Type: application/vnd.ms-excel");
511 header ("Content-Disposition: inline; filename=$nomefile");
512
513 echo "$datipdf";
514 echo "$html \n";
515}elseif($pdf=='1'){
516
517
518 $nomefile="$descr_cons votanti.pdf";
519
520
521
522
523
524
525 $stampa ="<div style=\"margin:0 auto;text-align:center;\">$datipdf $html</div>";
526
527 $html2pdf = new Html2Pdf('P','A4', 'it');
528 $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
529 $html2pdf->Output($nomefile);
530
531
532}
533
534
535
536
537if($csv!=1 ) include ("footer.php");
538
539
540
541?>
Note: See TracBrowser for help on using the repository browser.