ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestPDFGenerator Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilTestPDFGenerator:

Static Public Member Functions

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

Data Fields

const PDF_OUTPUT_DOWNLOAD = 'D'
 
const PDF_OUTPUT_INLINE = 'I'
 
const PDF_OUTPUT_FILE = 'F'
 
const service = "Test"
 

Static Protected Member Functions

static getTemplatePath ($a_filename, $module_path='Modules/Test/')
 
static getCssContent ()
 

Static Private Member Functions

static buildHtmlDocument ($contentHtml, $styleHtml)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 27 of file class.ilTestPDFGenerator.php.

Member Function Documentation

◆ buildHtmlDocument()

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

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

35  : string
36  {
37  return "
38  <html>
39  <head>
40  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
41  $styleHtml
42  </head>
43  <body>$contentHtml</body>
44  </html>
45  ";
46  }

◆ generatePDF()

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

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

References $filename.

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

110  {
111  $pdf_output = self::preprocessHTML($pdf_output);
112 
113  if (substr($filename, strlen($filename) - 4, 4) != '.pdf') {
114  $filename .= '.pdf';
115  }
116  $pdf_factory = new ilHtmlToPdfTransformerFactory();
117 
118  if (!$pdf_factory->deliverPDFFromHTMLString(
119  $pdf_output,
120  $filename,
121  $output_mode,
122  self::service,
123  $purpose
124  )) {
125  throw new \Exception('could not write PDF');
126  }
127  return true;
128  }
$filename
Definition: buildRTE.php:78
+ Here is the caller graph for this function:

◆ getCssContent()

static ilTestPDFGenerator::getCssContent ( )
staticprotected

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

153  : string
154  {
155  $cssContent = file_get_contents(self::getTemplatePath('delos.css', ''));
156  $cssContent .= file_get_contents(self::getTemplatePath('test_pdf.css'));
157 
158  return $cssContent;
159  }

◆ getTemplatePath()

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

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

References ilStyleDefinition\getCurrentSkin().

137  : string
138  {
139  // use ilStyleDefinition instead of account to get the current skin
140  include_once "Services/Style/System/classes/class.ilStyleDefinition.php";
141  $fname = '';
142  if (ilStyleDefinition::getCurrentSkin() != "default") {
143  $fname = "./Customizing/global/skin/" .
144  ilStyleDefinition::getCurrentSkin() . "/" . $module_path . basename($a_filename);
145  }
146 
147  if ($fname == "" || !file_exists($fname)) {
148  $fname = "./" . $module_path . "templates/default/" . basename($a_filename);
149  }
150  return $fname;
151  }
static getCurrentSkin()
get the current skin use always this function instead of getting the account&#39;s skin the current skin ...
+ Here is the call graph for this function:

◆ preprocessHTML()

static ilTestPDFGenerator::preprocessHTML (   $html)
static

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

130  : string
131  {
132  $html = self::makeHtmlDocument($html, '<style>' . self::getCssContent() . '</style>');
133 
134  return $html;
135  }

Field Documentation

◆ PDF_OUTPUT_DOWNLOAD

◆ PDF_OUTPUT_FILE

◆ PDF_OUTPUT_INLINE

const ilTestPDFGenerator::PDF_OUTPUT_INLINE = 'I'

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

◆ service

const ilTestPDFGenerator::service = "Test"

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


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