[348] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /************************************************************************/
|
---|
| 4 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 5 | /* by Luciano Apolito & Roberto Gigli */
|
---|
| 6 | /* http://www.eleonline.it */
|
---|
| 7 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
| 8 | /************************************************************************/
|
---|
| 9 |
|
---|
| 10 | //testa_riga[contenuto in posizione 0][y]
|
---|
| 11 | //testa_colonna[x][contenuto in posizione 0]
|
---|
| 12 | //corpo[da 1 a x][da 1 a y]
|
---|
| 13 |
|
---|
| 14 | if (!defined('MODULE_FILE')) {
|
---|
| 15 | die ("You can't access this file directly...");
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | require_once('inc/hpdf403/html2pdf.class.php');
|
---|
| 19 |
|
---|
| 20 | global $name;
|
---|
| 21 |
|
---|
| 22 | function crea_tabella($ar) {
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | global $prefix,$dbi,$pdf,$csv,$xls,$lang,$descr_cons,$prefix,$dbi,$id_comune,$descrizione,$siteistat,$min,$offset,$minsez,$offsetsez,$datipdf,$orienta,$formato;
|
---|
| 26 | $sql="SELECT descrizione,simbolo,stemma FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
|
---|
| 27 | $res = $dbi->prepare("$sql");
|
---|
| 28 | $res->execute();
|
---|
| 29 |
|
---|
| 30 | list($descr_com,$simbolo,$stemma) = $res->fetch(PDO::FETCH_NUM);
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | $datipdf=stripslashes($datipdf);
|
---|
| 35 |
|
---|
| 36 | $data=date("d-m-y G:i");
|
---|
| 37 |
|
---|
| 38 | if ($xls==1) {
|
---|
| 39 |
|
---|
| 40 | $nomefile=strip_tags(str_replace(array('"', "'", ' ', ','), "_", $datipdf).".xls");
|
---|
| 41 | # $nomefile=$_SESSION['nomefile'].".xls";
|
---|
| 42 | header ("Content-Type: application/vnd.ms-excel");
|
---|
| 43 | header ("Content-Disposition: inline; filename=$nomefile");
|
---|
| 44 |
|
---|
| 45 | $datipdf=str_replace("<br/>","\n",$datipdf);
|
---|
| 46 |
|
---|
| 47 | $datipdf=strip_tags($datipdf);
|
---|
| 48 | // $cella=str_replace("</b>"," ",$cella);
|
---|
| 49 | // $cella=str_replace("<br />"," ",$cella);
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | echo "$datipdf";
|
---|
| 53 |
|
---|
| 54 | $y=1;$i='';$e='';
|
---|
| 55 | foreach ($ar as $riga) {
|
---|
| 56 | $e++;
|
---|
| 57 | if($y) {
|
---|
| 58 | echo "\n";
|
---|
| 59 | }else{
|
---|
| 60 |
|
---|
| 61 | echo "\n";
|
---|
| 62 |
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 | foreach ($riga as $cella) {
|
---|
| 67 | $cella=str_replace("<b>"," ",$cella);
|
---|
| 68 | $cella=str_replace("</b>"," ",$cella);
|
---|
| 69 | $cella=str_replace("<br>"," ",$cella);
|
---|
| 70 | $cella=str_replace("<br />"," ",$cella);
|
---|
| 71 | $cella=str_replace("<span class=\"red\"><i>"," - ",$cella);
|
---|
| 72 | $cella=str_replace("<span class=\"red\" style=\"font-size:80%;\"><i>"," - ",$cella);
|
---|
| 73 | $cella=str_replace("</span>%</i>","%",$cella);
|
---|
| 74 | $cella=str_replace("</i></span>","",$cella);
|
---|
| 75 | $cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
|
---|
| 76 | $cella=str_replace("_SEZIONI","Sezione ",$cella);
|
---|
| 77 | $cella=str_replace("_TOT","Totale",$cella);
|
---|
| 78 | $cella=str_replace("_COMPLESSIVO","Complessivo",$cella);
|
---|
| 79 |
|
---|
| 80 | echo "$cella \t";
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | }
|
---|
| 84 | if ($y) $y=0;
|
---|
| 85 |
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | echo"\n\n\nPowered by Eleonline http://www.eleonline.it \t \n";
|
---|
| 89 | echo"by luciano apolito & roberto gigli - stampato: $data \t \n";
|
---|
| 90 | die();
|
---|
| 91 |
|
---|
| 92 | }else{
|
---|
| 93 |
|
---|
| 94 |
|
---|
| 95 |
|
---|
| 96 | $bg='bgw';
|
---|
| 97 |
|
---|
| 98 | $tmpbg='bggray2';
|
---|
| 99 | $tmpbg1='bgw';
|
---|
| 100 | $tmpbg2='bggray';
|
---|
| 101 | $tmpbg3='bggray2';
|
---|
| 102 |
|
---|
| 103 | $html ='';
|
---|
| 104 | if ($pdf!="1" && $csv=="1")
|
---|
| 105 | {
|
---|
| 106 |
|
---|
| 107 | $html .="<center><table><tr><td>
|
---|
| 108 | <img src=\"modules.php?name=Elezioni&file=foto&id_comune=".$id_comune."\" align=\"left\" alt=\"logo\" /> ";
|
---|
| 109 | $html .= "</td><td>$datipdf</td></td></table>";
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 |
|
---|
[354] | 114 | $html .= "<table class=\"table-docs\">";
|
---|
[348] | 115 |
|
---|
| 116 |
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 | $y=1;$i='';$e='';
|
---|
| 120 | foreach ($ar as $riga) {
|
---|
| 121 | $e++;
|
---|
| 122 | if($y) {
|
---|
| 123 | $html .= "<tr class=\"bggray\">";
|
---|
| 124 | }else{
|
---|
| 125 | $bg= ($bg==$tmpbg) ? $tmpbg1:$tmpbg3;
|
---|
| 126 | $html .= "<tr class=\"$bg\">";
|
---|
[354] | 127 | $i="class=\"td-150c\"";
|
---|
[348] | 128 | }
|
---|
| 129 | foreach ($riga as $cella) {
|
---|
| 130 |
|
---|
| 131 | $cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
|
---|
| 132 | $cella=str_replace("_SEZIONI","Sezione ",$cella);
|
---|
| 133 | $cella=str_replace("_TOT","Totale",$cella);
|
---|
| 134 | $cella=str_replace("_COMPLESSIVO","",$cella);
|
---|
| 135 |
|
---|
| 136 | if ($e==1){
|
---|
| 137 | $t="<td";$f="</td>";
|
---|
| 138 | }else{
|
---|
| 139 | $t="<td";$f="</td>";
|
---|
| 140 | }
|
---|
| 141 | $html .= "$t $i>$cella $f";
|
---|
[354] | 142 | $i="class=\"td-150b\"";
|
---|
[348] | 143 |
|
---|
| 144 | }
|
---|
| 145 | if ($y) $y=0;
|
---|
| 146 | $html .= "</tr>";
|
---|
| 147 | }
|
---|
| 148 | $html .= "</table>";
|
---|
| 149 |
|
---|
| 150 |
|
---|
| 151 | if ($pdf!="1" && $csv=="1"){
|
---|
| 152 | $html .="<br/><span class=\"copy\"><i>Stampato: $data</i></span>";
|
---|
| 153 | $html .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
|
---|
| 154 | $html .="</center><br />";
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 | # inizio stampa a video o pdf
|
---|
| 158 |
|
---|
| 159 |
|
---|
| 160 | if ($pdf!='1'){
|
---|
| 161 | echo $html;
|
---|
| 162 | }else{
|
---|
| 163 |
|
---|
| 164 | $style ="
|
---|
| 165 | <style type=\"text/css\">
|
---|
| 166 | <!--
|
---|
| 167 | .table-docs {
|
---|
| 168 | font-size: 10px;
|
---|
| 169 | padding: 1px;
|
---|
| 170 | color: #000000;
|
---|
| 171 | /* margin: 4px 4px 40px;*/
|
---|
| 172 | border: solid #666666;
|
---|
| 173 | text-align:center;
|
---|
| 174 | }
|
---|
| 175 | .bggray {
|
---|
| 176 | background: #d2d2d2;
|
---|
| 177 | FONT-SIZE: 13px;
|
---|
| 178 | FONT-FAMILY: Helvetica;
|
---|
| 179 | border: 1px;
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | .bggray2 {
|
---|
| 183 | background: #EFEFEF;
|
---|
| 184 | FONT-SIZE: 13px;
|
---|
| 185 | FONT-FAMILY: Helvetica;
|
---|
| 186 | border: 1px;
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | bggray3 {
|
---|
| 190 | background: #EFEFEF;
|
---|
| 191 | FONT-SIZE: 10px;
|
---|
| 192 | FONT-FAMILY: Helvetica;
|
---|
| 193 | text-align: left
|
---|
| 194 | }
|
---|
| 195 |
|
---|
| 196 | .bgw {
|
---|
| 197 | background: #ffffff;
|
---|
| 198 | FONT-SIZE: 13px;
|
---|
| 199 | FONT-FAMILY: Helvetica;
|
---|
| 200 | border: 1px;
|
---|
| 201 |
|
---|
| 202 | }
|
---|
| 203 | .td-130 {
|
---|
| 204 | float: right;
|
---|
| 205 | margin: 0px 0 0 1px;
|
---|
| 206 | width: 130px;
|
---|
| 207 | border: none;
|
---|
| 208 | background-color: #d2d2d2;
|
---|
| 209 | padding: 0px;
|
---|
| 210 |
|
---|
| 211 | }
|
---|
| 212 | .td-130c {
|
---|
| 213 | float: right;
|
---|
| 214 | text-align:left;
|
---|
| 215 | margin: 0px 0 0 1px;
|
---|
| 216 | width: 130px;
|
---|
| 217 | border: none;
|
---|
| 218 | padding: 0px;
|
---|
| 219 | }
|
---|
| 220 |
|
---|
| 221 | td {
|
---|
| 222 | border: .2px;
|
---|
| 223 | }
|
---|
| 224 | .red {
|
---|
| 225 | BACKGROUND: none;
|
---|
| 226 | COLOR: #ff0000;
|
---|
| 227 | FONT-SIZE: 12px;
|
---|
| 228 | FONT-FAMILY: Helvetica
|
---|
| 229 | }
|
---|
| 230 | .copy {
|
---|
| 231 | background: #d2d2d2;
|
---|
| 232 | FONT-SIZE: 8px;
|
---|
| 233 | FONT-FAMILY: Helvetica;
|
---|
| 234 | border: 1px;
|
---|
| 235 | }
|
---|
| 236 | .cen {
|
---|
| 237 | margin: 10px auto 0 auto;
|
---|
| 238 | }
|
---|
| 239 | -->
|
---|
| 240 | </style>";
|
---|
| 241 |
|
---|
| 242 |
|
---|
| 243 | # salva sull'hardisk lo stemma del comune
|
---|
| 244 | $logo=verificasimbolo();
|
---|
| 245 | $immagine= "<img src=\"modules/Elezioni/images/$logo\" alt=\"logo\" align=\"left\"/>";
|
---|
| 246 |
|
---|
| 247 |
|
---|
[352] | 248 | $style .="<table style=\"margin: auto;border-collapse: collapse;\"><tr><td border=0>$immagine</td> ";
|
---|
[348] | 249 |
|
---|
| 250 | $style .= "<td border=0>$datipdf</td></tr></table><br/><br/>";
|
---|
| 251 | $style .= "<table style=\"margin: auto;\"><tr><td>$html</td></tr></table>";
|
---|
[352] | 252 | $style .= "<table style=\"margin: auto;border-collapse: collapse;\"><tr><td border=0>";
|
---|
[348] | 253 |
|
---|
| 254 | $data=date("d-m-y G:i");
|
---|
| 255 | $style .="<br/><span class=\"copy\"><i>Stampato il $data</i></span>";
|
---|
| 256 | $style .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
|
---|
| 257 | $style .="</td></tr></table>";
|
---|
| 258 | $nomefile=strip_tags($datipdf).".pdf";
|
---|
| 259 | # $nomefile=$_SESSION['nomefile'].".pdf";
|
---|
| 260 | $nomefile=str_replace(" ", "_",$nomefile);
|
---|
| 261 | // conversion HTML => PDF
|
---|
| 262 | //$nomefile="elezioni_tabelle.pdf";
|
---|
| 263 | //$orienta="P";
|
---|
| 264 | $html2pdf = new Html2Pdf($orienta,$formato, 'it');
|
---|
| 265 | $html2pdf->WriteHTML($style, isset($_GET['vuehtml']));
|
---|
| 266 | $html2pdf->Output($nomefile);
|
---|
| 267 |
|
---|
| 268 |
|
---|
| 269 |
|
---|
| 270 | }
|
---|
| 271 |
|
---|
| 272 |
|
---|
| 273 |
|
---|
| 274 |
|
---|
| 275 | }
|
---|
| 276 | }
|
---|
| 277 |
|
---|
| 278 |
|
---|
| 279 |
|
---|
| 280 |
|
---|
| 281 |
|
---|
| 282 | ?>
|
---|