ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPDFGeneratorUtils Class Reference

Class ilPDFGeneratorUtils. More...

+ Collaboration diagram for ilPDFGeneratorUtils:

Static Public Member Functions

static prepareGenerationRequest ($service, $purpose)
 Prepare the content processing for a PDF generation request This function should be called as in a request before any content is generated It sets the generation mode for Latex processing according the needs of the PDF renderer. More...
 
static getTestPdfDir ()
 
static removePrintMediaDefinitionsFromStyleFile ($path)
 
static removeWrongPathFromStyleFiles ($path)
 
static setCheckedIfTrue (\ilPropertyFormGUI $form)
 
static getPurposeMap ()
 
static getSelectionMap ()
 
static getRenderers ()
 
static updateRendererSelection ($service, $purpose, $renderer)
 
static removeRendererConfig ($service, $purpose, $renderer)
 

Static Protected Member Functions

static isRendererPlugin ($path)
 

Detailed Description

Class ilPDFGeneratorUtils.

Definition at line 6 of file class.ilPDFGeneratorUtils.php.

Member Function Documentation

◆ getPurposeMap()

static ilPDFGeneratorUtils::getPurposeMap ( )
static

Definition at line 74 of file class.ilPDFGeneratorUtils.php.

References $DIC, $ilDB, $result, and $row.

Referenced by ilObjPDFGenerationGUI\configForm(), and ilObjPDFGenerationGUI\saveSettings().

75  {
76  global $DIC;
77  $ilDB = $DIC['ilDB'];
78 
79  $purposes = array();
80 
81  $result = $ilDB->query('SELECT service, purpose FROM pdfgen_purposes ORDER BY service, purpose');
82 
83  while ($row = $ilDB->fetchAssoc($result)) {
84  $purposes[$row['service']][] = $row['purpose'];
85  }
86 
87  return $purposes;
88  }
$result
global $DIC
Definition: saml.php:7
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getRenderers()

static ilPDFGeneratorUtils::getRenderers ( )
static

Definition at line 106 of file class.ilPDFGeneratorUtils.php.

References $DIC, $ilDB, $result, and $row.

Referenced by ilObjPDFGenerationGUI\configForm(), and ilObjPDFGenerationGUI\saveSettings().

107  {
108  global $DIC;
109  $ilDB = $DIC['ilDB'];
110 
111  $renderers = array();
112  $result = $ilDB->query('SELECT renderer, service, purpose FROM pdfgen_renderer_avail');
113 
114  while ($row = $ilDB->fetchAssoc($result)) {
115  $renderers[$row['service']][$row['purpose']][] = $row['renderer'];
116  }
117 
118  return $renderers;
119  }
$result
global $DIC
Definition: saml.php:7
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getSelectionMap()

static ilPDFGeneratorUtils::getSelectionMap ( )
static

Definition at line 90 of file class.ilPDFGeneratorUtils.php.

References $DIC, $ilDB, $result, and $row.

Referenced by ilObjPDFGenerationGUI\configForm(), and ilObjPDFGenerationGUI\saveSettings().

91  {
92  global $DIC;
93  $ilDB = $DIC['ilDB'];
94 
95  $mappings = array();
96  $result = $ilDB->query('SELECT service, purpose, preferred, selected FROM pdfgen_map');
97 
98  while ($row = $ilDB->fetchAssoc($result)) {
99  $mappings[$row['service']][$row['purpose']]['selected'] = $row['selected'];
100  $mappings[$row['service']][$row['purpose']]['preferred'] = $row['preferred'];
101  }
102 
103  return $mappings;
104  }
$result
global $DIC
Definition: saml.php:7
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getTestPdfDir()

static ilPDFGeneratorUtils::getTestPdfDir ( )
static

Definition at line 27 of file class.ilPDFGeneratorUtils.php.

28  {
29  $iliasPDFTestPath = 'data/' . CLIENT_ID . '/pdf_service/';
30  if (!file_exists($iliasPDFTestPath)) {
31  mkdir($iliasPDFTestPath);
32  }
33  return $iliasPDFTestPath;
34  }

◆ isRendererPlugin()

static ilPDFGeneratorUtils::isRendererPlugin (   $path)
staticprotected
Parameters
$path
Returns
bool

Definition at line 235 of file class.ilPDFGeneratorUtils.php.

References $config, $DIC, $ilDB, $path, $query, $result, and $row.

236  {
237  $needle = 'Plugin.php';
238  $length = strlen($needle);
239  return (substr($path, -$length) === $needle);
240  }
$path
Definition: aliased.php:25

◆ prepareGenerationRequest()

