ILIAS  release_8 Revision v8.24
ilChatroomServerSettings Class Reference

Class ilChatroomServerSettings. More...

+ Collaboration diagram for ilChatroomServerSettings:

Public Member Functions

 getURL (string $action, $scope=null)
 Creates URL by calling $this->getBaseURL and using given $action and $scope and returns it. More...
 
 generateIliasUrl ()
 
 getIliasUrlEnabled ()
 
 setIliasUrlEnabled (bool $iliasUrlEnabled)
 
 getProtocol ()
 
 setProtocol (string $protocol)
 
 getIliasUrl ()
 
 setIliasUrl (string $iliasUrl)
 
 getBaseURL ()
 Creates base URL by calling $this->getProtocol(), $this->getDomain() and $this->getPort() and returnes it. More...
 
 getDomain ()
 
 setDomain (string $domain)
 
 getPort ()
 
 setPort (int $port)
 
 getInstance ()
 
 setInstance (string $instance)
 
 generateClientUrl ()
 
 getClientUrlEnabled ()
 
 setClientUrlEnabled (bool $clientUrlEnabled)
 
 getClientUrl ()
 
 setClientUrl (string $clientUrl)
 
 getSmiliesEnabled ()
 
 setSmiliesEnabled (bool $a_bool)
 
 getAuthKey ()
 
 setAuthKey (string $authKey)
 
 getAuthSecret ()
 
 setAuthSecret (string $authSecret)
 
 getSubDirectory ()
 
 setSubDirectory (string $subDirectory)
 

Static Public Member Functions

static loadDefault ()
 

Data Fields

const PREFIX = '/backend'
 

Private Attributes

const DEFAULT_PORT = 8585
 
const DEFAULT_PROCOTOL = 'http://'
 
const DEFAULT_HOST = '192.168.1.94'
 
int $port = self::DEFAULT_PORT
 
string $protocol = self::DEFAULT_PROCOTOL
 
string $domain = self::DEFAULT_HOST
 
string $instance = '123456'
 
bool $smilies_enabled = false
 
string $authKey = ''
 
string $authSecret = ''
 
bool $clientUrlEnabled = false
 
string $clientUrl = ''
 
bool $iliasUrlEnabled = false
 
string $iliasUrl = ''
 
string $subDirectory = ''
 

Detailed Description

Member Function Documentation

◆ generateClientUrl()

ilChatroomServerSettings::generateClientUrl ( )

Definition at line 185 of file class.ilChatroomServerSettings.php.

185 : string
186 {
187 if ($this->getClientUrlEnabled()) {
188 $url = $this->getClientUrl();
189
190 if (strpos($url, '://') === false) {
191 $url = $this->getProtocol() . $url;
192 }
193
194 return $url;
195 }
196 return $this->getBaseURL();
197 }
getBaseURL()
Creates base URL by calling $this->getProtocol(), $this->getDomain() and $this->getPort() and returne...
$url

References $url, getBaseURL(), getClientUrl(), getClientUrlEnabled(), and getProtocol().

+ Here is the call graph for this function:

◆ generateIliasUrl()

ilChatroomServerSettings::generateIliasUrl ( )

Definition at line 98 of file class.ilChatroomServerSettings.php.

98 : string
99 {
100 if ($this->getIliasUrlEnabled()) {
101 $url = $this->getIliasUrl();
102
103 if (strpos($url, '://') === false) {
104 $url = $this->getProtocol() . $url;
105 }
106
107 return $url;
108 }
109
110 return $this->getBaseURL();
111 }

References $url, getBaseURL(), getIliasUrl(), getIliasUrlEnabled(), and getProtocol().

Referenced by getURL().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAuthKey()

ilChatroomServerSettings::getAuthKey ( )

Definition at line 229 of file class.ilChatroomServerSettings.php.

229 : string
230 {
231 return $this->authKey;
232 }

References $authKey.

◆ getAuthSecret()

ilChatroomServerSettings::getAuthSecret ( )

Definition at line 239 of file class.ilChatroomServerSettings.php.

239 : string
240 {
241 return $this->authSecret;
242 }

References $authSecret.

◆ getBaseURL()

ilChatroomServerSettings::getBaseURL ( )

Creates base URL by calling $this->getProtocol(), $this->getDomain() and $this->getPort() and returnes it.

Returns
string

Definition at line 150 of file class.ilChatroomServerSettings.php.

