ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilChatroomViewGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
23 
31 {
32  public function joinWithCustomName(): void
33  {
34  $this->redirectIfNoPermission('read');
35 
36  $this->gui->switchToVisibleMode();
37  $this->setupTemplate();
38  $room = ilChatroom::byObjectId($this->gui->getObject()->getId());
39  $chat_user = new ilChatroomUser($this->ilUser, $room);
40  $failure = true;
41  $username = '';
42 
43  if ($this->hasRequestValue('custom_username_radio')) {
44  if (
45  $this->hasRequestValue('custom_username_text') &&
46  $this->getRequestValue('custom_username_radio', $this->refinery->kindlyTo()->string()) === 'custom_username'
47  ) {
48  $username = $this->getRequestValue('custom_username_text', $this->refinery->kindlyTo()->string());
49  $failure = false;
50  } elseif (
51  method_exists(
52  $chat_user,
53  'build' . $this->getRequestValue('custom_username_radio', $this->refinery->kindlyTo()->string())
54  )
55  ) {
56  $username = $chat_user->{
57  'build' . $this->getRequestValue('custom_username_radio', $this->refinery->kindlyTo()->string())
58  }();
59  $failure = false;
60  }
61  }
62 
63  if (!$failure && trim($username) !== '') {
64  if (!$room->isSubscribed($chat_user->getUserId())) {
65  $chat_user->setUsername($chat_user->buildUniqueUsername($username));
66  }
67 
68  $this->showRoom($room, $chat_user);
69  } else {
70  $this->mainTpl->setOnScreenMessage('failure', $this->ilLng->txt('no_username_given'));
71  $this->showNameSelection($chat_user);
72  }
73  }
74 
78  private function setupTemplate(): void
79  {
80  $this->mainTpl->addJavaScript('Modules/Chatroom/js/chat.js');
81  $this->mainTpl->addJavaScript('Modules/Chatroom/js/iliaschat.jquery.js');
82  $this->mainTpl->addJavaScript('node_modules/jquery-outside-events/jquery.ba-outside-events.js');
83  $this->mainTpl->addJavaScript('./Services/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js');
84 
85  $this->mainTpl->addCss('Modules/Chatroom/templates/default/style.css');
86 
87  $this->mainTpl->setPermanentLink($this->gui->getObject()->getType(), $this->gui->getObject()->getRefId());
88  }
89 
95  private function showRoom(ilChatroom $room, ilChatroomUser $chat_user): void
96  {
97  $this->redirectIfNoPermission('read');
98 
99  $user_id = $chat_user->getUserId();
100 
101  $ref_id = $this->getRequestValue('ref_id', $this->refinery->kindlyTo()->int());
102  $this->navigationHistory->addItem(
103  $ref_id,
104  $this->ilCtrl->getLinkTargetByClass(ilRepositoryGUI::class, 'view'),
105  'chtr'
106  );
107 
108  if ($room->isUserBanned($user_id)) {
109  $this->cancelJoin($this->ilLng->txt('banned'));
110  return;
111  }
112 
113  $scope = $room->getRoomId();
114  $connector = $this->gui->getConnector();
115  $response = $connector->connect($scope, $user_id);
116 
117  if (!$response) {
118  $this->mainTpl->setOnScreenMessage('failure', $this->ilLng->txt('unable_to_connect'), true);
119  $this->ilCtrl->redirectByClass(ilInfoScreenGUI::class, 'info');
120  }
121 
122  if (!$room->isSubscribed($chat_user->getUserId())) {
123  $room->connectUser($chat_user);
124  }
125 
126  $subScope = 0;
127  $response = $connector->sendEnterPrivateRoom($scope, $subScope, $user_id);
128  if (!$response) {
129  $this->mainTpl->setOnScreenMessage('failure', $this->ilLng->txt('unable_to_connect'), true);
130  $this->ilCtrl->redirectByClass('ilinfoscreengui', 'info');
131  }
132 
133  $settings = $connector->getSettings();
134  $known_private_room = $room->getActivePrivateRooms($this->ilUser->getId());
135 
136  $initial = new stdClass();
137  $initial->users = $room->getConnectedUsers();
138  $initial->private_rooms = array_values($known_private_room);
139  $initial->redirect_url = $this->ilCtrl->getLinkTarget($this->gui, 'view-lostConnection', '', false);
140  $initial->profile_image_url = $this->ilCtrl->getLinkTarget($this->gui, 'view-getUserProfileImages', '', true);
141  $initial->no_profile_image_url = ilUtil::getImagePath('no_photo_xxsmall.jpg');
142  $initial->private_rooms_enabled = (bool) $room->getSetting('private_rooms_enabled');
143  $initial->subdirectory = $settings->getSubDirectory();
144 
145  $initial->userinfo = [
146  'moderator' => ilChatroom::checkUserPermissions('moderate', $ref_id, false),
147  'id' => $chat_user->getUserId(),
148  'login' => $chat_user->getUsername(),
149  'broadcast_typing' => $chat_user->enabledBroadcastTyping(),
150  ];
151 
152  $smileys = [];
153 
154  if ($settings->getSmiliesEnabled()) {
155  $smileys_array = ilChatroomSmilies::_getSmilies();
156  foreach ($smileys_array as $smiley_array) {
157  $new_keys = [];
158  $new_val = '';
159  foreach ($smiley_array as $key => $value) {
160  if ($key === 'smiley_keywords') {
161  $new_keys = explode("\n", $value);
162  }
163 
164  if ($key === 'smiley_fullpath') {
165  $new_val = $value;
166  }
167  }
168 
169  if (!$new_keys || !$new_val) {
170  continue;
171  }
172 
173  foreach ($new_keys as $new_key) {
174  $smileys[$new_key] = $new_val;
175  }
176  }
177 
178  $initial->smileys = $smileys;
179  } else {
180  $initial->smileys = '{}';
181  }
182 
183  $initial->messages = [];
184 
185  $sub = null;
186  if ($this->hasRequestValue('sub')) {
187  $sub = $this->getRequestValue('sub', $this->refinery->kindlyTo()->int());
188  }
189 
190  if ($sub !== null) {
191  if ($known_private_room[$sub]) {
192  if (!$room->isAllowedToEnterPrivateRoom($chat_user->getUserId(), $sub)) {
193  $initial->messages[] = [
194  'type' => 'error',
195  'message' => $this->ilLng->txt('not_allowed_to_enter'),
196  ];
197  } else {
198  $scope = $room->getRoomId();
199  $params = [];
200  $params['user'] = $chat_user->getUserId();
201  $params['sub'] = $sub;
202 
203  $params['message'] = json_encode([
204  'type' => 'private_room_entered',
205  'user' => $user_id
206  ], JSON_THROW_ON_ERROR);
207 
208  $connector = $this->gui->getConnector();
209  $response = $connector->sendEnterPrivateRoom($scope, $sub, $chat_user->getUserId());
210 
211  if ($this->isSuccessful($response)) {
212  $room->subscribeUserToPrivateRoom($params['sub'], $params['user']);
213  }
214 
215  $initial->enter_room = $sub;
216  }
217  } else {
218  $initial->messages[] = [
219  'type' => 'error',
220  'message' => $this->ilLng->txt('user_invited'),
221  ];
222  }
223  }
224 
225  if ((int) $room->getSetting('display_past_msgs')) {
226  $initial->messages = array_merge(
227  $initial->messages,
228  array_reverse($room->getLastMessages($room->getSetting('display_past_msgs'), $chat_user))
229  );
230  }
231 
232  $roomTpl = new ilTemplate('tpl.chatroom.html', true, true, 'Modules/Chatroom');
233  $roomTpl->setVariable('BASEURL', $settings->generateClientUrl());
234  $roomTpl->setVariable('INSTANCE', $settings->getInstance());
235  $roomTpl->setVariable('SCOPE', $scope);
236  $roomTpl->setVariable('POSTURL', $this->ilCtrl->getLinkTarget($this->gui, 'postMessage', '', true));
237 
238  $roomTpl->setVariable('ACTIONS', $this->ilLng->txt('actions'));
239  $roomTpl->setVariable('LBL_CREATE_PRIVATE_ROOM', $this->ilLng->txt('create_private_room_label'));
240  $roomTpl->setVariable('LBL_USER', $this->ilLng->txt('user'));
241  $roomTpl->setVariable('LBL_USER_TEXT', $this->ilLng->txt('invite_username'));
242  $showAutoMessages = true;
243  if ($this->ilUser->getPref('chat_hide_automsg_' . $room->getRoomId())) {
244  $showAutoMessages = false;
245  }
246 
247  $roomTpl->setVariable(
248  'TOGGLE_SCROLLING_COMPONENT',
249  $this->uiRenderer->render(
250  $this->uiFactory->button()->toggle(
251  $this->ilLng->txt('auto_scroll'),
252  '#',
253  '#',
254  true
255  )
256  ->withAriaLabel($this->ilLng->txt('auto_scroll'))
257  ->withOnLoadCode(static function (string $id): string {
258  return '
259  $("#' . $id . '")
260  .on("click", function(e) {
261  let t = $(this), msg = $("#chat_messages");
262  if (t.hasClass("on")) {
263  msg.trigger("msg-scrolling:toggle", [true]);
264  } else {
265  msg.trigger("msg-scrolling:toggle", [false]);
266  }
267  });
268  ';
269  })
270  )
271  );
272 
273  $toggleUrl = $this->ilCtrl->getFormAction($this->gui, 'view-toggleAutoMessageDisplayState', '', true, false);
274  $roomTpl->setVariable(
275  'TOGGLE_AUTO_MESSAGE_COMPONENT',
276  $this->uiRenderer->render(
277  $this->uiFactory->button()->toggle(
278  $this->ilLng->txt('chat_show_auto_messages'),
279  '#',
280  '#',
281  $showAutoMessages
282  )
283  ->withAriaLabel($this->ilLng->txt('chat_show_auto_messages'))
284  ->withOnLoadCode(static function (string $id) use ($toggleUrl): string {
285  return '
286  $("#' . $id . '")
287  .on("click", function(e) {
288  let t = $(this), msg = $("#chat_messages");
289  if (t.hasClass("on")) {
290  msg.trigger("auto-message:toggle", [true, "' . $toggleUrl . '"]);
291  } else {
292  msg.trigger("auto-message:toggle", [false, "' . $toggleUrl . '"]);
293  }
294  });
295  ';
296  })
297  )
298  );
299 
300  $initial->state = new stdClass();
301  $initial->state->scrolling = true;
302  $initial->state->show_auto_msg = $showAutoMessages;
303 
304  $roomTpl->setVariable('INITIAL_DATA', json_encode($initial, JSON_THROW_ON_ERROR));
305  $roomTpl->setVariable('INITIAL_USERS', json_encode($room->getConnectedUsers(), JSON_THROW_ON_ERROR));
306 
307  $this->renderSendMessageBox($roomTpl);
308  $this->renderLanguageVariables($roomTpl);
309 
311 
312  $roomRightTpl = new ilTemplate('tpl.chatroom_right.html', true, true, 'Modules/Chatroom');
313  $this->renderRightUsersBlock($roomRightTpl);
314 
315  $right_content_panel = ilPanelGUI::getInstance();
316  $right_content_panel->setHeading($this->ilLng->txt('users'));
317  $right_content_panel->setPanelStyle(ilPanelGUI::PANEL_STYLE_SECONDARY);
318  $right_content_panel->setHeadingStyle(ilPanelGUI::HEADING_STYLE_BLOCK);
319  $right_content_panel->setBody($roomRightTpl->get());
320 
321  $this->mainTpl->setContent($roomTpl->get());
322  $this->mainTpl->setRightContent($right_content_panel->getHTML());
323  }
324 
325  public function toggleAutoMessageDisplayState(): void
326  {
327  $this->redirectIfNoPermission('read');
328 
329  $room = ilChatroom::byObjectId($this->gui->getObject()->getId());
330 
331  $state = 0;
332  if ($this->http->wrapper()->post()->has('state')) {
333  $state = $this->http->wrapper()->post()->retrieve('state', $this->refinery->kindlyTo()->int());
334  }
335 
337  $this->ilUser->getId(),
338  'chat_hide_automsg_' . $room->getRoomId(),
339  (string) ((int) (!(bool) $state))
340  );
341 
342  $this->http->saveResponse(
343  $this->http->response()
344  ->withHeader(ResponseHeader::CONTENT_TYPE, 'application/json')
345  ->withBody(Streams::ofString(json_encode(['success' => true], JSON_THROW_ON_ERROR)))
346  );
347  $this->http->sendResponse();
348  $this->http->close();
349  }
350 
355  private function cancelJoin(string $message): void
356  {
357  $this->mainTpl->setOnScreenMessage('failure', $message);
358  }
359 
360  protected function renderSendMessageBox(ilTemplate $roomTpl): void
361  {
362  $roomTpl->setVariable('LBL_MESSAGE', $this->ilLng->txt('chat_message'));
363  $roomTpl->setVariable('LBL_TOALL', $this->ilLng->txt('chat_message_to_all'));
364  $roomTpl->setVariable('LBL_OPTIONS', $this->ilLng->txt('chat_message_options'));
365  $roomTpl->setVariable('LBL_DISPLAY', $this->ilLng->txt('chat_message_display'));
366  $roomTpl->setVariable('LBL_SEND', $this->ilLng->txt('send'));
367  }
368 
369  protected function renderLanguageVariables(ilTemplate $roomTpl): void
370  {
371  $js_translations = [
372  'LBL_MAINROOM' => 'chat_mainroom',
373  'LBL_LEAVE_PRIVATE_ROOM' => 'leave_private_room',
374  'LBL_LEFT_PRIVATE_ROOM' => 'left_private_room',
375  'LBL_JOIN' => 'chat_join',
376  'LBL_DELETE_PRIVATE_ROOM' => 'delete_private_room',
377  'LBL_DELETE_PRIVATE_ROOM_QUESTION' => 'delete_private_room_question',
378  'LBL_INVITE_TO_PRIVATE_ROOM' => 'invite_to_private_room',
379  'LBL_KICK' => 'chat_kick',
380  'LBL_BAN' => 'chat_ban',
381  'LBL_KICK_QUESTION' => 'kick_question',
382  'LBL_BAN_QUESTION' => 'ban_question',
383  'LBL_ADDRESS' => 'chat_address',
384  'LBL_WHISPER' => 'chat_whisper',
385  'LBL_CONNECT' => 'chat_connection_established',
386  'LBL_DISCONNECT' => 'chat_connection_disconnected',
387  'LBL_TO_MAINROOM' => 'chat_to_mainroom',
388  'LBL_CREATE_PRIVATE_ROOM_JS' => 'chat_create_private_room_button',
389  'LBL_WELCOME_TO_CHAT' => 'welcome_to_chat',
390  'LBL_USER_INVITED' => 'user_invited',
391  'LBL_USER_KICKED' => 'user_kicked',
392  'LBL_USER_INVITED_SELF' => 'user_invited_self',
393  'LBL_PRIVATE_ROOM_CLOSED' => 'private_room_closed',
394  'LBL_PRIVATE_ROOM_ENTERED' => 'private_room_entered',
395  'LBL_PRIVATE_ROOM_LEFT' => 'private_room_left',
396  'LBL_PRIVATE_ROOM_ENTERED_USER' => 'private_room_entered_user',
397  'LBL_KICKED_FROM_PRIVATE_ROOM' => 'kicked_from_private_room',
398  'LBL_OK' => 'ok',
399  'LBL_INVITE' => 'chat_invite',
400  'LBL_CANCEL' => 'cancel',
401  'LBL_WHISPER_TO' => 'whisper_to',
402  'LBL_SPEAK_TO' => 'speak_to',
403  'LBL_HISTORY_CLEARED' => 'history_cleared',
404  'LBL_CLEAR_ROOM_HISTORY' => 'clear_room_history',
405  'LBL_CLEAR_ROOM_HISTORY_QUESTION' => 'clear_room_history_question',
406  'LBL_END_WHISPER' => 'end_whisper',
407  'LBL_TIMEFORMAT' => 'lang_timeformat_no_sec',
408  'LBL_DATEFORMAT' => 'lang_dateformat'
409  ];
410  foreach ($js_translations as $placeholder => $lng_variable) {
411  $roomTpl->setVariable($placeholder, json_encode($this->ilLng->txt($lng_variable), JSON_THROW_ON_ERROR));
412  }
413  $this->ilLng->toJSMap([
414  'chat_user_x_is_typing' => $this->ilLng->txt('chat_user_x_is_typing'),
415  'chat_users_are_typing' => $this->ilLng->txt('chat_users_are_typing'),
416  ]);
417 
418  $roomTpl->setVariable('LBL_CREATE_PRIVATE_ROOM', $this->ilLng->txt('chat_create_private_room_button'));
419  $roomTpl->setVariable('LBL_CREATE_PRIVATE_ROOM_TEXT', $this->ilLng->txt('create_private_room_text'));
420  $roomTpl->setVariable('LBL_LAYOUT', $this->ilLng->txt('layout'));
421  $roomTpl->setVariable('LBL_SHOW_SETTINGS', $this->ilLng->txt('show_settings'));
422  $roomTpl->setVariable('LBL_USER_IN_ROOM', $this->ilLng->txt('user_in_room'));
423  $roomTpl->setVariable('LBL_USER_IN_ILIAS', $this->ilLng->txt('user_in_ilias'));
424  }
425 
426  protected function renderRightUsersBlock(ilTemplate $roomTpl): void
427  {
428  $roomTpl->setVariable('LBL_NO_FURTHER_USERS', $this->ilLng->txt('no_further_users'));
429  }
430 
431  private function showNameSelection(ilChatroomUser $chat_user): void
432  {
433  $name_options = $chat_user->getChatNameSuggestions();
434  $formFactory = new ilChatroomFormFactory();
435  $selectionForm = $formFactory->getUserChatNameSelectionForm($name_options);
436 
437  $this->ilCtrl->saveParameter($this->gui, 'sub');
438 
439  $selectionForm->addCommandButton('view-joinWithCustomName', $this->ilLng->txt('enter'));
440  $selectionForm->setFormAction(
441  $this->ilCtrl->getFormAction($this->gui, 'view-joinWithCustomName')
442  );
443 
444  $this->mainTpl->setVariable('ADM_CONTENT', $selectionForm->getHTML());
445  }
446 
453  public function executeDefault(string $requestedMethod): void
454  {
455  $this->redirectIfNoPermission('read');
456 
457  $this->gui->switchToVisibleMode();
458  $this->setupTemplate();
459 
460  $chatSettings = new ilSetting('chatroom');
461  if (!$chatSettings->get('chat_enabled', '0')) {
462  $this->ilCtrl->redirect($this->gui, 'settings-general');
463  }
464 
465  $room = ilChatroom::byObjectId($this->gui->getObject()->getId());
466 
467  if (!$room->getSetting('allow_anonymous') && $this->ilUser->isAnonymous()) {
468  $this->cancelJoin($this->ilLng->txt('chat_anonymous_not_allowed'));
469  return;
470  }
471 
472  $chat_user = new ilChatroomUser($this->ilUser, $room);
473 
474  if ($room->getSetting('allow_custom_usernames')) {
475  if ($room->isSubscribed($chat_user->getUserId())) {
476  $chat_user->setUsername($chat_user->getUsername());
477  $this->showRoom($room, $chat_user);
478  } else {
479  $this->showNameSelection($chat_user);
480  }
481  } else {
482  $chat_user->setUsername($this->ilUser->getLogin());
483  $this->showRoom($room, $chat_user);
484  }
485  }
486 
487  public function invitePD(): void
488  {
489  $chatSettings = new ilSetting('chatroom');
490  if (!$chatSettings->get('chat_enabled', '0')) {
491  $this->ilCtrl->redirect($this->gui, 'settings-general');
492  }
493 
494  $room = ilChatroom::byObjectId($this->gui->getObject()->getId());
495  $chat_user = new ilChatroomUser($this->ilUser, $room);
496 
497  $user_id = $this->getRequestValue('usr_id', $this->refinery->kindlyTo()->int());
498 
499  $connector = $this->gui->getConnector();
500  $title = $room->getUniquePrivateRoomTitle($chat_user->buildLogin());
501  $subRoomId = $room->addPrivateRoom($title, $chat_user, ['public' => false]);
502 
503  $room->inviteUserToPrivateRoom($user_id, $subRoomId);
504  $connector->sendCreatePrivateRoom($room->getRoomId(), $subRoomId, $chat_user->getUserId(), $title);
505  $connector->sendInviteToPrivateRoom($room->getRoomId(), $subRoomId, $chat_user->getUserId(), $user_id);
506 
507  $room->sendInvitationNotification($this->gui, $chat_user, $user_id, $subRoomId);
508 
509  ilSession::set('show_invitation_message', $user_id);
510 
511  $this->ilCtrl->setParameter($this->gui, 'sub', $subRoomId);
512  $this->ilCtrl->redirect($this->gui, 'view');
513  }
514 
515  public function logout(): void
516  {
517  $pid = $this->tree->getParentId($this->gui->getRefId());
518  $this->ilCtrl->setParameterByClass(ilRepositoryGUI::class, 'ref_id', $pid);
519  $this->ilCtrl->redirectByClass(ilRepositoryGUI::class);
520  }
521 
522  public function lostConnection(): void
523  {
524  if ($this->http->wrapper()->query()->has('msg')) {
525  switch ($this->http->wrapper()->query()->retrieve('msg', $this->refinery->kindlyTo()->string())) {
526  case 'kicked':
527  $this->mainTpl->setOnScreenMessage('failure', $this->ilLng->txt('kicked'), true);
528  break;
529 
530  case 'banned':
531  $this->mainTpl->setOnScreenMessage('failure', $this->ilLng->txt('banned'), true);
532  break;
533 
534  default:
535  $this->mainTpl->setOnScreenMessage('failure', $this->ilLng->txt('lost_connection'), true);
536  break;
537  }
538  } else {
539  $this->mainTpl->setOnScreenMessage('failure', $this->ilLng->txt('lost_connection'), true);
540  }
541 
542  $this->ilCtrl->redirectByClass(ilInfoScreenGUI::class, 'info');
543  }
544 
545  public function getUserProfileImages(): void
546  {
547  global $DIC;
548 
549  $response = [];
550 
551  $usr_ids = null;
552  if ($this->hasRequestValue('usr_ids')) {
553  $usr_ids = $this->getRequestValue('usr_ids', $this->refinery->kindlyTo()->string());
554  }
555  if (null === $usr_ids || '' === $usr_ids) {
556  $this->sendResponse($response);
557  }
558 
559  $this->ilLng->loadLanguageModule('user');
560 
562 
563  $user_ids = array_filter(array_map('intval', array_map('trim', explode(',', $usr_ids))));
564 
565  $room = ilChatroom::byObjectId($this->gui->getObject()->getId());
566  $chatRoomUserDetails = ilChatroomUser::getUserInformation($user_ids, $room->getRoomId());
567  $chatRoomUserDetailsByUsrId = array_combine(
568  array_map(
569  static function (stdClass $userData): int {
570  return (int) $userData->id;
571  },
572  $chatRoomUserDetails
573  ),
574  $chatRoomUserDetails
575  );
576 
577  $public_data = ilUserUtil::getNamePresentation($user_ids, true, false, '', false, true, false, true);
578  $public_names = ilUserUtil::getNamePresentation($user_ids, false, false, '', false, true, false, false);
579 
580  foreach ($user_ids as $usr_id) {
581  if (!array_key_exists($usr_id, $chatRoomUserDetailsByUsrId)) {
582  continue;
583  }
584 
585  if ($room->getSetting('allow_custom_usernames')) {
587  $avatar = $DIC["user.avatar.factory"]->avatar('xsmall');
588  $avatar->setUsrId(ANONYMOUS_USER_ID);
589  $avatar->setName(ilStr::subStr($chatRoomUserDetailsByUsrId[$usr_id]->login, 0, 2));
590 
591  $public_name = $chatRoomUserDetailsByUsrId[$usr_id]->login;
592  $public_image = $avatar->getUrl();
593  } else {
594  $public_image = $public_data[$usr_id]['img'] ?? '';
595  $public_name = '';
596  if (isset($public_names[$usr_id])) {
597  $public_name = $public_names[$usr_id];
598  if (isset($public_data[$usr_id]['login']) && 'unknown' === $public_name) {
599  $public_name = $public_data[$usr_id]['login'];
600  }
601  }
602  }
603 
604  $response[$usr_id] = [
605  'public_name' => $public_name,
606  'profile_image' => $public_image,
607  ];
608  }
609 
610  $this->sendResponse($response);
611  }
612 }
static checkUserPermissions($permissions, int $ref_id, bool $send_info=true)
Checks user permissions by given array and ref_id.
getSetting(string $name)
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
getUserId()
Returns Ilias User ID.
$scope
Definition: ltiregstart.php:53
const ANONYMOUS_USER_ID
Definition: constants.php:27
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
renderLanguageVariables(ilTemplate $roomTpl)
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
redirectIfNoPermission($permission)
Checks for requested permissions and redirects if the permission check failed.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Class ilChatroomViewGUI.
static initJS(ilGlobalTemplateInterface $a_main_tpl=null)
getRequestValue(string $key, Transformation $trafo, $default=null)
getLastMessages(int $number, ilChatroomUser $chatuser)
renderSendMessageBox(ilTemplate $roomTpl)
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Definition: class.ilStr.php:24
getConnectedUsers(bool $only_data=true)
static getUserInformation(array $usrIds, ?int $roomId=null)
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
Class ilChatroomFormFactory.
global $DIC
Definition: feed.php:28
cancelJoin(string $message)
Calls ilUtil::sendFailure method using given $message as parameter.
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:67
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
Class ilChatroomGUIHandler.
setupTemplate()
Adds CSS and JavaScript files that should be included in the header.
isSubscribed(int $chat_userid)
string $key
Consumer key/client ID value.
Definition: System.php:193
isUserBanned(int $user_id)
showRoom(ilChatroom $room, ilChatroomUser $chat_user)
Prepares and displays chatroom and connects user to it.
isSuccessful($response)
Checks for success param in an json decoded response.
connectUser(ilChatroomUser $user)
isAllowedToEnterPrivateRoom(int $chat_userid, int $proom_id)
Class ilChatroom.
getChatNameSuggestions()
Returns an array of chat-name suggestions.
static getInstance()
executeDefault(string $requestedMethod)
Chatroom and Chatuser get prepared before $this->showRoom method is called.
sendResponse($response, bool $isJson=false)
Sends a json encoded response and exits the php process.
Class ilChatroomUser.
static byObjectId(int $object_id)
showNameSelection(ilChatroomUser $chat_user)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static _writePref(int $a_usr_id, string $a_keyword, string $a_value)
const PANEL_STYLE_SECONDARY
$message
Definition: xapiexit.php:32
getUsername()
Returns username from Object or SESSION.
const HEADING_STYLE_BLOCK
subscribeUserToPrivateRoom(int $room_id, int $user_id)
$response
renderRightUsersBlock(ilTemplate $roomTpl)
static set(string $a_var, $a_val)
Set a value.
getActivePrivateRooms(int $userid)