ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilChatroomInviteUsersToPrivateRoomGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
5require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
6
14{
15
19 public function executeDefault($requestedMethod)
20 {
21 $this->byLogin();
22 }
23
24 public function byLogin()
25 {
26 $this->inviteById(ilObjUser::_lookupId($_REQUEST['user']));
27 }
28
32 private function inviteById($invited_id)
33 {
34 $this->redirectIfNoPermission('read');
35
36 $room = ilChatroom::byObjectId($this->gui->object->getId());
37 $subRoomId = (int) $_REQUEST['sub'];
38 $chat_user = new ilChatroomUser($this->ilUser, $room);
39
40 $this->exitIfNoRoomExists($room);
41 $this->exitIfNoRoomPermission($room, $subRoomId, $chat_user);
42
43 if (!$this->isMainRoom($subRoomId)) {
44 $room->inviteUserToPrivateRoom($invited_id, $subRoomId);
45 }
46
47 $connector = $this->gui->getConnector();
48 $response = $connector->sendInviteToPrivateRoom($room->getRoomId(), $subRoomId, $chat_user->getUserId(), $invited_id);
49
50 $room->sendInvitationNotification($this->gui, $chat_user, $invited_id, $subRoomId);
51
52 $this->sendResponse($response);
53 }
54
58 public function byId()
59 {
60 $this->inviteById($_REQUEST['user']);
61 }
62
66 public function getUserList()
67 {
68 require_once 'Services/User/classes/class.ilUserAutoComplete.php';
69 $auto = new ilUserAutoComplete();
70 $auto->setUser($this->ilUser);
72 if ($this->ilUser->isAnonymous()) {
73 $auto->setSearchType(ilUserAutoComplete::SEARCH_TYPE_EQUALS);
74 }
75
76 if (($_REQUEST['fetchall'])) {
77 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
78 }
79 $auto->setMoreLinkAvailable(true);
80 $auto->setSearchFields(array('firstname', 'lastname'));
81 $auto->setResultField('login');
82 $auto->enableFieldSearchableCheck(true);
83 echo $auto->getList($_REQUEST['q']);
84 exit;
85 }
86}
An exception for terminatinating execution or to throw for unit testing.
Class ilChatroomGUIHandler.
exitIfNoRoomPermission($room, $subRoom, $chat_user)
Check if user can moderate a chatroom.
redirectIfNoPermission($permission)
Checks for requested permissions and redirects if the permission check failed.
sendResponse($response)
Sends a json encoded response and exits the php process.
exitIfNoRoomExists($room)
Checks if a ilChatroom exists.
Class ilChatroomUser.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
static _lookupId($a_user_str)
Lookup id by login.
Auto completion class for user lists.
exit
Definition: login.php:29
$response