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

Class ilChatroomKickGUI. More...

+ Inheritance diagram for ilChatroomKickGUI:
+ Collaboration diagram for ilChatroomKickGUI:

Public Member Functions

 executeDefault ($method)
 Displays window box to kick a user fetched from $_REQUEST['user']. More...
 
 main ()
 
 sub ()
 Kicks user from subroom into mainroom. More...
 
- 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...
 

Private Member Functions

 buildMessage ($messageString, ilChatroomUser $chat_user)
 Instantiates stdClass, sets $data->user and $data->userToKick using given $messageString and $chat_user and returns $data. More...
 

Additional Inherited Members

- 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 inherited from ilChatroomGUIHandler
 $gui
 
 $ilUser
 
 $ilCtrl
 
 $ilLng
 
 $webDirectory
 
 $upload
 
 $rbacsystem
 
 $mainTpl
 
 $ilias
 
 $navigationHistory
 
 $tree
 
 $tabs
 

Detailed Description

Class ilChatroomKickGUI.

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

Definition at line 12 of file class.ilChatroomKickGUI.php.

Member Function Documentation

◆ buildMessage()

ilChatroomKickGUI::buildMessage (   $messageString,
ilChatroomUser  $chat_user 
)
private

Instantiates stdClass, sets $data->user and $data->userToKick using given $messageString and $chat_user and returns $data.

Parameters
string$messageString
ilChatroomUser$chat_user
Returns
stdClass

Definition at line 22 of file class.ilChatroomKickGUI.php.

References $data.

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  }
$data
Definition: bench.php:6

◆ executeDefault()

ilChatroomKickGUI::executeDefault (   $method)

Displays window box to kick a user fetched from $_REQUEST['user'].

Definition at line 38 of file class.ilChatroomKickGUI.php.

References $response, ilChatroom\byObjectId(), ilChatroomGUIHandler\exitIfNoRoomExists(), ilChatroomGUIHandler\isSuccessful(), ilChatroomGUIHandler\redirectIfNoPermission(), and ilChatroomGUIHandler\sendResponse().

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  }
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.
isSuccessful($response)
Checks for success param in an json decoded response.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
$response
+ Here is the call graph for this function:

◆ main()

ilChatroomKickGUI::main ( )

Definition at line 59 of file class.ilChatroomKickGUI.php.

References $response, ilChatroom\byObjectId(), ilChatroomGUIHandler\exitIfNoRoomExists(), ilChatroomGUIHandler\isSuccessful(), and ilChatroomGUIHandler\sendResponse().

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  }
sendResponse($response)
Sends a json encoded response and exits the php process.
exitIfNoRoomExists($room)
Checks if a ilChatroom exists.
isSuccessful($response)
Checks for success param in an json decoded response.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
$response
+ Here is the call graph for this function:

◆ sub()

ilChatroomKickGUI::sub ( )

Kicks user from subroom into mainroom.

Definition at line 81 of file class.ilChatroomKickGUI.php.

References $response, ilChatroom\byObjectId(), ilChatroom\checkUserPermissions(), ilCtrl\redirectByClass(), ilChatroomGUIHandler\sendResponse(), and ilCtrl\setParameterByClass().

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  }
This class provides processing control methods.
sendResponse($response)
Sends a json encoded response and exits the php process.
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.
setParameterByClass($a_class, $a_parameter, $a_value)
Same as setParameterByClass, except that a class name is passed.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
$response
+ Here is the call graph for this function:

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