Class ilTestPDFGenerator.
More...
Class ilTestPDFGenerator.
Class that handles PDF generation for test and assessment.
- Author
- Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
- Version
- $Id$
Definition at line 13 of file class.ilTestPDFGenerator.php.
◆ generatePDF()
static ilTestPDFGenerator::generatePDF |
( |
|
$pdf_output, |
|
|
|
$output_mode, |
|
|
|
$filename = null |
|
) |
| |
|
static |
Definition at line 59 of file class.ilTestPDFGenerator.php.
References $filename, and ilPDFGeneration\doJob().
Referenced by ilTestArchiveService\archiveActivesPass(), ilTestPlayerAbstractGUI\archiveParticipantSubmission(), ilObjTestGUI\createUserResults(), ilTestServiceGUI\getQuestionResultForTestUsers(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), ilTestEvaluationGUI\outUserResultsOverview(), ilTestSubmissionReviewGUI\pdfDownload(), ilObjTestGUI\printobject(), ilTestScoring\recalculatePasses(), and ilTestArchiver\updateTestArchive().
61 $pdf_output = self::preprocessHTML($pdf_output);
68 require_once
'./Services/PDFGeneration/classes/class.ilPDFGeneration.php';
71 $job->setAutoPageBreak(
true)
72 ->setCreator(
'ILIAS Test')
75 ->setMarginRight(
'20')
77 ->setMarginBottom(
'20')
78 ->setOutputMode($output_mode)
79 ->addPage($pdf_output);
Class ilPDFGenerationJob.
static doJob(ilPDFGenerationJob $job)
◆ getTemplatePath()
static ilTestPDFGenerator::getTemplatePath |
( |
|
$a_filename | ) |
|
|
staticprotected |
Definition at line 91 of file class.ilTestPDFGenerator.php.
93 $module_path =
"Modules/Test/";
96 include_once
"Services/Style/classes/class.ilStyleDefinition.php";
97 if (ilStyleDefinition::getCurrentSkin() !=
"default")
99 $fname =
"./Customizing/global/skin/".
100 ilStyleDefinition::getCurrentSkin().
"/".$module_path.basename($a_filename);
103 if($fname ==
"" || !file_exists($fname))
105 $fname =
"./".$module_path.
"templates/default/".basename($a_filename);
◆ preprocessHTML()
static ilTestPDFGenerator::preprocessHTML |
( |
|
$html | ) |
|
|
static |
Definition at line 84 of file class.ilTestPDFGenerator.php.
86 $html = self::removeScriptElements($html);
87 $pdf_css_path = self::getTemplatePath(
'test_pdf.css');
88 return '<style>' . file_get_contents($pdf_css_path) .
'</style>' . $html;
◆ removeScriptElements()
static ilTestPDFGenerator::removeScriptElements |
( |
|
$html | ) |
|
|
staticprivate |
- Parameters
-
- Returns
- string
Definition at line 23 of file class.ilTestPDFGenerator.php.
25 if(!is_string($html) || !strlen(trim($html)))
31 if(!@$dom->loadHTML(
'<?xml encoding="UTF-8">' . $html))
36 $invalid_elements = array();
38 $script_elements = $dom->getElementsByTagName(
'script');
39 foreach($script_elements as $elm)
41 $invalid_elements[] = $elm;
44 foreach($invalid_elements as $elm)
46 $elm->parentNode->removeChild($elm);
49 $dom->encoding =
'UTF-8';
50 $cleaned_html = $dom->saveHTML();
◆ PDF_OUTPUT_DOWNLOAD
const ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD = 'D' |
◆ PDF_OUTPUT_FILE
const ilTestPDFGenerator::PDF_OUTPUT_FILE = 'F' |
◆ PDF_OUTPUT_INLINE
const ilTestPDFGenerator::PDF_OUTPUT_INLINE = 'I' |
The documentation for this class was generated from the following file: