ILIAS  release_8 Revision v8.24
class.ilFolderImporter.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
24{
25 private ?ilObject $folder = null;
26
27
28 public function init(): void
29 {
30 }
31
32 public function importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping): void
33 {
34 if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
35 $this->folder = ilObjectFactory::getInstanceByObjId((int) $new_id, false);
36 } elseif ($new_id = $a_mapping->getMapping('Services/Container', 'refs', '0')) {
37 $this->folder = ilObjectFactory::getInstanceByRefId((int) $new_id, false);
38 } elseif (!$this->folder instanceof ilObjFolder) {
39 $this->folder = new ilObjFolder();
40 $this->folder->create();
41 }
42
43 try {
44 $parser = new ilFolderXmlParser($this->folder, $a_xml);
45 $parser->start();
46 $a_mapping->addMapping('Modules/Folder', 'fold', $a_id, (string) $this->folder->getId());
47 } catch (ilSaxParserException $e) {
48 $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
49 }
50 }
51}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
XML parser for folder xml.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
SaxParserException thrown by ilSaxParser if property throwException is set.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...