ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
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(
72 $moduleName, 'Modules/' . $moduleName . '/', 'classes', $guiScope
73 );
74
75 return $object;
76 }
77
83 public function hasGUI($gui)
84 {
85 return file_exists($this->getGUIPath($gui));
86 }
87
93 public function getGUIPath($gui)
94 {
95 return $this->moduleBasePath . '/' . $this->relativeClassPath . '/' .
96 $this->guiScope . 'gui/class.' . $this->getGUIClassName($gui) . '.php';
97 }
98
104 public function getGUIClassName($gui)
105 {
106 return 'il' . $this->moduleName . ucfirst($this->guiScope) . ucfirst($gui) . 'GUI';
107 }
108
114 public function loadGUI($gui)
115 {
116 require_once $this->getGUIPath($gui);
117 }
118
125 public function buildGUI($gui, ilChatroomObjectGUI $chatroomObjectGUI)
126 {
127 $className = $this->getGUIClassName($gui);
128 $guiInstance = new $className($chatroomObjectGUI);
129
130 return $guiInstance;
131 }
132}
An exception for terminatinating execution or to throw for unit testing.
__construct($moduleName, $moduleBasePath, $relativeClassPath='classes', $guiScope='')
Sets class parameters using given parameters.
static getDefaultDefinitionWithCustomGUIPath($moduleName, $guiScope='')
Returns an Instance of ilChatroomObjectDefinition, using given $moduleName and $guiScope as parameter...
getGUIPath($gui)
Builds gui path using given $gui and returns it.
loadGUI($gui)
Requires file, whereby given $gui is used as parameter in getGUIPath method to build the filename of ...
buildGUI($gui, ilChatroomObjectGUI $chatroomObjectGUI)
Builds and returns new gui using given $gui and $gui.
static getDefaultDefinition($moduleName)
Returns an Instance of ilChatroomObjectDefinition, using given $moduleName as parameter.
hasGUI($gui)
Returns true if file exists.
getGUIClassName($gui)
Builds gui classname using given $gui and returns it.