ILIAS  release_8 Revision v8.23
ilFileImporter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilFileImporter:
+ Collaboration diagram for ilFileImporter:

Public Member Functions

 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 Import XML. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 
 setImport (ilImport $a_val)
 
 getImport ()
 
 init ()
 
 setInstallId (string $a_val)
 
 getInstallId ()
 
 setInstallUrl (string $a_val)
 
 getInstallUrl ()
 
 setSchemaVersion (string $a_val)
 
 getSchemaVersion ()
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setSkipEntities (array $a_val)
 
 getSkipEntities ()
 
 exportedFromSameInstallation ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 finalProcessing (ilImportMapping $a_mapping)
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 

Protected Attributes

ilObjFile $current_obj = null
 
- Protected Attributes inherited from ilXmlImporter
array $skip_entities = array()
 
ilImport $imp
 
string $install_id
 
string $install_url
 
string $schema_version
 
string $import_directory
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Importer class for files

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id

Definition at line 25 of file class.ilFileImporter.php.

Member Function Documentation

◆ importXmlRepresentation()

ilFileImporter::importXmlRepresentation ( string  $a_entity,
string  $a_id,
string  $a_xml,
ilImportMapping  $a_mapping 
)

Import XML.

Parameters

Definition at line 33 of file class.ilFileImporter.php.

References ilImportMapping\addMapping(), ilXmlImporter\getImportDirectory(), ilObjectFactory\getInstanceByObjId(), and ilImportMapping\getMapping().

33  : 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  }
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
+ Here is the call graph for this function:

Field Documentation

◆ $current_obj

ilObjFile ilFileImporter::$current_obj = null
protected

Definition at line 27 of file class.ilFileImporter.php.


The documentation for this class was generated from the following file: