4 require_once
'Services/Xml/classes/class.ilXmlWriter.php';
5 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
33 $this->room->setSetting(
'object_id', $this->chat->getId());
36 parent::__construct();
46 $this->
xmlElement(
'ObjId', null, (
int) $this->chat->getId());
47 $this->
xmlElement(
'RoomId', null, (
int) $this->room->getRoomId());
48 $this->
xmlElement(
'Title', null, $this->chat->getTitle());
49 $this->
xmlElement(
'Description', null, $this->chat->getDescription());
50 $this->
xmlElement(
'OnlineStatus', null, (
int) $this->room->getSetting(
'online_status'));
51 $this->
xmlElement(
'AllowAnonymousAccess', null, (
int) $this->room->getSetting(
'allow_anonymous'));
52 $this->
xmlElement(
'AllowCustomUsernames', null, (
int) $this->room->getSetting(
'allow_custom_usernames'));
53 $this->
xmlElement(
'EnableHistory', null, (
int) $this->room->getSetting(
'enable_history'));
54 $this->
xmlElement(
'RestrictHistory', null, (
int) $this->room->getSetting(
'restrict_history'));
55 $this->
xmlElement(
'PrivateRoomsEnabled', null, (
int) $this->room->getSetting(
'private_rooms_enabled'));
56 $this->
xmlElement(
'DisplayPastMessages', null, (
int) $this->room->getSetting(
'display_past_msgs'));
57 $this->
xmlElement(
'AutoGeneratedUsernameSchema', null, $this->room->getSetting(
'autogen_usernames'));
59 if ((
int) $this->room->getRoomId() > 0) {
71 $privateRooms = $this->room->getPrivateRooms();
72 if (count($privateRooms) > 0) {
74 foreach ($privateRooms as $privateRoom) {
76 $this->
xmlElement(
'SubRoomId', null, (
int) $privateRoom[
'proom_id']);
77 $this->
xmlElement(
'Title', null, $privateRoom[
'title']);
78 $this->
xmlElement(
'Owner', null, (
int) $privateRoom[
'owner']);
79 $this->
xmlElement(
'Closed', null, (
int) $privateRoom[
'closed']);
80 $this->
xmlElement(
'Public', null, (
int) $privateRoom[
'is_public']);
81 $this->
xmlElement(
'CreatedTimestamp', null, (
int) $privateRoom[
'created']);
83 foreach ($this->room->getPrivilegedUsersForPrivateRoom((
int) $privateRoom[
'proom_id']) as $usrId) {
84 $this->
xmlElement(
'PrivilegedUserId', null, $usrId);
92 $history = $this->room->getHistory(null, null, null, null,
false);
93 if (count($history) > 0) {
95 foreach ($history as $entry) {
97 $this->
xmlElement(
'SubRoomId', null, (
int) $entry[
'sub_room']);
98 $this->
xmlElement(
'Body', null, json_encode($entry[
'message']));
99 $this->
xmlElement(
'CreatedTimestamp', null, (
int) $entry[
'timestamp']);
112 return str_replace(
'',
'', $this->
xmlDumpMem(
false));
Class ilChatroomXMLWriter.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlDumpMem($format=true)
Returns xml document from memory.
__construct(ilObjChatroom $chat)
ilChatroomXMLWriter constructor.
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.