1<?php
2/* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Export/classes/class.ilXmlImporter.php';
5
6/**
7 * Class ilChatroomImporter
8 */
9class ilChatroomImporter extends ilXmlImporter
10{
11    /**
12     * Import XML
13     *
14     * @param
15     * @return
16     */
17    public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
18    {
19        require_once 'Modules/Chatroom/classes/class.ilObjChatroom.php';
20
21        if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
22            $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
23        } else {
24            $newObj = new ilObjChatroom();
25            $newObj->setType('chtr');
26            $newObj->create();
27        }
28
29        require_once 'Modules/Chatroom/classes/class.ilChatroomXMLParser.php';
30        $parser = new ilChatroomXMLParser($newObj, $a_xml);
31        $parser->setImportInstallId($this->getInstallId());
32        $parser->startParsing();
33
34        $a_mapping->addMapping('Modules/Chatroom', 'chtr', $a_id, $newObj->getId());
35    }
36}
37