ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilChatroomBanGUI Class Reference

Class ilChatroomBanGUI. More...

+ Inheritance diagram for ilChatroomBanGUI:
+ Collaboration diagram for ilChatroomBanGUI:

Public Member Functions

 delete ()
 Unbans users fetched from $_REQUEST['banned_user_id']. More...
 
 executeDefault ($method)
 {
Parameters
string$requestedMethod
Returns
mixed
} More...
 
 show ()
 Displays banned users task. More...
 
 active ()
 Kicks and bans user, fetched from $_REQUEST['user'] and adds history entry. 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...
 

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
 
 $webDirectory
 
 $upload
 

Detailed Description

Class ilChatroomBanGUI.

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

Member Function Documentation

◆ active()

ilChatroomBanGUI::active ( )

Kicks and bans user, fetched from $_REQUEST['user'] and adds history entry.

Definition at line 88 of file class.ilChatroomBanGUI.php.

89 {
90 $this->redirectIfNoPermission(array('read', 'moderate'));
91
92 $room = ilChatroom::byObjectId($this->gui->object->getId());
93 $subRoomId = $_REQUEST['sub'];
94 $userToBan = $_REQUEST['user'];
95
96 $this->exitIfNoRoomExists($room);
97
98 $connector = $this->gui->getConnector();
99 $response = $connector->sendBan($room->getRoomId(), $subRoomId, $userToBan); // @TODO Respect Scope
100
101 if ($this->isSuccessful($response)) {
102 $room->banUser($_REQUEST['user'], $GLOBALS['DIC']->user()->getId());
103 $room->disconnectUser($_REQUEST['user']);
104 }
105
106 $this->sendResponse($response);
107 }
user()
Definition: user.php:4
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$response

References $GLOBALS, $response, ilChatroom\byObjectId(), ilChatroomGUIHandler\exitIfNoRoomExists(), ilChatroomGUIHandler\isSuccessful(), ilChatroomGUIHandler\redirectIfNoPermission(), ilChatroomGUIHandler\sendResponse(), and user().

+ Here is the call graph for this function:

◆ delete()

ilChatroomBanGUI::delete ( )

Unbans users fetched from $_REQUEST['banned_user_id'].

Definition at line 18 of file class.ilChatroomBanGUI.php.

19 {
20 $users = $_REQUEST['banned_user_id'];
21
22 if (!is_array($users)) {
23 ilUtil::sendInfo($this->ilLng->txt('no_checkbox'), true);
24 $this->ilCtrl->redirect($this->gui, 'ban-show');
25 }
26
27 $room = ilChatroom::byObjectId($this->gui->object->getId());
28 $room->unbanUser($users);
29
30 $this->ilCtrl->redirect($this->gui, 'ban-show');
31 }
$users
Definition: authpage.php:44
This class provides processing control methods.
redirect($a_gui_obj, $a_cmd="", $a_anchor="", $a_asynch=false)
Redirect to another command.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $users, ilChatroom\byObjectId(), ilCtrl\redirect(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ executeDefault()

ilChatroomBanGUI::executeDefault (   $method)

{

Parameters
string$requestedMethod
Returns
mixed
}

Reimplemented from ilChatroomGUIHandler.

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

37 {
38 $this->show();
39 }
show()
Displays banned users task.

References show().

+ Here is the call graph for this function:

◆ show()

ilChatroomBanGUI::show ( )

Displays banned users task.

Definition at line 44 of file class.ilChatroomBanGUI.php.

45 {
46 include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
47
48 $this->redirectIfNoPermission('read');
49
50 $this->gui->switchToVisibleMode();
51
52 require_once 'Modules/Chatroom/classes/class.ilBannedUsersTableGUI.php';
53
54 $table = new ilBannedUsersTableGUI($this->gui, 'ban-show');
55 $table->setFormAction($GLOBALS['DIC']->ctrl()->getFormAction($this->gui, 'ban-show'));
56
57 $room = ilChatroom::byObjectId($this->gui->object->getId());
58 if ($room) {
59 $data = $room->getBannedUsers();
60
61 $actorIDs = array_filter(array_map(function ($row) {
62 return $row['actor_id'];
63 }, $data));
64
65 require_once 'Services/User/classes/class.ilUserUtil.php';
66 $sortable_names = ilUserUtil::getNamePresentation($actorIDs);
67 $names = ilUserUtil::getNamePresentation($actorIDs, false, false, '', false, false, false);
68
69 array_walk($data, function (&$row) use ($names, $sortable_names) {
70 if ($row['actor_id'] > 0 && isset($names[$row['actor_id']])) {
71 $row['actor_display'] = $names[$row['actor_id']];
72 $row['actor'] = $sortable_names[$row['actor_id']];
73 } else {
74 $row['actor_display'] = $GLOBALS['DIC']->language()->txt('unknown');
75 $row['actor'] = $GLOBALS['DIC']->language()->txt('unknown');
76 }
77 });
78
79 $table->setData($data);
80 }
81
82 $this->gui->tpl->setVariable('ADM_CONTENT', $table->getHTML());
83 }
Class ilBannedUsersTableGUI.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
if(empty($password)) $table
Definition: pwgen.php:24

References $data, $GLOBALS, $names, $row, $table, ilChatroom\byObjectId(), ilUserUtil\getNamePresentation(), and ilChatroomGUIHandler\redirectIfNoPermission().

Referenced by executeDefault().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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