19            $map = self::getRendererMapForPurpose(
$service, $purpose);
 
   20            $renderer = self::getRendererInstance($map[
'selected']);
 
   21            $renderer->prepareGenerationRequest(
$service, $purpose);
 
   22        } 
catch (Exception 
$e) {
 
   29        $iliasPDFTestPath = 
'data/' . CLIENT_ID . 
'/pdf_service/';
 
   30        if (!file_exists($iliasPDFTestPath)) {
 
   31            mkdir($iliasPDFTestPath);
 
   33        return $iliasPDFTestPath;
 
   41        foreach (glob($path . 
'*.css') as 
$filename) {
 
   43            $content = preg_replace(
'/@media[\s]* print/', 
'@media nothing', $content);
 
   53        foreach (glob($path . 
'*.css') as 
$filename) {
 
   55            $content = preg_replace(
'/src:\surl\([\',\"](..\/)*(\S)/', 
"src: url(./$2", $content);
 
   65        foreach ($form->
getItems() as $item) {
 
   67                if ($item->getChecked() != 
null && ($item->getValue() == 
true || $item->getValue() == 
'1')) {
 
   68                    $item->setChecked(
true);
 
   81        $result = 
$ilDB->query(
'SELECT service, purpose FROM pdfgen_purposes ORDER BY service, purpose');
 
   84            $purposes[$row[
'service']][] = $row[
'purpose'];
 
   96        $result = 
$ilDB->query(
'SELECT service, purpose, preferred, selected FROM pdfgen_map');
 
   99            $mappings[$row[
'service']][$row[
'purpose']][
'selected'] = $row[
'selected'];
 
  100            $mappings[$row[
'service']][$row[
'purpose']][
'preferred'] = $row[
'preferred'];
 
  111        $renderers = array();
 
  112        $result = 
$ilDB->query(
'SELECT renderer, service, purpose FROM pdfgen_renderer_avail');
 
  115            $renderers[$row[
'service']][$row[
'purpose']][] = $row[
'renderer'];
 
  133            array( 
'selected' => array(
'text', $renderer) ),
 
  135                             'service' => array(
'text', 
$service),
 
  136                             'purpose' => array(
'text', $purpose)
 
  147    public static function getRendererConfig(
$service, $purpose, $renderer)
 
  153        $query = 
'SELECT config FROM pdfgen_conf WHERE renderer = ' . 
$ilDB->quote($renderer, 
'text') .
 
  154            ' AND service = ' . 
$ilDB->quote(
$service, 
'text') . 
' AND purpose = ' . 
$ilDB->quote($purpose, 
'text');
 
  158            return self::getRendererDefaultConfig(
$service, $purpose, $renderer);
 
  161            return json_decode($row[
'config'], 
true);
 
  171    public static function getRendererDefaultConfig(
$service, $purpose, $renderer)
 
  174        $class_instance = self::getRendererInstance($renderer);
 
  176        return $class_instance->getDefaultConfig(
$service, $purpose);
 
  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');
 
  200    public static function getRendererInstance($renderer)
 
  206        $result = 
$ilDB->query(
'SELECT path FROM pdfgen_renderer WHERE renderer = ' . 
$ilDB->quote($renderer, 
'text'));
 
  209            throw new Exception(
'No such renderer - given: ' . $renderer);
 
  213        include_once $row[
'path'];
 
  214        if (self::isRendererPlugin($row[
'path'])) {
 
  215            $classname = 
'il' . $renderer . 
'RendererPlugin';
 
  217            $classname = 
'il' . $renderer . 
'Renderer';
 
  220        if (
false && !class_exists($classname)) {
 
  222                'Class failed loading, including path ' . $row[
'path']
 
  223                . 
' did not lead to class definition ' . $classname . 
' being available.' 
  227        $class_instance = 
new $classname;
 
  228        return $class_instance;
 
  237        $needle = 
'Plugin.php';
 
  238        $length = strlen($needle);
 
  239        return (substr($path, -$length) === $needle);
 
  248    public static function saveRendererPurposeConfig(
$service, $purpose, $renderer, 
$config)
 
  254        $query = 
'DELETE FROM pdfgen_conf WHERE renderer = ' . 
$ilDB->quote($renderer, 
'text') .
 
  255            ' AND service = ' . 
$ilDB->quote(
$service, 
'text') . 
' AND purpose = ' . 
$ilDB->quote($purpose, 
'text');
 
  262                'conf_id' => array(
'integer', 
$ilDB->nextId(
'pdfgen_conf')),
 
  263                'renderer' => array(
'text', $renderer),
 
  264                'service' => array(
'text', 
$service),
 
  265                'purpose' => array(
'text', $purpose),
 
  266                'config' => array(
'clob', json_encode(
$config))
 
  276    public static function getRendererMapForPurpose(
$service, $purpose)
 
  282        $result = 
$ilDB->query(
'SELECT preferred, selected FROM pdfgen_map WHERE 
  283                service = ' . 
$ilDB->quote(
$service, 
'text') . 
' AND purpose=' . 
$ilDB->quote($purpose, 
'text'));
 
  286            return array(
'selected' => 
'TCPDF', 
'preferred' => 
'TCPDF');
 
An exception for terminatinating execution or to throw for unit testing.
Class ilPDFGeneratorUtils.
static removeRendererConfig($service, $purpose, $renderer)
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
static removeWrongPathFromStyleFiles($path)
static updateRendererSelection($service, $purpose, $renderer)
static setCheckedIfTrue(\ilPropertyFormGUI $form)
static removePrintMediaDefinitionsFromStyleFile($path)
static isRendererPlugin($path)