ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCOPagePCDef.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
13 {
14  public static $pc_def = null;
15  public static $pc_def_by_name = null;
16  public static $pc_gui_classes = array();
17  public static $pc_gui_classes_lc = array();
18  public static $pc_def_by_gui_class_cl = array();
19 
26  public static function init()
27  {
28  global $DIC;
29 
30  $db = $DIC->database();
31 
32  if (self::$pc_def == null) {
33  $set = $db->query("SELECT * FROM copg_pc_def ");
34  while ($rec = $db->fetchAssoc($set)) {
35  $rec["pc_class"] = "ilPC" . $rec["name"];
36  $rec["pc_gui_class"] = "ilPC" . $rec["name"] . "GUI";
37  self::$pc_gui_classes[] = $rec["pc_gui_class"];
38  self::$pc_gui_classes_lc[] = strtolower($rec["pc_gui_class"]);
39  self::$pc_def[$rec["pc_type"]] = $rec;
40  self::$pc_def_by_name[$rec["name"]] = $rec;
41  self::$pc_def_by_gui_class_cl[strtolower($rec["pc_gui_class"])] = $rec;
42  }
43  }
44  }
45 
46 
53  public static function getPCDefinitions()
54  {
55  self::init();
56  return self::$pc_def;
57  }
58 
65  public static function getPCDefinitionByType($a_pc_type)
66  {
67  self::init();
68  return self::$pc_def[$a_pc_type];
69  }
70 
77  public static function getPCDefinitionByName($a_pc_name)
78  {
79  self::init();
80  return self::$pc_def_by_name[$a_pc_name];
81  }
82 
89  public static function getPCDefinitionByGUIClassName($a_gui_class_name)
90  {
91  self::init();
92  $a_gui_class_name = strtolower($a_gui_class_name);
93  return self::$pc_def_by_gui_class_cl[$a_gui_class_name];
94  }
95 
102  public static function requirePCClassByName($a_name)
103  {
104  $pc_def = self::getPCDefinitionByName($a_name);
105  $pc_class = "ilPC" . $pc_def["name"];
106  $pc_path = "./" . $pc_def["component"] . "/" . $pc_def["directory"] . "/class." . $pc_class . ".php";
107  include_once($pc_path);
108  }
109 
116  public static function requirePCGUIClassByName($a_name)
117  {
118  $pc_def = self::getPCDefinitionByName($a_name);
119  $pc_class = "ilPC" . $pc_def["name"] . "GUI";
120  $pc_path = "./" . $pc_def["component"] . "/" . $pc_def["directory"] . "/class." . $pc_class . ".php";
121  include_once($pc_path);
122  }
123 
130  public static function isPCGUIClassName($a_class_name, $a_lower_case = false)
131  {
132  if ($a_lower_case) {
133  return in_array($a_class_name, self::$pc_gui_classes_lc);
134  } else {
135  return in_array($a_class_name, self::$pc_gui_classes);
136  }
137  }
138 }
static isPCGUIClassName($a_class_name, $a_lower_case=false)
Is given class name a pc gui class?
static getPCDefinitionByName($a_pc_name)
Get PC definition by name.
COPage PC elements definition handler.
global $DIC
Definition: saml.php:7
static getPCDefinitionByGUIClassName($a_gui_class_name)
Get PC definition by name.
static getPCDefinitions()
Get PC definitions.
static requirePCClassByName($a_name)
Get instance.
static $pc_def_by_gui_class_cl
Create styles array
The data for the language used.
static init()
Init.
static requirePCGUIClassByName($a_name)
Get instance.
static getPCDefinitionByType($a_pc_type)
Get PC definition by type.