ILIAS  release_8 Revision v8.23
ilFileExporter 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 ilFileExporter:
+ Collaboration diagram for ilFileExporter:

Public Member Functions

 init ()
 Initialisation. More...
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get tail dependencies. More...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 Get xml representation. More...
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 
 setExport (ilExport $a_exp)
 
 getExport ()
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 init ()
 
 setExportDirectories (string $a_dir_relative, string $a_dir_absolute)
 
 getRelativeExportDirectory ()
 
 getAbsoluteExportDirectory ()
 
 getXmlExportHeadDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get tail dependencies. More...
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
 determineSchemaVersion (string $a_entity, string $a_target_release)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlExporter
static lookupExportDirectory (string $a_obj_type, int $a_obj_id, string $a_export_type='xml', string $a_entity="")
 
- Protected Attributes inherited from ilXmlExporter
string $dir_relative = ""
 
string $dir_absolute = ""
 
ilExport $exp
 

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 Exporter 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.ilFileExporter.php.

Member Function Documentation

◆ getValidSchemaVersions()

ilFileExporter::getValidSchemaVersions ( string  $a_entity)

Returns schema versions that the component can export to.

ILIAS chooses the first one, that has min/max constraints which fit to the target release. Please put the newest on top.

Definition at line 98 of file class.ilFileExporter.php.

98  : array
99  {
100  return array(
101  "4.1.0" => array(
102  "namespace" => "http://www.ilias.de/Modules/File/file/4_1",
103  "xsd_file" => "ilias_file_4_1.xsd",
104  "min" => "4.1.0",
105  "max" => "",
106  ),
107  );
108  }

◆ getXmlExportTailDependencies()

ilFileExporter::getXmlExportTailDependencies ( string  $a_entity,
string  $a_target_release,
array  $a_ids 
)

Get tail dependencies.

Parameters
stringentity
stringtarget release
arrayids
Returns
array array of array with keys "component", entity", "ids"

Definition at line 42 of file class.ilFileExporter.php.

42  : array
43  {
44  $md_ids = [];
45  foreach ($a_ids as $file_id) {
46  $md_ids[] = $file_id . ":0:file";
47  }
48 
49  return [
50  [
51  "component" => "Services/MetaData",
52  "entity" => "md",
53  "ids" => $md_ids,
54  ],
55  [
56  "component" => "Services/Object",
57  "entity" => "common",
58  "ids" => $a_ids
59  ]
60  ];
61  }

◆ getXmlRepresentation()

ilFileExporter::getXmlRepresentation ( string  $a_entity,
string  $a_schema_version,
string  $a_id 
)

Get xml representation.

Parameters
stringentity
stringtarget release
stringid
Returns
string xml string

Definition at line 71 of file class.ilFileExporter.php.

References ilFileXMLWriter\$CONTENT_ATTACH_COPY, $xml, ilObject\_lookupType(), ilXmlExporter\getAbsoluteExportDirectory(), ilXmlExporter\getRelativeExportDirectory(), and ilFileUtils\makeDirParents().

71  : string
72  {
73  $xml = '';
74  if (ilObject::_lookupType($a_id) == "file") {
75  $file = new ilObjFile($a_id, false);
76  $writer = new ilFileXMLWriter();
77  $writer->setFile($file);
78  $writer->setOmitHeader(true);
79  $writer->setAttachFileContents(ilFileXMLWriter::$CONTENT_ATTACH_COPY);
81  $writer->setFileTargetDirectories(
84  );
85  $writer->start();
86  $xml = $writer->getXml();
87  }
88 
89  return $xml;
90  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
Class ilObjFile.
$xml
Definition: metadata.php:351
static int $CONTENT_ATTACH_COPY
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ init()

ilFileExporter::init ( )

Initialisation.

Definition at line 30 of file class.ilFileExporter.php.

30  : void
31  {
32  }

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