ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilChatroomObjectDefinition.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
8 {
13  private $moduleName;
14 
19  private $moduleBasePath;
20 
26 
32  private $guiScope;
33 
42  {
43  $this->moduleName = $moduleName;
44  $this->moduleBasePath = rtrim($moduleBasePath, '/\\');
45  $this->relativeClassPath = rtrim($relativeClassPath);
46  $this->guiScope = rtrim($guiScope);
47  }
48 
55  public static function getDefaultDefinition($moduleName)
56  {
57  $object = new self($moduleName, 'Modules/' . $moduleName . '/');
58 
59  return $object;
60  }
61 
70  {
71  $object = new self(
73  'Modules/' . $moduleName . '/',
74  'classes',
75  $guiScope
76  );
77 
78  return $object;
79  }
80 
86  public function hasGUI($gui)
87  {
88  return file_exists($this->getGUIPath($gui));
89  }
90 
96  public function getGUIPath($gui)
97  {
98  return $this->moduleBasePath . '/' . $this->relativeClassPath . '/' .
99  $this->guiScope . 'gui/class.' . $this->getGUIClassName($gui) . '.php';
100  }
101 
107  public function getGUIClassName($gui)
108  {
109  return 'il' . $this->moduleName . ucfirst($this->guiScope) . ucfirst($gui) . 'GUI';
110  }
111 
117  public function loadGUI($gui)
118  {
119  require_once $this->getGUIPath($gui);
120  }
121 
128  public function buildGUI($gui, ilChatroomObjectGUI $chatroomObjectGUI)
129  {
130  $className = $this->getGUIClassName($gui);
131  $guiInstance = new $className($chatroomObjectGUI);
132 
133  return $guiInstance;
134  }
135 }
__construct($moduleName, $moduleBasePath, $relativeClassPath='classes', $guiScope='')
Sets class parameters using given parameters.
getGUIClassName($gui)
Builds gui classname using given $gui and returns it.
static getDefaultDefinition($moduleName)
Returns an Instance of ilChatroomObjectDefinition, using given $moduleName as parameter.
getGUIPath($gui)
Builds gui path using given $gui and returns it.
hasGUI($gui)
Returns true if file exists.
static getDefaultDefinitionWithCustomGUIPath($moduleName, $guiScope='')
Returns an Instance of ilChatroomObjectDefinition, using given $moduleName and $guiScope as parameter...
buildGUI($gui, ilChatroomObjectGUI $chatroomObjectGUI)
Builds and returns new gui using given $gui and $gui.
loadGUI($gui)
Requires file, whereby given $gui is used as parameter in getGUIPath method to build the filename of ...