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

Class ilChatroomKickTask. More...

+ Inheritance diagram for ilChatroomClearTask:
+ Collaboration diagram for ilChatroomClearTask:

Public Member Functions

 __construct (ilChatroomObjectGUI $gui)
 Constructor. More...
 
 executeDefault ($method)
 Displays window box to kick a user fetched from $_REQUEST['user']. More...
 
 __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.ilChatroomClearTask.php.

Constructor & Destructor Documentation

◆ __construct()

ilChatroomClearTask::__construct ( ilChatroomObjectGUI  $gui)

Constructor.

Sets $this->gui using given $gui.

Parameters
ilChatroomObjectGUI$gui

Reimplemented from ilChatroomTaskHandler.

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

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

References $gui.

Member Function Documentation

◆ buildMessage()

ilChatroomClearTask::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 93 of file class.ilChatroomClearTask.php.

94 {
95 $data = new stdClass();
96
97 $data->user = $this->gui->object->getPersonalInformation( $chat_user );
98 $data->timestamp = date( 'c' );
99 $data->type = 'clear';
100 $data->sub = $messageString;
101
102 return $data;
103 }
$data

References $data.

Referenced by executeDefault().

+ Here is the caller graph for this function:

◆ executeDefault()

ilChatroomClearTask::executeDefault (   $method)

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

@global ilObjUser $ilUser

Parameters
string$method

Reimplemented from ilChatroomTaskHandler.

Definition at line 36 of file class.ilChatroomClearTask.php.

37 {
38 global $ilUser, $ilCtrl;
39
40 require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
41 require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
42
43 if ( !ilChatroom::checkUserPermissions( array('moderate') , $this->gui->ref_id ) )
44 {
45 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
46 $ilCtrl->redirectByClass("ilrepositorygui", "");
47 }
48
49 $room = ilChatroom::byObjectId( $this->gui->object->getId() );
50
51 if( $room )
52 {
53 // if user is in scope
54 $scope = $room->getRoomId();
55
56 $chat_user = new ilChatroomUser( $ilUser, $room );
57
58 $message = json_encode( $this->buildMessage(
59 ilUtil::stripSlashes( (int)$_REQUEST['sub'] ), $chat_user
60 ) );
61
62 $params = array(
63 'message' => $message,
64 );
65
66 $query = http_build_query( $params );
67 $connector = $this->gui->getConnector();
68 $response = $connector->post( $scope, $query );
69 $responseObject = json_decode( $response );
70
71 $room->clearMessages($_REQUEST['sub']);
72 }
73 else
74 {
75 $response = json_encode( array(
76 'success' => false,
77 'reason' => 'unkown room'
78 ) );
79 }
80
81 echo $response;
82 exit;
83 }
buildMessage($messageString, ilChatroomUser $chat_user)
Instantiates stdClass, sets $data->user and $data->userToKick using given $messageString and $chat_us...
Class ilChatroomUser.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$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, buildMessage(), ilChatroom\byObjectId(), ilChatroom\checkUserPermissions(), exit, and ilUtil\stripSlashes().

+ Here is the call graph for this function:

Field Documentation

◆ $gui

ilChatroomClearTask::$gui
private

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

Referenced by __construct().


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