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