ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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/chat/README.txt'
 

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
 
 $rbacsystem
 

Private Member Functions

 defaultActions ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilChatroomAdminViewGUI::__construct ( ilChatroomObjectGUI  $gui)

Constructor.

Parameters
ilChatroomObjectGUI$gui

Reimplemented from ilChatroomGUIHandler.

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

36 {
37 global $tpl;
38
39 parent::__construct($gui);
40 $this->commonSettings = new ilSetting('common');
41 $this->ilTpl = $tpl;
42 }
global $tpl
Definition: ilias.php:8
ILIAS Setting Class.

References ilChatroomGUIHandler\$gui, and $tpl.

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 190 of file class.ilChatroomAdminViewGUI.php.

191 {
192 require_once 'Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
193
194 if(
195 $serverSettings['port'] &&
196 $serverSettings['address'] &&
198 )
199 {
200 ilUtil::sendInfo($this->ilLng->txt('chat_cannot_connect_to_server'));
201 }
202 }
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 279 of file class.ilChatroomAdminViewGUI.php.

280 {
281 ilChatroom::checkUserPermissions('read', $this->gui->ref_id);
282
283 $this->defaultActions();
284 $this->gui->switchToVisibleMode();
285
286 $adminSettings = new ilChatroomAdmin($this->gui->object->getId());
287 $serverSettings = $adminSettings->loadGeneralSettings();
288
289 if($form === null)
290 {
291 $clientSettings = $adminSettings->loadClientSettings();
292 $factory = new ilChatroomFormFactory();
293 $form = $factory->getClientSettingsForm();
294 $form->setValuesByArray($clientSettings);
295 }
296
297 $this->checkServerConnection($serverSettings);
298
299 $form->setTitle($this->ilLng->txt('general_settings_title'));
300 $form->addCommandButton('view-saveClientSettings', $this->ilLng->txt('save'));
301 $form->setFormAction($this->ilCtrl->getFormAction($this->gui, 'view-saveClientSettings'));
302
303 $settingsTpl = $this->createSettingTemplate($form);
304 $this->ilTpl->setVariable('ADM_CONTENT', $settingsTpl->get());
305 }
checkServerConnection(array $serverSettings)
Checks for server connection.
createSettingTemplate(ilPropertyFormGUI $form)
Class ilChatroomAdmin.
Class ilChatroomFormFactory.
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.
setFormAction($a_formaction)
Set FormAction.
addCommandButton($a_cmd, $a_text, $a_id="")
Add Command button.
setValuesByArray($a_values, $a_restrict_to_value_keys=false)
Set form values from an array.
setTitle($a_title)
Set Title.

References checkServerConnection(), ilChatroom\checkUserPermissions(), createSettingTemplate(), defaultActions(), and ilCtrl\getFormAction().

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 179 of file class.ilChatroomAdminViewGUI.php.

180 {
181 require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
182 ilChatroomInstaller::createDefaultPublicRoom(true);
183 ilUtil::sendSuccess($this->ilLng->txt('public_chat_created'), true);
184 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References ilUtil\sendSuccess().

Referenced by forcePublicRoom().

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

◆ createSettingTemplate()

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

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

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

References ilPropertyFormGUI\getHTML(), and sprintf.

Referenced by clientsettings(), and serversettings().

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

◆ defaultActions()

ilChatroomAdminViewGUI::defaultActions ( )
private

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

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

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 47 of file class.ilChatroomAdminViewGUI.php.

48 {
49 $this->ilCtrl->redirect($this->gui, 'view-clientsettings');
50 }
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 143 of file class.ilChatroomAdminViewGUI.php.

144 {
146 if(!$ref_id)
147 {
148 $this->createPublicRoom();
149 return;
150 }
151
153 if(!$instance)
154 {
155 $this->createPublicRoom();
156 return;
157 }
158
160 if(!$obj_id)
161 {
162 $this->createPublicRoom();
163 return;
164 }
165
167 {
168 $this->createPublicRoom();
169 return;
170 }
171
172 require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
173 ilChatroomInstaller::ensureCorrectPublicChatroomTreeLocation($ref_id);
174 }
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
$ref_id
Definition: sahs_server.php:39

References $ref_id, 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 222 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 230 of file class.ilChatroomAdminViewGUI.php.

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

References clientsettings(), ilCtrl\redirect(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveSettings()

ilChatroomAdminViewGUI::saveSettings ( )

Saves settings fetched from $_POST.

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

56 {
57 $factory = new ilChatroomFormFactory();
58 $form = $factory->getGeneralSettingsForm();
59
60 if(!$form->checkInput())
61 {
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 'ilias_proxy' => $form->getInput('ilias_proxy'),
77 'ilias_url' => $form->getInput('ilias_url'),
78 'client_proxy' => $form->getInput('client_proxy'),
79 'client_url' => $form->getInput('client_url'),
80 'sub_directory'=> $form->getInput('sub_directory'),
81 'deletion_mode'=> $form->getInput('deletion_mode'),
82 'deletion_unit'=> $form->getInput('deletion_unit'),
83 'deletion_value'=> $form->getInput('deletion_value'),
84 'deletion_time' => $form->getInput('deletion_time'),
85 );
86
87 $adminSettings = new ilChatroomAdmin($this->gui->object->getId());
88 $adminSettings->saveGeneralSettings((object)$settings);
89
90 $fileHandler = new ilChatroomConfigFileHandler();
91 $fileHandler->createServerConfigFile($settings);
92
93 ilUtil::sendSuccess($this->ilLng->txt('settings_has_been_saved'), true);
94 $this->ilCtrl->redirect($this->gui, 'view-serversettings');
95 }
serversettings(ilPropertyFormGUI $form=null)
Prepares view form and displays it.

References ilCtrl\redirect(), ilUtil\sendSuccess(), 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 101 of file class.ilChatroomAdminViewGUI.php.

102 {
103 ilChatroom::checkUserPermissions('read', $this->gui->ref_id);
104
105 $this->defaultActions();
106 $this->gui->switchToVisibleMode();
107
108 $adminSettings = new ilChatroomAdmin($this->gui->object->getId());
109 $serverSettings = $adminSettings->loadGeneralSettings();
110
111 if($form === null)
112 {
113 $factory = new ilChatroomFormFactory();
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 $form->addCommandButton('view-saveSettings', $this->ilLng->txt('save'));
122 $form->setFormAction($this->ilCtrl->getFormAction($this->gui, 'view-saveSettings'));
123
124 $settingsTpl = $this->createSettingTemplate($form);
125 $this->ilTpl->setVariable('ADM_CONTENT', $settingsTpl->get());
126 }

References checkServerConnection(), ilChatroom\checkUserPermissions(), createSettingTemplate(), defaultActions(), and ilCtrl\getFormAction().

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 24 of file class.ilChatroomAdminViewGUI.php.

◆ $ilTpl

ilChatroomAdminViewGUI::$ilTpl
protected

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

◆ CHATROOM_README_PATH

const ilChatroomAdminViewGUI::CHATROOM_README_PATH = '/Modules/Chatroom/chat/README.txt'

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

Referenced by getReadmePath().


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