ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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, $module_path='Modules/Test/')
 
static getCssContent ()
 

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.

References $html, and array.

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 100 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(), ilTestServiceGUI\populateContent(), ilObjTestGUI\printobject(), ilObjTestGUI\reviewobject(), and ilTestArchiver\updateTestArchive().

101  {
102  $pdf_output = self::preprocessHTML($pdf_output);
103 
104  if (substr($filename, strlen($filename) - 4, 4) != '.pdf')
105  {
106  $filename .= '.pdf';
107  }
108 
109  require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php';
110 
111  $job = new ilPDFGenerationJob();
112  $job->setAutoPageBreak(true)
113  ->setCreator('ILIAS Test')
114  ->setFilename($filename)
115  ->setMarginLeft('20')
116  ->setMarginRight('20')
117  ->setMarginTop('20')
118  ->setMarginBottom('20')
119  ->setOutputMode($output_mode)
120  ->addPage($pdf_output);
121 
123  }
Class ilPDFGenerationJob.
static doJob(ilPDFGenerationJob $job)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCssContent()

static ilTestPDFGenerator::getCssContent ( )
staticprotected

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

150  {
151  $cssContent = file_get_contents( self::getTemplatePath('delos.css', '') );
152  $cssContent .= file_get_contents( self::getTemplatePath('test_pdf.css') );
153 
154  return $cssContent;
155  }

◆ getTemplatePath()

static ilTestPDFGenerator::getTemplatePath (   $a_filename,
  $module_path = 'Modules/Test/' 
)
staticprotected

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

133  {
134  // use ilStyleDefinition instead of account to get the current skin
135  include_once "Services/Style/System/classes/class.ilStyleDefinition.php";
136  if (ilStyleDefinition::getCurrentSkin() != "default")
137  {
138  $fname = "./Customizing/global/skin/".
139  ilStyleDefinition::getCurrentSkin()."/".$module_path.basename($a_filename);
140  }
141 
142  if($fname == "" || !file_exists($fname))
143  {
144  $fname = "./".$module_path."templates/default/".basename($a_filename);
145  }
146  return $fname;
147  }

◆ preprocessHTML()

static ilTestPDFGenerator::preprocessHTML (   $html)
static

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

References $html.

126  {
127  $html = self::makeHtmlDocument($html, '<style>'.self::getCssContent().'</style>');
128 
129  return $html;
130  }
$html
Definition: example_001.php:87

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: