require_once ROOT_DIR . '/include/PdfClass.inc.php'; $pdf = new PdfClass('', $PDFdata['title']); $pdf->addHeader($PDFdata['title'], ROOT_DIR . '/layout/' . $userObj->template_family . '/img/header-logo.png')->addFooter(translateFN("Report") . " " . translateFN("generato") . " " . translateFN("il") . " " . date("d/m/Y") . " " . translateFN("alle") . " " . date("H:i:s")); /** * begin PDF body generation */ $pdf->ezText($PDFdata['block1'], $pdf->docFontSize); $pdf->ezText($PDFdata['block2'], $pdf->docFontSize, array('justification' => 'center')); $pdf->ezSetDy(-20); $pdf->ezImage(HTTP_ROOT_DIR . "/browsing/include/graph_pies.inc.php?nodes_percent=" . urlencode($nodes_percent), 5, 200, 'width'); $pdf->ezText($PDFdata['block3'], $pdf->docFontSize, array('justification' => 'center')); $pdf->ezSetDy(-20); if (is_array($PDFdata['table'])) { // tables output foreach ($PDFdata['table'] as $count => $PDFTable) { $pdf->ezTable($PDFTable['data'], $PDFTable['cols'], $PDFTable['title'], array('width' => $pdf->ez['pageWidth'] - $pdf->ez['leftMargin'] - $pdf->ez['rightMargin'])); if ($count < count($PDFdata['table']) - 1) { $pdf->ezSetDy(-20); } } } $pdf->saveAs($filename); } else { /* * outputs the data of selected student as a file excel */ header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate");
if (preg_match('/img/', $val) !== 0) { continue; } $cols[$key] = strip_tags($val); } array_shift($courses_student); // prepare data rows $data = array(); $i = 0; foreach ($courses_student as $num => $elem) { foreach ($elem as $key => $val) { $data[$i][$key] = strip_tags($val); } $i++; } $pdf->ezTable($data, $cols, array('width' => $pdf->ez['pageWidth'] - $pdf->ez['leftMargin'] - $pdf->ez['rightMargin'])); $pdf->saveAs($filename); } else { if ($type === 'xls') { $tObj = BaseHtmlLib::tableElement('id:table_Report', array_shift($courses_student), $courses_student, array(), null); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 header("Content-Type: application/vnd.ms-excel"); // header("Content-Length: ".filesize($name));