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

Last change on this file since 113 was 111, checked in by roby, 13 years ago

admin: inserito controllo su affluenze, la rilevazione successiva non puo' avere meno votanti di una precedente
admin: importa liste, corretto un caso particolare
client: tolte font pdf non usate
client: ridotta font per le percentuali di sezione

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