ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 
ILIAS FileDelivery Services $file_delivery
 

Detailed Description

Member Function Documentation

◆ execute()

ilChatroomGUIHandler::execute ( string  $method)

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

109 : void
110 {
111 $this->ilLng->loadLanguageModule('chatroom');
112
113 if (is_callable([$this, $method])) {
114 $this->$method();
115 return;
116 }
117
118 $this->executeDefault($method);
119 }
executeDefault(string $requestedMethod)

References executeDefault().

+ Here is the call graph for this function:

◆ executeDefault()

ilChatroomGUIHandler::executeDefault ( string  $requestedMethod)
abstract

◆ 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 159 of file class.ilChatroomGUIHandler.php.

159 : void
160 {
161 if (null === $room) {
162 $this->sendJSONResponse([
163 'success' => false,
164 'reason' => 'unknown room',
165 ]);
166 }
167 }
sendJSONResponse($response)
Sends a json encoded response and exits the php process.

References sendJSONResponse().

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

+ 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 87 of file class.ilChatroomGUIHandler.php.

88 {
89 if ($this->http->wrapper()->query()->has($key)) {
90 return $this->http->wrapper()->query()->retrieve($key, $trafo);
91 }
92
93 if ($this->http->wrapper()->post()->has($key)) {
94 return $this->http->wrapper()->post()->retrieve($key, $trafo);
95 }
96
97 return $default;
98 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\FileDelivery\http().

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

+ 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 151 of file class.ilChatroomGUIHandler.php.

151 : ?ilChatroom
152 {
153 return ilChatroom::byObjectId($objectId);
154 }
Class ilChatroom.
static byObjectId(int $object_id)

References ilChatroom\byObjectId().

Referenced by ilChatroomClearGUI\executeDefault().

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

◆ hasPermission()

ilChatroomGUIHandler::hasPermission ( string  $permission)

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

191 : bool
192 {
193 return ilChatroom::checkUserPermissions($permission, $this->gui->getRefId());
194 }
static checkUserPermissions($permissions, int $ref_id, bool $send_info=true)
Checks user permissions by given array and ref_id.

References ilChatroom\checkUserPermissions().

+ Here is the call graph for this function:

◆ hasRequestValue()

ilChatroomGUIHandler::hasRequestValue ( string  $key)
protected

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

100 : bool
101 {
102 if ($this->http->wrapper()->query()->has($key)) {
103 return true;
104 }
105
106 return $this->http->wrapper()->post()->has($key);
107 }

References ILIAS\FileDelivery\http().

Referenced by ilChatroomViewGUI\joinWithCustomName().

+ 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 140 of file class.ilChatroomGUIHandler.php.

140 : bool
141 {
142 if (!is_string($response)) {
143 return false;
144 }
145
146 $response = json_decode($response, true, 512, JSON_THROW_ON_ERROR);
147
148 return $response !== null && array_key_exists('success', $response) && $response['success'];
149 }
$response
Definition: xapitoken.php:93

References $response.

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

+ 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 127 of file class.ilChatroomGUIHandler.php.

127 : void
128 {
129 if (!ilChatroom::checkUserPermissions($permission, $this->gui->getRefId())) {
130 $this->ilCtrl->setParameterByClass(ilRepositoryGUI::class, 'ref_id', ROOT_FOLDER_ID);
131 $this->ilCtrl->redirectByClass(ilRepositoryGUI::class);
132 }
133 }
Class ilCtrl provides processing control methods.
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
const ROOT_FOLDER_ID
Definition: constants.php:32

References ilChatroom\checkUserPermissions(), ilCtrl\redirectByClass(), ROOT_FOLDER_ID, and ilCtrl\setParameterByClass().

Referenced by ilChatroomBanGUI\active(), ilChatroomBanGUI\delete(), ilChatroomAdminViewGUI\deliverDocumentation(), ilChatroomClearGUI\executeDefault(), ilChatroomInfoScreenGUI\executeDefault(), ilChatroomInviteUsersToPrivateRoomGUI\inviteById(), ilChatroomViewGUI\joinWithCustomName(), ilChatroomKickGUI\main(), ilChatroomAdminViewGUI\saveClientSettings(), and ilChatroomBanGUI\show().

+ 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 172 of file class.ilChatroomGUIHandler.php.

172 : void
173 {
174 $this->sendResponse(json_encode($response), 'application/json');
175 }
sendResponse(string $content, string $type)
Sends a response and exits the php process.

References $response, and sendResponse().

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

+ 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 180 of file class.ilChatroomGUIHandler.php.

180 : void
181 {
182 $this->http->saveResponse(
183 $this->http->response()
184 ->withHeader(ResponseHeader::CONTENT_TYPE, $type)
185 ->withBody(Streams::ofString($content))
186 );
187 $this->http->sendResponse();
188 $this->http->close();
189 }

References ILIAS\FileDelivery\http().

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

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

Field Documentation

◆ $file_delivery

ILIAS FileDelivery Services ilChatroomGUIHandler::$file_delivery
protected

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

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