Ignore:
Timestamp:
Jun 2, 2011, 11:48:42 PM (13 years ago)
Author:
eol
Message:

implementazione dell'esportazione affluenze e votanti in formato pdf

File:
1 edited

Legend:

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

    r101 r117  
    1818if (isset($param['id_comune'])) $id_comune=intval($param['id_comune']);
    1919if (isset($param['xls'])) $xls=intval($param['xls']);
     20if (isset($param['pdf'])) $pdf=intval($param['pdf']);
    2021$res = mysql_query("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'" , $dbi);
    2122list($tipo_cons,$genere,$id_cons) = mysql_fetch_row($res);
     
    3536        $datipdf .= "<div style=\"margin:0px auto; text-align:center;\">";
    3637        $siteistat=$id_comune;
    37         if($xls!=1) $datipdf .= "<table><tr><td><img src=\"modules.php?name=Elezioni&amp;file=foto&amp;id_comune=".$id_comune."\" alt=\"mappa\" /></td><td>";
    38         $datipdf .= ""._COMUNE." $descr_com <br/>
    39         "._RISULTA." "._CONSULTA."<br/>";
    40         $datipdf .= "<h1>$descr_cons</h1>"._DISCLAIMER."";
     38        # salva sull'hardisk lo stemma del comune
     39        $logo=verificasimbolo();
     40        $immagine= "<img src=\"modules/Elezioni/images/$logo\" alt=\"logo\" align=\"left\"/>";
     41
     42        if($xls!=1) $datipdf .= "<table><tr><td>$immagine</td><td>";
     43       
     44        $datipdf .= ""._COMUNE." $descr_com <br />
     45        "._RISULTA." "._CONSULTA."<br/ >";
     46        $datipdf .= "$descr_cons<br />"._DISCLAIMER."
     47        <br /><b>"._DETTAGLIO."  "._AFFLUENZE."</b>";
    4148        if($xls!=1) $datipdf .=  "</td></tr></table>";
    42         $datipdf .="      <h2><b>"._DETTAGLIO."  "._AFFLUENZE."</b></h2></div>";
     49        $datipdf .="</div>";
    4350
    4451        $html = "<style type=\"text/css\">
     
    123130        <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&amp;csv=1&amp;xls=1\">
    124131        <img class=\"image\" src=\"modules/Elezioni/images/csv.gif\" alt=\"\" /></a>
     132<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&amp;csv=1&amp;pdf=1\">
     133        <img class=\"image\" src=\"modules/Elezioni/images/pdf.gif\" alt=\"\" /></a>
    125134
    126135        </div>
     
    296305             if($genere==0){ //se e' referendum
    297306        #'Pagina precedente' e 'Pagina Successiva'
     307        if ($xls!='1' && $pdf!='1' && $csv='1'){
    298308        $html .= "<div class=\"modulo\">";
    299309            $cur=$num_ref;
     
    311321        $html .= "</div>";
    312322        }
    313 
     323}
    314324       
    315325if(!isset($style)) $style='';   
     
    317327      $data=date("d-m-y G:i");
    318328      $style .="\t\t\n<br/><br/><br/><div style=\"margin:0px auto;text-align:center;\"><i>Stampato: $data</i></div>";
    319       $style .="<br/><div style=\"text-align:center;\"><i>Eleonline by l. apolito & r. gigli - www.eleonline.it</i></div>";             
     329      $style .="<br/><div style=\"text-align:center;\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></div>";           
    320330      $style .= "<br/>  ";     
    321331     
    322332}       
    323 $html .= "</div>";
     333//$html .= "</div>";
    324334
    325335
    326336############### stampa
    327 if ($xls!='1'){
     337if ($xls!='1' && $pdf!='1'){
    328338      echo "$datipdf $html $style";
    329 }else{
    330         $nomefile="export.xls";
     339
     340}elseif($xls=="1"){
     341        $nomefile="affluenze.xls";
    331342        header ("Content-Type: application/vnd.ms-excel");
    332343        header ("Content-Disposition: inline; filename=$nomefile");
    333 
    334344        echo "$datipdf";
    335345        echo "$html \t\n $style";
     346}elseif($pdf=='1'){
     347                $nomefile="$descr_cons affluenze.pdf";
     348               
     349                $stampa ="$datipdf $html $style";
     350               
     351                require_once('inc/hpdf403/html2pdf.class.php');
     352                $html2pdf = new HTML2PDF('L','A4', 'it');
     353                $html2pdf->WriteHTML($stampa, isset($_GET['vuehtml']));
     354                $html2pdf->Output($nomefile);
    336355}
    337356
Note: See TracChangeset for help on using the changeset viewer.