150 : string
151 {
152 return $this->getProtocol() . $this->getDomain() . ':' . $this->getPort();
153 }

References getDomain(), getPort(), and getProtocol().

Referenced by generateClientUrl(), and generateIliasUrl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getClientUrl()

ilChatroomServerSettings::getClientUrl ( )

Definition at line 209 of file class.ilChatroomServerSettings.php.

209 : string
210 {
211 return $this->clientUrl;
212 }

References $clientUrl.

Referenced by generateClientUrl().

+ Here is the caller graph for this function:

◆ getClientUrlEnabled()

ilChatroomServerSettings::getClientUrlEnabled ( )

Definition at line 199 of file class.ilChatroomServerSettings.php.

199 : bool
200 {
202 }

References $clientUrlEnabled.

Referenced by generateClientUrl().

+ Here is the caller graph for this function:

◆ getDomain()

ilChatroomServerSettings::getDomain ( )

Definition at line 155 of file class.ilChatroomServerSettings.php.

155 : string
156 {
157 return $this->domain;
158 }

References $domain.

Referenced by getBaseURL().

+ Here is the caller graph for this function:

◆ getIliasUrl()

ilChatroomServerSettings::getIliasUrl ( )

Definition at line 135 of file class.ilChatroomServerSettings.php.

135 : string
136 {
137 return $this->iliasUrl;
138 }

References $iliasUrl.

Referenced by generateIliasUrl().

+ Here is the caller graph for this function:

◆ getIliasUrlEnabled()

ilChatroomServerSettings::getIliasUrlEnabled ( )

Definition at line 113 of file class.ilChatroomServerSettings.php.

113 : bool
114 {
116 }

References $iliasUrlEnabled.

Referenced by generateIliasUrl().

+ Here is the caller graph for this function:

◆ getInstance()

ilChatroomServerSettings::getInstance ( )

Definition at line 175 of file class.ilChatroomServerSettings.php.

175 : string
176 {
177 return $this->instance;
178 }

References $instance.

Referenced by getURL().

+ Here is the caller graph for this function:

◆ getPort()

ilChatroomServerSettings::getPort ( )

Definition at line 165 of file class.ilChatroomServerSettings.php.

165 : int
166 {
167 return $this->port;
168 }

References $port.

Referenced by getBaseURL().

+ Here is the caller graph for this function:

◆ getProtocol()

ilChatroomServerSettings::getProtocol ( )

Definition at line 123 of file class.ilChatroomServerSettings.php.

123 : string
124 {
125 return $this->protocol;
126 }

References $protocol.

Referenced by generateClientUrl(), generateIliasUrl(), and getBaseURL().

+ Here is the caller graph for this function:

◆ getSmiliesEnabled()

ilChatroomServerSettings::getSmiliesEnabled ( )

Definition at line 219 of file class.ilChatroomServerSettings.php.

219 : bool
220 {
222 }

References $smilies_enabled.

Referenced by ilOnScreenChatGUI\getEmoticons().

+ Here is the caller graph for this function:

◆ getSubDirectory()

ilChatroomServerSettings::getSubDirectory ( )

Definition at line 249 of file class.ilChatroomServerSettings.php.

249 : string
250 {
251 return $this->subDirectory;
252 }

References $subDirectory.

◆ getURL()

ilChatroomServerSettings::getURL ( string  $action,
  $scope = null 
)

Creates URL by calling $this->getBaseURL and using given $action and $scope and returns it.

Parameters
string$action
string | int | null$scope
Returns
string

Definition at line 87 of file class.ilChatroomServerSettings.php.

87 : string
88 {
89 $url = $this->generateIliasUrl() . self::PREFIX . '/' . $action . '/' . $this->getInstance();
90
91 if ($scope !== null) {
92 $url .= '/' . $scope;
93 }
94
95 return $url;
96 }
$scope
Definition: ltiregstart.php:53

References $scope, $url, generateIliasUrl(), and getInstance().

+ Here is the call graph for this function:

◆ loadDefault()

static ilChatroomServerSettings::loadDefault ( )
static

Definition at line 47 of file class.ilChatroomServerSettings.php.

