ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilChatroomGUIHandler Class Reference

Class ilChatroomGUIHandler. More...

+ Inheritance diagram for ilChatroomGUIHandler:
+ Collaboration diagram for ilChatroomGUIHandler:

Public Member Functions

 execute (string $method)
 
 executeDefault (string $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...
 
 hasPermission (string $permission)
 

Protected Member Functions

 getRequestValue (string $key, Transformation $trafo, $default=null)
 
 hasRequestValue (string $key)
 
 getRoomByObjectId (int $objectId)
 
 exitIfNoRoomExists (?ilChatroom $room)
 Checks if a ilChatroom exists. More...
 
 sendJSONResponse ($response)
 Sends a json encoded response and exits the php process. More...
 
 sendResponse (string $content, string $type)
 Sends a response and exits the php process. More...
 

Protected Attributes

ilObjUser $ilUser
 
ilCtrlInterface $ilCtrl
 
ilLanguage $ilLng
 
Filesystem $webDirectory
 
ilObjectService $obj_service
 
FileUpload $upload
 
ilRbacSystem $rbacsystem
 
ilGlobalTemplateInterface $mainTpl
 
ILIAS $ilias
 
ilNavigationHistory $navigationHistory
 
ilTree $tree
 
ilTabsGUI $tabs
 
UIFactory $uiFactory
 
UIRenderer $uiRenderer
 
GlobalHttpState $http
 
Refinery $refinery
 

Detailed Description

Member Function Documentation

◆ execute()

ilChatroomGUIHandler::execute ( string  $method)

Definition at line 107 of file class.ilChatroomGUIHandler.php.

References executeDefault().

107  : void
108  {
109  $this->ilLng->loadLanguageModule('chatroom');
110 
111  if (is_callable([$this, $method])) {
112  $this->$method();
113  return;
114  }
115 
116  $this->executeDefault($method);
117  }
executeDefault(string $requestedMethod)
+ Here is the call graph for this function:

◆ executeDefault()

ilChatroomGUIHandler::executeDefault ( string  $requestedMethod)
abstract

Referenced by execute().

+ Here is the caller graph for this function:

◆ exitIfNoRoomExists()

ilChatroomGUIHandler::exitIfNoRoomExists ( ?ilChatroom  $room)
protected

Checks if a ilChatroom exists.

If not, it will send a json encoded response with success = false

Definition at line 157 of file class.ilChatroomGUIHandler.php.

References null, and sendJSONResponse().

Referenced by ilChatroomBanGUI\active(), ilChatroomHistoryGUI\byDayExport(), ilChatroomBanGUI\delete(), ilChatroomClearGUI\executeDefault(), ilChatroomInviteUsersToPrivateRoomGUI\inviteById(), ilChatroomKickGUI\main(), and ilChatroomBanGUI\show().

157  : void
158  {
159  if (null === $room) {
160  $this->sendJSONResponse([
161  'success' => false,
162  'reason' => 'unknown room',
163  ]);
164  }
165  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
sendJSONResponse($response)
Sends a json encoded response and exits the php process.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRequestValue()

ilChatroomGUIHandler::getRequestValue ( string  $key,
Transformation  $trafo,
  $default = null 
)
protected
Parameters
mixed$default
Returns
mixed|null

Definition at line 85 of file class.ilChatroomGUIHandler.php.

References ILIAS\FileDelivery\http().

Referenced by ilChatroomBanGUI\active(), ilChatroomInviteUsersToPrivateRoomGUI\byId(), ilChatroomInviteUsersToPrivateRoomGUI\byLogin(), ilChatroomBanGUI\delete(), ilChatroomInviteUsersToPrivateRoomGUI\getUserList(), ilChatroomInviteUsersToPrivateRoomGUI\inviteById(), ilChatroomViewGUI\joinWithCustomName(), ilChatroomKickGUI\main(), and ilChatroomViewGUI\showRoom().

86  {
87  if ($this->http->wrapper()->query()->has($key)) {
88  return $this->http->wrapper()->query()->retrieve($key, $trafo);
89  }
90 
91  if ($this->http->wrapper()->post()->has($key)) {
92  return $this->http->wrapper()->post()->retrieve($key, $trafo);
93  }
94 
95  return $default;
96  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRoomByObjectId()

ilChatroomGUIHandler::getRoomByObjectId ( int  $objectId)
protected

Definition at line 149 of file class.ilChatroomGUIHandler.php.

References ilChatroom\byObjectId().

Referenced by ilChatroomClearGUI\executeDefault().

149  : ?ilChatroom
150  {
151  return ilChatroom::byObjectId($objectId);
152  }
static byObjectId(int $object_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasPermission()

ilChatroomGUIHandler::hasPermission ( string  $permission)

Definition at line 189 of file class.ilChatroomGUIHandler.php.

References ilChatroom\checkUserPermissions().

189  : bool
190  {
191  return ilChatroom::checkUserPermissions($permission, $this->gui->getRefId());
192  }
static checkUserPermissions($permissions, int $ref_id, bool $send_info=true)
Checks user permissions by given array and ref_id.
+ Here is the call graph for this function:

◆ hasRequestValue()

ilChatroomGUIHandler::hasRequestValue ( string  $key)
protected

Definition at line 98 of file class.ilChatroomGUIHandler.php.

References ILIAS\FileDelivery\http().

Referenced by ilChatroomViewGUI\joinWithCustomName().

98  : bool
99  {
100  if ($this->http->wrapper()->query()->has($key)) {
101  return true;
102  }
103 
104  return $this->http->wrapper()->post()->has($key);
105  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSuccessful()

ilChatroomGUIHandler::isSuccessful (   $response)

Checks for success param in an json decoded response.

Parameters
string | false$response
Returns
bool

Definition at line 138 of file class.ilChatroomGUIHandler.php.

References $response, and null.

Referenced by ilChatroomBanGUI\active(), and ilChatroomKickGUI\main().

138  : bool
139  {
140  if (!is_string($response)) {
141  return false;
142  }
143 
144  $response = json_decode($response, true, 512, JSON_THROW_ON_ERROR);
145 
146  return $response !== null && array_key_exists('success', $response) && $response['success'];
147  }
$response
Definition: xapitoken.php:93
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ redirectIfNoPermission()

ilChatroomGUIHandler::redirectIfNoPermission (   $permission)

Checks for requested permissions and redirects if the permission check failed.

Parameters
string[]|string$permission

Definition at line 125 of file class.ilChatroomGUIHandler.php.

References ilChatroom\checkUserPermissions(), and ROOT_FOLDER_ID.

Referenced by ilChatroomBanGUI\active(), ilChatroomInfoScreenGUI\executeDefault(), ilChatroomClearGUI\executeDefault(), ilChatroomViewGUI\executeDefault(), ilChatroomInviteUsersToPrivateRoomGUI\inviteById(), ilChatroomViewGUI\joinWithCustomName(), ilChatroomKickGUI\main(), ilChatroomAdminViewGUI\saveClientSettings(), ilChatroomBanGUI\show(), ilChatroomHistoryGUI\showMessages(), ilChatroomViewGUI\showRoom(), and ilChatroomViewGUI\toggleAutoMessageDisplayState().

125  : void
126  {
127  if (!ilChatroom::checkUserPermissions($permission, $this->gui->getRefId())) {
128  $this->ilCtrl->setParameterByClass(ilRepositoryGUI::class, 'ref_id', ROOT_FOLDER_ID);
129  $this->ilCtrl->redirectByClass(ilRepositoryGUI::class);
130  }
131  }
static checkUserPermissions($permissions, int $ref_id, bool $send_info=true)
Checks user permissions by given array and ref_id.
const ROOT_FOLDER_ID
Definition: constants.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendJSONResponse()

ilChatroomGUIHandler::sendJSONResponse (   $response)
protected

Sends a json encoded response and exits the php process.

Definition at line 170 of file class.ilChatroomGUIHandler.php.

References $response, and sendResponse().

Referenced by ilChatroomPollGUI\executeDefault(), exitIfNoRoomExists(), and ilChatroomViewGUI\lostConnection().

170  : void
171  {
172  $this->sendResponse(json_encode($response), 'application/json');
173  }
$response
Definition: xapitoken.php:93
sendResponse(string $content, string $type)
Sends a response and exits the php process.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendResponse()

ilChatroomGUIHandler::sendResponse ( string  $content,
string  $type 
)
protected

Sends a response and exits the php process.

Definition at line 178 of file class.ilChatroomGUIHandler.php.

References ILIAS\FileDelivery\http().

Referenced by ilChatroomBanGUI\active(), ilChatroomClearGUI\executeDefault(), ilChatroomInviteUsersToPrivateRoomGUI\getUserList(), ilChatroomInviteUsersToPrivateRoomGUI\inviteById(), ilChatroomKickGUI\main(), sendJSONResponse(), and ilChatroomViewGUI\userEntry().

178  : void
179  {
180  $this->http->saveResponse(
181  $this->http->response()
182  ->withHeader(ResponseHeader::CONTENT_TYPE, $type)
183  ->withBody(Streams::ofString($content))
184  );
185  $this->http->sendResponse();
186  $this->http->close();
187  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $http

GlobalHttpState ilChatroomGUIHandler::$http
protected

Definition at line 53 of file class.ilChatroomGUIHandler.php.

Referenced by ilChatroomBanGUI\show().

◆ $ilCtrl

ilCtrlInterface ilChatroomGUIHandler::$ilCtrl
protected

Definition at line 40 of file class.ilChatroomGUIHandler.php.

Referenced by ilChatroomBanGUI\show().

◆ $ilias

ILIAS ilChatroomGUIHandler::$ilias
protected

Definition at line 47 of file class.ilChatroomGUIHandler.php.

◆ $ilLng

ilLanguage ilChatroomGUIHandler::$ilLng
protected

Definition at line 41 of file class.ilChatroomGUIHandler.php.

Referenced by ilChatroomBanGUI\show().

◆ $ilUser

ilObjUser ilChatroomGUIHandler::$ilUser
protected

Definition at line 39 of file class.ilChatroomGUIHandler.php.

◆ $mainTpl

ilGlobalTemplateInterface ilChatroomGUIHandler::$mainTpl
protected

Definition at line 46 of file class.ilChatroomGUIHandler.php.

◆ $navigationHistory

ilNavigationHistory ilChatroomGUIHandler::$navigationHistory
protected

Definition at line 48 of file class.ilChatroomGUIHandler.php.

◆ $obj_service

ilObjectService ilChatroomGUIHandler::$obj_service
protected

Definition at line 43 of file class.ilChatroomGUIHandler.php.

◆ $rbacsystem

ilRbacSystem ilChatroomGUIHandler::$rbacsystem
protected

Definition at line 45 of file class.ilChatroomGUIHandler.php.

◆ $refinery

Refinery ilChatroomGUIHandler::$refinery
protected

Definition at line 54 of file class.ilChatroomGUIHandler.php.

◆ $tabs

ilTabsGUI ilChatroomGUIHandler::$tabs
protected

Definition at line 50 of file class.ilChatroomGUIHandler.php.

◆ $tree

ilTree ilChatroomGUIHandler::$tree
protected

Definition at line 49 of file class.ilChatroomGUIHandler.php.

◆ $uiFactory

UIFactory ilChatroomGUIHandler::$uiFactory
protected

Definition at line 51 of file class.ilChatroomGUIHandler.php.

Referenced by ilChatroomBanGUI\show().

◆ $uiRenderer

UIRenderer ilChatroomGUIHandler::$uiRenderer
protected

Definition at line 52 of file class.ilChatroomGUIHandler.php.

◆ $upload

FileUpload ilChatroomGUIHandler::$upload
protected

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

◆ $webDirectory

Filesystem ilChatroomGUIHandler::$webDirectory
protected

Definition at line 42 of file class.ilChatroomGUIHandler.php.


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