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

Last change on this file since 249 was 225, checked in by roby, 10 years ago

client: ulteriore modifica della funzione di proiezione del consiglio comunale

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