ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilChatroomKickGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
4 require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
5 
13 {
14 
22  private function buildMessage($messageString, ilChatroomUser $chat_user)
23  {
24  $data = new stdClass();
25 
26  $data->user = $this->gui->object->getPersonalInformation($chat_user);
27  $data->userToKick = $messageString;
28  $data->timestamp = date('c');
29  $data->type = 'kick';
30 
31  return $data;
32  }
33 
38  public function executeDefault($method)
39  {
40  $this->redirectIfNoPermission(array('read', 'moderate'));
41 
42  $room = ilChatroom::byObjectId($this->gui->object->getId());
43  $userToKick = $_REQUEST['user'];
44  $subRoomId = $_REQUEST['sub'];
45 
46  $this->exitIfNoRoomExists($room);
47 
48  $connector = $this->gui->getConnector();
49  $response = $connector->sendKick($room->getRoomId(), $subRoomId, $userToKick);
50 
51  if ($this->isSuccessful($response) && !$subRoomId) {
52  // 2013-09-11: Should already been done by the chat server
53  $room->disconnectUser($userToKick);
54  }
55 
56  $this->sendResponse($response);
57  }
58 
59  public function main()
60  {
61  $room = ilChatroom::byObjectId($this->gui->object->getId());
62  $userToKick = $_REQUEST['user'];
63  $subRoomId = $_REQUEST['sub'];
64 
65  $this->exitIfNoRoomExists($room);
66 
67  $connector = $this->gui->getConnector();
68  $response = $connector->sendKick($room->getRoomId(), $subRoomId, $userToKick);
69 
70  if ($this->isSuccessful($response)) {
71  // 2013-09-11: Should already been done by the chat server
72  $room->disconnectUser($userToKick);
73  }
74 
75  $this->sendResponse($response);
76  }
77 
81  public function sub()
82  {
83  $room = ilChatroom::byObjectId($this->gui->object->getId());
84 
85  if ($room) {
86  if (!$room->isOwnerOfPrivateRoom($this->ilUser->getId(), $_REQUEST['sub'])) {
87  if (!ilChatroom::checkUserPermissions(array('read', 'moderate'), $this->gui->ref_id)) {
88  $this->ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
89  $this->ilCtrl->redirectByClass("ilrepositorygui", "");
90  }
91  }
92 
93  $roomId = $room->getRoomId();
94  $subRoomId = $_REQUEST['sub'];
95  $userToKick = $_REQUEST['user'];
96 
97  if ($room->userIsInPrivateRoom($subRoomId, $userToKick)) {
98  $connector = $this->gui->getConnector();
99  $response = $connector->sendKick($roomId, $subRoomId, $userToKick);
100  $this->sendResponse($response);
101  }
102  }
103  }
104 }
executeDefault($method)
Displays window box to kick a user fetched from $_REQUEST[&#39;user&#39;].
This class provides processing control methods.
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.
sub()
Kicks user from subroom into mainroom.
exitIfNoRoomExists($room)
Checks if a ilChatroom exists.
buildMessage($messageString, ilChatroomUser $chat_user)
Instantiates stdClass, sets $data->user and $data->userToKick using given $messageString and $chat_us...
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
redirectByClass($a_class, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to other gui class using class name.
Class ilChatroomGUIHandler.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
isSuccessful($response)
Checks for success param in an json decoded response.
Create styles array
The data for the language used.
setParameterByClass($a_class, $a_parameter, $a_value)
Same as setParameterByClass, except that a class name is passed.
Class ilChatroomUser.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
Class ilChatroomKickGUI.
$response