ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilChatroomKickTask Class Reference

Class ilChatroomKickTask. More...

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

Public Member Functions

 __construct (ilChatroomObjectGUI $gui)
 Constructor.
 sub ()
 Kicks user from subroom into mainroom.
 recantInvitation ($subroom_id, $user_id)
 Recant invitation for given $user_id in given $subroom_id.
- Public Member Functions inherited from ilChatroomTaskHandler
 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.

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

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.

References $gui.

{
$this->gui = $gui;
}

Member Function Documentation

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.

{
$data = new stdClass();
$data->user = $this->gui->object->getPersonalInformation( $chat_user );
$data->userToKick = $messageString;
$data->timestamp = date( 'c' );
$data->type = 'kick';
return $data;
}
ilChatroomKickTask::recantInvitation (   $subroom_id,
  $user_id 
)

Recant invitation for given $user_id in given $subroom_id.

ilDB $ilDB

Parameters
integer$subroom_id
integer$user_id

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

References $query, $res, and $row.

Referenced by sub().

{
global $ilDB;
$query = "
SELECT proom_id
FROM chatroom_proomaccess
WHERE proom_id = %s
AND user_id = %s
";
$types = array( 'integer', 'integer' );
$values = array( $subroom_id, $user_id );
$res = $ilDB->queryF( $query, $types, $values );
if( $row = $ilDB->fetchAssoc( $res ) )
{
$delete = "
DELETE
FROM chatroom_proomaccess
WHERE proom_id = %s
AND user_id = %s
";
$ilDB->manipulateF( $delete, $types, $values );
}
}

+ Here is the caller graph for this function:

ilChatroomKickTask::sub ( )

Kicks user from subroom into mainroom.

ilObjUser $ilUser

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

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

{
global $ilUser, $ilCtrl;
require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
$room = ilChatroom::byObjectId($this->gui->object->getId());
if($room)
{
if(!$room->isOwnerOfPrivateRoom($ilUser->getId(), $_REQUEST['sub']))
{
if(!ilChatroom::checkPermissionsOfUser($ilUser->getId(), array('read', 'moderate'), $this->gui->ref_id))
{
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
$ilCtrl->redirectByClass("ilrepositorygui", "");
}
}
$scope = $room->getRoomId();
$params = array();
$params['user'] = $_REQUEST['user'];
$params['sub'] = $_REQUEST['sub'];
if($room->userIsInPrivateRoom($params['sub'], $params['user']))
{
$query = http_build_query($params);
$connector = $this->gui->getConnector();
$response = $connector->leavePrivateRoom($scope, $query);
$responseObject = json_decode($response);
/*
if( $responseObject->success == true && $room->getSetting( 'enable_history' ) )
{
//$room->addHistoryEntry( $message, $recipient, $publicMessage );
}
*/
$room->unsubscribeUserFromPrivateRoom($params['sub'], $params['user']);
$this->recantInvitation($params['sub'], $params['user']);
$message = json_encode(array(
'type' => 'userjustkicked',
'user' => $params['user'],
'sub' => $params['sub']
));
$connector->sendMessage($room->getRoomId(), $message, array(
'public' => 1,
'sub' => 0
));
}
else
{
$response = json_encode(array(
'success' => true,
'message' => 'was not in room'
));
}
echo $response;
}
}

+ Here is the call graph for this function:

Field Documentation

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: