Class ilChatroomPrivateRoomTask.
More...
|
| buildMessage ($messageString, $params, ilChatroomUser $chat_user) |
| Instantiates stdClass, sets $data->user, $data->message, $data->public and $data->recipients using given $chat_user, $messageString and $params and returns $data. More...
|
|
◆ __construct()
◆ buildMessage()
ilChatroomPrivateRoomTask::buildMessage |
( |
|
$messageString, |
|
|
|
$params, |
|
|
ilChatroomUser |
$chat_user |
|
) |
| |
|
private |
Instantiates stdClass, sets $data->user, $data->message, $data->public and $data->recipients using given $chat_user, $messageString and $params and returns $data.
- Parameters
-
- Returns
- stdClass
Definition at line 314 of file class.ilChatroomPrivateRoomTask.php.
References $data, and ilChatroomUser\getUserId().
316 $data =
new stdClass();
319 $data->title = $params[
'title'];
320 $data->timestamp = date(
'c' );
321 $data->type =
'private_room_created';
getUserId()
Returns Ilias User ID.
◆ create()
ilChatroomPrivateRoomTask::create |
( |
| ) |
|
Prepares and posts message fetched from $_REQUEST['message'] to recipients fetched from $_REQUEST['recipient'] and adds an entry to history if successful.
ilTemplate $tpl ilObjUser $ilUser
- Parameters
-
Definition at line 45 of file class.ilChatroomPrivateRoomTask.php.
References $_REQUEST, $ilCtrl, $ilUser, $tpl, ilChatroom\byObjectId(), ilChatroom\checkUserPermissions(), and exit.
49 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
50 require_once
'Modules/Chatroom/classes/class.ilChatroomUser.php';
54 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", ROOT_FOLDER_ID);
55 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
61 $user_id = $chat_user->getUserId();
65 $response = json_encode( array(
67 'reason' =>
'unkown room' 69 echo json_encode( $response );
72 else if( !$room->isSubscribed( $chat_user->getUserId() ) )
74 $response = json_encode( array(
76 'reason' =>
'not subscribed' 78 echo json_encode( $response );
82 $title = $room->getUniquePrivateRoomTitle(
$_REQUEST[
'title']);
83 $connector = $this->gui->getConnector();
84 $response = $connector->createPrivateRoom($room, $title, $chat_user);
86 echo json_encode($response);
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
◆ delete()
ilChatroomPrivateRoomTask::delete |
( |
| ) |
|
Definition at line 90 of file class.ilChatroomPrivateRoomTask.php.
References $_REQUEST, $ilUser, $query, $tpl, ilChatroom\byObjectId(), and exit.
94 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
95 require_once
'Modules/Chatroom/classes/class.ilChatroomUser.php';
100 $user_id = $chat_user->getUserId();
104 $response = json_encode( array(
106 'reason' =>
'unkown room' 108 echo json_encode( $response );
111 else if( !$room->isOwnerOfPrivateRoom( $user_id,
$_REQUEST[
'sub'] ) && !$rbacsystem->checkAccess(
'moderate', $this->gui->getRefId()) )
113 $response = json_encode( array(
115 'reason' =>
'not owner of private room' 117 echo json_encode( $response );
121 $scope = $room->getRoomId();
124 $params[
'user'] = $chat_user->getUserId();
125 $params[
'id'] = $room->closePrivateRoom(
$_REQUEST[
'sub'], $chat_user, $settings);
126 $query = http_build_query( $params );
127 $connector = $this->gui->getConnector();
129 if(
true || $responseObject->success ==
true )
131 $message = json_encode( array(
132 'type' =>
'private_room_deleted',
134 'timestamp' => date(
'c' ),
137 'id' => $responseObject->id,
140 'message' =>
'room deleted',
146 $connector->sendMessage( $room->getRoomId(), $message, array(
'public' => 1) );
149 $response = json_encode(array(
'success' =>
true));
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
◆ enter()
ilChatroomPrivateRoomTask::enter |
( |
| ) |
|
Definition at line 230 of file class.ilChatroomPrivateRoomTask.php.
References $_REQUEST, $ilUser, $query, $tpl, ilChatroom\byObjectId(), ilChatroom\checkUserPermissions(), and exit.
239 $user_id = $chat_user->getUserId();
243 $response = json_encode( array(
245 'reason' =>
'unkown room' 247 echo json_encode( $response );
250 else if( !$room->isAllowedToEnterPrivateRoom( $chat_user->getUserId(),
$_REQUEST[
'sub'] ) )
252 $response = json_encode( array(
254 'reason' =>
'not allowed enter to private room' 257 echo json_encode( $response );
261 $scope = $room->getRoomId();
264 $params[
'user'] = $chat_user->getUserId();
266 $params[
'message'] = json_encode( array(
267 'type' =>
'private_room_entered',
272 $query = http_build_query( $params );
273 $connector = $this->gui->getConnector();
274 $response = $connector->enterPrivateRoom( $scope,
$query );
275 $responseObject = json_decode( $response );
277 $message = json_encode( array(
278 'type' =>
'private_room_entered',
279 'user' => $params[
'user'],
280 'sub' => $params[
'sub']
283 $connector->sendMessage( $room->getRoomId(), $message, array(
'public' => 1,
'sub' => $params[
'sub']) );
285 if( $responseObject->success ==
true )
287 $room->subscribeUserToPrivateRoom( $params[
'sub'], $params[
'user'] );
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
◆ executeDefault()
ilChatroomPrivateRoomTask::executeDefault |
( |
|
$method | ) |
|
◆ leave()
ilChatroomPrivateRoomTask::leave |
( |
| ) |
|
Prepares and posts message fetched from $_REQUEST['message'] to recipients fetched from $_REQUEST['recipient'] and adds an entry to history if successful.
ilTemplate $tpl ilObjUser $ilUser
- Parameters
-
Definition at line 163 of file class.ilChatroomPrivateRoomTask.php.
References $_REQUEST, $ilUser, $query, $tpl, ilChatroom\byObjectId(), and exit.
170 $user_id = $chat_user->getUserId();
171 $connector = $this->gui->getConnector();
175 $response = json_encode( array(
177 'reason' =>
'unkown room' 179 echo json_encode( $response );
182 else if( !$room->isSubscribed( $chat_user->getUserId() ) )
184 $response = json_encode( array(
186 'reason' =>
'not subscribed' 188 echo json_encode( $response );
192 $scope = $room->getRoomId();
195 $params[
'user'] = $chat_user->getUserId();
198 $message = json_encode( array(
199 'type' =>
'private_room_left',
200 'user' => $params[
'user'],
201 'sub' => $params[
'sub']
204 $connector->sendMessage( $room->getRoomId(), $message, array(
'public' => 1,
'sub' => $params[
'sub']) );
206 if( $room->userIsInPrivateRoom( $params[
'sub'], $params[
'user'] ) )
209 $query = http_build_query( $params );
210 $connector = $this->gui->getConnector();
211 $response = $connector->leavePrivateRoom( $scope,
$query );
212 $responseObject = json_decode( $response );
219 $room->unsubscribeUserFromPrivateRoom( $params[
'sub'], $params[
'user'] );
223 $response = json_encode( array(
'success' =>
true,
'message' =>
'was not in room') );
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
◆ listUsers()
ilChatroomPrivateRoomTask::listUsers |
( |
| ) |
|
◆ $gui
ilChatroomPrivateRoomTask::$gui |
|
private |
The documentation for this class was generated from the following file: