ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilChatroomBanGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
5require_once 'Modules/Chatroom/classes/class.ilChatroomUser.php';
6
14{
18 public function delete()
19 {
24 global $ilCtrl, $lng;
25
26 $users = $_REQUEST['banned_user_id'];
27
28 if(!is_array($users))
29 {
30 ilUtil::sendInfo($lng->txt('no_checkbox'), true);
31 $ilCtrl->redirect($this->gui, 'ban-show');
32 }
33
34 $room = ilChatroom::byObjectId($this->gui->object->getId());
35 $room->unbanUser($users);
36
37 $ilCtrl->redirect($this->gui, 'ban-show');
38 }
39
43 public function executeDefault($method)
44 {
45 $this->show();
46 }
47
51 public function show()
52 {
56 global $ilCtrl;
57
58 include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
59
60 ilChatroom::checkUserPermissions('read', $this->gui->ref_id);
61
62 $this->gui->switchToVisibleMode();
63
64 require_once 'Modules/Chatroom/classes/class.ilBannedUsersTableGUI.php';
65
66 $table = new ilBannedUsersTableGUI($this->gui, 'ban-show');
67 $table->setFormAction($ilCtrl->getFormAction($this->gui, 'ban-show'));
68
69 $room = ilChatroom::byObjectId($this->gui->object->getId());
70
71 if($room)
72 {
73 $table->setData($room->getBannedUsers());
74 }
75
76 $this->gui->tpl->setVariable('ADM_CONTENT', $table->getHTML());
77 }
78
82 public function active()
83 {
84 $this->redirectIfNoPermission(array('read', 'moderate'));
85
86 $room = ilChatroom::byObjectId($this->gui->object->getId());
87 $subRoomId = $_REQUEST['sub'];
88 $userToBan = $_REQUEST['user'];
89
90 $this->exitIfNoRoomExists($room);
91
92 $connector = $this->gui->getConnector();
93 $response = $connector->sendBan($room->getRoomId(), $subRoomId, $userToBan); // @TODO Respect Scope
94
95 if($this->isSuccessful($response))
96 {
97 $room->banUser($_REQUEST['user']);
98 $room->disconnectUser($_REQUEST['user']);
99 }
100
101 $this->sendResponse($response);
102 }
103}
An exception for terminatinating execution or to throw for unit testing.
show()
returns the content of IniFile @access public
Class ilBannedUsersTableGUI.
Class ilChatroomBanGUI.
active()
Kicks and bans user, fetched from $_REQUEST['user'] and adds history entry.
executeDefault($method)
{mixed}
Class ilChatroomGUIHandler.
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.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $lng
Definition: privfeed.php:17