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

Last change on this file since 360 was 348, checked in by roby, 3 years ago

Ripristino compatibilità con php <= 5.6

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