ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilRendererFactory.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once("./Services/Preview/classes/class.ilPreview.php");
5
15{
20 private static $renderers = null;
21
27 public static function getRenderers()
28 {
30 return self::$renderers;
31 }
32
39 public static function getRenderer($preview)
40 {
42
43 // check each renderer if it supports that preview object
44 foreach ($renderers as $renderer) {
45 if ($renderer->supports($preview)) {
46 return $renderer;
47 }
48 }
49
50 // no matching renderer was found
51 return null;
52 }
53
59 private static function loadAvailableRenderers()
60 {
61 // already loaded?
62 if (self::$renderers != null) {
63 return;
64 }
65
66 $r = array();
67
68 // get registered and active plugins
69 global $DIC;
70 $ilPluginAdmin = $DIC['ilPluginAdmin'];
71 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Preview", "pvre");
72 foreach ($pl_names as $pl) {
74 $r[] = $plugin->getRendererClassInstance();
75 }
76
77 // add default renderers
78 include_once("./Services/Preview/classes/class.ilImageMagickRenderer.php");
79 $r[] = new ilImageMagickRenderer();
80
81 include_once("./Services/Preview/classes/class.ilGhostscriptRenderer.php");
83 $r[] = new ilGhostscriptRenderer();
84 }
85
86 self::$renderers = $r;
87 }
88}
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
Preview renderer class that is able to create previews from PDF, PS and EPS by using GhostScript.
static isGhostscriptInstalled()
Determines whether Ghostscript is installed.
Preview renderer class that is able to create previews from images by using ImageMagick.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
Factory that provides access to all available preview renderers.
static loadAvailableRenderers()
Loads the available preview renderers.
static getRenderer($preview)
Gets the renderer that is able to create a preview for the specified preview object.
static getRenderers()
Gets an array containing all available preview renderers.
global $DIC
Definition: goto.php:24
$preview
Definition: imgupload.php:55