47 : self
48 {
49 global $DIC;
50
51 $query = 'SELECT * FROM chatroom_admconfig';
52 $rset = $DIC->database()->query($query);
53 $row = $DIC->database()->fetchAssoc($rset);
54
55 $client_settings = json_decode($row['client_settings'], false, 512, JSON_THROW_ON_ERROR);
56 $server_settings = json_decode($row['server_settings'], false, 512, JSON_THROW_ON_ERROR);
57
58 $settings = new self();
59 if ($server_settings instanceof stdClass) {
60 $settings->setPort((int) ($server_settings->port ?? self::DEFAULT_PORT));
61 $settings->setProtocol((string) ($server_settings->protocol ?? self::DEFAULT_PROCOTOL));
62 $settings->setDomain((string) ($server_settings->address ?? self::DEFAULT_HOST));
63 $settings->setSmiliesEnabled((bool) ($client_settings->enable_smilies ?? false));
64 $settings->setClientUrlEnabled((bool) ($server_settings->client_proxy ?? false));
65 $settings->setIliasUrlEnabled((bool) ($server_settings->ilias_proxy ?? false));
66 $settings->setClientUrl((string) ($server_settings->client_url ?? ''));
67 $settings->setIliasUrl((string) ($server_settings->ilias_url ?? ''));
68 $settings->setSubDirectory((string) ($server_settings->sub_directory ?? ''));
69 }
70
71 if ($client_settings instanceof stdClass) {
72 $settings->setInstance((string) ($client_settings->name ?? ''));
73 $settings->setAuthKey((string) ($client_settings->auth->key ?? ''));
74 $settings->setAuthSecret((string) ($client_settings->auth->secret ?? ''));
75 }
76
77 return $settings;
78 }
global $DIC
Definition: feed.php:28
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
$query

References $DIC, $query, ILIAS\LTI\ToolProvider\$settings, DEFAULT_HOST, DEFAULT_PORT, and DEFAULT_PROCOTOL.

Referenced by ilObjChatroomAdminGUI\getConnector(), ilChatroomAdmin\getServerSettings(), and ilOnScreenChatGUI\initializeFrontend().

+ Here is the caller graph for this function:

◆ setAuthKey()

ilChatroomServerSettings::setAuthKey ( string  $authKey)

Definition at line 234 of file class.ilChatroomServerSettings.php.

234 : void
235 {
236 $this->authKey = $authKey;
237 }

References $authKey.

◆ setAuthSecret()

ilChatroomServerSettings::setAuthSecret ( string  $authSecret)

Definition at line 244 of file class.ilChatroomServerSettings.php.

244 : void
245 {
246 $this->authSecret = $authSecret;
247 }

References $authSecret.

◆ setClientUrl()

ilChatroomServerSettings::setClientUrl ( string  $clientUrl)

Definition at line 214 of file class.ilChatroomServerSettings.php.

214 : void
215 {
216 $this->clientUrl = $clientUrl;
217 }

References $clientUrl.

◆ setClientUrlEnabled()

ilChatroomServerSettings::setClientUrlEnabled ( bool  $clientUrlEnabled)

Definition at line 204 of file class.ilChatroomServerSettings.php.

204 : void
205 {
206 $this->clientUrlEnabled = $clientUrlEnabled;
207 }

References $clientUrlEnabled.

◆ setDomain()

ilChatroomServerSettings::setDomain ( string  $domain)

Definition at line 160 of file class.ilChatroomServerSettings.php.

160 : void
161 {
162 $this->domain = $domain;
163 }

References $domain.

◆ setIliasUrl()

ilChatroomServerSettings::setIliasUrl ( string  $iliasUrl)

Definition at line 140 of file class.ilChatroomServerSettings.php.

140 : void
141 {
142 $this->iliasUrl = $iliasUrl;
143 }

References $iliasUrl.

◆ setIliasUrlEnabled()

ilChatroomServerSettings::setIliasUrlEnabled ( bool  $iliasUrlEnabled)

Definition at line 118 of file class.ilChatroomServerSettings.php.

118 : void
119 {
120 $this->iliasUrlEnabled = $iliasUrlEnabled;
121 }

References $iliasUrlEnabled.

◆ setInstance()

ilChatroomServerSettings::setInstance ( string  $instance)

Definition at line 180 of file class.ilChatroomServerSettings.php.

180 : void
181 {
182 $this->instance = $instance;
183 }

References $instance.

◆ setPort()

ilChatroomServerSettings::setPort ( int  $port)

Definition at line 170 of file class.ilChatroomServerSettings.php.

