ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilFolderImporter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Export/classes/class.ilXmlImporter.php");
5
16{
17 private $folder = null;
18
19
20 public function init()
21 {
22 }
23
30 public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
31 {
32 include_once './Modules/Folder/classes/class.ilObjFolder.php';
33 if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
34 $this->folder = ilObjectFactory::getInstanceByObjId($new_id, false);
35 } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', 0)) {
36 $this->folder = ilObjectFactory::getInstanceByRefId($new_id, false);
37 } elseif (!$this->folder instanceof ilObjFolder) {
38 $this->folder = new ilObjFolder();
39 $this->folder->create(true);
40 }
41
42 include_once './Modules/Folder/classes/class.ilFolderXmlParser.php';
43
44 try {
45 $parser = new ilFolderXmlParser($this->folder, $a_xml);
46 $parser->start();
47 $a_mapping->addMapping('Modules/Folder', 'fold', $a_id, $this->folder->getId());
48 } catch (ilSaxParserException $e) {
49 $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
50 } catch (ilWebLinkXMLParserException $e) {
51 $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
52 }
53 }
54}
$parser
Definition: BPMN2Parser.php:23
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
folder xml importer
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import XML.
XML parser for folder xml.
Class ilObjFolder.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
SaxParserException thrown by ilSaxParser if property throwException is set.
Xml importer class.