4 require_once
'Services/Xml/classes/class.ilSaxParser.php';
5 require_once
'Modules/Chatroom/classes/class.ilChatroomUser.php';
6 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
101 parent::__construct();
108 $this->room->setSetting(
'object_id', $this->chat->getId());
112 $this->
setXMLContent(
'<?xml version="1.0" encoding="utf-8"?>' . $a_xml_data);
120 $this->import_install_id =
$id;
144 xml_set_object($a_xml_parser, $this);
145 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
146 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
158 $this->in_sub_rooms =
true;
162 $this->in_messages =
true;
173 $this->cdata = trim($this->cdata);
177 if ($this->in_sub_rooms) {
180 $this->chat->setTitle($this->cdata);
185 $this->chat->setDescription($this->cdata);
189 $this->room->setSetting(
'online_status', (
int) $this->cdata);
192 case 'AllowAnonymousAccess':
193 $this->room->setSetting(
'allow_anonymous', (
int) $this->cdata);
196 case 'AllowCustomUsernames':
197 $this->room->setSetting(
'allow_custom_usernames', (
int) $this->cdata);
200 case 'EnableHistory':
201 $this->room->setSetting(
'enable_history', (
int) $this->cdata);
204 case 'RestrictHistory':
205 $this->room->setSetting(
'restrict_history', (
int) $this->cdata);
208 case 'PrivateRoomsEnabled':
209 $this->room->setSetting(
'private_rooms_enabled', (
int) $this->cdata);
212 case 'DisplayPastMessages':
213 $this->room->setSetting(
'display_past_msgs', (
int) $this->cdata);
216 case 'AutoGeneratedUsernameSchema':
217 $this->room->setSetting(
'autogen_usernames', $this->cdata);
221 $this->exportRoomId = (int) $this->cdata;
225 $this->exportSubRoomId = (int) $this->cdata;
229 $this->owner = (int) $this->cdata;
233 $this->closed = (int) $this->cdata;
237 $this->
public = (int) $this->cdata;
240 case 'CreatedTimestamp':
241 $this->timestamp = (int) $this->cdata;
244 case 'PrivilegedUserId':
245 $this->userIds[] = (int) $this->cdata;
251 $user->setId($this->owner);
254 $subRoomId = $this->room->addPrivateRoom(
258 'public' => (
bool) $this->
public,
259 'created' => (
int) $this->timestamp,
260 'closed' => (
bool) $this->closed
264 foreach ($this->userIds as $userId) {
265 $this->room->inviteUserToPrivateRoom($userId, $subRoomId);
271 $this->exportSubRoomId = 0;
276 $this->timestamp = 0;
277 $this->userIds =
array();
281 $this->in_sub_rooms =
false;
290 $message = json_decode($this->message,
true);
293 (!$this->exportSubRoomId || array_key_exists($this->exportSubRoomId, $this->subRoomIdMapping))
295 $message[
'roomId'] = $this->room->getRoomId();
299 $this->room->addHistoryEntry(
$message);
303 $this->timestamp = 0;
304 $this->exportSubRoomId = 0;
308 $this->in_messages =
false;
312 $this->chat->update();
314 $this->room->setSetting(
'online_status', 0);
328 if ($a_data !=
"\n") {
329 $this->cdata .= preg_replace(
"/\t+/",
" ", $a_data);
handlerCharacterData($a_xml_parser, $a_data)
setHandlers($a_xml_parser)
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handlerEndTag($a_xml_parser, $a_name)
if(!array_key_exists('StateId', $_REQUEST)) $id
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
Create styles array
The data for the language used.
__construct($chat, $a_xml_data)
Constructor.
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
Class ilChatroomXMLParser.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
setXMLContent($a_xml_content)