ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilRendererFactory Class Reference

Factory that provides access to all available preview renderers. More...

+ Collaboration diagram for ilRendererFactory:

Static Public Member Functions

static getRenderers ()
 Gets an array containing all available preview renderers. More...
 
static getRenderer ($preview)
 Gets the renderer that is able to create a preview for the specified preview object. More...
 

Static Private Member Functions

static loadAvailableRenderers ()
 Loads the available preview renderers. More...
 

Static Private Attributes

static $renderers = null
 

Detailed Description

Factory that provides access to all available preview renderers.

Author
Stefan Born stefa.nosp@m.n.bo.nosp@m.rn@ph.nosp@m.zh.c.nosp@m.h
Version
$Id$

Definition at line 14 of file class.ilRendererFactory.php.

Member Function Documentation

◆ getRenderer()

static ilRendererFactory::getRenderer (   $preview)
static

Gets the renderer that is able to create a preview for the specified preview object.

Parameters
ilPReview$previewThe preview to get the renderer for.
Returns
ilPreviewRenderer A renderer or null if no renderer matches the preview object.

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

40 {
42
43 // check each renderer if it supports that preview object
44 foreach ($renderers as $renderer)
45 {
46 if ($renderer->supports($preview))
47 {
48 return $renderer;
49 }
50 }
51
52 // no matching renderer was found
53 return null;
54 }
static getRenderers()
Gets an array containing all available preview renderers.
$preview

References $preview, $renderers, and getRenderers().

Referenced by ilPreview\create(), and ilPreview\hasPreview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRenderers()

static ilRendererFactory::getRenderers ( )
static

Gets an array containing all available preview renderers.

Returns
array All available preview renderers.

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

28 {
30 return self::$renderers;
31 }
static loadAvailableRenderers()
Loads the available preview renderers.

References $renderers, and loadAvailableRenderers().

Referenced by ilObjFileAccessSettingsGUI\editPreviewSettings(), and getRenderer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadAvailableRenderers()

static ilRendererFactory::loadAvailableRenderers ( )
staticprivate

Loads the available preview renderers.

That is built in renderers and plugins.

Returns
array The available renderers.

Definition at line 61 of file class.ilRendererFactory.php.

62 {
63 // already loaded?
64 if (self::$renderers != null)
65 return;
66
67 $r = array();
68
69 // get registered and active plugins
70 global $ilPluginAdmin;
71 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Preview", "pvre");
72 foreach ($pl_names as $pl)
73 {
74 $plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "Preview", "pvre", $pl);
75 $r[] = $plugin->getRendererClassInstance();
76 }
77
78 // add default renderers
79 include_once("./Services/Preview/classes/class.ilImageMagickRenderer.php");
80 $r[] = new ilImageMagickRenderer();
81
82 include_once("./Services/Preview/classes/class.ilGhostscriptRenderer.php");
84 $r[] = new ilGhostscriptRenderer();
85
86 self::$renderers = $r;
87 }
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.
$r
Definition: example_031.php:79

References $r, ilPluginAdmin\getPluginObject(), IL_COMP_SERVICE, and ilGhostscriptRenderer\isGhostscriptInstalled().

Referenced by getRenderers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $renderers

ilRendererFactory::$renderers = null
staticprivate

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

Referenced by getRenderer(), and getRenderers().


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