ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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().

38  : void {
39  // case i container
40  if ($new_id = $a_mapping->getMapping('components/ILIAS/Container', 'objs', $a_id)) {
41  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
42  $newObj->setVersion(
43  0
44  ); // 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
45  } else { // case ii, non container
46  $newObj = new ilObjFile();
47  $newObj->setNoMetaDataCreation(true); // #16545
48  $newObj->create(true);
49  }
50 
51  $parser = new ilFileXMLParser($newObj, $a_xml);
52  $parser->setImportDirectory($this->getImportDirectory());
53  $parser->startParsing();
54 
55  $newObj->createProperties();
56 
57  $parser->setFileContents();
58  $this->current_obj = $newObj;
59 
60  $newObj->update(); // this is necessary for case ii (e.g. wiki import)
61 
62  $a_mapping->addMapping("components/ILIAS/File", "file", $a_id, $newObj->getId());
63  $a_mapping->addMapping(
64  "components/ILIAS/MetaData",
65  "md",
66  $a_id . ":0:file",
67  $newObj->getId() . ":0:file"
68  );
69  }
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: