ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilFileImporter Class Reference

Importer class for files. More...

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

Public Member Functions

 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import XML. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor. More...
 
 setImport ($a_val)
 Set import. More...
 
 getImport ()
 Get import. More...
 
 init ()
 Init. More...
 
 setInstallId ($a_val)
 Set installation id. More...
 
 getInstallId ()
 Get installation id. More...
 
 setInstallUrl ($a_val)
 Set installation url. More...
 
 getInstallUrl ()
 Get installation url. More...
 
 setSchemaVersion ($a_val)
 Set schema version. More...
 
 getSchemaVersion ()
 Get schema version. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setSkipEntities ($a_val)
 Set skip entities. More...
 
 getSkipEntities ()
 Get skip entities. More...
 
 exportedFromSameInstallation ()
 Is exporting and importing installation identical? More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 Called after all container objects have been implemented. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilXmlImporter
 $skip_entities = array()
 
 $imp
 

Detailed Description

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 13 of file class.ilFileImporter.php.

Member Function Documentation

◆ importXmlRepresentation()

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

Import XML.

Parameters

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

References $parser, ilXmlImporter\getImportDirectory(), and ilObjectFactory\getInstanceByObjId().

24  {
25  include_once './Modules/File/classes/class.ilObjFile.php';
26 
27  // case i container
28  if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
29  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
30  $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
31  } else { // case ii, non container
32  $newObj = new ilObjFile();
33  $newObj->setNoMetaDataCreation(true); // #16545
34  $newObj->create(true);
35  }
36 
37  include_once("./Modules/File/classes/class.ilFileXMLParser.php");
38  $parser = new ilFileXMLParser($newObj, $a_xml);
39  $parser->setImportDirectory($this->getImportDirectory());
40  $parser->startParsing();
41 
42  if ($newObj instanceof ilObjFile) {
43  $newObj->setMaxVersion($newObj->getVersion());
44  }
45 
46  $newObj->createProperties();
47 
48  $parser->setFileContents();
49  $this->current_obj = $newObj;
50 
51  $newObj->update(); // this is necessary for case ii (e.g. wiki import)
52 
53  $a_mapping->addMapping("Modules/File", "file", $a_id, $newObj->getId());
54  $a_mapping->addMapping(
55  "Services/MetaData",
56  "md",
57  $a_id . ":0:file",
58  $newObj->getId() . ":0:file"
59  );
60  }
getImportDirectory()
Get import directory.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
$parser
Definition: BPMN2Parser.php:23
+ Here is the call graph for this function:

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