ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilChatroomKickTask Class Reference

Class ilChatroomKickTask. More...

+ Inheritance diagram for ilChatroomKickTask:
+ Collaboration diagram for ilChatroomKickTask:

Public Member Functions

 __construct (ilChatroomObjectGUI $gui)
 Constructor. More...
 
 sub ()
 Kicks user from subroom into mainroom. More...
 
 recantInvitation ($subroom_id, $user_id)
 Recant invitation for given $user_id in given $subroom_id. More...
 
- Public Member Functions inherited from ilChatroomTaskHandler
 __construct (ilChatroomObjectGUI $gui)
 
 executeDefault ($requestedMethod)
 

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...
 

Private Attributes

 $gui
 

Detailed Description

Class ilChatroomKickTask.

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

Definition at line 13 of file class.ilChatroomKickTask.php.

Constructor & Destructor Documentation

◆ __construct()

ilChatroomKickTask::__construct ( ilChatroomObjectGUI  $gui)

Constructor.

Sets $this->gui using given $gui.

Parameters
ilChatroomObjectGUI$gui

Reimplemented from ilChatroomTaskHandler.

Definition at line 25 of file class.ilChatroomKickTask.php.

26 {
27 $this->gui = $gui;
28 }

References $gui.

Member Function Documentation

◆ buildMessage()

ilChatroomKickTask::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 117 of file class.ilChatroomKickTask.php.

118 {
119 $data = new stdClass();
120
121 $data->user = $this->gui->object->getPersonalInformation( $chat_user );
122 $data->userToKick = $messageString;
123 $data->timestamp = date( 'c' );
124 $data->type = 'kick';
125
126 return $data;
127 }
$data

References $data.

◆ recantInvitation()

ilChatroomKickTask::recantInvitation (   $subroom_id,
  $user_id 
)

Recant invitation for given $user_id in given $subroom_id.

@global ilDB $ilDB

Parameters
integer$subroom_id
integer$user_id

Definition at line 205 of file class.ilChatroomKickTask.php.

206 {
207 global $ilDB;
208
209 $query = "
210 SELECT proom_id
211 FROM chatroom_proomaccess
212 WHERE proom_id = %s
213 AND user_id = %s
214 ";
215
216 $types = array( 'integer', 'integer' );
217 $values = array( $subroom_id, $user_id );
218
219 $res = $ilDB->queryF( $query, $types, $values );
220
221 if( $row = $ilDB->fetchAssoc( $res ) )
222 {
223 $delete = "
224 DELETE
225 FROM chatroom_proomaccess
226 WHERE proom_id = %s
227 AND user_id = %s
228 ";
229
230 $ilDB->manipulateF( $delete, $types, $values );
231 }
232 }
global $ilDB

References $ilDB, $query, $res, and $row.

Referenced by sub().

+ Here is the caller graph for this function:

◆ sub()

ilChatroomKickTask::sub ( )

Kicks user from subroom into mainroom.

@global ilObjUser $ilUser

Definition at line 134 of file class.ilChatroomKickTask.php.

135 {
136 global $ilUser, $ilCtrl;
137
138 require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
139 require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
140
141 $room = ilChatroom::byObjectId($this->gui->object->getId());
142
143 if($room)
144 {
145 if(!$room->isOwnerOfPrivateRoom($ilUser->getId(), $_REQUEST['sub']))
146 {
147 if(!ilChatroom::checkPermissionsOfUser($ilUser->getId(), array('read', 'moderate'), $this->gui->ref_id))
148 {
149 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
150 $ilCtrl->redirectByClass("ilrepositorygui", "");
151 }
152 }
153
154 $scope = $room->getRoomId();
155 $params = array();
156 $params['user'] = $_REQUEST['user'];
157 $params['sub'] = $_REQUEST['sub'];
158
159 if($room->userIsInPrivateRoom($params['sub'], $params['user']))
160 {
161 $query = http_build_query($params);
162 $connector = $this->gui->getConnector();
163 $response = $connector->leavePrivateRoom($scope, $query);
164 $responseObject = json_decode($response);
165 /*
166 if( $responseObject->success == true && $room->getSetting( 'enable_history' ) )
167 {
168 //$room->addHistoryEntry( $message, $recipient, $publicMessage );
169 }
170 */
171 $room->unsubscribeUserFromPrivateRoom($params['sub'], $params['user']);
172 $this->recantInvitation($params['sub'], $params['user']);
173
174 $message = json_encode(array(
175 'type' => 'userjustkicked',
176 'user' => $params['user'],
177 'sub' => $params['sub']
178 ));
179
180 $connector->sendMessage($room->getRoomId(), $message, array(
181 'public' => 1,
182 'sub' => 0
183 ));
184 }
185 else
186 {
187 $response = json_encode(array(
188 'success' => true,
189 'message' => 'was not in room'
190 ));
191 }
192
193 echo $response;
194 exit;
195 }
196 }
recantInvitation($subroom_id, $user_id)
Recant invitation for given $user_id in given $subroom_id.
static checkPermissionsOfUser($usr_id, $permissions, $ref_id)
Checks user permissions in question for a given user id in relation to a given ref_id.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
$params
Definition: example_049.php:96
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15

References $_REQUEST, $ilCtrl, $ilUser, $params, $query, ilChatroom\byObjectId(), ilChatroom\checkPermissionsOfUser(), exit, and recantInvitation().

+ Here is the call graph for this function:

Field Documentation

◆ $gui

ilChatroomKickTask::$gui
private

Definition at line 16 of file class.ilChatroomKickTask.php.

Referenced by __construct().


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