ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 

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

◆ generatePDF()

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

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

References $filename, and ilPDFGeneration\doJob().

Referenced by ilTestPlayerAbstractGUI\archiveParticipantSubmission(), ilTestServiceGUI\getQuestionResultForTestUsers(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserResultsOverview(), ilObjTestGUI\printobject(), ilTestScoring\recalculatePasses(), ilTestSubmissionReviewGUI\show(), and ilTestArchiver\updateTestArchive().

20  {
21  $pdf_output = self::preprocessHTML($pdf_output);
22 
23  if (substr($filename, strlen($filename) - 4, 4) != '.pdf')
24  {
25  $filename .= '.pdf';
26  }
27 
28  require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php';
29 
30  $job = new ilPDFGenerationJob();
31  $job->setAutoPageBreak(true)
32  ->setCreator('ILIAS Test')
33  ->setFilename($filename)
34  ->setMarginLeft('20')
35  ->setMarginRight('20')
36  ->setMarginTop('20')
37  ->setMarginBottom('20')
38  ->setOutputMode($output_mode)
39  ->addPage($pdf_output);
40 
42  }
$filename
Definition: buildRTE.php:89
Class ilPDFGenerationJob.
static doJob(ilPDFGenerationJob $job)
+ 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 50 of file class.ilTestPDFGenerator.php.

References ilStyleDefinition\getCurrentSkin().

51  {
52  $module_path = "Modules/Test/";
53 
54  // use ilStyleDefinition instead of account to get the current skin
55  include_once "Services/Style/classes/class.ilStyleDefinition.php";
56  if (ilStyleDefinition::getCurrentSkin() != "default")
57  {
58  $fname = "./Customizing/global/skin/".
59  ilStyleDefinition::getCurrentSkin()."/".$module_path.basename($a_filename);
60  }
61 
62  if($fname == "" || !file_exists($fname))
63  {
64  $fname = "./".$module_path."templates/default/".basename($a_filename);
65  }
66  return $fname;
67  }
static getCurrentSkin()
get the current skin
+ Here is the call graph for this function:

◆ preprocessHTML()

static ilTestPDFGenerator::preprocessHTML (   $html)
static

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

45  {
46  $pdf_css_path = self::getTemplatePath('test_pdf.css');
47  return '<style>' . file_get_contents($pdf_css_path) . '</style>' . $html;
48  }

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: