ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPDFGeneratorUtils Class Reference

Class ilPDFGeneratorUtils. More...

+ Collaboration diagram for ilPDFGeneratorUtils:

Static Public Member Functions

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 55 of file class.ilPDFGeneratorUtils.php.

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

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

56  {
57  global $DIC;
58  $ilDB = $DIC['ilDB'];
59 
60  $purposes = array();
61 
62  $result = $ilDB->query('SELECT service, purpose FROM pdfgen_purposes ORDER BY service, purpose');
63 
64  while ($row = $ilDB->fetchAssoc($result)) {
65  $purposes[$row['service']][] = $row['purpose'];
66  }
67 
68  return $purposes;
69  }
$result
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getRenderers()

static ilPDFGeneratorUtils::getRenderers ( )
static

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

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

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

88  {
89  global $DIC;
90  $ilDB = $DIC['ilDB'];
91 
92  $renderers = array();
93  $result = $ilDB->query('SELECT renderer, service, purpose FROM pdfgen_renderer_avail');
94 
95  while ($row = $ilDB->fetchAssoc($result)) {
96  $renderers[$row['service']][$row['purpose']][] = $row['renderer'];
97  }
98 
99  return $renderers;
100  }
$result
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getSelectionMap()

static ilPDFGeneratorUtils::getSelectionMap ( )
static

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

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

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

72  {
73  global $DIC;
74  $ilDB = $DIC['ilDB'];
75 
76  $mappings = array();
77  $result = $ilDB->query('SELECT service, purpose, preferred, selected FROM pdfgen_map');
78 
79  while ($row = $ilDB->fetchAssoc($result)) {
80  $mappings[$row['service']][$row['purpose']]['selected'] = $row['selected'];
81  $mappings[$row['service']][$row['purpose']]['preferred'] = $row['preferred'];
82  }
83 
84  return $mappings;
85  }
$result
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getTestPdfDir()

static ilPDFGeneratorUtils::getTestPdfDir ( )
static

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

9  {
10  $iliasPDFTestPath = 'data/' . CLIENT_ID . '/pdf_service/';
11  if (!file_exists($iliasPDFTestPath)) {
12  mkdir($iliasPDFTestPath);
13  }
14  return $iliasPDFTestPath;
15  }

◆ isRendererPlugin()

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

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

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

217  {
218  $needle = 'Plugin.php';
219  $length = strlen($needle);
220  return (substr($path, -$length) === $needle);
221  }

◆ removePrintMediaDefinitionsFromStyleFile()

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

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

References $filename, and $path.

21  {
22  foreach (glob($path . '*.css') as $filename) {
23  $content = file_get_contents($filename);
24  $content = preg_replace('/@media[\s]* print/', '@media nothing', $content);
25  file_put_contents($filename, $content);
26  }
27  }

◆ removeRendererConfig()

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

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

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

Referenced by ilObjPDFGenerationGUI\resetSettings().

166  {
167  global $DIC;
168  $ilDB = $DIC['ilDB'];
169 
170  $query = 'DELETE FROM pdfgen_conf WHERE renderer = ' . $ilDB->quote($renderer, 'text') .
171  ' AND service = ' . $ilDB->quote($service, 'text') . ' AND purpose = ' . $ilDB->quote($purpose, 'text');
172 
173  $ilDB->manipulate($query);
174  }
global $DIC
Definition: saml.php:7
$service
Definition: login.php:15
$query
global $ilDB
+ Here is the caller graph for this function:

◆ removeWrongPathFromStyleFiles()

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

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

References $filename, and $path.

33  {
34  foreach (glob($path . '*.css') as $filename) {
35  $content = file_get_contents($filename);
36  $content = preg_replace('/src:\surl\([\',\"](..\/)*(\S)/', "src: url(./$2", $content);
37  file_put_contents($filename, $content);
38  }
39  }

◆ setCheckedIfTrue()

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

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

References ilPropertyFormGUI\getItems().

Referenced by ilPhantomJSRenderer\populateConfigElementsInForm().

45  {
46  foreach ($form->getItems() as $item) {
47  if ($item instanceof ilCheckboxInputGUI) {
48  if ($item->getChecked() != null && ($item->getValue() == true || $item->getValue() == '1')) {
49  $item->setChecked(true);
50  }
51  }
52  }
53  }
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 107 of file class.ilPDFGeneratorUtils.php.

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

Referenced by ilObjPDFGenerationGUI\saveSettings().

108  {
109  global $DIC;
110  $ilDB = $DIC['ilDB'];
111 
112  $ilDB->update(
113  'pdfgen_map',
114  array( 'selected' => array('text', $renderer) ),
115  array(
116  'service' => array('text', $service),
117  'purpose' => array('text', $purpose)
118  )
119  );
120  }
global $DIC
Definition: saml.php:7
$service
Definition: login.php:15
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

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