ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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 26 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 34 of file class.ilFileImporter.php.

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

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


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