source: trunk/client/modules/Elezioni/votantiphp5.php@ 348

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

Ripristino compatibilità con php <= 5.6

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