ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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...
 
 sendResponse ($response, bool $isJson=false)
 Sends a json encoded response and exits the php process. 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...
 

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 (method_exists($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 sendResponse().

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

157  : void
158  {
159  if (null === $room) {
160  $this->sendResponse([
161  'success' => false,
162  'reason' => 'unknown room',
163  ]);
164  }
165  }
sendResponse($response, bool $isJson=false)
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(), ilChatroomHistoryGUI\bySession(), ilChatroomBanGUI\delete(), ilChatroomInfoGUI\executeDefault(), ilChatroomInviteUsersToPrivateRoomGUI\getUserList(), ilChatroomInviteUsersToPrivateRoomGUI\inviteById(), ilChatroomViewGUI\joinWithCustomName(), ilChatroomViewGUI\lostConnection(), 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.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ 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  }
Class ilChatroom.
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 182 of file class.ilChatroomGUIHandler.php.

References ilChatroom\checkUserPermissions().

182  : bool
183  {
184  return ilChatroom::checkUserPermissions($permission, $this->gui->getRefId());
185  }
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(), and ilChatroomViewGUI\lostConnection().

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.
string $key
Consumer key/client ID value.
Definition: System.php:193
+ 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.

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
+ 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(), ilChatroomClearGUI\executeDefault(), ilChatroomInfoGUI\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:

◆ sendResponse()

ilChatroomGUIHandler::sendResponse (   $response,
bool  $isJson = false 
)

Sends a json encoded response and exits the php process.

Parameters
mixed$response

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

References $response, and ILIAS\FileDelivery\http().

Referenced by ilChatroomBanGUI\active(), ilChatroomPollGUI\executeDefault(), ilChatroomClearGUI\executeDefault(), exitIfNoRoomExists(), ilChatroomInviteUsersToPrivateRoomGUI\getUserList(), ilChatroomInviteUsersToPrivateRoomGUI\inviteById(), ilChatroomViewGUI\lostConnection(), and ilChatroomKickGUI\main().

171  : void
172  {
173  $this->http->saveResponse(
174  $this->http->response()
175  ->withHeader(ResponseHeader::CONTENT_TYPE, 'application/json')
176  ->withBody(Streams::ofString($isJson ? $response : json_encode($response, JSON_THROW_ON_ERROR)))
177  );
178  $this->http->sendResponse();
179  $this->http->close();
180  }
$response
Definition: xapitoken.php:93
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.

◆ $ilCtrl

ilCtrlInterface ilChatroomGUIHandler::$ilCtrl
protected

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

◆ $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.

◆ $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.

◆ $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: