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 324 of file class.ilChatroomPrivateRoomTask.php.
References $data, $params, and ilChatroomUser\getUserId().
326 $data =
new stdClass();
330 $data->timestamp = date(
'c' );
331 $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(), exit, and ilUtil\stripSlashes().
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);
84 $response = json_encode(array(
86 'reason' =>
'empty title' 93 $connector = $this->gui->getConnector();
94 $response = $connector->createPrivateRoom($room, $title, $chat_user);
96 echo json_encode($response);
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
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 100 of file class.ilChatroomPrivateRoomTask.php.
References $_REQUEST, $ilUser, $params, $query, $tpl, ilChatroom\byObjectId(), and exit.
104 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
105 require_once
'Modules/Chatroom/classes/class.ilChatroomUser.php';
110 $user_id = $chat_user->getUserId();
114 $response = json_encode( array(
116 'reason' =>
'unkown room' 118 echo json_encode( $response );
121 else if( !$room->isOwnerOfPrivateRoom( $user_id,
$_REQUEST[
'sub'] ) && !$rbacsystem->checkAccess(
'moderate', $this->gui->getRefId()) )
123 $response = json_encode( array(
125 'reason' =>
'not owner of private room' 127 echo json_encode( $response );
131 $scope = $room->getRoomId();
134 $params[
'user'] = $chat_user->getUserId();
135 $params[
'id'] = $room->closePrivateRoom(
$_REQUEST[
'sub'], $chat_user, $settings);
137 $connector = $this->gui->getConnector();
139 if(
true || $responseObject->success ==
true )
141 $message = json_encode( array(
142 'type' =>
'private_room_deleted',
144 'timestamp' => date(
'c' ),
147 'id' => $responseObject->id,
150 'message' =>
'room deleted',
156 $connector->sendMessage( $room->getRoomId(), $message, array(
'public' => 1) );
159 $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 240 of file class.ilChatroomPrivateRoomTask.php.
References $_REQUEST, $ilUser, $params, $query, $tpl, ilChatroom\byObjectId(), ilChatroom\checkUserPermissions(), and exit.
249 $user_id = $chat_user->getUserId();
253 $response = json_encode( array(
255 'reason' =>
'unkown room' 257 echo json_encode( $response );
260 else if( !$room->isAllowedToEnterPrivateRoom( $chat_user->getUserId(),
$_REQUEST[
'sub'] ) )
262 $response = json_encode( array(
264 'reason' =>
'not allowed enter to private room' 267 echo json_encode( $response );
271 $scope = $room->getRoomId();
274 $params[
'user'] = $chat_user->getUserId();
276 $params[
'message'] = json_encode( array(
277 'type' =>
'private_room_entered',
283 $connector = $this->gui->getConnector();
284 $response = $connector->enterPrivateRoom( $scope,
$query );
285 $responseObject = json_decode( $response );
287 $message = json_encode( array(
288 'type' =>
'private_room_entered',
293 $connector->sendMessage( $room->getRoomId(), $message, array(
'public' => 1,
'sub' =>
$params[
'sub']) );
295 if( $responseObject->success ==
true )
297 $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 173 of file class.ilChatroomPrivateRoomTask.php.
References $_REQUEST, $ilUser, $params, $query, $tpl, ilChatroom\byObjectId(), and exit.
180 $user_id = $chat_user->getUserId();
181 $connector = $this->gui->getConnector();
185 $response = json_encode( array(
187 'reason' =>
'unkown room' 189 echo json_encode( $response );
192 else if( !$room->isSubscribed( $chat_user->getUserId() ) )
194 $response = json_encode( array(
196 'reason' =>
'not subscribed' 198 echo json_encode( $response );
202 $scope = $room->getRoomId();
205 $params[
'user'] = $chat_user->getUserId();
208 $message = json_encode( array(
209 'type' =>
'private_room_left',
214 $connector->sendMessage( $room->getRoomId(), $message, array(
'public' => 1,
'sub' =>
$params[
'sub']) );
216 if( $room->userIsInPrivateRoom(
$params[
'sub'],
$params[
'user'] ) )
220 $connector = $this->gui->getConnector();
221 $response = $connector->leavePrivateRoom( $scope,
$query );
222 $responseObject = json_decode( $response );
229 $room->unsubscribeUserFromPrivateRoom(
$params[
'sub'],
$params[
'user'] );
233 $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: