19 declare(strict_types=1);
56 $this->room->setSetting(
'object_id', $this->chat->getId());
60 $this->
setXMLContent(
'<?xml version="1.0" encoding="utf-8"?>' . $a_xml_data);
65 $this->import_install_id =
$id;
80 xml_set_object($a_xml_parser, $this);
81 xml_set_element_handler($a_xml_parser, [$this,
'handlerBeginTag'], [$this,
'handlerEndTag']);
82 xml_set_character_data_handler($a_xml_parser, [$this,
'handlerCharacterData']);
85 public function handlerBeginTag($a_xml_parser,
string $a_name, array $a_attribs): void
89 $this->in_sub_rooms =
true;
93 $this->in_messages =
true;
100 $this->cdata = trim($this->cdata);
104 if ($this->in_sub_rooms) {
116 $this->room->setSetting(
'online_status', (
int) $this->cdata);
119 case 'AllowAnonymousAccess':
120 $this->room->setSetting(
'allow_anonymous', (
int) $this->cdata);
123 case 'AllowCustomUsernames':
124 $this->room->setSetting(
'allow_custom_usernames', (
int) $this->cdata);
127 case 'EnableHistory':
128 $this->room->setSetting(
'enable_history', (
int) $this->cdata);
131 case 'RestrictHistory':
132 $this->room->setSetting(
'restrict_history', (
int) $this->cdata);
135 case 'PrivateRoomsEnabled':
136 $this->room->setSetting(
'private_rooms_enabled', (
int) $this->cdata);
139 case 'DisplayPastMessages':
140 $this->room->setSetting(
'display_past_msgs', (
int) $this->cdata);
143 case 'AutoGeneratedUsernameSchema':
148 $this->exportRoomId = (
int) $this->cdata;
152 $this->exportSubRoomId = (
int) $this->cdata;
156 $this->owner = (
int) $this->cdata;
160 $this->closed = (
int) $this->cdata;
164 $this->
public = (
int) $this->cdata;
167 case 'CreatedTimestamp':
168 $this->timestamp = (
int) $this->cdata;
171 case 'PrivilegedUserId':
172 $this->userIds[] = (
int) $this->cdata;
178 $user->setId((
int) $this->owner);
181 $subRoomId = $this->room->addPrivateRoom(
185 'public' => (
bool) $this->
public,
186 'created' => (
int) $this->timestamp,
187 'closed' => (
bool) $this->closed
191 foreach ($this->userIds as $userId) {
192 $this->room->inviteUserToPrivateRoom($userId, $subRoomId);
198 $this->exportSubRoomId = 0;
203 $this->timestamp = 0;
208 $this->in_sub_rooms =
false;
217 $message = json_decode($this->message,
true, 512, JSON_THROW_ON_ERROR);
219 is_array($message) &&
220 (0 === $this->exportSubRoomId || array_key_exists($this->exportSubRoomId, $this->subRoomIdMapping))
222 $message[
'roomId'] = $this->room->getRoomId();
224 $message[
'sub'] = $message[
'subRoomId'];
227 $this->room->addHistoryEntry($message);
231 $this->timestamp = 0;
232 $this->exportSubRoomId = 0;
236 $this->in_messages =
false;
240 $this->chat->update();
242 $this->room->setSetting(
'online_status', 0);
252 if ($a_data !==
"\n") {
253 $this->cdata .= preg_replace(
"/\t+/",
' ', $a_data);
string $import_install_id
setHandlers($a_xml_parser)
handlerCharacterData($a_xml_parser, string $a_data)
setImportInstallId(?string $id)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
handlerEndTag($a_xml_parser, string $a_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
handlerBeginTag($a_xml_parser, string $a_name, array $a_attribs)
__construct(ilObjChatroom $chat, string $a_xml_data)
__construct(Container $dic, ilPlugin $plugin)
static byObjectId(int $object_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class ilChatroomXMLParser.
setXMLContent(string $a_xml_content)