ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilChatroomPrivateRoomGUI Class Reference

Class ilChatroomPrivateRoomGUI. More...

+ Inheritance diagram for ilChatroomPrivateRoomGUI:
+ Collaboration diagram for ilChatroomPrivateRoomGUI:

Public Member Functions

 executeDefault ($method)
 
 create ()
 
 delete ()
 
 leave ()
 
 enter ()
 
 listUsers ()
 
- Public Member Functions inherited from ilChatroomGUIHandler
 __construct (ilChatroomObjectGUI $gui)
 
 execute ($method)
 Executes given $method if existing, otherwise executes executeDefault() method. More...
 
 executeDefault ($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)
 Sends a json encoded response and exits the php process. More...
 
 hasPermission ($permission)
 Checks for access with ilRbacSystem. More...
 

Protected Member Functions

 exitIfNoRoomSubscription ($room, $chat_user)
 
 exitIfEnterRoomIsNotAllowed ($room, $subRoom, $chat_user)
 
- Protected Member Functions inherited from ilChatroomGUIHandler
 getRoomByObjectId ($objectId)
 
 exitIfNoRoomExists ($room)
 Checks if a ilChatroom exists. More...
 
 exitIfNoRoomPermission ($room, $subRoom, $chat_user)
 Check if user can moderate a chatroom. More...
 
 canModerate ($room, $subRoom, $user_id)
 Checks if the user has permission to moderate a ilChatroom. More...
 
 isMainRoom ($subRoomId)
 

Additional Inherited Members

- Protected Attributes inherited from ilChatroomGUIHandler
 $gui
 
 $ilUser
 
 $ilCtrl
 
 $ilLng
 
 $webDirectory
 
 $obj_service
 
 $upload
 
 $rbacsystem
 
 $mainTpl
 
 $ilias
 
 $navigationHistory
 
 $tree
 
 $tabs
 

Detailed Description

Member Function Documentation

◆ create()

ilChatroomPrivateRoomGUI::create ( )

Definition at line 19 of file class.ilChatroomPrivateRoomGUI.php.

20 {
21 $this->redirectIfNoPermission('read');
22
23 $room = ilChatroom::byObjectId($this->gui->object->getId());
24 $chat_user = new ilChatroomUser($this->ilUser, $room);
25
26 $this->exitIfNoRoomExists($room);
27 $this->exitIfNoRoomSubscription($room, $chat_user);
28
29 $title = $room->getUniquePrivateRoomTitle(ilUtil::stripSlashes((string) $_REQUEST['title']));
30 $subRoomId = $room->addPrivateRoom($title, $chat_user, array('public' => false));
31
32 $connector = $this->gui->getConnector();
33 $response = $connector->sendCreatePrivateRoom($room->getRoomId(), $subRoomId, $chat_user->getUserId(), $title);
34
35 if ($this->isSuccessful($response)) {
36 $response = array(
37 'success' => true,
38 'title' => $title,
39 'owner' => $chat_user->getUserId(),
40 'subRoomId' => $subRoomId
41 );
42 }
43
44 $this->sendResponse($response);
45 }
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.
Class ilChatroomUser.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$response

