ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilChatroomObjectDefinition.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
30 private readonly string $moduleBasePath;
31
36 private readonly string $relativeClassPath;
37
43 private readonly string $guiScope;
44
45 public function __construct(
49 private readonly string $moduleName,
50 string $moduleBasePath,
51 string $relativeClassPath = 'classes',
52 string $guiScope = ''
53 ) {
54 $this->moduleBasePath = rtrim($moduleBasePath, '/\\');
55 $this->relativeClassPath = rtrim($relativeClassPath);
56 $this->guiScope = rtrim($guiScope);
57 }
58
63 public static function getDefaultDefinition(string $moduleName): self
64 {
65 return new self($moduleName, '../components/ILIAS/' . $moduleName . '/');
66 }
67
73 public static function getDefaultDefinitionWithCustomGUIPath(string $moduleName, string $guiScope = ''): self
74 {
75 return new self(
76 $moduleName,
77 '../components/ILIAS/' . $moduleName . '/',
78 'classes',
80 );
81 }
82
83 public function hasGUI(string $gui): bool
84 {
85 $path = $this->getGUIPath($gui);
86 $class = $this->getGUIClassName($gui);
87
88 return class_exists($class) && file_exists($path);
89 }
90
94 public function getGUIPath(string $gui): string
95 {
96 return (
97 $this->moduleBasePath . '/' .
98 $this->relativeClassPath . '/' .
99 $this->guiScope . 'gui/class.' . $this->getGUIClassName($gui) . '.php'
100 );
101 }
102
106 public function getGUIClassName(string $gui): string
107 {
108 return 'il' . $this->moduleName . ucfirst($this->guiScope) . ucfirst($gui) . 'GUI';
109 }
110
114 public function buildGUI(string $gui, ilChatroomObjectGUI $chatroomObjectGUI): ilChatroomGUIHandler
115 {
116 $className = $this->getGUIClassName($gui);
117 return new $className($chatroomObjectGUI);
118 }
119}
Class ilChatroomGUIHandler.
static getDefaultDefinitionWithCustomGUIPath(string $moduleName, string $guiScope='')
Returns an Instance of ilChatroomObjectDefinition, using given $moduleName and $guiScope as parameter...
static getDefaultDefinition(string $moduleName)
Returns an Instance of ilChatroomObjectDefinition, using given $moduleName as parameter.
getGUIClassName(string $gui)
Builds gui classname using given $gui and returns it.
buildGUI(string $gui, ilChatroomObjectGUI $chatroomObjectGUI)
Builds and returns new gui using given $gui and $gui.
getGUIPath(string $gui)
Builds gui path using given $gui and returns it.
__construct(private readonly string $moduleName, string $moduleBasePath, string $relativeClassPath='classes', string $guiScope='')
$path
Definition: ltiservices.php:30