170 : void
171 {
172 $this->port = $port;
173 }

References $port.

◆ setProtocol()

ilChatroomServerSettings::setProtocol ( string  $protocol)

Definition at line 128 of file class.ilChatroomServerSettings.php.

128 : void
129 {
130 if (strpos($protocol, '://') === false) {
131 $this->protocol = $protocol . '://';
132 }
133 }

References $protocol.

◆ setSmiliesEnabled()

ilChatroomServerSettings::setSmiliesEnabled ( bool  $a_bool)

Definition at line 224 of file class.ilChatroomServerSettings.php.

224 : void
225 {
226 $this->smilies_enabled = $a_bool;
227 }

◆ setSubDirectory()

ilChatroomServerSettings::setSubDirectory ( string  $subDirectory)

Definition at line 254 of file class.ilChatroomServerSettings.php.

254 : void
255 {
256 $this->subDirectory = $subDirectory;
257 }

References $subDirectory.

Field Documentation

◆ $authKey

string ilChatroomServerSettings::$authKey = ''
private

Definition at line 39 of file class.ilChatroomServerSettings.php.

Referenced by getAuthKey(), and setAuthKey().

◆ $authSecret

string ilChatroomServerSettings::$authSecret = ''
private

Definition at line 40 of file class.ilChatroomServerSettings.php.

Referenced by getAuthSecret(), and setAuthSecret().

◆ $clientUrl

string ilChatroomServerSettings::$clientUrl = ''
private

Definition at line 42 of file class.ilChatroomServerSettings.php.

Referenced by getClientUrl(), and setClientUrl().

◆ $clientUrlEnabled

bool ilChatroomServerSettings::$clientUrlEnabled = false
private

Definition at line 41 of file class.ilChatroomServerSettings.php.

Referenced by getClientUrlEnabled(), and setClientUrlEnabled().

◆ $domain

string ilChatroomServerSettings::$domain = self::DEFAULT_HOST
private

Definition at line 36 of file class.ilChatroomServerSettings.php.

Referenced by getDomain(), and setDomain().

◆ $iliasUrl

string ilChatroomServerSettings::$iliasUrl = ''
private

Definition at line 44 of file class.ilChatroomServerSettings.php.

Referenced by getIliasUrl(), and setIliasUrl().

◆ $iliasUrlEnabled

bool ilChatroomServerSettings::$iliasUrlEnabled = false
private

Definition at line 43 of file class.ilChatroomServerSettings.php.

Referenced by getIliasUrlEnabled(), and setIliasUrlEnabled().

◆ $instance

string ilChatroomServerSettings::$instance = '123456'
private

Definition at line 37 of file class.ilChatroomServerSettings.php.

Referenced by getInstance(), and setInstance().

◆ $port

int ilChatroomServerSettings::$port = self::DEFAULT_PORT
private

Definition at line 34 of file class.ilChatroomServerSettings.php.

Referenced by getPort(), and setPort().

◆ $protocol

string ilChatroomServerSettings::$protocol = self::DEFAULT_PROCOTOL
private

Definition at line 35 of file class.ilChatroomServerSettings.php.

Referenced by getProtocol(), and setProtocol().

◆ $smilies_enabled

bool ilChatroomServerSettings::$smilies_enabled = false
private

Definition at line 38 of file class.ilChatroomServerSettings.php.

Referenced by getSmiliesEnabled().

◆ $subDirectory

string ilChatroomServerSettings::$subDirectory = ''
private

Definition at line 45 of file class.ilChatroomServerSettings.php.

Referenced by getSubDirectory(), and setSubDirectory().

◆ DEFAULT_HOST

const ilChatroomServerSettings::DEFAULT_HOST = '192.168.1.94'
private

Definition at line 31 of file class.ilChatroomServerSettings.php.

Referenced by loadDefault().

◆ DEFAULT_PORT

const ilChatroomServerSettings::DEFAULT_PORT = 8585
private

Definition at line 29 of file class.ilChatroomServerSettings.php.

Referenced by loadDefault().

◆ DEFAULT_PROCOTOL

const ilChatroomServerSettings::DEFAULT_PROCOTOL = 'http://'
private

Definition at line 30 of file class.ilChatroomServerSettings.php.

Referenced by loadDefault().

◆ PREFIX

const ilChatroomServerSettings::PREFIX = '/backend'

The documentation for this class was generated from the following file: