source: trunk/client/modules/Elezioni/crea_pagina.php@ 2

Last change on this file since 2 was 2, checked in by root, 15 years ago

importo il progetto

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