ILIAS  release_7 Revision v7.30-3-g800a261c036
ilChatroomBanGUI Class Reference

Class ilChatroomBanGUI. More...

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

Public Member Functions

 __construct (ilChatroomObjectGUI $gui, \ilCtrl $controller=null, \ilLanguage $language=null, \ilUser $user=null)
 
 delete ()
 Unbans users fetched from $_REQUEST['banned_user_id']. More...
 
 executeDefault ($requestedMethod)
 @inheritDoc 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)
 
 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...
 
 sendResponse ($response)
 Sends a json encoded response and exits the php process. More...
 
 hasPermission ($permission)
 Checks for access with ilRbacSystem. More...
 

Private Attributes

 $controller
 
 $language
 
 $user
 

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
 
 $obj_service
 
 $upload
 
 $rbacsystem
 
 $mainTpl
 
 $ilias
 
 $navigationHistory
 
 $tree
 
 $tabs
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilChatroomBanGUI::__construct ( ilChatroomObjectGUI  $gui,
\ilCtrl  $controller = null,
\ilLanguage  $language = null,
\ilUser  $user = null 
)
Parameters
ilChatroomObjectGUI$gui
ilCtrl | null$controller
ilLanguage | null$language
ilUser | null$user

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

35 {
36 if ($controller === null) {
37 global $DIC;
38 $controller = $DIC->ctrl();
39 }
40 $this->controller = $controller;
41
42 if ($language === null) {
43 global $DIC;
44 $language = $DIC->language();
45 }
46 $this->language = $language;
47
48 if ($user === null) {
49 global $DIC;
50 $user = $DIC->user();
51 }
52 $this->user = $user;
53
55 }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
language()
Definition: language.php:2
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $controller, $DIC, $language, $user, ILIAS\GlobalScreen\Provider\__construct(), language(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ active()

ilChatroomBanGUI::active ( )

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

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

131 {
132 $this->redirectIfNoPermission(array('read', 'moderate'));
133
134 $room = ilChatroom::byObjectId($this->gui->object->getId());
135 $subRoomId = $_REQUEST['sub'];
136 $userToBan = $_REQUEST['user'];
137
138 $this->exitIfNoRoomExists($room);
139
140 $connector = $this->gui->getConnector();
141 $response = $connector->sendBan($room->getRoomId(), $subRoomId, $userToBan); // @TODO Respect Scope
142
143 if ($this->isSuccessful($response)) {
144 $room->banUser($_REQUEST['user'], $this->user->getId());
145 $room->disconnectUser($_REQUEST['user']);
146 }
147
148 $this->sendResponse($response);
149 }
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.
$response

References $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 60 of file class.ilChatroomBanGUI.php.

61 {
62 $users = $_REQUEST['banned_user_id'];
63
64 if (!is_array($users)) {
65 ilUtil::sendInfo($this->ilLng->txt('no_checkbox'), true);
66 $this->ilCtrl->redirect($this->gui, 'ban-show');
67 }
68
69 $room = ilChatroom::byObjectId($this->gui->object->getId());
70 $room->unbanUser($users);
71
72 $this->ilCtrl->redirect($this->gui, 'ban-show');
73 }
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 ilChatroom\byObjectId(), ilCtrl\redirect(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ executeDefault()

ilChatroomBanGUI::executeDefault (   $requestedMethod)

@inheritDoc

Reimplemented from ilChatroomGUIHandler.

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

79 {
80 $this->show();
81 }
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 86 of file class.ilChatroomBanGUI.php.

87 {
88 include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
89
90 $this->redirectIfNoPermission('read');
91
92 $this->gui->switchToVisibleMode();
93
94 require_once 'Modules/Chatroom/classes/class.ilBannedUsersTableGUI.php';
95
96 $table = new ilBannedUsersTableGUI($this->gui, 'ban-show');
97 $table->setFormAction($this->controller->getFormAction($this->gui, 'ban-show'));
98
99 $room = ilChatroom::byObjectId($this->gui->object->getId());
100 if ($room) {
101 $data = $room->getBannedUsers();
102
103 $actorIDs = array_filter(array_map(function ($row) {
104 return $row['actor_id'];
105 }, $data));
106
107 require_once 'Services/User/classes/class.ilUserUtil.php';
108 $sortable_names = ilUserUtil::getNamePresentation($actorIDs);
109 $names = ilUserUtil::getNamePresentation($actorIDs, false, false, '', false, false, false);
110
111 array_walk($data, function (&$row) use ($names, $sortable_names) {
112 if ($row['actor_id'] > 0 && isset($names[$row['actor_id']])) {
113 $row['actor_display'] = $names[$row['actor_id']];
114 $row['actor'] = $sortable_names[$row['actor_id']];
115 } else {
116 $row['actor_display'] = $this->language->txt('unknown');
117 $row['actor'] = $this->language->txt('unknown');
118 }
119 });
120
121 $table->setData($data);
122 }
123
124 $this->gui->tpl->setVariable('ADM_CONTENT', $table->getHTML());
125 }
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:
$data
Definition: storeScorm.php:23

References $data, ilChatroom\byObjectId(), ilUserUtil\getNamePresentation(), language(), and ilChatroomGUIHandler\redirectIfNoPermission().

Referenced by executeDefault().

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

Field Documentation

◆ $controller

ilChatroomBanGUI::$controller
private

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

Referenced by __construct().

◆ $language

ilChatroomBanGUI::$language
private

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

Referenced by __construct().

◆ $user

ilChatroomBanGUI::$user
private

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

Referenced by __construct().


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