ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  static $pc_def = null;
15  static $pc_def_by_name = null;
16  static $pc_gui_classes = array();
19 
26  static function init()
27  {
28  global $ilDB;
29 
30  if (self::$pc_def == null)
31  {
32  $set = $ilDB->query("SELECT * FROM copg_pc_def ");
33  while ($rec = $ilDB->fetchAssoc($set))
34  {
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  static function getPCDefinitions()
54  {
55  self::init();
56  return self::$pc_def;
57  }
58 
65  static function getPCDefinitionByType($a_pc_type)
66  {
67  self::init();
68  return self::$pc_def[$a_pc_type];
69  }
70 
77  static function getPCDefinitionByName($a_pc_name)
78  {
79  self::init();
80  return self::$pc_def_by_name[$a_pc_name];
81  }
82 
89  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  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  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  static function isPCGUIClassName($a_class_name, $a_lower_case = false)
131  {
132  if ($a_lower_case)
133  {
134  return in_array($a_class_name, self::$pc_gui_classes_lc);
135  }
136  else
137  {
138  return in_array($a_class_name, self::$pc_gui_classes);
139  }
140  }
141 
142 
143 }
144 
145 ?>
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.
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.
global $ilDB
static getPCDefinitionByType($a_pc_type)
Get PC definition by type.