source: trunk/client/modules/Elezioni/crea_paginaphp5.php@ 429

Last change on this file since 429 was 399, checked in by roby, 9 months ago
  • ADMIN

-- Correzione per il caricamento di liste nelle elezioni europee

  • CLIENT

-- Centratura del logo del comune nelle stampe
-- Correzione per casi particolari nel widget gom_affluenze
-- Correzione per caso particolare in grafici

File size: 6.4 KB
RevLine 
[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
14if (!defined('MODULE_FILE')) {
15 die ("You can't access this file directly...");
16}
17
18require_once('inc/hpdf403/html2pdf.class.php');
19
20global $name;
21
22function crea_tabella($ar) {
[371]23 global $prefix,$dbi,$pdf,$csv,$xls,$lang,$descr_cons,$prefix,$dbi,$id_comune,$descrizione,$siteistat,$min,$offset,$minsez,$offsetsez,$datipdf,$orienta,$formato;
24 $sql="SELECT descrizione,simbolo,stemma FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
[348]25 $res = $dbi->prepare("$sql");
26 $res->execute();
27 list($descr_com,$simbolo,$stemma) = $res->fetch(PDO::FETCH_NUM);
[390]28 $datipdf=stripslashes("$datipdf");
[371]29 $data=date("d-m-y G:i");
30 if ($xls==1) {
31 $nomefile=strip_tags(str_replace(array('"', "'", ' ', ','), "_", $datipdf).".xls");
32 header ("Content-Type: application/vnd.ms-excel");
33 header ("Content-Disposition: inline; filename=$nomefile");
34 $datipdf=str_replace("<br/>","\n",$datipdf);
35 $datipdf=strip_tags($datipdf);
36 echo "$datipdf";
37 $y=1;$i='';$e=0;
[348]38 foreach ($ar as $riga) {
[371]39 $e++;
40 if($y) {
[348]41 echo "\n";
42 }else{
[371]43 echo "\n";
[348]44 }
45 foreach ($riga as $cella) {
[371]46 $cella=str_replace("<b>"," ",$cella);
47 $cella=str_replace("</b>"," ",$cella);
48 $cella=str_replace("<br>"," ",$cella);
49 $cella=str_replace("<br />"," ",$cella);
50 $cella=str_replace("<span class=\"red\"><i>"," - ",$cella);
51 $cella=str_replace("<span class=\"red\" style=\"font-size:80%;\"><i>"," - ",$cella);
52 $cella=str_replace("</span>%</i>","%",$cella);
53 $cella=str_replace("</i></span>","",$cella);
54 $cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
55 $cella=str_replace("_SEZIONI","Sezione ",$cella);
56 $cella=str_replace("_TOT","Totale",$cella);
57 $cella=str_replace("_COMPLESSIVO","Complessivo",$cella);
58 echo "$cella \t";
[348]59 }
[371]60 if ($y) $y=0;
[348]61 }
[371]62 echo"\n\n\nPowered by Eleonline http://www.eleonline.it \t \n";
63 echo"by luciano apolito & roberto gigli - stampato: $data \t \n";
64 die();
65 }else{
66 $bg='bgw';
67 $tmpbg='bggray2';
68 $tmpbg1='bgw';
69 $tmpbg2='bggray';
70 $tmpbg3='bggray2';
71 $html ='';
72 if ($pdf!="1" && $csv=="1")
73 {
[399]74 $html .="<center><table><tr><td align=\"middle\">
75 <img src=\"modules.php?name=Elezioni&amp;file=foto&amp;id_comune=".$id_comune."\" alt=\"logo\" /> ";
[371]76# $html .= "</td><td>$datipdf";
77 $html .= "</td></tr></table>";
[348]78 }
[375]79 if($pdf==1 or $csv==1) $html .= "<p style=\"text-align:center;\">$datipdf</p>";
[371]80 $html .= "<table class=\"table-docs\">";
81 $y=1;$e=0;
[348]82 foreach ($ar as $riga) {
[371]83 $e++;
84 $i=1;
[348]85 if($y) {
86 $html .= "<tr class=\"bggray\">";
87 }else{
88 $bg= ($bg==$tmpbg) ? $tmpbg1:$tmpbg3;
89 $html .= "<tr class=\"$bg\">";
90 }
91 foreach ($riga as $cella) {
[371]92 if($cella) {
93 $cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
94 $cella=str_replace("_SEZIONI","Sezione ",$cella);
95 $cella=str_replace("_TOT","Totale",$cella);
96 $cella=str_replace("_COMPLESSIVO","",$cella);
97 }
98 if ($e==1){
99 $t="<td";$f="</td>";
100 }elseif($i){
101 $t="<td style='text-align:left;'";$f="</td>";
102 }else{
103 $t="<td";$f="</td>";
104 }
105 $html .= "$t >$cella $f";
106 $i=0;
[348]107 }
108 if ($y) $y=0;
109 $html .= "</tr>";
110 }
111 $html .= "</table>";
112 if ($pdf!="1" && $csv=="1"){
[371]113 $html .="<br/><span class=\"copy\"><i>Stampato: $data</i></span>";
114 $html .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
115 $html .="</center><br />";
[348]116 }
117
118 # inizio stampa a video o pdf
119 if ($pdf!='1'){
[371]120 echo $html;
121 }else{
122 $style ="
123 <style type=\"text/css\">
124 <!--
125 .table-docs {
126 font-size: 12px;
127 text-align:center;
128 border: 1px;
129 border-color: black;
130 margin: auto;
131 border-collapse: collapse;
132 }
133 .bggray {
134 background: #d2d2d2;
135 FONT-SIZE: 16px;
136 FONT-FAMILY: Helvetica;
137 border: 1px;
138 border-spacing: 5px;
139 }
[348]140
[371]141 .bggray2 {
142 background: #EFEFEF;
143 FONT-SIZE: 13px;
144 FONT-FAMILY: Helvetica;
145 text-align: center;
146 border-spacing: 5px;
147 }
[348]148
[371]149 bggray3 {
150 background: #EFEFEF;
151 FONT-SIZE: 10px;
152 FONT-FAMILY: Helvetica;
153 text-align: left
154 }
[348]155
[371]156 .bgw {
157 background: #ffffff;
158 FONT-SIZE: 13px;
159 FONT-FAMILY: Helvetica;
160 border: 1px;
161 text-align: center;
162 border-spacing: 5px;
[348]163 }
[371]164 .td-130 {
165 float: right;
166 margin: 0px 0 0 1px;
167 width: 130px;
168 border: 1px;
169 background-color: #d2d2d2;
170 padding: 0px;
171 }
172 .td-130c {
173 float: right;
174 text-align:left;
175 margin: 0px 0px 0px 1px;
176 width: 130px;
177 border: 1px;
[348]178
[371]179 }
[348]180
[371]181 td {
182 border: 2px;
183 }
184 .red {
185 BACKGROUND: none;
186 COLOR: #ff0000;
187 FONT-SIZE: 12px;
188 FONT-FAMILY: Helvetica
189 }
190 .copy {
191 background: #d2d2d2;
192 FONT-SIZE: 8px;
193 FONT-FAMILY: Helvetica;
194 border: 1px;
195 }
196 .cen {
197 margin: 10px auto 0 auto;
198 }
199 -->
200 </style>";
[348]201 # salva sull'hardisk lo stemma del comune
202 $logo=verificasimbolo();
203 $immagine= "<img src=\"modules/Elezioni/images/$logo\" alt=\"logo\" align=\"left\"/>";
[371]204 $style .="<table style=\"margin: auto;border-collapse: collapse;text-align: center;\"><tr><td border=0>$immagine</td></tr></table> ";
205# $style .= "<tr style=\"border-spacing: 25px;\"><td>$datipdf</td></tr></table><br/><br/>";
206 $style .= "<br/>".$html;
207# $style .= "<table style=\"margin: auto;\"><tr><td>$html</td></tr></table>";
208 $style .= "<table style=\"margin: auto;border-collapse: collapse;\"><tr><td border=0>";
209 $data=date("d-m-y G:i");
210 $style .="<br/><span class=\"copy\"><i>Stampato il $data</i></span>";
211 $style .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
212 $style .="</td></tr></table>";
213 $nomefile=strip_tags($datipdf).".pdf";
214 $nomefile=str_replace(" ", "_",$nomefile);
215 // conversion HTML => PDF
216 $html2pdf = new Html2Pdf($orienta,$formato, 'it');
217 $html2pdf->WriteHTML($style, isset($_GET['vuehtml']));
218 $html2pdf->Output($nomefile);
219 }
220 }
221}
[348]222
223
224
225
226
227
228?>
Note: See TracBrowser for help on using the repository browser.