ILIAS  release_7 Revision v7.30-3-g800a261c036
ilChatroomAdminViewGUI Class Reference

Class ilChatroomAdminViewGUI. More...

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

Public Member Functions

 __construct (ilChatroomObjectGUI $gui)
 Constructor. More...
 
 executeDefault ($requestedMethod)
 @inheritDoc 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)
 
 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...
 
 sendResponse ($response)
 Sends a json encoded response and exits the php process. More...
 
 hasPermission ($permission)
 Checks for access with ilRbacSystem. 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
 
 $obj_service
 
 $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
39 $this->commonSettings = new ilSetting('common');
40 $this->ilTpl = $DIC->ui()->mainTemplate();
41 }
ILIAS Setting Class.
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ilChatroomGUIHandler\$gui, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

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

106 {
107 require_once 'Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
108
109 if (
110 $serverSettings['port'] &&
111 $serverSettings['address'] &&
113 ) {
114 ilUtil::sendInfo($this->ilLng->txt('chat_cannot_connect_to_server'));
115 }
116 }
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().

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

201 {
202 $this->redirectIfNoPermission(['visible','read']);
203
204 $this->defaultActions();
205 $this->gui->switchToVisibleMode();
206
207 $adminSettings = new ilChatroomAdmin($this->gui->object->getId());
208 $serverSettings = $adminSettings->loadGeneralSettings();
209
210 if ($form === null) {
211 $clientSettings = $adminSettings->loadClientSettings();
213 $form = $factory->getClientSettingsForm();
214 $form->setValuesByArray($clientSettings);
215 }
216
217 $this->checkServerConnection($serverSettings);
218
219 $form->setTitle($this->ilLng->txt('general_settings_title'));
220 if (ilChatroom::checkUserPermissions('write', $this->gui->ref_id, false)) {
221 $form->addCommandButton('view-saveClientSettings', $this->ilLng->txt('save'));
222 } else {
223 $form->getItemByPostVar('auth')->setIsReadOnly(true);
224 }
225 $form->setFormAction($this->ilCtrl->getFormAction($this->gui, 'view-saveClientSettings'));
226
227 $settingsTpl = $this->createSettingTemplate($form);
228 $this->ilTpl->setVariable('ADM_CONTENT', $settingsTpl->get());
229 }
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=false)
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.
getItemByPostVar($a_post_var)
Get Item by POST variable.
setTitle($a_title)
Set Title.
$factory
Definition: metadata.php:58

References $factory, 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 94 of file class.ilChatroomAdminViewGUI.php.

95 {
96 require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
97 ilChatroomInstaller::createDefaultPublicRoom(true);
98 ilUtil::sendSuccess($this->ilLng->txt('public_chat_created'), true);
99 }

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

123 {
124 $furtherInformation = sprintf($this->ilLng->txt('server_further_information'), $this->getReadmePath());
125 $serverTpl = new ilTemplate('tpl.chatroom_serversettings.html', true, true, 'Modules/Chatroom');
126 $serverTpl->setVariable('VAL_SERVERSETTINGS_FORM', $form->getHTML());
127 $serverTpl->setVariable('LBL_SERVERSETTINGS_FURTHER_INFORMATION', $furtherInformation);
128
129 return $serverTpl;
130 }
special template class to simplify handling of ITX/PEAR

References ilPropertyFormGUI\getHTML().

Referenced by clientsettings().

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

◆ defaultActions()

ilChatroomAdminViewGUI::defaultActions ( )
private

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

52 {
53 $chatSettings = new ilSetting('chatroom');
54 if ($chatSettings->get('chat_enabled', false)) {
55 $this->forcePublicRoom();
56 }
57 }

References forcePublicRoom().

Referenced by clientsettings().

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

◆ executeDefault()

ilChatroomAdminViewGUI::executeDefault (   $requestedMethod)

@inheritDoc

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

63 {
65 if (!$ref_id) {
66 $this->createPublicRoom();
67 return;
68 }
69
70 $instance = ilObjectFactory::getInstanceByRefId($ref_id, false);
71 if (!$instance) {
72 $this->createPublicRoom();
73 return;
74 }
75
76 $obj_id = ilObject::_lookupObjId($ref_id);
77 if (!$obj_id) {
78 $this->createPublicRoom();
79 return;
80 }
81
83 $this->createPublicRoom();
84 return;
85 }
86
87 require_once 'Modules/Chatroom/classes/class.ilChatroomInstaller.php';
88 ilChatroomInstaller::ensureCorrectPublicChatroomTreeLocation($ref_id);
89 }
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 136 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 144 of file class.ilChatroomAdminViewGUI.php.

145 {
146 $this->redirectIfNoPermission('write');
147
149 $form = $factory->getClientSettingsForm();
150
151 if (!$form->checkInput()) {
152 $form->setValuesByPost();
153 $this->clientsettings($form);
154 return;
155 }
156
157 $convIdleStateTime = max(1, (int) (int) $form->getInput('conversation_idle_state_in_minutes'));
158
159 $settings = array(
160 'name' => (string) $form->getInput('client_name'),
161 'enable_osd' => (boolean) $form->getInput('enable_osd'),
162 'enable_osc' => (boolean) $form->getInput('enable_osc'),
163 'enable_browser_notifications' => (boolean) $form->getInput('enable_browser_notifications'),
164 'conversation_idle_state_in_minutes' => $convIdleStateTime,
165 'osd_intervall' => (int) $form->getInput('osd_intervall'),
166 'chat_enabled' => ((boolean) $form->getInput('chat_enabled')),
167 'enable_smilies' => (boolean) $form->getInput('enable_smilies'),
168 'play_invitation_sound' => (boolean) $form->getInput('play_invitation_sound'),
169 'auth' => $form->getInput('auth')
170 );
171
172 if (!$settings['chat_enabled']) {
173 $settings['enable_osc'] = false;
174 }
175
176 $notificationSettings = new ilSetting('notifications');
177 $notificationSettings->set('osd_polling_intervall', (int) $form->getInput('osd_intervall'));
178 $notificationSettings->set('enable_osd', (boolean) $form->getInput('enable_osd'));
179
180 $chatSettings = new ilSetting('chatroom');
181 $chatSettings->set('chat_enabled', $settings['chat_enabled']);
182 $chatSettings->set('enable_browser_notifications', $settings['enable_browser_notifications']);
183 $chatSettings->set('conversation_idle_state_in_minutes', $convIdleStateTime);
184 $chatSettings->set('enable_osc', $settings['enable_osc']);
185 $chatSettings->set('play_invitation_sound', (boolean) $form->getInput('play_invitation_sound'));
186
187 $adminSettings = new ilChatroomAdmin($this->gui->object->getId());
188 $adminSettings->saveClientSettings((object) $settings);
189
190 $fileHandler = new ilChatroomConfigFileHandler();
191 $fileHandler->createClientConfigFile($settings);
192
193 ilUtil::sendSuccess($this->ilLng->txt('settings_has_been_saved'), true);
194 $this->ilCtrl->redirect($this->gui, 'view-clientsettings');
195 }
clientsettings(ilPropertyFormGUI $form=null)

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

+ Here is the call 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: