19 declare(strict_types=1);
36 $this->room->setSetting(
'object_id', $this->chat->getId());
46 $this->
xmlElement(
'ObjId', null, (
string) $this->chat->getId());
47 $this->
xmlElement(
'RoomId', null, (
string) $this->room->getRoomId());
48 $this->
xmlElement(
'Title', null, $this->chat->getTitle());
49 $this->
xmlElement(
'Description', null, $this->chat->getDescription());
50 $this->
xmlElement(
'OnlineStatus', null, (
string) ((
int) $this->room->getSetting(
'online_status')));
51 $this->
xmlElement(
'AllowAnonymousAccess', null, (
string) ((
int) $this->room->getSetting(
'allow_anonymous')));
52 $this->
xmlElement(
'AllowCustomUsernames', null, (
string) ((
int) $this->room->getSetting(
'allow_custom_usernames')));
53 $this->
xmlElement(
'EnableHistory', null, (
string) ((
int) $this->room->getSetting(
'enable_history')));
54 $this->
xmlElement(
'RestrictHistory', null, (
string) ((
int) $this->room->getSetting(
'restrict_history')));
55 $this->
xmlElement(
'PrivateRoomsEnabled', null, (
string) ((
int) $this->room->getSetting(
'private_rooms_enabled')));
56 $this->
xmlElement(
'DisplayPastMessages', null, (
string) ((
int) $this->room->getSetting(
'display_past_msgs')));
57 $this->
xmlElement(
'AutoGeneratedUsernameSchema', null, (
string) $this->room->getSetting(
'autogen_usernames'));
59 if ($this->room->getRoomId() > 0) {
68 $privateRooms = $this->room->getPrivateRooms();
69 if (count($privateRooms) > 0) {
71 foreach ($privateRooms as $privateRoom) {
73 $this->
xmlElement(
'SubRoomId', null, (
string) ((
int) $privateRoom[
'proom_id']));
74 $this->
xmlElement(
'Title', null, (
string) $privateRoom[
'title']);
75 $this->
xmlElement(
'Owner', null, (
string) ((
int) $privateRoom[
'owner']));
76 $this->
xmlElement(
'Closed', null, (
string) ((
int) $privateRoom[
'closed']));
77 $this->
xmlElement(
'Public', null, (
string) ((
int) $privateRoom[
'is_public']));
78 $this->
xmlElement(
'CreatedTimestamp', null, (
string) ((
int) $privateRoom[
'created']));
80 foreach ($this->room->getPrivilegedUsersForPrivateRoom((
int) $privateRoom[
'proom_id']) as $usrId) {
81 $this->
xmlElement(
'PrivilegedUserId', null, (
string) $usrId);
89 $history = $this->room->getHistory(null, null, null, null,
false);
90 if (count($history) > 0) {
92 foreach ($history as $entry) {
94 $this->
xmlElement(
'SubRoomId', null, (
string) ((
int) $entry[
'sub_room']));
95 $this->
xmlElement(
'Body', null, json_encode($entry[
'message'], JSON_THROW_ON_ERROR));
96 $this->
xmlElement(
'CreatedTimestamp', null, (
string) ((
int) $entry[
'timestamp']));
106 return str_replace(
'',
'', $this->
xmlDumpMem(
false));
Class ilChatroomXMLWriter.
__construct(ilObjChatroom $chat)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlEndTag(string $tag)
Writes an endtag.
__construct(Container $dic, ilPlugin $plugin)
static byObjectId(int $object_id)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlDumpMem(bool $format=true)
Returns xml document from memory.