ILIAS  release_7 Revision v7.30-3-g800a261c036
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(
73 'Modules/' . $moduleName . '/',
74 'classes',
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}
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.