$value) { ${$key} = !empty(${$key}) ? ${$key} : $value; } // Mostro o nascondo i costi dell'intervento... $visualizza_costi = get_var('Visualizza i costi sulle stampe degli interventi'); // Nuovo sistema di generazione stampe if (file_exists($docroot.'/templates/'.$ptype.'/init.php')) { // Impostazioni di default if (file_exists($docroot.'/templates/base/custom/settings.php')) { $default = include $docroot.'/templates/base/custom/settings.php'; } else { $default = include $docroot.'/templates/base/settings.php'; } // Impostazioni personalizzate della stampa if (file_exists($docroot.'/templates/'.$ptype.'/custom/settings.php')) { $custom = include $docroot.'/templates/'.$ptype.'/custom/settings.php'; } elseif (file_exists($docroot.'/templates/'.$ptype.'/settings.php')) { $custom = include $docroot.'/templates/'.$ptype.'/settings.php'; } // Individuazione delle impostazioni finali $settings = array_merge($default, (array) $custom); // Individuazione delle variabili fondamentali per la sostituzione dei contenuti if (file_exists($docroot.'/templates/'.$ptype.'/custom/init.php')) { include $docroot.'/templates/'.$ptype.'/custom/init.php'; } else { include $docroot.'/templates/'.$ptype.'/init.php'; } if (!empty($id_module)) { Permissions::addModule($id_module); } Permissions::check(); // Generazione dei contenuti della stampa ob_start(); if (file_exists($docroot.'/templates/'.$ptype.'/custom/body.php')) { include $docroot.'/templates/'.$ptype.'/custom/body.php'; } else { include $docroot.'/templates/'.$ptype.'/body.php'; } $report = ob_get_clean(); if(!empty($autofill)){ $result = ''; // max($autofill['additional']) = $autofill['rows'] - 1 for ($i = (floor($autofill['count']) % $autofill['rows']); $i < $autofill['additional']; ++$i) { $result .= '
'.$error.'
'; exit(); } $mode = !empty($filename) ? 'F' : 'I'; $filename = !empty($filename) ? $filename : sanitizeFilename($report_name); $title = basename($filename); if (file_exists($docroot.'/templates/'.$ptype.'/init.php')) { $styles = [ 'templates/base/bootstrap.css', 'templates/base/style.css', ]; $mpdf = new mPDF( 'c', $settings['dimension'], $settings['font-size'], 'helvetica', $settings['margins']['left'], $settings['margins']['right'], $settings['margins']['top'] + $settings['header-height'], $settings['margins']['bottom'] + $settings['footer-height'], $settings['margins']['top'], $settings['margins']['bottom'], strtolower($settings['orientation']) == 'l' ? 'l' : 'p' ); $mpdf->SetHTMLFooter($foot); $mpdf->SetHTMLHeader($head); $mpdf->SetTitle($title); foreach ($styles as $value) { $mpdf->WriteHTML(file_get_contents(__DIR__.'/'.$value), 1); } $mpdf->WriteHTML($report); $mpdf->Output($filename, $mode); } else { $html2pdf = new Spipu\Html2Pdf\Html2Pdf($orientation, 'A4', 'it', true, 'UTF-8'); $html2pdf->writeHTML($report); $html2pdf->pdf->setTitle($title); $html2pdf->output($filename, $mode); }