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

Class ilChatroomViewGUI. More...

+ Inheritance diagram for ilChatroomViewGUI:
+ Collaboration diagram for ilChatroomViewGUI:

Public Member Functions

 joinWithCustomName ()
 Joins user to chatroom with custom username, fetched from $_REQUEST['custom_username_text'] or by calling buld method. More...
 
 renderFileUploadForm (ilTemplate $roomTpl)
 Prepares Fileupload form and displays it. More...
 
 executeDefault ($method)
 Chatroom and Chatuser get prepared before $this->showRoom method is called. More...
 
 invitePD ()
 
 logout ()
 Performs logout. More...
 
 lostConnection ()
 
- 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...
 

Protected Member Functions

 renderSendMessageBox (ilTemplate $roomTpl)
 
 renderLanguageVariables (ilTemplate $roomTpl)
 
 renderRightUsersBlock (ilTemplate $roomTpl)
 
- 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)
 

Private Member Functions

 setupTemplate ()
 Adds CSS and JavaScript files that should be included in the header. More...
 
 showRoom (ilChatroom $room, ilChatroomUser $chat_user)
 Prepares and displays chatroom and connects user to it. More...
 
 cancelJoin ($message)
 Calls ilUtil::sendFailure method using given $message as parameter. More...
 
 showNameSelection (ilChatroomUser $chat_user)
 Prepares and displays name selection. More...
 

Additional Inherited Members

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

Detailed Description

Class ilChatroomViewGUI.

Author
Jan Posselt jposs.nosp@m.elt@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilChatroomViewGUI.php.

Member Function Documentation

◆ cancelJoin()

ilChatroomViewGUI::cancelJoin (   $message)
private

Calls ilUtil::sendFailure method using given $message as parameter.

Parameters
string$message

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

