ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilNewsRendererFactory.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
17  protected static $renderer = array();
18 
25  public static function getRenderer($a_context_obj_type)
26  {
27  global $DIC;
28 
29  if (!isset(self::$renderer[$a_context_obj_type])) {
30  $obj_def = $DIC["objDefinition"];
31 
32  $comp = $obj_def->getComponentForType($a_context_obj_type);
33  $class = $obj_def->getClassName($a_context_obj_type);
34 
35  $class = "il" . $class . "NewsRendererGUI";
36  $type_renderer_path = "./" . $comp . "/classes/class." . $class . ".php";
37  if (is_file($type_renderer_path)) {
38  include_once($type_renderer_path);
39  $rend = new $class();
40  } else {
41  include_once("./Services/News/classes/class.ilNewsDefaultRendererGUI.php");
42  $rend = new ilNewsDefaultRendererGUI();
43  }
44  self::$renderer[$a_context_obj_type] = $rend;
45  }
46 
47  return self::$renderer[$a_context_obj_type];
48  }
49 }
global $DIC
Definition: saml.php:7
static getRenderer($a_context_obj_type)
Get renderer.