ILIAS  release_8 Revision v8.24
class.ilFileImporter.php
Go to the documentation of this file.
1<?php
26{
27 protected ?ilObjFile $current_obj = null;
28
33 public function importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping): void
34 {
35 // case i container
36 if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
37 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
38 $newObj->setVersion(0); // If $version is 0 from database, it will be set to 1 in ilObFile::doRead(). In ilFileXMLParser::handlerBeginTag $version will being increased. So its incorrectly 2. Set $version to 0 like case ii, non container
39 } else { // case ii, non container
40 $newObj = new ilObjFile();
41 $newObj->setNoMetaDataCreation(true); // #16545
42 $newObj->create(true);
43 }
44
45 $parser = new ilFileXMLParser($newObj, $a_xml);
46 $parser->setImportDirectory($this->getImportDirectory());
47 $parser->startParsing();
48
49 $newObj->createProperties();
50
51 $parser->setFileContents();
52 $this->current_obj = $newObj;
53
54 $newObj->update(); // this is necessary for case ii (e.g. wiki import)
55
56 $a_mapping->addMapping("Modules/File", "file", $a_id, $newObj->getId());
57 $a_mapping->addMapping(
58 "Services/MetaData",
59 "md",
60 $a_id . ":0:file",
61 $newObj->getId() . ":0:file"
62 );
63 }
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)
Import 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)
Class ilObjFile.
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...