Changeset 376 for trunk/client/modules


Ignore:
Timestamp:
Sep 24, 2022, 1:11:18 PM (21 months ago)
Author:
roby
Message:

Admin:

  • modificata la funzione aggiornadb per gestire il caso di cambiamento del nome del superutente e tolto il default per tipi campo text
  • modificata la funzione dei controlli per gestire il tipo consultazione Regionali in Sicilia

Install:

  • modificata la funzione di installazione per compatibilità con php 8.0

Client:

  • cambiata l'immagine "vuoto.jpg" nel formato png per gestire la trasparenza
  • modificate le funzioni affluenze e votanti per correggere l'esportazione in pdf e le stampe
  • per il tema Futura2 eliminato il taglio della descrizione della consultazione
Location:
trunk/client/modules/Elezioni
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/modules/Elezioni/affluenze.php

    r371 r376  
    44/* by Luciano Apolito & Roberto Gigli                                   */
    55/* http://www.eleonline.it                                              */
    6 /* info@eleonline.it  luciano@aniene.net rgigli@libero.it               */
     6/* info@eleonline.it rgigli@libero.it                                   */
    77/************************************************************************/
    88
     
    1111}
    1212
     13
    1314require_once('inc/hpdf5/autoload.php');
    1415use Spipu\Html2Pdf\Html2Pdf;
     
    1617use Spipu\Html2Pdf\Exception\ExceptionFormatter;
    1718
    18 if (isset($param['id_cons_gen'])) $id_cons_gen=intval($param['id_cons_gen']); else $id_cons_gen='';
    19 if (isset($param['num_ref'])) $num_ref=intval($param['num_ref']);
    20 if (isset($param['num_refs'])) $num_refs=intval($param['num_refs']);
    21 if (isset($param['id_comune'])) $id_comune=intval($param['id_comune']);
    22 if (isset($param['xls'])) $xls=intval($param['xls']);
    23 if (isset($param['pdf'])) $pdf=intval($param['pdf']);
    24 $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'";
    25 $res = $dbi->prepare("$sql");
    26 $res->execute();
    27 list($tipo_cons,$genere,$id_cons) = $res->fetch(PDO::FETCH_NUM);
    28 global $lang,$circo,$id_circ;
    29 
    30 if (isset($circo) and $circo) $circos="and t2.id_circ='$id_circ'";
    31 else $circos='';
    32 
    33 # testata
    34 include_once("modules/Elezioni/language/lang-$lang.php");
    35 if($csv==1){
    36         include_once("modules/Elezioni/funzioni.php");
    37        
    38         $sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
    39         $res = $dbi->prepare("$sql");
    40         $res->execute();
    41         list($descr_com) = $res->fetch(PDO::FETCH_NUM);
    42         $descr_com =stripslashes($descr_com);
    43         $datipdf .= "<div style=\"margin:0px auto; text-align:center;\">";
    44         $siteistat=$id_comune;
    45         # salva sull'hardisk lo stemma del comune
    46         $logo=verificasimbolo();
    47         $immagine= "<img src=\"modules/Elezioni/images/$logo\" alt=\"logo\" align=\"left\"/>";
    48 
    49         if($xls!=1) $datipdf .= "<table><tr><td>$immagine</td><td>";
    50        
    51         $datipdf .= ""._COMUNE." $descr_com <br />
    52         "._RISULTA." "._CONSULTA."<br/ >";
    53         $datipdf .= "$descr_cons<br />"._DISCLAIMER."
    54         <br /><b>"._DETTAGLIO."  "._AFFLUENZE."</b>";
    55         if($xls!=1) $datipdf .=  "</td></tr></table>";
    56         $datipdf .="</div>";
    57 
    58         $html = "<style type=\"text/css\">
    59         <!--
    60 
    61         .td-89 {
    62         width: 89%;     
    63         border: 1px;
    64         text-align: left;
    65         }
    66         .td-vuoto {
    67                
    68         width: 100%;   
    69         border: 1px;
    70         text-align: left;
    71        
    72 }
    73 
    74 
    75         .td-5 {
    76        
    77         margin: 0px 0 0 0px;
    78         width: 5%;     
    79         /*border: none;*/
    80         padding: 0px;
    81        
    82         text-align: center;
    83         }       
    84 
    85 
    86 
    87         .bggray         {
    88                 background: #ffffff;
    89                 FONT-SIZE: 13px;
    90                 FONT-FAMILY: Helvetica;
    91                 border: 1px;
    92         }
    93 
    94         .bggray2        {
    95                 background: #EFEFEF;
    96                 FONT-SIZE: 13px;
    97                 FONT-FAMILY: Helvetica;
    98                 border: 1px;
    99                 }
    100         -->
    101         </style>";
    102 
    103 
    104 
    105 
    106 }
    107        
    108      
    109 
    110 
    111 
    112 
    113    
    114         // referendum
    115        
    116         $posref='';
    117         if (!IsSet($num_ref)) {
    118                 $num_ref=1;
    119                 $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons'";
    120                 $resg = $dbi->prepare("$sql");
    121                 $resg->execute();
    122                 $num_refs= $resg->rowCount(); //quante pagine?
    123         }       
    124         if($genere=='0'){
    125                 $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' and num_gruppo='$num_ref'";
    126                 $resg = $dbi->prepare("$sql");
    127                 $resg->execute();
    128                 list($id_gruppo)=$resg->fetch(PDO::FETCH_NUM);
    129         $posref="&amp;num_ref=$num_ref&amp;num_refs=$num_refs";
    130        
    131         }
    132         // icone stampa e grafici
    133        
    134         if (!$csv){
    135         if(!isset($html)) $html='';
    136         $html .= "<div>
    137         <a href=\"modules.php?name=Elezioni&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;op=affluenze_graf\">
    138         "._VER_GRAF." <img class=\"image\" src=\"modules/Elezioni/images/grafici.png\" alt=\"\" /></a>
    139         <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=affluenze_sez$posref&amp;csv=1\">"._VER_STAMPA."
    140         <img class=\"image\" src=\"modules/Elezioni/images/printer.png\" alt=\"\" /></a>
    141         <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=affluenze_sez$posref&amp;csv=1&amp;xls=1\">
    142         <img class=\"image\" src=\"modules/Elezioni/images/csv.gif\" alt=\"\" /></a>
    143 <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=affluenze_sez$posref&amp;csv=1&amp;pdf=1\">
    144         <img class=\"image\" src=\"modules/Elezioni/images/pdf.gif\" alt=\"\" /></a>
    145 
    146         </div>
    147 
    148         <h2><b>"._DETTAGLIO."  "._AFFLUENZE."</b></h2>";
    149           } 
    150        
    151         // descrizione
    152          if ($genere==0){
    153          $sql="select descrizione from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
    154         $des = $dbi->prepare("$sql");
    155         $des->execute();
    156                 list($descrizione)=$des->fetch(PDO::FETCH_NUM);
    157                 if(!isset($html)) $html='';
    158                 $html .= "<div><h4>$descrizione</h4></div>";
    159         }
    160        
    161        
    162         $cond= $genere==0 ? "and t3.id_gruppo='$id_gruppo'" : "";
    163         $i=1;
    164        
    165        
    166         $sql="SELECT num_sez,id_sez,t1.id_sede, t2.id_circ,maschi,femmine,(maschi+femmine) as elettori FROM ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circos order by num_sez";
    167         $res = $dbi->prepare("$sql");
    168         $res->execute();
    169         while ($linka[$i++] = $res->fetch(PDO::FETCH_BOTH));
    170 #       while (list($appo) = mysql_fetch_array($res)) {$i=$appo['num_sez']; $linka[$i] = $appo;echo "\nnum:$i:".$linka[$i]['num_sez'];}die();
    171         $num_sez = $res->rowCount(); //numero totale delle sezioni
    172         if (isset($linka[1]['num_sez']))  $sez_da=$linka[1]['num_sez']; else $sez_da=0;
    173         $sez_a=$sez_da+$num_sez-1;
    174         $tot_compl=0;$tot_u=0;$tot_d=0;
    175 //      $ar['riga1'][0]="<hr>";
    176         $tot= array();
    177         $ar[0][0]="<b>TOTALI</b>";
    178         $ar['perc'][0]="Perc.";
    179 //      $ar['riga2'][0]="<hr>";
    180 #       foreach($linka['num_sez'] as $i)
    181 $y=1;
    182 for ($i=$sez_da;$i<=$sez_a;$i++,$y++)   {       
    183 #               $ar[$i]['numsez']=$i;
    184                 if(!isset($linka[$y]['num_sez'])) { $linka[$y]['num_sez']=0; $linka[$y]['elettori']=0;}
    185                 $z=$linka[$y]['num_sez'];
    186                 $ar[$z]['numsez']=$linka[$y]['num_sez'];
    187                 $ar[$z]['elettori']=number_format($linka[$y]['elettori'],0,',','.');
    188                 $tot_compl+=$linka[$y]['elettori'];
    189                 $tot_u+=$linka[$y]['maschi'];
    190                 $tot_d+=$linka[$y]['femmine'];
    191 
    192 
    193         }
    194         $ar[0][1]="<b>".number_format($tot_compl,0,',','.')."</b>";
    195 
    196         $ar['perc'][1]=" ";
    197 
    198         $perc_u=0;$perc_d=0;$perc_c=0;
    199         $sql="SELECT t1.data,t1.orario FROM ".$prefix."_ele_rilaff as t1 left join ".$prefix."_ele_voti_parziale as t2 on t2.data=t1.data and t2.orario=t1.orario left join ".$prefix."_ele_cons_comune as t3 on t3.id_cons_gen=t1.id_cons_gen where t1.id_cons_gen='$id_cons_gen' and t3.id_cons=t2.id_cons group by t1.data,t1.orario order by t1.data,t1.orario";
    200         $resril = $dbi->prepare("$sql");
    201         $resril->execute();
    202         $num_ril= $resril->rowCount();  //numero delle rilevazioni previste
    203         if(!isset($html)) $html='';
    204         $html .= "<table class=\"td-89\">";
    205         $html .= "<tr class=\"bggray\"><td class=\"\">"._SEZIONI."</td><td>"._ISCR_SEZ."</td>";
    206 
    207                 $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1";
    208                 $resuo = $dbi->prepare("$sql");
    209                 $resuo->execute();
    210                 list($ultora,$ultdata)=$resuo->fetch(PDO::FETCH_NUM);
    211                
    212 
    213         $sql="select t3.data,t3.orario,sum(t3.voti_complessivi),sum(t3.voti_uomini),sum(t3.voti_donne)  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' $circos $cond group by t3.data,t3.orario,t3.id_gruppo order by t3.data,t3.orario";
    214         $ressomma = $dbi->prepare("$sql");
    215         $ressomma->execute();
    216 
    217 
    218 $perc_u=array(); $perc_d=array(); $perc_c=array();
    219         while (list($data,$ora,$somma,$votiu,$votid) = $ressomma->fetch(PDO::FETCH_NUM)) {
    220                 $perc_u[$data.$ora]=0;
    221                 $perc_d[$data.$ora]=0;
    222                 $perc_c[$data.$ora]=0;
    223                 if($votiu or $votid)
    224 #               if(($data==$ultdata) and ($ora==$ultora))
    225                 {
    226                         $tot[$data.$ora]="<table style=\"width:180px;\"><tr class=\"bggray2\"><td style=\"width:33%;text-align:center;\">
    227                         <b>".number_format($votiu,0,',','.')."</b></td><td style=\"width:33%;text-align:center;\">
    228                         <b>".number_format($votid,0,',','.')."</b></td><td style=\"width:33%;text-align:center;\">
    229                         <b>".number_format($somma,0,',','.')."</b></td>
    230                         </tr></table>";
    231                         $perc_u[$data.$ora]=number_format($votiu*100/$tot_u,2);
    232                         $perc_d[$data.$ora]=number_format($votid*100/$tot_d,2);
    233                         $perc_c[$data.$ora]=number_format($somma*100/$tot_compl,2);
    234                 }
    235                 else
    236                         $tot[$data.$ora]=$somma;
    237         }
    238         $ud=0;$ora_rif="";
    239         while (list($data1,$ora1) = $resril->fetch(PDO::FETCH_NUM))
    240         {
    241                 $ud++; 
    242                 list($hour, $minute, $second) = explode(":", $ora1);
    243                 $ora_ril=$hour.":".$minute;
    244                 $html .= "<td";
    245                 if ($ud==$num_ril and (isset($perc_u[$data1.$ora1]) or isset($perc_d[$data1.$ora1]))) {$ora_rif="$data1.$ora1";}
    246                 $html .= ">";
    247                 $data_a=form_data($data1);
    248                 $html .= "".$data_a."<br />"._ORE." ".$ora_ril;
    249                 $sql="SELECT count(data) FROM ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' and data='$data1' and orario='$ora_ril' $circos group by t3.id_gruppo";
    250                 $resaff = $dbi->prepare("$sql");
    251                 $resaff->execute();
    252                 list($num_scr) = $resaff->fetch(PDO::FETCH_NUM);  //numero delle sezioni inserite
    253                 $html .= "<br />"._SEZIONI." $num_scr "._SU." $num_sez";
    254 ##              if ($ud==$num_ril and ($perc_u or $perc_d)) $html .= "<br />
    255                 if (isset($perc_u[$data1.$ora1]) or isset($perc_d[$data1.$ora1])) $html .= "<br />
    256                
    257                 <table style=\"width:180px;\"><tr class=\"bggray\">
    258                 <th style=\"width:28%;text-align:center;\">"._UOMINI."</th>
    259                 <th style=\"width:28%;text-align:center;\">"._DONNE."</th>
    260                 <th style=\"width:28%;text-align:center;\">"._COMPLESSIVI."</th>
    261                 </tr></table>";
    262                
    263                 $html .= "</td>";
    264 
    265         if (isset($tot[$data1.$ora1])){
    266 ##              if ($ora_rif=="$data1.$ora1")
    267 if (($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1]))           {
    268                         $ar['perc'][$data1.$ora1]="<table style=\"width:180px;\"><tr class=\"bggray2\">
    269                         <td style=\"width:33%;text-align:center;\"><b><i><span class=\"red\">".$perc_u[$data1.$ora1]."%</span></i></b></td>
    270                         <td style=\"width:33%;text-align:center;\"><b><i><span class=\"red\">".$perc_d[$data1.$ora1]."%</span></i></b></td>
    271                         <td style=\"width:33%;text-align:center;\" ><span class=\"red\"><b><i>".$perc_c[$data1.$ora1]."%</i></b></span></td>
    272                         </tr></table>";
    273                         $ar[0][$data1.$ora1]=$tot[$data1.$ora1];
    274                 }
    275                 else
    276                 {
    277                         $ar['perc'][$data1.$ora1]="<b><span class=\"red\"><i>
    278                         ".number_format($tot[$data1.$ora1]*100/$tot_compl,2)."%</i></span></b>";
    279                         $ar[0][$data1.$ora1]="<b>".(number_format($tot[$data1.$ora1],0,',','.'))."</b>";
    280                 }
    281 
    282                 if (intval(preg_match('/[1-9]/',$tot[$data1.$ora1]))>0) {
    283 #foreach($ar[['num_sez'] as $i)
    284 ##########
    285         $sql="select t1.num_sez  from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t2.id_cons='$id_cons' $circos order by t1.num_sez ";
    286         $resvoti = $dbi->prepare("$sql");
    287         $resvoti->execute();
    288 
    289 ###########
    290 #               for ($i=$sez_da;$i<=$sez_a;$i++)
    291                 while (list($i)=$resvoti->fetch(PDO::FETCH_NUM))
    292                         {
    293                                 $ar[$i][$data1.$ora1]="<span style=\"color: rgb(255, 0, 0);\">non rilevata</span>";
    294                         }
    295                 }
    296         }
    297         }
    298         $sql="select t3.data,t3.orario,t1.num_sez,voti_uomini, voti_donne, voti_complessivi  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' $circos $cond order by data,orario,t1.num_sez ";
    299         $resvoti = $dbi->prepare("$sql");
    300         $resvoti->execute();
    301         $ud=0;
    302         while (list($data,$ora,$numsez,$uomini,$donne,$complessivi) = $resvoti->fetch(PDO::FETCH_NUM)) {
    303 #               if ($ora_rif=="$data.$ora")
    304                 if(($uomini+$donne)>0)
    305                         $ar[$numsez][$data.$ora]="<table style=\"width:180px;\"><tr class=\"bggray2\">
    306                         <td style=\"width:33%;text-align:center;\">$uomini</td>
    307                         <td style=\"width:33%;text-align:center;\">$donne</td>
    308                         <td style=\"width:33%;text-align:center;\">$complessivi</td>
    309                         </tr></table>";
    310                 else
    311                         $ar[$numsez][$data.$ora]=$complessivi;
    312         }
    313     $html .= "</tr>";
    314 
    315         foreach ($ar as $i => $arr) {
    316                 $html .= "<tr class=\"bggray2\">";
    317                 foreach ($arr as $valore)
    318                 {
    319                
    320                         $html .= "<td class=\"bggray2\" style=\"text-align:center;\">$valore</td>";
    321                 }
    322                 $html .= "</tr>";
    323         }
    324 
    325        
    326              
    327              $html .= "</table>";
    328                
    329              if($genere==0){ //se e' referendum
    330         #'Pagina precedente' e 'Pagina Successiva'
    331         if ($xls!='1' && $pdf!='1' && $csv!='1'){
    332         $html .= "<div class=\"modulo\">";
    333             $cur=$num_ref;
    334         if ($cur>1) {
    335                
    336                 $num_ref--;
    337                           $html .= "<a href=\"modules.php?name=Elezioni&amp;op=come&amp;info=affluenze_sez&amp;id_cons_gen=$id_cons_gen&amp;num_ref=$num_ref&amp;num_refs=$num_refs&amp;id_comune=$id_comune\">";
    338                 $html .= "[ <b>"._PREV_MATCH."</b> ] </a>";
    339         }
    340         if ($cur<$num_refs) {
    341                 $cur++;       
    342                         $html .= "<a href=\"modules.php?name=Elezioni&amp;op=come&amp;info=affluenze_sez&amp;id_cons_gen=$id_cons_gen&amp;num_ref=$cur&amp;num_refs=$num_refs&amp;id_comune=$id_comune\">";
    343             $html .= "[ <b>"._NEXT_MATCH."</b> ] </a>";
    344         }
    345         $html .= "</div>";
    346         }
    347 }
    348        
    349 if(!isset($style)) $style='';   
    350 if($csv==1){
    351       $data=date("d-m-y G:i");
    352       $style .="\t\t\n<br/><br/><br/><div style=\"margin:0px auto;text-align:center;\"><i>Stampato: $data</i></div>";
    353       $style .="<br/><div style=\"text-align:center;\"><i>Eleonline by luciano apolito e roberto gigli - www.eleonline.it</i></div>";           
    354       $style .= "<br/>  ";     
    355      
    356 }       
    357 //$html .= "</div>";
    358 
     19include('affluenze-inc.php');
    35920
    36021############### stampa
    36122if ($xls!='1' && $pdf!='1'){
    362       echo "$datipdf $html $style";
    363 
     23    echo "$datipdf $html $style";
    36424}elseif($xls=="1"){
    36525        $nomefile="affluenze.xls";
     
    37232        echo "$html \t\n $style";
    37333}elseif($pdf=='1'){
    374                 $nomefile="$descr_cons affluenze.pdf";
    375                
    376                 $stampa ="$datipdf $html $style";
    377                
     34        $nomefile="$descr_cons affluenze.pdf"; 
     35        $stampa ="$datipdf $html $style";
     36        if($vismf)             
     37                $html2pdf = new Html2Pdf('L','A4', 'it');
     38        else
    37839                $html2pdf = new Html2Pdf('P','A4', 'it');
    379                 $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
    380                 $html2pdf->Output($nomefile);
     40        $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
     41        $html2pdf->Output($nomefile);
    38142}
     43if($csv!=1 ) include ("footer.php");
    38244
    383 
    384 if($csv!=1 ) include ("footer.php");
    385  
    38645?>
  • trunk/client/modules/Elezioni/affluenzephp5.php

    r371 r376  
    44/* by Luciano Apolito & Roberto Gigli                                   */
    55/* http://www.eleonline.it                                              */
    6 /* info@eleonline.it  luciano@aniene.net rgigli@libero.it               */
     6/* info@eleonline.it rgigli@libero.it                                   */
    77/************************************************************************/
    88
     
    1313require_once('inc/hpdf403/html2pdf.class.php');
    1414
    15 if (isset($param['id_cons_gen'])) $id_cons_gen=intval($param['id_cons_gen']); else $id_cons_gen='';
    16 if (isset($param['num_ref'])) $num_ref=intval($param['num_ref']);
    17 if (isset($param['num_refs'])) $num_refs=intval($param['num_refs']);
    18 if (isset($param['id_comune'])) $id_comune=intval($param['id_comune']);
    19 if (isset($param['xls'])) $xls=intval($param['xls']);
    20 if (isset($param['pdf'])) $pdf=intval($param['pdf']);
    21 $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'";
    22 $res = $dbi->prepare("$sql");
    23 $res->execute();
    24 list($tipo_cons,$genere,$id_cons) = $res->fetch(PDO::FETCH_NUM);
    25 global $lang,$circo,$id_circ;
    26 
    27 if (isset($circo) and $circo) $circos="and t2.id_circ='$id_circ'";
    28 else $circos='';
    29 
    30 # testata
    31 include_once("modules/Elezioni/language/lang-$lang.php");
    32 if($csv==1){
    33         include_once("modules/Elezioni/funzioni.php");
    34        
    35         $sql="SELECT descrizione FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
    36         $res = $dbi->prepare("$sql");
    37         $res->execute();
    38         list($descr_com) = $res->fetch(PDO::FETCH_NUM);
    39         $descr_com =stripslashes($descr_com);
    40         $datipdf .= "<div style=\"margin:0px auto; text-align:center;\">";
    41         $siteistat=$id_comune;
    42         # salva sull'hardisk lo stemma del comune
    43         $logo=verificasimbolo();
    44         $immagine= "<img src=\"modules/Elezioni/images/$logo\" alt=\"logo\" align=\"left\"/>";
    45 
    46         if($xls!=1) $datipdf .= "<table><tr><td>$immagine</td><td>";
    47        
    48         $datipdf .= ""._COMUNE." $descr_com <br />
    49         "._RISULTA." "._CONSULTA."<br/ >";
    50         $datipdf .= "$descr_cons<br />"._DISCLAIMER."
    51         <br /><b>"._DETTAGLIO."  "._AFFLUENZE."</b>";
    52         if($xls!=1) $datipdf .=  "</td></tr></table>";
    53         $datipdf .="</div>";
    54 
    55         $html = "<style type=\"text/css\">
    56         <!--
    57 
    58         .td-89 {
    59         width: 89%;     
    60         border: 1px;
    61         text-align: left;
    62         }
    63         .td-vuoto {
    64                
    65         width: 100%;   
    66         border: 1px;
    67         text-align: left;
    68        
    69 }
    70 
    71 
    72         .td-5 {
    73        
    74         margin: 0px 0 0 0px;
    75         width: 5%;     
    76         /*border: none;*/
    77         padding: 0px;
    78        
    79         text-align: center;
    80         }       
    81 
    82 
    83 
    84         .bggray         {
    85                 background: #ffffff;
    86                 FONT-SIZE: 13px;
    87                 FONT-FAMILY: Helvetica;
    88                 border: 1px;
    89         }
    90 
    91         .bggray2        {
    92                 background: #EFEFEF;
    93                 FONT-SIZE: 13px;
    94                 FONT-FAMILY: Helvetica;
    95                 border: 1px;
    96                 }
    97         -->
    98         </style>";
    99 
    100 
    101 
    102 
    103 }
    104        
    105      
    106 
    107 
    108 
    109 
    110    
    111         // referendum
    112        
    113         $posref='';
    114         if (!IsSet($num_ref)) {
    115                 $num_ref=1;
    116                 $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons'";
    117                 $resg = $dbi->prepare("$sql");
    118                 $resg->execute();
    119                 $num_refs= $resg->rowCount(); //quante pagine?
    120         }       
    121         if($genere=='0'){
    122                 $sql="SELECT id_gruppo from ".$prefix."_ele_gruppo where id_cons='$id_cons' and num_gruppo='$num_ref'";
    123                 $resg = $dbi->prepare("$sql");
    124                 $resg->execute();
    125                 list($id_gruppo)=$resg->fetch(PDO::FETCH_NUM);
    126         $posref="&amp;num_ref=$num_ref&amp;num_refs=$num_refs";
    127        
    128         }
    129         // icone stampa e grafici
    130        
    131         if (!$csv){
    132         if(!isset($html)) $html='';
    133         $html .= "<div>
    134         <a href=\"modules.php?name=Elezioni&amp;file=index&amp;id_cons_gen=$id_cons_gen&amp;id_comune=$id_comune&amp;op=affluenze_graf\">
    135         "._VER_GRAF." <img class=\"image\" src=\"modules/Elezioni/images/grafici.png\" alt=\"\" /></a>
    136         <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=affluenze_sez$posref&amp;csv=1\">"._VER_STAMPA."
    137         <img class=\"image\" src=\"modules/Elezioni/images/printer.png\" alt=\"\" /></a>
    138         <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=affluenze_sez$posref&amp;csv=1&amp;xls=1\">
    139         <img class=\"image\" src=\"modules/Elezioni/images/csv.gif\" alt=\"\" /></a>
    140 <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=affluenze_sez$posref&amp;csv=1&amp;pdf=1\">
    141         <img class=\"image\" src=\"modules/Elezioni/images/pdf.gif\" alt=\"\" /></a>
    142 
    143         </div>
    144 
    145         <h2><b>"._DETTAGLIO."  "._AFFLUENZE."</b></h2>";
    146           } 
    147        
    148         // descrizione
    149          if ($genere==0){
    150          $sql="select descrizione from ".$prefix."_ele_gruppo where id_gruppo='$id_gruppo'";
    151         $des = $dbi->prepare("$sql");
    152         $des->execute();
    153                 list($descrizione)=$des->fetch(PDO::FETCH_NUM);
    154                 if(!isset($html)) $html='';
    155                 $html .= "<div><h4>$descrizione</h4></div>";
    156         }
    157        
    158        
    159         $cond= $genere==0 ? "and t3.id_gruppo='$id_gruppo'" : "";
    160         $i=1;
    161        
    162        
    163         $sql="SELECT num_sez,id_sez,t1.id_sede, t2.id_circ,maschi,femmine,(maschi+femmine) as elettori FROM ".$prefix."_ele_sezioni as t1, ".$prefix."_ele_sede as t2 where t1.id_cons='$id_cons' and t1.id_sede=t2.id_sede $circos order by num_sez";
    164         $res = $dbi->prepare("$sql");
    165         $res->execute();
    166         while ($linka[$i++] = $res->fetch(PDO::FETCH_BOTH));
    167 #       while (list($appo) = mysql_fetch_array($res)) {$i=$appo['num_sez']; $linka[$i] = $appo;echo "\nnum:$i:".$linka[$i]['num_sez'];}die();
    168         $num_sez = $res->rowCount(); //numero totale delle sezioni
    169         if (isset($linka[1]['num_sez']))  $sez_da=$linka[1]['num_sez']; else $sez_da=0;
    170         $sez_a=$sez_da+$num_sez-1;
    171         $tot_compl=0;$tot_u=0;$tot_d=0;
    172 //      $ar['riga1'][0]="<hr>";
    173         $tot= array();
    174         $ar[0][0]="<b>TOTALI</b>";
    175         $ar['perc'][0]="Perc.";
    176 //      $ar['riga2'][0]="<hr>";
    177 #       foreach($linka['num_sez'] as $i)
    178 $y=1;
    179 for ($i=$sez_da;$i<=$sez_a;$i++,$y++)   {       
    180 #               $ar[$i]['numsez']=$i;
    181                 if(!isset($linka[$y]['num_sez'])) { $linka[$y]['num_sez']=0; $linka[$y]['elettori']=0;}
    182                 $z=$linka[$y]['num_sez'];
    183                 $ar[$z]['numsez']=$linka[$y]['num_sez'];
    184                 $ar[$z]['elettori']=number_format($linka[$y]['elettori'],0,',','.');
    185                 $tot_compl+=$linka[$y]['elettori'];
    186                 $tot_u+=$linka[$y]['maschi'];
    187                 $tot_d+=$linka[$y]['femmine'];
    188 
    189 
    190         }
    191         $ar[0][1]="<b>".number_format($tot_compl,0,',','.')."</b>";
    192 
    193         $ar['perc'][1]=" ";
    194 
    195         $perc_u=0;$perc_d=0;$perc_c=0;
    196         $sql="SELECT t1.data,t1.orario FROM ".$prefix."_ele_rilaff as t1 left join ".$prefix."_ele_voti_parziale as t2 on t2.data=t1.data and t2.orario=t1.orario left join ".$prefix."_ele_cons_comune as t3 on t3.id_cons_gen=t1.id_cons_gen where t1.id_cons_gen='$id_cons_gen' and t3.id_cons=t2.id_cons group by t1.data,t1.orario order by t1.data,t1.orario";
    197         $resril = $dbi->prepare("$sql");
    198         $resril->execute();
    199         $num_ril= $resril->rowCount();  //numero delle rilevazioni previste
    200         if(!isset($html)) $html='';
    201         $html .= "<table class=\"td-89\">";
    202         $html .= "<tr class=\"bggray\"><td class=\"\">"._SEZIONI."</td><td>"._ISCR_SEZ."</td>";
    203 
    204                 $sql="SELECT orario,data FROM ".$prefix."_ele_rilaff where id_cons_gen=$id_cons_gen order by data desc,orario desc limit 0,1";
    205                 $resuo = $dbi->prepare("$sql");
    206                 $resuo->execute();
    207                 list($ultora,$ultdata)=$resuo->fetch(PDO::FETCH_NUM);
    208                
    209 
    210         $sql="select t3.data,t3.orario,sum(t3.voti_complessivi),sum(t3.voti_uomini),sum(t3.voti_donne)  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' $circos $cond group by t3.data,t3.orario,t3.id_gruppo order by t3.data,t3.orario";
    211         $ressomma = $dbi->prepare("$sql");
    212         $ressomma->execute();
    213 
    214 
    215 $perc_u=array(); $perc_d=array(); $perc_c=array();
    216         while (list($data,$ora,$somma,$votiu,$votid) = $ressomma->fetch(PDO::FETCH_NUM)) {
    217                 $perc_u[$data.$ora]=0;
    218                 $perc_d[$data.$ora]=0;
    219                 $perc_c[$data.$ora]=0;
    220                 if($votiu or $votid)
    221 #               if(($data==$ultdata) and ($ora==$ultora))
    222                 {
    223                         $tot[$data.$ora]="<table style=\"width:180px;\"><tr class=\"bggray2\"><td style=\"width:33%;text-align:center;\">
    224                         <b>".number_format($votiu,0,',','.')."</b></td><td style=\"width:33%;text-align:center;\">
    225                         <b>".number_format($votid,0,',','.')."</b></td><td style=\"width:33%;text-align:center;\">
    226                         <b>".number_format($somma,0,',','.')."</b></td>
    227                         </tr></table>";
    228                         $perc_u[$data.$ora]=number_format($votiu*100/$tot_u,2);
    229                         $perc_d[$data.$ora]=number_format($votid*100/$tot_d,2);
    230                         $perc_c[$data.$ora]=number_format($somma*100/$tot_compl,2);
    231                 }
    232                 else
    233                         $tot[$data.$ora]=$somma;
    234         }
    235         $ud=0;$ora_rif="";
    236         while (list($data1,$ora1) = $resril->fetch(PDO::FETCH_NUM))
    237         {
    238                 $ud++; 
    239                 list($hour, $minute, $second) = explode(":", $ora1);
    240                 $ora_ril=$hour.":".$minute;
    241                 $html .= "<td";
    242                 if ($ud==$num_ril and ($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1])) {$ora_rif="$data1.$ora1";}
    243                 $html .= ">";
    244                 $data_a=form_data($data1);
    245                 $html .= "".$data_a."<br />"._ORE." ".$ora_ril;
    246                 $sql="SELECT count(data) FROM ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t1.id_cons='$id_cons' and data='$data1' and orario='$ora_ril' $circos group by t3.id_gruppo";
    247                 $resaff = $dbi->prepare("$sql");
    248                 $resaff->execute();
    249                 list($num_scr) = $resaff->fetch(PDO::FETCH_NUM);  //numero delle sezioni inserite
    250                 $html .= "<br />"._SEZIONI." $num_scr "._SU." $num_sez";
    251 ##              if ($ud==$num_ril and ($perc_u or $perc_d)) $html .= "<br />
    252                 if (($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1])) $html .= "<br />
    253                
    254                 <table style=\"width:180px;\"><tr class=\"bggray\">
    255                 <th style=\"width:28%;text-align:center;\">"._UOMINI."</th>
    256                 <th style=\"width:28%;text-align:center;\">"._DONNE."</th>
    257                 <th style=\"width:28%;text-align:center;\">"._COMPLESSIVI."</th>
    258                 </tr></table>";
    259                
    260                 $html .= "</td>";
    261 
    262         if (isset($tot[$data1.$ora1])){
    263 ##              if ($ora_rif=="$data1.$ora1")
    264 if (($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1]))           {
    265                         $ar['perc'][$data1.$ora1]="<table style=\"width:180px;\"><tr class=\"bggray2\">
    266                         <td style=\"width:33%;text-align:center;\"><b><i><span class=\"red\">".$perc_u[$data1.$ora1]."%</span></i></b></td>
    267                         <td style=\"width:33%;text-align:center;\"><b><i><span class=\"red\">".$perc_d[$data1.$ora1]."%</span></i></b></td>
    268                         <td style=\"width:33%;text-align:center;\" ><span class=\"red\"><b><i>".$perc_c[$data1.$ora1]."%</i></b></span></td>
    269                         </tr></table>";
    270                         $ar[0][$data1.$ora1]=$tot[$data1.$ora1];
    271                 }
    272                 else
    273                 {
    274                         $ar['perc'][$data1.$ora1]="<b><span class=\"red\"><i>
    275                         ".number_format($tot[$data1.$ora1]*100/$tot_compl,2)."%</i></span></b>";
    276                         $ar[0][$data1.$ora1]="<b>".(number_format($tot[$data1.$ora1],0,',','.'))."</b>";
    277                 }
    278 
    279                 if (intval(preg_match('/[1-9]/',$tot[$data1.$ora1]))>0) {
    280 #foreach($ar[['num_sez'] as $i)
    281 ##########
    282         $sql="select t1.num_sez  from ".$prefix."_ele_sezioni as t1 left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t2.id_cons='$id_cons' $circos order by t1.num_sez ";
    283         $resvoti = $dbi->prepare("$sql");
    284         $resvoti->execute();
    285 
    286 ###########
    287 #               for ($i=$sez_da;$i<=$sez_a;$i++)
    288                 while (list($i)=$resvoti->fetch(PDO::FETCH_NUM))
    289                         {
    290                                 $ar[$i][$data1.$ora1]="<span style=\"color: rgb(255, 0, 0);\">non rilevata</span>";
    291                         }
    292                 }
    293         }
    294         }
    295         $sql="select t3.data,t3.orario,t1.num_sez,voti_uomini, voti_donne, voti_complessivi  from ".$prefix."_ele_voti_parziale as t3 left join ".$prefix."_ele_sezioni as t1 on t3.id_sez=t1.id_sez left join ".$prefix."_ele_sede as t2 on t1.id_sede=t2.id_sede where t3.id_cons='$id_cons' $circos $cond order by data,orario,t1.num_sez ";
    296         $resvoti = $dbi->prepare("$sql");
    297         $resvoti->execute();
    298         $ud=0;
    299         while (list($data,$ora,$numsez,$uomini,$donne,$complessivi) = $resvoti->fetch(PDO::FETCH_NUM)) {
    300 #               if ($ora_rif=="$data.$ora")
    301                 if(($uomini+$donne)>0)
    302                         $ar[$numsez][$data.$ora]="<table style=\"width:180px;\"><tr class=\"bggray2\">
    303                         <td style=\"width:33%;text-align:center;\">$uomini</td>
    304                         <td style=\"width:33%;text-align:center;\">$donne</td>
    305                         <td style=\"width:33%;text-align:center;\">$complessivi</td>
    306                         </tr></table>";
    307                 else
    308                         $ar[$numsez][$data.$ora]=$complessivi;
    309         }
    310     $html .= "</tr>";
    311 
    312         foreach ($ar as $i => $arr) {
    313                 $html .= "<tr class=\"bggray2\">";
    314                 foreach ($arr as $valore)
    315                 {
    316                
    317                         $html .= "<td class=\"bggray2\" style=\"text-align:center;\">$valore</td>";
    318                 }
    319                 $html .= "</tr>";
    320         }
    321 
    322        
    323              
    324              $html .= "</table>";
    325                
    326              if($genere==0){ //se e' referendum
    327         #'Pagina precedente' e 'Pagina Successiva'
    328         if ($xls!='1' && $pdf!='1' && $csv!='1'){
    329         $html .= "<div class=\"modulo\">";
    330             $cur=$num_ref;
    331         if ($cur>1) {
    332                
    333                 $num_ref--;
    334                           $html .= "<a href=\"modules.php?name=Elezioni&amp;op=come&amp;info=affluenze_sez&amp;id_cons_gen=$id_cons_gen&amp;num_ref=$num_ref&amp;num_refs=$num_refs&amp;id_comune=$id_comune\">";
    335                 $html .= "[ <b>"._PREV_MATCH."</b> ] </a>";
    336         }
    337         if ($cur<$num_refs) {
    338                 $cur++;       
    339                         $html .= "<a href=\"modules.php?name=Elezioni&amp;op=come&amp;info=affluenze_sez&amp;id_cons_gen=$id_cons_gen&amp;num_ref=$cur&amp;num_refs=$num_refs&amp;id_comune=$id_comune\">";
    340             $html .= "[ <b>"._NEXT_MATCH."</b> ] </a>";
    341         }
    342         $html .= "</div>";
    343         }
    344 }
    345        
    346 if(!isset($style)) $style='';   
    347 if($csv==1){
    348       $data=date("d-m-y G:i");
    349       $style .="\t\t\n<br/><br/><br/><div style=\"margin:0px auto;text-align:center;\"><i>Stampato: $data</i></div>";
    350       $style .="<br/><div style=\"text-align:center;\"><i>Eleonline by luciano apolito &amp roberto gigli - www.eleonline.it</i></div>";               
    351       $style .= "<br/>  ";     
    352      
    353 }       
    354 //$html .= "</div>";
    355 
     15include('affluenze-inc.php');
    35616
    35717############### stampa
    35818if ($xls!='1' && $pdf!='1'){
    359       echo "$datipdf $html $style";
    360 
     19    echo "$datipdf $html $style";
    36120}elseif($xls=="1"){
    36221        $nomefile="affluenze.xls";
     
    36928        echo "$html \t\n $style";
    37029}elseif($pdf=='1'){
    371                 $nomefile="$descr_cons affluenze.pdf";
    372                
    373                 $stampa ="$datipdf $html $style";
    374                
     30        $nomefile="$descr_cons affluenze.pdf"; 
     31        $stampa ="$datipdf $html $style";
     32        if($vismf)             
     33                $html2pdf = new Html2Pdf('L','A4', 'it');
     34        else
    37535                $html2pdf = new Html2Pdf('P','A4', 'it');
    376                 $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
    377                 $html2pdf->Output($nomefile);
     36        $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
     37        $html2pdf->Output($nomefile);
    37838}
     39if($csv!=1 ) include ("footer.php");
    37940
    380 
    381 if($csv!=1 ) include ("footer.php");
    382  
    38341?>
  • trunk/client/modules/Elezioni/foto.php

    r265 r376  
    5252
    5353// nessuno stemma immagine vuota
    54 if ($stemma=="" && is_readable('modules/Elezioni/images/vuoto.jpg')){
    55         $stemma =  fread( fopen( 'modules/Elezioni/images/vuoto.jpg', 'r' ), filesize( 'modules/Elezioni/images/vuoto.jpg' ) );}
     54if ($stemma=="" && is_readable('modules/Elezioni/images/vuoto.png')){
     55        $stemma =  fread( fopen( 'modules/Elezioni/images/vuoto.png', 'r' ), filesize( 'modules/Elezioni/images/vuoto.png' ) );}
    5656if(isset($pdf))
    5757{
  • trunk/client/modules/Elezioni/funzioni.php

    r370 r376  
    448448        global $prefix,$dbi,$id_comune,$ins_logo;
    449449        if($ins_logo=="0"){
    450                 $logo="vuoto.jpg";  //var nel config.php
     450                $logo="vuoto.png";  //var nel config.php
    451451        }else{
    452452
  • trunk/client/modules/Elezioni/votanti.php

    r371 r376  
    44/* by Luciano Apolito & Roberto Gigli                                   */
    55/* http://www.eleonline.it                                              */
    6 /* info@eleonline.it  luciano@aniene.net rgigli@libero.it               */
     6/* info@eleonline.it rgigli@libero.it                                   */
    77/************************************************************************/
    88
     
    1515use Spipu\Html2Pdf\Exception\ExceptionFormatter;
    1616
    17 $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ?
    18         $_GET : $_POST;
    19 
    20 $id_comune= (isset($param['id_comune'])) ? $param['id_comune']:$siteistat;
    21 if (isset($param['id_cons_gen'])) $id_cons_gen=intval($param['id_cons_gen']); else $id_cons_gen='';
    22 if (isset($param['op'])) $op=$param['op']; else $op='';
    23 if (isset($param['minsez'])) $minsez=intval($param['minsez']); else $minsez='';
    24 if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista='';
    25 if (isset($param['id_circ'])) $id_circ=intval($param['id_circ']); else $id_circ='';
    26 if (isset($param['csv'])) $csv=intval($param['csv']); else $csv='';
    27 if (isset($param['min'])) $min=intval($param['min']); else $min= 0;
    28 if (isset($param['orvert'])) $orvert=intval($param['orvert']); else $orvert='';
    29 if (isset($param['offset'])) $offset=intval($param['offset']); else $offset='';
    30 if (isset($param['offsetsez'])) $offsetsez=intval($param['offsetsez']); else $offsetsez='';
    31 if (isset($param['perc'])) $perc=$param['perc']; else $perc='';
    32 if (isset($param['info'])) $info=addslashes($param['info']); else $info='';
    33 if (isset($param['files'])) $files=addslashes($param['files']); else $files='';
    34 if (isset($param['voti_lista'])) $voti_lista=intval($param['voti_lista']); else $voti_lista= 0;
    35 if (isset($param['perc_lista'])) $perc_lista=$param['perc_lista']; else $perc_lista= 0;
    36 if (isset($param['lettera'])) $lettera=addslashes($param['lettera']); else $lettera='';
    37 if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='';
    38 if (isset($param['tipo_cons'])) $tipo_cons=intval($param['tipo_cons']); else $tipo_cons='';
    39 if (isset($param['xls'])) $xls=intval($param['xls']); else $xls='';
    40 if (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 
    60 list($tipo_cons,$genere,$id_cons) = $res->fetch(PDO::FETCH_NUM);
    61 
    62 if (isset($param['ops'])) $ops=$param['ops']; else $ops='';
    63 if (isset($param['pag'])) $pag=$param['pag']; else $pag=0;
    64 if (isset($param['num_ref'])) $num_ref=$param['num_ref'];
    65 if (isset($param['num_refs'])) $num_refs=$param['num_refs'];
    66 $bgcolor2='#cacaca';
    67 
    68 
    69 if (!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 
    85 global $prefix, $dbi,$id_circ,$lang, $fascia, $limite, $votog;
    86 
    87 include_once("modules/Elezioni/language/lang-$lang.php");
    88 # testata
    89 
    90 if($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,t2.num_sez,t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,t2.voti_nulli 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 t1.id_sez,t1.num_sez,t1.solo_gruppo,t1.solo_lista,t1.validi,t1.nulli,t1.bianchi,t1.contestati,t4.id_circ,t1.id_sede,t1.voti_nulli 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 t1.id_sez,t1.num_sez,t1.solo_gruppo,t1.validi,t1.nulli,t1.bianchi,t1.contestati,t4.id_circ,t1.id_sede,t1.voti_nulli 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 }
    479 if($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 
    493 if($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 
     17include('votanti-inc.php');
    50318
    50419############### stampa
    50520if ($xls!='1' && $pdf!='1'){
    506       echo "$datipdf $html";
     21          echo "$datipdf $html";
    50722}elseif($xls=="1"){
    50823        $nomefile="votanti.xls";
     
    51530        echo "$html \n";
    51631}elseif($pdf=='1'){
    517 
    518 
    519                 $nomefile="$descr_cons votanti.pdf";
    520 
    521 
    522 
    523 
    524 
    525                
    526 #               $stampa ="<div style=\"margin:0 auto;text-align:center;\">$datipdf $html</div>";
    527                 $stampa ="$datipdf $html";
    528                
    529                 $html2pdf = new Html2Pdf('P','A4', 'it');
    530                 $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
    531                 $html2pdf->Output($nomefile);
    532 
    533 
     32        $nomefile="$descr_cons votanti.pdf";
     33        $stampa ="$datipdf $html";             
     34        $html2pdf = new Html2Pdf('P','A4', 'it');
     35        $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
     36        $html2pdf->Output($nomefile);
    53437}
    535 
    536 
    537 
    538 
    53938if($csv!=1 ) include ("footer.php");
    54039
    541 
    542 
    54340?>
  • trunk/client/modules/Elezioni/votantiphp5.php

    r348 r376  
    44/* by Luciano Apolito & Roberto Gigli                                   */
    55/* http://www.eleonline.it                                              */
    6 /* info@eleonline.it  luciano@aniene.net rgigli@libero.it               */
     6/* info@eleonline.it rgigli@libero.it                                   */
    77/************************************************************************/
    88
     
    1212require_once('inc/hpdf403/html2pdf.class.php');
    1313
    14 $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ?
    15         $_GET : $_POST;
    16 
    17 $id_comune= (isset($param['id_comune'])) ? $param['id_comune']:$siteistat;
    18 if (isset($param['id_cons_gen'])) $id_cons_gen=intval($param['id_cons_gen']); else $id_cons_gen='';
    19 if (isset($param['op'])) $op=$param['op']; else $op='';
    20 if (isset($param['minsez'])) $minsez=intval($param['minsez']); else $minsez='';
    21 if (isset($param['id_lista'])) $id_lista=intval($param['id_lista']); else $id_lista='';
    22 if (isset($param['id_circ'])) $id_circ=intval($param['id_circ']); else $id_circ='';
    23 if (isset($param['csv'])) $csv=intval($param['csv']); else $csv='';
    24 if (isset($param['min'])) $min=intval($param['min']); else $min= 0;
    25 if (isset($param['orvert'])) $orvert=intval($param['orvert']); else $orvert='';
    26 if (isset($param['offset'])) $offset=intval($param['offset']); else $offset='';
    27 if (isset($param['offsetsez'])) $offsetsez=intval($param['offsetsez']); else $offsetsez='';
    28 if (isset($param['perc'])) $perc=$param['perc']; else $perc='';
    29 if (isset($param['info'])) $info=addslashes($param['info']); else $info='';
    30 if (isset($param['files'])) $files=addslashes($param['files']); else $files='';
    31 if (isset($param['voti_lista'])) $voti_lista=intval($param['voti_lista']); else $voti_lista= 0;
    32 if (isset($param['perc_lista'])) $perc_lista=$param['perc_lista']; else $perc_lista= 0;
    33 if (isset($param['lettera'])) $lettera=addslashes($param['lettera']); else $lettera='';
    34 if (isset($param['id_gruppo'])) $id_gruppo=intval($param['id_gruppo']); else $id_gruppo='';
    35 if (isset($param['tipo_cons'])) $tipo_cons=intval($param['tipo_cons']); else $tipo_cons='';
    36 if (isset($param['xls'])) $xls=intval($param['xls']); else $xls='';
    37 if (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 
    57 list($tipo_cons,$genere,$id_cons) = $res->fetch(PDO::FETCH_NUM);
    58 
    59 if (isset($param['ops'])) $ops=$param['ops']; else $ops='';
    60 if (isset($param['pag'])) $pag=$param['pag']; else $pag=0;
    61 if (isset($param['num_ref'])) $num_ref=$param['num_ref'];
    62 if (isset($param['num_refs'])) $num_refs=$param['num_refs'];
    63 $bgcolor2='#cacaca';
    64 
    65 
    66 if (!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 
    82 global $prefix, $dbi,$id_circ,$lang, $fascia, $limite, $votog;
    83 
    84 include_once("modules/Elezioni/language/lang-$lang.php");
    85 # testata
    86 
    87 if($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 }
    476 if($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 
    490 if($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 
     14include('votanti-inc.php');
    50015
    50116############### stampa
    50217if ($xls!='1' && $pdf!='1'){
    503       echo "$datipdf $html";
     18          echo "$datipdf $html";
    50419}elseif($xls=="1"){
    50520        $nomefile="votanti.xls";
    50621        header ("Content-Type: application/vnd.ms-excel");
    50722        header ("Content-Disposition: inline; filename=$nomefile");
    508 
     23        header("Pragma: no-cache");
     24        header("Expires: 0");
     25        $datipdf = mb_convert_encoding($datipdf , "HTML-ENTITIES", "UTF-8");
    50926        echo "$datipdf";
    51027        echo "$html \n";
    51128}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 
     29        $nomefile="$descr_cons votanti.pdf";
     30        $stampa ="$datipdf $html";             
     31        $html2pdf = new Html2Pdf('P','A4', 'it');
     32        $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
     33        $html2pdf->Output($nomefile);
    52834}
    529 
    530 
    531 
    532 
    53335if($csv!=1 ) include ("footer.php");
    53436
    535 
    536 
    53737?>
Note: See TracChangeset for help on using the changeset viewer.