ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

References $preview, and $renderers.

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

40  {
41  $renderers = self::getRenderers();
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  }
$preview
+ 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.

Referenced by ilObjFileAccessSettingsGUI\editPreviewSettings().

28  {
29  self::loadAvailableRenderers();
30  return self::$renderers;
31  }
+ 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 59 of file class.ilRendererFactory.php.

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

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) {
73  $plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "Preview", "pvre", $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  }
Preview renderer class that is able to create previews from images by using ImageMagick.
global $DIC
Definition: saml.php:7
static isGhostscriptInstalled()
Determines whether Ghostscript is installed.
$r
Definition: example_031.php:79
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
Create styles array
The data for the language used.
const IL_COMP_SERVICE
Preview renderer class that is able to create previews from PDF, PS and EPS by using GhostScript...
+ Here is the call graph for this function:

Field Documentation

◆ $renderers

ilRendererFactory::$renderers = null
staticprivate

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

Referenced by getRenderer().


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