ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilFolderImporter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 private ?ilObject $folder = null;
29
30
31 public function init(): void
32 {
33 }
34
35 public function importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping): void
36 {
37 if ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'objs', $a_id)) {
38 $this->folder = ilObjectFactory::getInstanceByObjId((int) $new_id, false);
39 } elseif ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'refs', '0')) {
40 $this->folder = ilObjectFactory::getInstanceByRefId((int) $new_id, false);
41 } elseif (!$this->folder instanceof ilObjFolder) {
42 $this->folder = new ilObjFolder();
43 $this->folder->create();
44 }
45
46 try {
47 $parser = new ilFolderXmlParser($this->folder, $a_xml);
48 $parser->start();
49 $a_mapping->addMapping('components/ILIAS/Folder', 'fold', $a_id, (string) $this->folder->getId());
50 } catch (ilSaxParserException $e) {
51 $GLOBALS['ilLog']->write(__METHOD__ . ': Parsing failed with message, "' . $e->getMessage() . '".');
52 }
53 }
54}
folder xml importer
importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
XML parser for folder xml.
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)
Class ilObjFolder.
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
Class ilObject Basic functions for all objects.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Xml importer class.
$GLOBALS["DIC"]
Definition: wac.php:54