ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
- 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.ilChatroomClearTask.php.

Constructor & Destructor Documentation

◆ __construct()

ilChatroomClearTask::__construct ( ilChatroomObjectGUI  $gui)

Constructor.

Sets $this->gui using given $gui.

Parameters
ilChatroomObjectGUI$gui

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

References $gui.

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

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.

References $data.

Referenced by executeDefault().

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  }
+ Here is the caller graph for this function:

◆ executeDefault()

ilChatroomClearTask::executeDefault (   $method)

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

ilObjUser $ilUser

Parameters
string$method

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

References $_REQUEST, $ilCtrl, $ilUser, $query, buildMessage(), ilChatroom\byObjectId(), ilChatroom\checkUserPermissions(), exit, and ilUtil\stripSlashes().

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  }
exit
Definition: login.php:54
global $ilCtrl
Definition: ilias.php:18
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
buildMessage($messageString, ilChatroomUser $chat_user)
Instantiates stdClass, sets $data->user and $data->userToKick using given $messageString and $chat_us...
global $ilUser
Definition: imgupload.php:15
Class ilChatroomUser.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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: