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