19 declare(strict_types=1);
39 if ($controller ===
null) {
41 $controller = $DIC->ctrl();
45 if ($language ===
null) {
47 $language = $DIC->language();
62 $action = $this->
http->wrapper()->query()->retrieve(
63 'chat_ban_table_action',
65 $this->refinery->kindlyTo()->string(),
70 'delete' => $this->
delete(),
71 default => $this->
ilCtrl->redirect($this,
'show'),
75 public function delete():
void 77 $userTrafo = $this->
refinery->kindlyTo()->listOf($this->
refinery->kindlyTo()->string());
79 $users = $this->
getRequestValue(
'chat_ban_table_user_ids', $userTrafo, []);
81 $this->mainTpl->setOnScreenMessage(
'info', $this->ilLng->txt(
'no_checkbox'),
true);
82 $this->
ilCtrl->redirect($this->gui,
'ban-show');
88 if ((
string) current($users) ===
'ALL_OBJECTS') {
89 $users =
array_map(
static fn(array $row):
int => (
int) $row[
'user_id'], $room->getBannedUsers());
94 $room->unbanUser($users);
96 $this->mainTpl->setOnScreenMessage(
97 $this->mainTpl::MESSAGE_TYPE_SUCCESS,
98 $this->ilLng->txt(
'saved_successfully'),
101 $this->
ilCtrl->redirect($this->gui,
'ban-show');
116 $this->gui->switchToVisibleMode();
121 $data = $room->getBannedUsers();
122 $actorId = array_filter(
array_map(
static fn(array $row):
int => (
int) $row[
'actor_id'],
$data));
127 array_walk(
$data,
function (&$row) use ($names, $sortable_names):
void {
128 if ($row[
'actor_id'] > 0 && isset($names[$row[
'actor_id']])) {
129 $row[
'actor_display'] = $names[$row[
'actor_id']];
130 $row[
'actor'] = $sortable_names[$row[
'actor_id']];
132 $row[
'actor_display'] = $this->
language->txt(
'unknown');
133 $row[
'actor'] = $this->
language->txt(
'unknown');
137 $tbl = new \ILIAS\Chatroom\Bans\BannedUsersTable(
147 $this->mainTpl->setContent($this->uiRenderer->render($tbl->getComponent()));
159 $connector = $this->gui->getConnector();
160 $response = $connector->sendBan($room->getRoomId(), $userToBan);
163 $room->banUser($userToBan, $this->
user->getId());
164 $room->disconnectUser($userToBan);
redirectIfNoPermission($permission)
Checks for requested permissions and redirects if the permission check failed.
getRequestValue(string $key, Transformation $trafo, $default=null)
exitIfNoRoomExists(?ilChatroom $room)
Checks if a ilChatroom exists.
show()
Displays banned users task.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
sendResponse(string $content, string $type)
Sends a response and exits the php process.
static http()
Fetches the global http state from ILIAS.
readonly ilCtrlInterface $controller
__construct(?ilChatroomObjectGUI $gui, ?ilCtrlInterface $controller=null, ?ilLanguage $language=null, ?ilObjUser $user=null)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path='ilpublicuserprofilegui')
Default behaviour is:
Class ilChatroomGUIHandler.
readonly ilLanguage $language
isSuccessful($response)
Checks for success param in an json decoded response.
__construct(Container $dic, ilPlugin $plugin)
static byObjectId(int $object_id)
executeDefault(string $requestedMethod)
language()
description: > Example for rendring a language glyph.