References $response, ilChatroom\byObjectId(), ilChatroomGUIHandler\exitIfNoRoomExists(), exitIfNoRoomSubscription(), ilChatroomGUIHandler\isSuccessful(), ilChatroomGUIHandler\redirectIfNoPermission(), ilChatroomGUIHandler\sendResponse(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ delete()

ilChatroomPrivateRoomGUI::delete ( )

Definition at line 61 of file class.ilChatroomPrivateRoomGUI.php.

62 {
63 $room = ilChatroom::byObjectId($this->gui->object->getId());
64 $subRoom = $_REQUEST['sub'];
65 $chat_user = new ilChatroomUser($this->ilUser, $room);
66
67 $this->exitIfNoRoomExists($room);
68 $this->exitIfNoRoomSubscription($room, $chat_user);
69
70 $room->closePrivateRoom($subRoom);
71
72 $connector = $this->gui->getConnector();
73 $response = $connector->sendDeletePrivateRoom($room->getRoomId(), $subRoom, $chat_user->getUserId());
74
75 $this->sendResponse($response);
76 }

References $response, ilChatroom\byObjectId(), ilChatroomGUIHandler\exitIfNoRoomExists(), exitIfNoRoomSubscription(), and ilChatroomGUIHandler\sendResponse().

+ Here is the call graph for this function:

◆ enter()

ilChatroomPrivateRoomGUI::enter ( )

Definition at line 97 of file class.ilChatroomPrivateRoomGUI.php.

98 {
99 $this->redirectIfNoPermission('read');
100
101 $room = ilChatroom::byObjectId($this->gui->object->getId());
102 $subRoom = $_REQUEST['sub'];
103 $chat_user = new ilChatroomUser($this->ilUser, $room);
104
105 $this->exitIfNoRoomExists($room);
106 $this->exitIfEnterRoomIsNotAllowed($room, $subRoom, $chat_user);
107
108 $connector = $this->gui->getConnector();
109 $response = $connector->sendEnterPrivateRoom($room->getRoomId(), $subRoom, $chat_user->getUserId());
110
111 if ($this->isSuccessful($response)) {
112 $room->subscribeUserToPrivateRoom($subRoom, $chat_user->getUserId());
113 }
114
115 $this->sendResponse($response);
116 }
exitIfEnterRoomIsNotAllowed($room, $subRoom, $chat_user)

References $response, ilChatroom\byObjectId(), exitIfEnterRoomIsNotAllowed(), ilChatroomGUIHandler\exitIfNoRoomExists(), ilChatroomGUIHandler\isSuccessful(), ilChatroomGUIHandler\redirectIfNoPermission(), and ilChatroomGUIHandler\sendResponse().

+ Here is the call graph for this function:

◆ executeDefault()

ilChatroomPrivateRoomGUI::executeDefault (   $requestedMethod)
Parameters
string$requestedMethod
Returns
mixed

Reimplemented from ilChatroomGUIHandler.

Definition at line 15 of file class.ilChatroomPrivateRoomGUI.php.

16 {
17 }

◆ exitIfEnterRoomIsNotAllowed()

ilChatroomPrivateRoomGUI::exitIfEnterRoomIsNotAllowed (   $room,
  $subRoom,
  $chat_user 
)
protected
Parameters
ilChatroom$room
int$subRoom
ilChatroomUser$chat_user

Definition at line 123 of file class.ilChatroomPrivateRoomGUI.php.

124 {
125 if (!$room->isAllowedToEnterPrivateRoom($chat_user->getUserId(), $subRoom)) {
126 $this->sendResponse(array(
127 'success' => false,
128 'reason' => 'not allowed enter to private room'
129 ));
130 }
131 }

References ilChatroomGUIHandler\sendResponse().

Referenced by enter().

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

◆ exitIfNoRoomSubscription()

ilChatroomPrivateRoomGUI::exitIfNoRoomSubscription (   $room,
  $chat_user 
)
protected
Parameters
ilChatroom$room
ilChatroomUser$chat_user

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

52 {
53 if (!$room->isSubscribed($chat_user->getUserId())) {
54 $this->sendResponse(array(
55 'success' => false,
56 'reason' => 'not subscribed'
57 ));
58 }
59 }

References ilChatroomGUIHandler\sendResponse().

Referenced by create(), delete(), and leave().

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

◆ leave()

ilChatroomPrivateRoomGUI::leave ( )

Definition at line 78 of file class.ilChatroomPrivateRoomGUI.php.

79 {
80 $room = ilChatroom::byObjectId($this->gui->object->getId());
81 $chat_user = new ilChatroomUser($this->ilUser, $room);
82 $subRoom = $_REQUEST['sub'];
83
84 $this->exitIfNoRoomExists($room);
85 $this->exitIfNoRoomSubscription($room, $chat_user);
86
87 $connector = $this->gui->getConnector();
88 $response = $connector->sendLeavePrivateRoom($room->getRoomId(), $subRoom, $chat_user->getUserId());
89
90 if ($room->userIsInPrivateRoom($subRoom, $chat_user->getUserId())) {
91 $room->unsubscribeUserFromPrivateRoom($subRoom, $chat_user->getUserId());
92 }
93
94 $this->sendResponse($response);
95 }

References $response, ilChatroom\byObjectId(), ilChatroomGUIHandler\exitIfNoRoomExists(), exitIfNoRoomSubscription(), and ilChatroomGUIHandler\sendResponse().

+ Here is the call graph for this function:

◆ listUsers()

ilChatroomPrivateRoomGUI::listUsers ( )

Definition at line 133 of file class.ilChatroomPrivateRoomGUI.php.

134 {
135 $room = ilChatroom::byObjectId($this->gui->object->getId());
136
137 $response = $room->listUsersInPrivateRoom($_REQUEST['sub']);
138 $this->sendResponse($response);
139 }

References $response, ilChatroom\byObjectId(), and ilChatroomGUIHandler\sendResponse().

+ Here is the call graph for this function:

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