ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 @global ilObjUser $ilUser. 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
 
 $rbacsystem
 

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.

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 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())

References $data, and date.

◆ executeDefault()

ilChatroomKickGUI::executeDefault (   $method)

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

@global ilObjUser $ilUser

Parameters
string$method

Reimplemented from ilChatroomGUIHandler.

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

40 {
41 $this->redirectIfNoPermission(array('read', 'moderate'));
42
43 $room = ilChatroom::byObjectId($this->gui->object->getId());
44 $userToKick = $_REQUEST['user'];
45 $subRoomId = $_REQUEST['sub'];
46
47 $this->exitIfNoRoomExists($room);
48
49 $connector = $this->gui->getConnector();
50 $response = $connector->sendKick($room->getRoomId(), $subRoomId, $userToKick);
51
52 if($this->isSuccessful($response) && !$subRoomId)
53 {
54 // 2013-09-11: Should already been done by the chat server
55 $room->disconnectUser($userToKick);
56 }
57
58 $this->sendResponse($response);
59 }
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.

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

+ Here is the call graph for this function:

◆ main()

ilChatroomKickGUI::main ( )

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

62 {
63 $room = ilChatroom::byObjectId($this->gui->object->getId());
64 $userToKick = $_REQUEST['user'];
65 $subRoomId = $_REQUEST['sub'];
66
67 $this->exitIfNoRoomExists($room);
68
69 $connector = $this->gui->getConnector();
70 $response = $connector->sendKick($room->getRoomId(), $subRoomId, $userToKick);
71
72 if($this->isSuccessful($response))
73 {
74 // 2013-09-11: Should already been done by the chat server
75 $room->disconnectUser($userToKick);
76 }
77
78 $this->sendResponse($response);
79 }

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

+ Here is the call graph for this function:

◆ sub()

ilChatroomKickGUI::sub ( )

Kicks user from subroom into mainroom @global ilObjUser $ilUser.

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

86 {
87 global $ilUser, $ilCtrl;
88
89 $room = ilChatroom::byObjectId($this->gui->object->getId());
90
91 if($room)
92 {
93 if(!$room->isOwnerOfPrivateRoom($ilUser->getId(), $_REQUEST['sub']))
94 {
95 if(!ilChatroom::checkPermissionsOfUser($ilUser->getId(), array('read', 'moderate'), $this->gui->ref_id))
96 {
97 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
98 $ilCtrl->redirectByClass("ilrepositorygui", "");
99 }
100 }
101
102 $roomId = $room->getRoomId();
103 $subRoomId = $_REQUEST['sub'];
104 $userToKick = $_REQUEST['user'];
105
106 if($room->userIsInPrivateRoom($subRoomId, $userToKick))
107 {
108 $connector = $this->gui->getConnector();
109 $response = $connector->sendKick($roomId, $subRoomId, $userToKick);
110 $this->sendResponse($response);
111 }
112
113 /*
114 if( $responseObject->success == true && $room->getSetting( 'enable_history' ) )
115 {
116 //$room->addHistoryEntry( $message, $recipient, $publicMessage );
117 }
118
119
120
121 $message = json_encode(array(
122 'type' => 'userjustkicked',
123 'user' => $params['user'],
124 'sub' => $params['sub']
125 ));
126
127 $connector->sendMessage($room->getRoomId(), $message, array(
128 'public' => 1,
129 'sub' => 0
130 ));
131 }
132 else
133 {
134 $response = json_encode(array(
135 'success' => true,
136 'message' => 'was not in room'
137 ));
138 }
139
140 echo $response;
141 exit;*/
142 }
143 }
static checkPermissionsOfUser($usr_id, $permissions, $ref_id)
Checks user permissions in question for a given user id in relation to a given ref_id.

References ilChatroomGUIHandler\$ilCtrl, ilChatroomGUIHandler\$ilUser, ilChatroom\byObjectId(), ilChatroom\checkPermissionsOfUser(), and ilChatroomGUIHandler\sendResponse().

+ Here is the call graph for this function:

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