ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilTestPDFGenerator Class Reference

Class ilTestPDFGenerator. More...

+ Collaboration diagram for ilTestPDFGenerator:

Static Public Member Functions

static generatePDF ($pdf_output, $output_mode, $filename=null)
 
static preprocessHTML ($html)
 

Data Fields

const PDF_OUTPUT_DOWNLOAD = 'D'
 
const PDF_OUTPUT_INLINE = 'I'
 
const PDF_OUTPUT_FILE = 'F'
 

Static Protected Member Functions

static getTemplatePath ($a_filename)
 

Static Private Member Functions

static buildHtmlDocument ($contentHtml, $styleHtml)
 

Detailed Description

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.

Member Function Documentation

◆ buildHtmlDocument()

static ilTestPDFGenerator::buildHtmlDocument (   $contentHtml,
  $styleHtml 
)
staticprivate

Definition at line 19 of file class.ilTestPDFGenerator.php.

20 {
21 return "
22 <html>
23 <head>
24 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
25 $styleHtml
26 </head>
27 <body>$contentHtml</body>
28 </html>
29 ";
30 }

◆ generatePDF()

static ilTestPDFGenerator::generatePDF (   $pdf_output,
  $output_mode,
  $filename = null 
)
static

Definition at line 107 of file class.ilTestPDFGenerator.php.

108 {
109 $pdf_output = self::preprocessHTML($pdf_output);
110
111 if (substr($filename, strlen($filename) - 4, 4) != '.pdf')
112 {
113 $filename .= '.pdf';
114 }
115
116 require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php';
117
118 $job = new ilPDFGenerationJob();
119 $job->setAutoPageBreak(true)
120 ->setCreator('ILIAS Test')
121 ->setFilename($filename)
122 ->setMarginLeft('20')
123 ->setMarginRight('20')
124 ->setMarginTop('20')
125 ->setMarginBottom('20')
126 ->setOutputMode($output_mode)
127 ->addPage($pdf_output);
128
130 }
$filename
Definition: buildRTE.php:89
Class ilPDFGenerationJob.
static doJob(ilPDFGenerationJob $job)

References $filename, ilPDFGeneration\doJob(), and preprocessHTML().

Referenced by ilTestArchiveService\archiveActivesPass(), ilTestPlayerAbstractGUI\archiveParticipantSubmission(), ilObjTestGUI\createUserResults(), ilTestServiceGUI\getQuestionResultForTestUsers(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), ilTestEvaluationGUI\outUserResultsOverview(), ilTestSubmissionReviewGUI\pdfDownload(), ilTestServiceGUI\populateContent(), ilObjTestGUI\printobject(), and ilTestArchiver\updateTestArchive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTemplatePath()

static ilTestPDFGenerator::getTemplatePath (   $a_filename)
staticprotected

Definition at line 140 of file class.ilTestPDFGenerator.php.

141 {
142 $module_path = "Modules/Test/";
143
144 // use ilStyleDefinition instead of account to get the current skin
145 include_once "Services/Style/classes/class.ilStyleDefinition.php";
146 if (ilStyleDefinition::getCurrentSkin() != "default")
147 {
148 $fname = "./Customizing/global/skin/".
149 ilStyleDefinition::getCurrentSkin()."/".$module_path.basename($a_filename);
150 }
151
152 if($fname == "" || !file_exists($fname))
153 {
154 $fname = "./".$module_path."templates/default/".basename($a_filename);
155 }
156 return $fname;
157 }

Referenced by preprocessHTML().

+ Here is the caller graph for this function:

◆ preprocessHTML()

static ilTestPDFGenerator::preprocessHTML (   $html)
static

Definition at line 132 of file class.ilTestPDFGenerator.php.

133 {
134 $pdf_css_path = self::getTemplatePath('test_pdf.css');
135 $html = self::makeHtmlDocument($html, '<style>'.file_get_contents($pdf_css_path).'</style>');
136
137 return $html;
138 }
static getTemplatePath($a_filename)
$html
Definition: example_001.php:87

References $html, and getTemplatePath().

Referenced by generatePDF().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ PDF_OUTPUT_DOWNLOAD

◆ PDF_OUTPUT_FILE

◆ PDF_OUTPUT_INLINE

const ilTestPDFGenerator::PDF_OUTPUT_INLINE = 'I'

Definition at line 16 of file class.ilTestPDFGenerator.php.


The documentation for this class was generated from the following file: