ILIAS  release_7 Revision v7.30-3-g800a261c036
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.

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 108 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().

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

◆ getCssContent()

static ilTestPDFGenerator::getCssContent ( )
staticprotected

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

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

◆ getTemplatePath()

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

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

References ilStyleDefinition\getCurrentSkin().

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

◆ preprocessHTML()

static ilTestPDFGenerator::preprocessHTML (   $html)
static

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

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

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: