ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilChatroomAdminViewGUI Class Reference

Class ilChatroomAdminViewGUI. More...

+ Inheritance diagram for ilChatroomAdminViewGUI:
+ Collaboration diagram for ilChatroomAdminViewGUI:

Public Member Functions

 __construct (ilChatroomObjectGUI $gui)
 Constructor. More...
 
 executeDefault ($method)
 {
Parameters
string$requestedMethod
Returns
mixed
} More...
 
 saveSettings ()
 Saves settings fetched from $_POST. More...
 
 serversettings (ilPropertyFormGUI $form=null)
 Prepares view form and displays it. More...
 
 forcePublicRoom ()
 
 createPublicRoom ()
 Creates a public chatroom. More...
 
 saveClientSettings ()
 Saves client settings fetched from $_POST. More...
 
 clientsettings (ilPropertyFormGUI $form=null)
 
- Public Member Functions inherited from ilChatroomGUIHandler
 __construct (ilChatroomObjectGUI $gui)
 
 sendResponse ($response)
 Sends a json encoded response and exits the php process. More...
 
 hasPermission ($permission)
 Checks for access with ilRbacSystem. More...
 
 execute ($method)
 Executes given $method if existing, otherwise executes executeDefault() method. More...
 
 executeDefault ($requestedMethod)
 
 redirectIfNoPermission ($permission)
 Checks for requested permissions and redirects if the permission check failed. More...
 
 isSuccessful ($response)
 Checks for success param in an json decoded response. More...
 

Data Fields

const CHATROOM_README_PATH = '/Modules/Chatroom/README.md'
 

Protected Member Functions

 checkServerConnection (array $serverSettings)
 Checks for server connection. More...
 
 createSettingTemplate (ilPropertyFormGUI $form)
 
 getReadmePath ()
 Get the path to the README.txt file. More...
 
- Protected Member Functions inherited from ilChatroomGUIHandler
 getRoomByObjectId ($objectId)
 
 exitIfNoRoomExists ($room)
 Checks if a ilChatroom exists. More...
 
 exitIfNoRoomPermission ($room, $subRoom, $chat_user)
 Check if user can moderate a chatroom. More...
 
 canModerate ($room, $subRoom, $user_id)
 Checks if the user has permission to moderate a ilChatroom. More...
 
 isMainRoom ($subRoomId)
 

Protected Attributes

 $commonSettings
 
 $ilTpl
 
- Protected Attributes inherited from ilChatroomGUIHandler
 $gui
 
 $ilUser
 
 $ilCtrl
 
 $ilLng
 
 $webDirectory
 
 $upload
 
 $rbacsystem
 
 $mainTpl
 
 $ilias
 
 $navigationHistory
 
 $tree
 
 $tabs
 

Private Member Functions

 defaultActions ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilChatroomAdminViewGUI::__construct ( ilChatroomObjectGUI  $gui)

Constructor.

Parameters
ilChatroomObjectGUI$gui

Reimplemented from ilChatroomGUIHandler.

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

35 {
36 global $DIC;
37
38 parent::__construct($gui);
39 $this->commonSettings = new ilSetting('common');
40 $this->ilTpl = $DIC->ui()->mainTemplate();
41 }
ILIAS Setting Class.
global $DIC
Definition: saml.php:7

References $DIC, and ilChatroomGUIHandler\$gui.

Member Function Documentation

◆ checkServerConnection()

ilChatroomAdminViewGUI::checkServerConnection ( array  $serverSettings)
protected

Checks for server connection.

If no connection if possible, show info in gui

Parameters
array$serverSettings

Definition at line 187 of file class.ilChatroomAdminViewGUI.php.

188 {
189 require_once 'Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
190
191 if (
192 $serverSettings['port'] &&
193 $serverSettings['address'] &&
195 ) {
196 ilUtil::sendInfo($this->ilLng->txt('chat_cannot_connect_to_server'));
197 }
198 }
static checkServerConnection($use_cache=true)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References ilChatroomServerConnector\checkServerConnection(), and ilUtil\sendInfo().

Referenced by clientsettings(), and serversettings().

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

◆ clientsettings()

ilChatroomAdminViewGUI::clientsettings ( ilPropertyFormGUI  $form = null)
Parameters
ilPropertyFormGUI$form

