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