240 {
242 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
catch(Exception $e) $message

References $message, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ executeDefault()

ilChatroomViewGUI::executeDefault (   $method)

Chatroom and Chatuser get prepared before $this->showRoom method is called.

If custom usernames are allowed, $this->showNameSelection method is called if user isn't already registered in the Chatroom.

Parameters
string$method

Reimplemented from ilChatroomGUIHandler.

Definition at line 366 of file class.ilChatroomViewGUI.php.

367 {
368 include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
369
370 $this->redirectIfNoPermission('read');
371
372 $this->gui->switchToVisibleMode();
373 $this->setupTemplate();
374
375 $chatSettings = new ilSetting('chatroom');
376 if (!$chatSettings->get('chat_enabled')) {
377 $this->ilCtrl->redirect($this->gui, 'settings-general');
378 exit;
379 }
380
381 $room = ilChatroom::byObjectId($this->gui->object->getId());
382
383 if (!$room->getSetting('allow_anonymous') && $this->ilUser->isAnonymous()) {
384 $this->cancelJoin($this->ilLng->txt('chat_anonymous_not_allowed'));
385 return;
386 }
387
388 $chat_user = new ilChatroomUser($this->ilUser, $room);
389
390 if ($room->getSetting('allow_custom_usernames')) {
391 if ($room->isSubscribed($chat_user->getUserId())) {
392 $chat_user->setUsername($chat_user->getUsername());
393 $this->showRoom($room, $chat_user);
394 } else {
395 $this->showNameSelection($chat_user);
396 }
397 } else {
398 $chat_user->setUsername($this->ilUser->getLogin());
399 $this->showRoom($room, $chat_user);
400 }
401 }
exit
Definition: backend.php:16
redirectIfNoPermission($permission)
Checks for requested permissions and redirects if the permission check failed.
Class ilChatroomUser.
setupTemplate()
Adds CSS and JavaScript files that should be included in the header.
showNameSelection(ilChatroomUser $chat_user)
Prepares and displays name selection.
cancelJoin($message)
Calls ilUtil::sendFailure method using given $message as parameter.
showRoom(ilChatroom $room, ilChatroomUser $chat_user)
Prepares and displays chatroom and connects user to it.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
This class provides processing control methods.
redirect($a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to another command.
ILIAS Setting Class.

References ilChatroom\byObjectId(), exit, and ilCtrl\redirect().

+ Here is the call graph for this function:

◆ invitePD()

ilChatroomViewGUI::invitePD ( )

Definition at line 406 of file class.ilChatroomViewGUI.php.

407 {
408 $chatSettings = new ilSetting('chatroom');
409 if (!$chatSettings->get('chat_enabled')) {
410 $this->ilCtrl->redirect($this->gui, 'settings-general');
411 }
412
413 $room = ilChatroom::byObjectId($this->gui->object->getId());
414 $chat_user = new ilChatroomUser($this->ilUser, $room);
415 $user_id = $_REQUEST['usr_id'];
416 $connector = $this->gui->getConnector();
417 $title = $room->getUniquePrivateRoomTitle($chat_user->buildLogin());
418 $subRoomId = $room->addPrivateRoom($title, $chat_user, array('public' => false));
419
420 $room->inviteUserToPrivateRoom($user_id, $subRoomId);
421 $connector->sendCreatePrivateRoom($room->getRoomId(), $subRoomId, $chat_user->getUserId(), $title);
422 $connector->sendInviteToPrivateRoom($room->getRoomId(), $subRoomId, $chat_user->getUserId(), $user_id);
423
424 $room->sendInvitationNotification($this->gui, $chat_user, $user_id, $subRoomId);
425
426 $_REQUEST['sub'] = $subRoomId;
427
428 $_SESSION['show_invitation_message'] = $user_id;
429
430 $this->ilCtrl->setParameter($this->gui, 'sub', $subRoomId);
431 $this->ilCtrl->redirect($this->gui, 'view');
432 }
$_SESSION["AccountId"]
setParameter($a_obj, $a_parameter, $a_value)
Set parameters that should be passed a form and link of a gui class.

References $_SESSION, $title, ilChatroom\byObjectId(), ilCtrl\redirect(), and ilCtrl\setParameter().

+ Here is the call graph for this function:

◆ joinWithCustomName()

ilChatroomViewGUI::joinWithCustomName ( )

Joins user to chatroom with custom username, fetched from $_REQUEST['custom_username_text'] or by calling buld method.

If sucessful, $this->showRoom method is called, otherwise $this->showNameSelection.

Definition at line 21 of file class.ilChatroomViewGUI.php.

22 {
23 $this->gui->switchToVisibleMode();
24 $this->setupTemplate();
25 $room = ilChatroom::byObjectId($this->gui->object->getId());
26 $chat_user = new ilChatroomUser($this->ilUser, $room);
27 $failure = false;
28 $username = '';
29
30 if ($_REQUEST['custom_username_radio'] == 'custom_username') {
31 $username = $_REQUEST['custom_username_text'];
32 } elseif (method_exists($chat_user, 'build' . $_REQUEST['custom_username_radio'])) {
33 $username = $chat_user->{'build' . $_REQUEST['custom_username_radio']}();
34 } else {
35 $failure = true;
36 }
37
38 if (!$failure && trim($username) != '') {
39 if (!$room->isSubscribed($chat_user->getUserId())) {
40 $chat_user->setUsername($chat_user->buildUniqueUsername($username));
41 }
42
43 $this->showRoom($room, $chat_user);
44 } else {
45 ilUtil::sendFailure($this->ilLng->txt('no_username_given'));
46 $this->showNameSelection($chat_user);
47 }
48 }
$failure

References $failure, ilChatroom\byObjectId(), and setupTemplate().

+ Here is the call graph for this function:

◆ logout()

ilChatroomViewGUI::logout ( )

Performs logout.

Todo:
logout user from room

Definition at line 437 of file class.ilChatroomViewGUI.php.

438 {
442 $pid = $this->tree->getParentId($this->gui->getRefId());
443 $this->ilCtrl->setParameterByClass('ilrepositorygui', 'ref_id', $pid);
444 $this->ilCtrl->redirectByClass('ilrepositorygui', '');
445 }
setParameterByClass($a_class, $a_parameter, $a_value)
Same as setParameterByClass, except that a class name is passed.
redirectByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to other gui class using class name.

References ilCtrl\redirectByClass(), and ilCtrl\setParameterByClass().

+ Here is the call graph for this function:

◆ lostConnection()

ilChatroomViewGUI::lostConnection ( )

Definition at line 450 of file class.ilChatroomViewGUI.php.

451 {
452 if (isset($_GET['msg'])) {
453 switch ($_GET['msg']) {
454 case 'kicked':
455 ilUtil::sendFailure($this->ilLng->txt('kicked'), true);
456 break;
457
458 case 'banned':
459 ilUtil::sendFailure($this->ilLng->txt('banned'), true);
460 break;
461
462 default:
463 ilUtil::sendFailure($this->ilLng->txt('lost_connection'), true);
464 break;
465 }
466 } else {
467 ilUtil::sendFailure($this->ilLng->txt('lost_connection'), true);
468 }
469
470 $this->ilCtrl->redirectByClass('ilinfoscreengui', 'info');
471 }
$_GET["client_id"]

References $_GET, ilCtrl\redirectByClass(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ renderFileUploadForm()

ilChatroomViewGUI::renderFileUploadForm ( ilTemplate  $roomTpl)

Prepares Fileupload form and displays it.

Parameters
ilTemplate$roomTpl

Definition at line 248 of file class.ilChatroomViewGUI.php.

249 {
250 // @todo: Not implemented yet
251 return;
252
253 require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
254 $formFactory = new ilChatroomFormFactory();
255 $file_upload = $formFactory->getFileUploadForm();
256 //$file_upload->setFormAction( $ilCtrl->getFormAction($this->gui, 'UploadFile-uploadFile') );
257 $roomTpl->setVariable('FILE_UPLOAD', $file_upload->getHTML());
258 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:613
Class ilChatroomFormFactory.

References HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ renderLanguageVariables()

ilChatroomViewGUI::renderLanguageVariables ( ilTemplate  $roomTpl)
protected
Parameters
ilTemplate$roomTpl

Definition at line 275 of file class.ilChatroomViewGUI.php.

276 {
277 $js_translations = array(
278 'LBL_MAINROOM' => 'chat_mainroom',
279 'LBL_LEAVE_PRIVATE_ROOM' => 'leave_private_room',
280 'LBL_LEFT_PRIVATE_ROOM' => 'left_private_room',
281 'LBL_JOIN' => 'chat_join',
282 'LBL_DELETE_PRIVATE_ROOM' => 'delete_private_room',
283 'LBL_DELETE_PRIVATE_ROOM_QUESTION' => 'delete_private_room_question',
284 'LBL_INVITE_TO_PRIVATE_ROOM' => 'invite_to_private_room',
285 'LBL_KICK' => 'chat_kick',
286 'LBL_BAN' => 'chat_ban',
287 'LBL_KICK_QUESTION' => 'kick_question',
288 'LBL_BAN_QUESTION' => 'ban_question',
289 'LBL_ADDRESS' => 'chat_address',
290 'LBL_WHISPER' => 'chat_whisper',
291 'LBL_CONNECT' => 'chat_connection_established',
292 'LBL_DISCONNECT' => 'chat_connection_disconnected',
293 'LBL_TO_MAINROOM' => 'chat_to_mainroom',
294 'LBL_CREATE_PRIVATE_ROOM_JS' => 'chat_create_private_room_button',
295 'LBL_WELCOME_TO_CHAT' => 'welcome_to_chat',
296 'LBL_USER_INVITED' => 'user_invited',
297 'LBL_USER_KICKED' => 'user_kicked',
298 'LBL_USER_INVITED_SELF' => 'user_invited_self',
299 'LBL_PRIVATE_ROOM_CLOSED' => 'private_room_closed',
300 'LBL_PRIVATE_ROOM_ENTERED' => 'private_room_entered',
301 'LBL_PRIVATE_ROOM_LEFT' => 'private_room_left',
302 'LBL_PRIVATE_ROOM_ENTERED_USER' => 'private_room_entered_user',
303 'LBL_KICKED_FROM_PRIVATE_ROOM' => 'kicked_from_private_room',
304 'LBL_OK' => 'ok',
305 'LBL_INVITE' => 'chat_invite',
306 'LBL_CANCEL' => 'cancel',
307 'LBL_WHISPER_TO' => 'whisper_to',
308 'LBL_SPEAK_TO' => 'speak_to',
309 'LBL_HISTORY_CLEARED' => 'history_cleared',
310 'LBL_CLEAR_ROOM_HISTORY' => 'clear_room_history',
311 'LBL_CLEAR_ROOM_HISTORY_QUESTION' => 'clear_room_history_question',
312 'LBL_END_WHISPER' => 'end_whisper',
313 'LBL_TIMEFORMAT' => 'lang_timeformat_no_sec',
314 'LBL_DATEFORMAT' => 'lang_dateformat'
315 );
316 foreach ($js_translations as $placeholder => $lng_variable) {
317 $roomTpl->setVariable($placeholder, json_encode($this->ilLng->txt($lng_variable)));
318 }
319
320 $roomTpl->setVariable('LBL_CREATE_PRIVATE_ROOM', $this->ilLng->txt('chat_create_private_room_button'));
321 $roomTpl->setVariable('LBL_CREATE_PRIVATE_ROOM_TEXT', $this->ilLng->txt('create_private_room_text'));
322 $roomTpl->setVariable('LBL_LAYOUT', $this->ilLng->txt('layout'));
323 $roomTpl->setVariable('LBL_SHOW_SETTINGS', $this->ilLng->txt('show_settings'));
324 $roomTpl->setVariable('LBL_USER_IN_ROOM', $this->ilLng->txt('user_in_room'));
325 $roomTpl->setVariable('LBL_USER_IN_ILIAS', $this->ilLng->txt('user_in_ilias'));
326 }

References HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ renderRightUsersBlock()

ilChatroomViewGUI::renderRightUsersBlock ( ilTemplate  $roomTpl)
protected
Parameters
ilTemplate$roomTpl

Definition at line 331 of file class.ilChatroomViewGUI.php.

332 {
333 $roomTpl->setVariable('LBL_NO_FURTHER_USERS', $this->ilLng->txt('no_further_users'));
334 }

References HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ renderSendMessageBox()

ilChatroomViewGUI::renderSendMessageBox ( ilTemplate  $roomTpl)
protected
Parameters
ilTemplate$roomTpl

Definition at line 263 of file class.ilChatroomViewGUI.php.

264 {
265 $roomTpl->setVariable('LBL_MESSAGE', $this->ilLng->txt('chat_message'));
266 $roomTpl->setVariable('LBL_TOALL', $this->ilLng->txt('chat_message_to_all'));
267 $roomTpl->setVariable('LBL_OPTIONS', $this->ilLng->txt('chat_message_options'));
268 $roomTpl->setVariable('LBL_DISPLAY', $this->ilLng->txt('chat_message_display'));
269 $roomTpl->setVariable('LBL_SEND', $this->ilLng->txt('send'));
270 }

References HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ setupTemplate()

ilChatroomViewGUI::setupTemplate ( )
private

Adds CSS and JavaScript files that should be included in the header.

Definition at line 53 of file class.ilChatroomViewGUI.php.

54 {
55 $this->mainTpl->addJavaScript('Modules/Chatroom/js/chat.js');
56 $this->mainTpl->addJavaScript('Modules/Chatroom/js/iliaschat.jquery.js');
57 $this->mainTpl->addJavaScript('libs/bower/bower_components/jquery-outside-events/jquery.ba-outside-events.min.js');
58
59 $this->mainTpl->addJavaScript('./Services/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js');
60
61 $this->mainTpl->addCSS('Modules/Chatroom/templates/default/style.css');
62 }

Referenced by joinWithCustomName().

+ Here is the caller graph for this function:

◆ showNameSelection()

ilChatroomViewGUI::showNameSelection ( ilChatroomUser  $chat_user)
private

Prepares and displays name selection.

Fetches name option by calling getChatNameSuggestions method on given $chat_user object.

Parameters
ilChatroomUser$chat_user

Definition at line 342 of file class.ilChatroomViewGUI.php.

343 {
344 require_once 'Modules/Chatroom/classes/class.ilChatroomFormFactory.php';
345
346 $name_options = $chat_user->getChatNameSuggestions();
347 $formFactory = new ilChatroomFormFactory();
348 $selectionForm = $formFactory->getUserChatNameSelectionForm($name_options);
349
350 $this->ilCtrl->saveParameter($this->gui, 'sub');
351
352 $selectionForm->addCommandButton('view-joinWithCustomName', $this->ilLng->txt('enter'));
353 $selectionForm->setFormAction(
354 $this->ilCtrl->getFormAction($this->gui, 'view-joinWithCustomName')
355 );
356
357 $this->mainTpl->setVariable('ADM_CONTENT', $selectionForm->getHtml());
358 }
getChatNameSuggestions()
Returns an array of chat-name suggestions.
getFormAction( $a_gui_obj, $a_fallback_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get form action url for gui class object.
saveParameter($a_obj, $a_parameter)
Set parameters that should be passed in every form and link of a gui class.

References ilChatroomUser\getChatNameSuggestions(), ilCtrl\getFormAction(), and ilCtrl\saveParameter().

+ Here is the call graph for this function:

◆ showRoom()

ilChatroomViewGUI::showRoom ( ilChatroom  $room,
ilChatroomUser  $chat_user 
)
private

Prepares and displays chatroom and connects user to it.

Parameters
ilChatroom$room
ilChatroomUser$chat_user

Definition at line 69 of file class.ilChatroomViewGUI.php.

70 {
71 $this->redirectIfNoPermission('read');
72
73 $user_id = $chat_user->getUserId($this->ilUser);
74
75 $this->navigationHistory->addItem($_GET['ref_id'], $this->ilCtrl->getLinkTargetByClass('ilrepositorygui', 'view'), 'chtr');
76
77 if ($room->isUserBanned($user_id)) {
78 $this->cancelJoin($this->ilLng->txt('banned'));
79 return;
80 }
81
82 $scope = $room->getRoomId();
83 $connector = $this->gui->getConnector();
84 $response = @$connector->connect($scope, $user_id);
85
86 if (!$response) {
87 ilUtil::sendFailure($this->ilLng->txt('unable_to_connect'), true);
88 $this->ilCtrl->redirectByClass('ilinfoscreengui', 'info');
89 }
90
91 if (!$room->isSubscribed($chat_user->getUserId())) {
92 $room->connectUser($chat_user);
93 }
94
95 $subScope = 0;
96 $response = $connector->sendEnterPrivateRoom($scope, $subScope, $user_id);
97 if (!$response) {
98 ilUtil::sendFailure($this->ilLng->txt('unable_to_connect'), true);
99 $this->ilCtrl->redirectByClass('ilinfoscreengui', 'info');
100 }
101
102 $connection_info = json_decode($response);
103 $settings = $connector->getSettings();
104 $known_private_room = $room->getActivePrivateRooms($this->ilUser->getId());
105
106 $initial = new stdClass();
107 $initial->users = $room->getConnectedUsers();
108 $initial->private_rooms = array_values($known_private_room);
109 $initial->redirect_url = $this->ilCtrl->getLinkTarget($this->gui, 'view-lostConnection', '', false, false);
110 $initial->profile_image_url = $this->ilCtrl->getLinkTarget($this->gui, 'view-getUserProfileImages', '', true, false);
111 $initial->no_profile_image_url = ilUtil::getImagePath('no_photo_xxsmall.jpg');
112 $initial->private_rooms_enabled = (boolean) $room->getSetting('private_rooms_enabled');
113 $initial->subdirectory = $settings->getSubDirectory();
114
115 $initial->userinfo = array(
116 'moderator' => ilChatroom::checkUserPermissions('moderate', (int) $_GET['ref_id'], false),
117 'id' => $chat_user->getUserId(),
118 'login' => $chat_user->getUsername()
119 );
120
121 $smileys = array();
122
123 include_once('Modules/Chatroom/classes/class.ilChatroomSmilies.php');
124
125 if ($settings->getSmiliesEnabled()) {
126 $smileys_array = ilChatroomSmilies::_getSmilies();
127 foreach ($smileys_array as $smiley_array) {
128 $new_keys = array();
129 $new_val = '';
130 foreach ($smiley_array as $key => $value) {
131 if ($key == 'smiley_keywords') {
132 $new_keys = explode("\n", $value);
133 }
134
135 if ($key == 'smiley_fullpath') {
136 $new_val = $value;
137 }
138 }
139
140 if (!$new_keys || !$new_val) {
141 continue;
142 }
143
144 foreach ($new_keys as $new_key) {
145 $smileys[$new_key] = $new_val;
146 }
147 }
148
149 $initial->smileys = $smileys;
150 } else {
151 $initial->smileys = '{}';
152 }
153
154 $initial->messages = array();
155
156 if (isset($_REQUEST['sub'])) {
157 if ($known_private_room[$_REQUEST['sub']]) {
158 if (!$room->isAllowedToEnterPrivateRoom($chat_user->getUserId(), $_REQUEST['sub'])) {
159 $initial->messages[] = array(
160 'type' => 'error',
161 'message' => $this->ilLng->txt('not_allowed_to_enter'),
162 );
163 } else {
164 $scope = $room->getRoomId();
165 $params = array();
166 $params['user'] = $chat_user->getUserId();
167 $params['sub'] = $_REQUEST['sub'];
168
169 $params['message'] = json_encode(
170 array(
171 'type' => 'private_room_entered',
172 'user' => $user_id
173 )
174 );
175
176 $connector = $this->gui->getConnector();
177 $response = $connector->sendEnterPrivateRoom($scope, $_REQUEST['sub'], $chat_user->getUserId());
178
179 if ($this->isSuccessful($response)) {
180 $room->subscribeUserToPrivateRoom($params['sub'], $params['user']);
181 }
182
183 $initial->enter_room = $_REQUEST['sub'];
184 }
185 } else {
186 $initial->messages[] = array(
187 'type' => 'error',
188 'message' => $this->ilLng->txt('user_invited'),
189 );
190 }
191 }
192
193 if ((int) $room->getSetting('display_past_msgs')) {
194 $initial->messages = array_merge($initial->messages, array_reverse($room->getLastMessages($room->getSetting('display_past_msgs'), $chat_user)));
195 }
196
197 $roomTpl = new ilTemplate('tpl.chatroom.html', true, true, 'Modules/Chatroom');
198 $roomTpl->setVariable('SESSION_ID', $connection_info->{'session-id'});
199 $roomTpl->setVariable('BASEURL', $settings->generateClientUrl());
200 $roomTpl->setVariable('INSTANCE', $settings->getInstance());
201 $roomTpl->setVariable('SCOPE', $scope);
202 $roomTpl->setVariable('MY_ID', $user_id);
203 $roomTpl->setVariable('INITIAL_DATA', json_encode($initial));
204 $roomTpl->setVariable('POSTURL', $this->ilCtrl->getLinkTarget($this->gui, 'postMessage', '', true, true));
205
206 $roomTpl->setVariable('ACTIONS', $this->ilLng->txt('actions'));
207 $roomTpl->setVariable('LBL_CREATE_PRIVATE_ROOM', $this->ilLng->txt('create_private_room_label'));
208 $roomTpl->setVariable('LBL_USER', $this->ilLng->txt('user'));
209 $roomTpl->setVariable('LBL_USER_TEXT', $this->ilLng->txt('invite_username'));
210 $roomTpl->setVariable('LBL_AUTO_SCROLL', $this->ilLng->txt('auto_scroll'));
211
212 $roomTpl->setVariable('INITIAL_USERS', json_encode($room->getConnectedUsers()));
213
214 $this->renderFileUploadForm($roomTpl);
215 $this->renderSendMessageBox($roomTpl);
216 $this->renderLanguageVariables($roomTpl);
217
218 require_once 'Services/UIComponent/Modal/classes/class.ilModalGUI.php';
220
221 $roomRightTpl = new ilTemplate('tpl.chatroom_right.html', true, true, 'Modules/Chatroom');
222 $this->renderRightUsersBlock($roomRightTpl);
223
224 require_once 'Services/UIComponent/Panel/classes/class.ilPanelGUI.php';
225 $right_content_panel = ilPanelGUI::getInstance();
226 $right_content_panel->setHeading($this->ilLng->txt('users'));
227 $right_content_panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
228 $right_content_panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_BLOCK);
229 $right_content_panel->setBody($roomRightTpl->get());
230
231 $this->mainTpl->setContent($roomTpl->get());
232 $this->mainTpl->setRightContent($right_content_panel->getHTML());
233 }
isSuccessful($response)
Checks for success param in an json decoded response.
getUserId()
Returns Ilias User ID.
getUsername()
Returns username from Object or SESSION.
renderLanguageVariables(ilTemplate $roomTpl)
renderFileUploadForm(ilTemplate $roomTpl)
Prepares Fileupload form and displays it.
renderRightUsersBlock(ilTemplate $roomTpl)
renderSendMessageBox(ilTemplate $roomTpl)
isSubscribed($chat_userid)
Returns true if entry exists in userTable matching given $chat_userid and $this->roomId.
isUserBanned($user_id)
Returns true if there's an entry in banTable matching roomId and given $user_id.
connectUser(ilChatroomUser $user)
Connects user by inserting userdata into userTable.
getConnectedUsers($only_data=true)
Returns an array of connected users.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
getActivePrivateRooms($userid)
subscribeUserToPrivateRoom($room_id, $user_id)
getLastMessages($number, $chatuser=null)
getRoomId()
Returns roomID from $this->roomId.
getSetting($name)
Returns setting from $this->settings array by given name.
isAllowedToEnterPrivateRoom($chat_userid, $proom_id)
getLinkTargetByClass( $a_class, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui class name.
getLinkTarget( $a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false, $xml_style=true)
Get link target for command using gui object.
static initJS(ilTemplate $a_main_tpl=null)
Init javascript.
const PANEL_STYLE_SECONDARY
const HEADING_STYLE_BLOCK
static getInstance()
Get instance.
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$key
Definition: croninfo.php:18
$response

References $_GET, $key, PHPMailer\PHPMailer\$params, $response, ilChatroom\checkUserPermissions(), ilChatroom\connectUser(), ilChatroom\getActivePrivateRooms(), ilChatroom\getConnectedUsers(), ilUtil\getImagePath(), ilChatroom\getLastMessages(), ilCtrl\getLinkTarget(), ilCtrl\getLinkTargetByClass(), ilChatroom\getRoomId(), ilChatroom\getSetting(), ilChatroomUser\getUserId(), ilChatroomUser\getUsername(), ilChatroom\isAllowedToEnterPrivateRoom(), ilChatroom\isSubscribed(), ilChatroom\isUserBanned(), ilCtrl\redirectByClass(), ilUtil\sendFailure(), and ilChatroom\subscribeUserToPrivateRoom().

+ Here is the call graph for this function:

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