static ilPDFGeneratorUtils::prepareGenerationRequest (   $service,
  $purpose 
)
static

Prepare the content processing for a PDF generation request This function should be called as in a request before any content is generated It sets the generation mode for Latex processing according the needs of the PDF renderer.

Parameters
string$service
string$purpose

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

References $map.

Referenced by ilTestExportGUI\createTestArchiveExport(), ilParticipantsTestResultsGUI\createUserResults(), ilObjPortfolioGUI\exportPDF(), ilTestServiceGUI\getQuestionResultForTestUsers(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), ilTestEvaluationGUI\outUserResultsOverview(), ilTestSubmissionReviewGUI\pdfDownload(), ilObjWikiGUI\pdfExportObject(), ilObjTestGUI\printobject(), ilObjTestGUI\reviewobject(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

17  {
18  try {
19  $map = self::getRendererMapForPurpose($service, $purpose);
20  $renderer = self::getRendererInstance($map['selected']);
21  $renderer->prepareGenerationRequest($service, $purpose);
22  } catch (Exception $e) {
23  return;
24  }
25  }
+ Here is the caller graph for this function:

◆ removePrintMediaDefinitionsFromStyleFile()

static ilPDFGeneratorUtils::removePrintMediaDefinitionsFromStyleFile (   $path)
static
Parameters
string$path

Definition at line 39 of file class.ilPDFGeneratorUtils.php.

References $filename, and $path.

40  {
41  foreach (glob($path . '*.css') as $filename) {
42  $content = file_get_contents($filename);
43  $content = preg_replace('/@media[\s]* print/', '@media nothing', $content);
44  file_put_contents($filename, $content);
45  }
46  }
$path
Definition: aliased.php:25
$filename
Definition: buildRTE.php:89

◆ removeRendererConfig()

static ilPDFGeneratorUtils::removeRendererConfig (   $service,
  $purpose,
  $renderer 
)
static
Parameters
string$service
string$purpose
string$renderer

Definition at line 184 of file class.ilPDFGeneratorUtils.php.

References $DIC, $ilDB, $query, $result, and $row.

Referenced by ilObjPDFGenerationGUI\resetSettings().

185  {
186  global $DIC;
187  $ilDB = $DIC['ilDB'];
188 
189  $query = 'DELETE FROM pdfgen_conf WHERE renderer = ' . $ilDB->quote($renderer, 'text') .
190  ' AND service = ' . $ilDB->quote($service, 'text') . ' AND purpose = ' . $ilDB->quote($purpose, 'text');
191 
192  $ilDB->manipulate($query);
193  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the caller graph for this function:

◆ removeWrongPathFromStyleFiles()

static ilPDFGeneratorUtils::removeWrongPathFromStyleFiles (   $path)
static
Parameters
string$path

Definition at line 51 of file class.ilPDFGeneratorUtils.php.

References $filename, and $path.

52  {
53  foreach (glob($path . '*.css') as $filename) {
54  $content = file_get_contents($filename);
55  $content = preg_replace('/src:\surl\([\',\"](..\/)*(\S)/', "src: url(./$2", $content);
56  file_put_contents($filename, $content);
57  }
58  }
$path
Definition: aliased.php:25
$filename
Definition: buildRTE.php:89

◆ setCheckedIfTrue()

static ilPDFGeneratorUtils::setCheckedIfTrue ( \ilPropertyFormGUI  $form)
static
Parameters
ilPropertyFormGUI$form

Definition at line 63 of file class.ilPDFGeneratorUtils.php.

References ilPropertyFormGUI\getItems().

Referenced by ilPhantomJSRenderer\populateConfigElementsInForm().

64  {
65  foreach ($form->getItems() as $item) {
66  if ($item instanceof ilCheckboxInputGUI) {
67  if ($item->getChecked() != null && ($item->getValue() == true || $item->getValue() == '1')) {
68  $item->setChecked(true);
69  }
70  }
71  }
72  }
This class represents a checkbox property in a property form.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateRendererSelection()

static ilPDFGeneratorUtils::updateRendererSelection (   $service,
  $purpose,
  $renderer 
)
static
Parameters
string$service
string$purpose
string$renderer

Definition at line 126 of file class.ilPDFGeneratorUtils.php.

References $DIC, $ilDB, $query, $result, and $row.

Referenced by ilObjPDFGenerationGUI\saveSettings().

127  {
128  global $DIC;
129  $ilDB = $DIC['ilDB'];
130 
131  $ilDB->update(
132  'pdfgen_map',
133  array( 'selected' => array('text', $renderer) ),
134  array(
135  'service' => array('text', $service),
136  'purpose' => array('text', $purpose)
137  )
138  );
139  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

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