Esempio n. 1
0
                 $PDFdata['table'][0]['cols'][$key] = translateFN($key);
             }
         }
         // this time returned data contains html tags, let's strip'em down
         foreach ($PDFdata['table'][0]['data'] as $num => $rowElement) {
             foreach ($rowElement as $key => $cellValue) {
                 $PDFdata['table'][0]['data'][$num][$key] = strip_tags($cellValue, $allowableTags);
             }
         }
     }
 } else {
     unset($PDFdata['table'][0]);
 }
 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);
Esempio n. 2
0
 // 1. Get the instance courses data
 $instance_course_ha = $dh->course_instance_get($id_instance);
 if (AMA_DB::isError($instance_course_ha)) {
     $start_date = '';
     $instance_title = '';
 } else {
     $start_date = AMA_DataHandler::ts_to_date($instance_course_ha['data_inizio'], ADA_DATE_FORMAT);
     $instance_title = $instance_course_ha['title'];
 }
 $caption = translateFN("Studenti del corso") . " <strong>{$course_title}</strong>  - " . translateFN("Classe") . " " . $instance_title . " (" . $id_instance . ") - " . translateFN("Iniziato il ") . "&nbsp;<strong>{$start_date}</strong>";
 // build up filename to be streamed out
 $filename = 'course_' . $id_course . '_class_' . $id_instance . '.' . $type;
 if ($type === 'pdf') {
     require_once ROOT_DIR . '/include/PdfClass.inc.php';
     $pdf = new PdfClass('landscape', strip_tags(html_entity_decode($courses_student['caption'])));
     $pdf->addHeader(strip_tags(html_entity_decode($caption)), ROOT_DIR . '/layout/' . $userObj->template_family . '/img/header-logo.png', 14)->addFooter(translateFN("Report") . " " . translateFN("generato") . " " . translateFN("il") . " " . date("d/m/Y") . " " . translateFN("alle") . " " . date("H:i:s"));
     // prepare header row
     foreach ($courses_student[0] as $key => $val) {
         // skip level up and down images, cannot be done in config file
         // because it would remove cols from html too, and this is not good
         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) {