Definition at line 276 of file class.ilChatroomAdminViewGUI.php.

277 {
278 $this->redirectIfNoPermission('read');
279
280 $this->defaultActions();
281 $this->gui->switchToVisibleMode();
282
283 $adminSettings = new ilChatroomAdmin($this->gui->object->getId());
284 $serverSettings = $adminSettings->loadGeneralSettings();
285
286 if ($form === null) {
287 $clientSettings = $adminSettings->loadClientSettings();
289 $form = $factory->getClientSettingsForm();
290 $form->setValuesByArray($clientSettings);
291 }
292
293 $this->checkServerConnection($serverSettings);
294
295 $form->setTitle($this->ilLng->txt('general_settings_title'));
296 if (ilChatroom::checkUserPermissions('write', $this->gui->ref_id, false)) {
297 $form->addCommandButton('view-saveClientSettings', $this->ilLng->txt('save'));
298 }
299 $form->setFormAction($this->ilCtrl->getFormAction($this->gui, 'view-saveClientSettings'));
300
301 $settingsTpl = $this->createSettingTemplate($form);
302 $this->ilTpl->setVariable('ADM_CONTENT', $settingsTpl->get());
303 }
$factory
Definition: metadata.php:43
checkServerConnection(array $serverSettings)
Checks for server connection.
createSettingTemplate(ilPropertyFormGUI $form)
Class ilChatroomAdmin.
Class ilChatroomFormFactory.
redirectIfNoPermission($permission)
Checks for requested permissions and redirects if the permission check failed.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
This class provides processing control methods.
getFormAction( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class object.
if(isset($_POST['submit'])) $form

References $factory, $form, checkServerConnection(), ilChatroom\checkUserPermissions(), createSettingTemplate(), defaultActions(), ilCtrl\getFormAction(), and ilChatroomGUIHandler\redirectIfNoPermission().

Referenced by saveClientSettings().

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

◆ createPublicRoom()

ilChatroomAdminViewGUI::createPublicRoom ( )

Creates a public chatroom.

Definition at line 176 of file class.ilChatroomAdminViewGUI.php.

177 {
178 require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
179 ilChatroomInstaller::createDefaultPublicRoom(true);
180 ilUtil::sendSuccess($this->ilLng->txt('public_chat_created'), true);
181 }

Referenced by forcePublicRoom().

+ Here is the caller graph for this function:

◆ createSettingTemplate()

ilChatroomAdminViewGUI::createSettingTemplate ( ilPropertyFormGUI  $form)
protected
Parameters
ilPropertyFormGUI$form
Returns
ilTemplate

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

205 {
206 $furtherInformation = sprintf($this->ilLng->txt('server_further_information'), $this->getReadmePath());
207 $serverTpl = new ilTemplate('tpl.chatroom_serversettings.html', true, true, 'Modules/Chatroom');
208 $serverTpl->setVariable('VAL_SERVERSETTINGS_FORM', $form->getHTML());
209 $serverTpl->setVariable('LBL_SERVERSETTINGS_FURTHER_INFORMATION', $furtherInformation);
210
211 return $serverTpl;
212 }
special template class to simplify handling of ITX/PEAR

References $form.

Referenced by clientsettings(), and serversettings().

+ Here is the caller graph for this function:

◆ defaultActions()

ilChatroomAdminViewGUI::defaultActions ( )
private

Definition at line 133 of file class.ilChatroomAdminViewGUI.php.

134 {
135 $chatSettings = new ilSetting('chatroom');
136 if ($chatSettings->get('chat_enabled', false)) {
137 $this->forcePublicRoom();
138 }
139 }

References forcePublicRoom().

Referenced by clientsettings(), and serversettings().

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

◆ executeDefault()

ilChatroomAdminViewGUI::executeDefault (   $method)

{

Parameters
string$requestedMethod
Returns
mixed
}

Reimplemented from ilChatroomGUIHandler.

Definition at line 46 of file class.ilChatroomAdminViewGUI.php.

47 {
48 $this->ilCtrl->redirect($this->gui, 'view-clientsettings');
49 }
redirect($a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to another command.

References ilCtrl\redirect().

+ Here is the call graph for this function:

◆ forcePublicRoom()

ilChatroomAdminViewGUI::forcePublicRoom ( )

Definition at line 144 of file class.ilChatroomAdminViewGUI.php.

145 {
147 if (!$ref_id) {
148 $this->createPublicRoom();
149 return;
150 }
151
152 $instance = ilObjectFactory::getInstanceByRefId($ref_id, false);
153 if (!$instance) {
154 $this->createPublicRoom();
155 return;
156 }
157
158 $obj_id = ilObject::_lookupObjId($ref_id);
159 if (!$obj_id) {
160 $this->createPublicRoom();
161 return;
162 }
163
164 if (!ilObject::_hasUntrashedReference($obj_id)) {
165 $this->createPublicRoom();
166 return;
167 }
168
169 require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
170 ilChatroomInstaller::ensureCorrectPublicChatroomTreeLocation($ref_id);
171 }
createPublicRoom()
Creates a public chatroom.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupObjId($a_id)
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash

References ilObjChatroom\_getPublicRefId(), ilObject\_hasUntrashedReference(), ilObject\_lookupObjId(), createPublicRoom(), and ilObjectFactory\getInstanceByRefId().

Referenced by defaultActions().

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

◆ getReadmePath()

ilChatroomAdminViewGUI::getReadmePath ( )
protected

Get the path to the README.txt file.

Returns
string

Definition at line 218 of file class.ilChatroomAdminViewGUI.php.

References ilUtil\_getHttpPath(), and CHATROOM_README_PATH.

+ Here is the call graph for this function:

◆ saveClientSettings()

ilChatroomAdminViewGUI::saveClientSettings ( )

Saves client settings fetched from $_POST.

Definition at line 226 of file class.ilChatroomAdminViewGUI.php.

227 {
228 $this->redirectIfNoPermission('write');
229
231 $form = $factory->getClientSettingsForm();
232
233 if (!$form->checkInput()) {
234 $form->setValuesByPost();
235 $this->clientsettings($form);
236 return;
237 }
238
239 $settings = array(
240 'name' => (string) $form->getInput('client_name'),
241 'enable_osd' => (boolean) $form->getInput('enable_osd'),
242 'enable_osc' => (boolean) $form->getInput('enable_osc'),
243 'osd_intervall' => (int) $form->getInput('osd_intervall'),
244 'chat_enabled' => ((boolean) $form->getInput('chat_enabled')),
245 'enable_smilies' => (boolean) $form->getInput('enable_smilies'),
246 'play_invitation_sound' => (boolean) $form->getInput('play_invitation_sound'),
247 'auth' => $form->getInput('auth')
248 );
249
250 if (!$settings['chat_enabled']) {
251 $settings['enable_osc'] = false;
252 }
253
254 $notificationSettings = new ilSetting('notifications');
255 $notificationSettings->set('osd_polling_intervall', (int) $form->getInput('osd_intervall'));
256 $notificationSettings->set('enable_osd', (boolean) $form->getInput('enable_osd'));
257
258 $chatSettings = new ilSetting('chatroom');
259 $chatSettings->set('chat_enabled', $settings['chat_enabled']);
260 $chatSettings->set('enable_osc', $settings['enable_osc']);
261 $chatSettings->set('play_invitation_sound', (boolean) $form->getInput('play_invitation_sound'));
262
263 $adminSettings = new ilChatroomAdmin($this->gui->object->getId());
264 $adminSettings->saveClientSettings((object) $settings);
265
266 $fileHandler = new ilChatroomConfigFileHandler();
267 $fileHandler->createClientConfigFile($settings);
268
269 ilUtil::sendSuccess($this->ilLng->txt('settings_has_been_saved'), true);
270 $this->ilCtrl->redirect($this->gui, 'view-clientsettings');
271 }
clientsettings(ilPropertyFormGUI $form=null)

References $factory, $form, clientsettings(), ilCtrl\redirect(), and ilChatroomGUIHandler\redirectIfNoPermission().

+ Here is the call graph for this function:

◆ saveSettings()

ilChatroomAdminViewGUI::saveSettings ( )

Saves settings fetched from $_POST.

Definition at line 54 of file class.ilChatroomAdminViewGUI.php.

55 {
56 $this->redirectIfNoPermission('write');
57
59 $form = $factory->getGeneralSettingsForm();
60
61 if (!$form->checkInput()) {
62 $form->setValuesByPost();
63 $this->serversettings($form);
64 return;
65 }
66
67 $settings = array(
68 'protocol' => $form->getInput('protocol'),
69 'port' => $form->getInput('port'),
70 'address' => $form->getInput('address'),
71 'cert' => $form->getInput('cert'),
72 'key' => $form->getInput('key'),
73 'dhparam' => $form->getInput('dhparam'),
74 'log' => $form->getInput('log'),
75 'error_log' => $form->getInput('error_log'),
76 'log_level' => $form->getInput('log_level'),
77 'ilias_proxy' => $form->getInput('ilias_proxy'),
78 'ilias_url' => $form->getInput('ilias_url'),
79 'client_proxy' => $form->getInput('client_proxy'),
80 'client_url' => $form->getInput('client_url'),
81 'sub_directory' => $form->getInput('sub_directory'),
82 'deletion_mode' => $form->getInput('deletion_mode'),
83 'deletion_unit' => $form->getInput('deletion_unit'),
84 'deletion_value' => $form->getInput('deletion_value'),
85 'deletion_time' => $form->getInput('deletion_time'),
86 );
87
88 $adminSettings = new ilChatroomAdmin($this->gui->object->getId());
89 $adminSettings->saveGeneralSettings((object) $settings);
90
91 $fileHandler = new ilChatroomConfigFileHandler();
92 $fileHandler->createServerConfigFile($settings);
93
94 ilUtil::sendSuccess($this->ilLng->txt('settings_has_been_saved'), true);
95 $this->ilCtrl->redirect($this->gui, 'view-serversettings');
96 }
serversettings(ilPropertyFormGUI $form=null)
Prepares view form and displays it.

References $factory, $form, ilCtrl\redirect(), ilChatroomGUIHandler\redirectIfNoPermission(), and serversettings().

+ Here is the call graph for this function:

◆ serversettings()

ilChatroomAdminViewGUI::serversettings ( ilPropertyFormGUI  $form = null)

Prepares view form and displays it.

Parameters
ilPropertyFormGUI$form

Definition at line 102 of file class.ilChatroomAdminViewGUI.php.

103 {
104 $this->redirectIfNoPermission('read');
105
106 $this->defaultActions();
107 $this->gui->switchToVisibleMode();
108
109 $adminSettings = new ilChatroomAdmin($this->gui->object->getId());
110 $serverSettings = $adminSettings->loadGeneralSettings();
111
112 if ($form === null) {
114 $form = $factory->getGeneralSettingsForm();
115 $form->setValuesByArray($serverSettings);
116 }
117
118 $this->checkServerConnection($serverSettings);
119
120 $form->setTitle($this->ilLng->txt('chatserver_settings_title'));
121 if (ilChatroom::checkUserPermissions('write', $this->gui->ref_id, false)) {
122 $form->addCommandButton('view-saveSettings', $this->ilLng->txt('save'));
123 }
124 $form->setFormAction($this->ilCtrl->getFormAction($this->gui, 'view-saveSettings'));
125
126 $settingsTpl = $this->createSettingTemplate($form);
127 $this->ilTpl->setVariable('ADM_CONTENT', $settingsTpl->get());
128 }

References $factory, $form, checkServerConnection(), ilChatroom\checkUserPermissions(), createSettingTemplate(), defaultActions(), ilCtrl\getFormAction(), and ilChatroomGUIHandler\redirectIfNoPermission().

Referenced by saveSettings().

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

Field Documentation

◆ $commonSettings

ilChatroomAdminViewGUI::$commonSettings
protected

Definition at line 23 of file class.ilChatroomAdminViewGUI.php.

◆ $ilTpl

ilChatroomAdminViewGUI::$ilTpl
protected

Definition at line 28 of file class.ilChatroomAdminViewGUI.php.

◆ CHATROOM_README_PATH

const ilChatroomAdminViewGUI::CHATROOM_README_PATH = '/Modules/Chatroom/README.md'

Definition at line 18 of file class.ilChatroomAdminViewGUI.php.

Referenced by getReadmePath().


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