ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilFileExporter Class Reference

Exporter class for files. 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)
 

Protected Member Functions

 prepareExportDirectories (ilFileXMLWriter $writer)
 

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
ilExport $exp
 

Detailed Description

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 28 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.

Reimplemented from ilXmlExporter.

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

109 : array
110 {
111 return [
112 "4.1.0" => [
113 "namespace" => "http://www.ilias.de/Modules/File/file/4_1",
114 "xsd_file" => "ilias_file_4_1.xsd",
115 "min" => "4.1.0",
116 "max" => ""
117 ]
118 ];
119 }

◆ 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"

Reimplemented from ilXmlExporter.

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

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

◆ 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

Reimplemented from ilXmlExporter.

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

73 : string
74 {
75 $xml = '';
76 if (ilObject::_lookupType((int) $a_id) === 'file') {
77 $file = new ilObjFile((int) $a_id, false);
78 $writer = new ilFileXMLWriter();
79 $writer->setFile($file);
80 $writer->setOmitHeader(true);
81 $writer->setAttachFileContents(ilFileXMLWriter::$CONTENT_ATTACH_COPY);
82 $this->prepareExportDirectories($writer);
83 $writer->start();
84 $xml = $writer->getXml();
85 }
86 return $xml;
87 }
prepareExportDirectories(ilFileXMLWriter $writer)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static int $CONTENT_ATTACH_COPY
Class ilObjFile.
static _lookupType(int $id, bool $reference=false)

References ilFileXMLWriter\$CONTENT_ATTACH_COPY, ilObject\_lookupType(), and prepareExportDirectories().

+ Here is the call graph for this function:

◆ init()

ilFileExporter::init ( )

Initialisation.

Reimplemented from ilXmlExporter.

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

33 : void
34 {
35 }

◆ prepareExportDirectories()

ilFileExporter::prepareExportDirectories ( ilFileXMLWriter  $writer)
protected

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

91 : void {
92 $path = str_replace('\\', '/', $this->exp->getExportDirInContainer());
93 $segments = explode('/', $path);
94 array_shift($segments);
95 $target_dir_relative = implode('/', $segments) . '/expDir_1';
96 $target_dir_absolute = rtrim($this->getAbsoluteExportDirectory(), '/') . '/' . $target_dir_relative;
97 ilFileUtils::makeDirParents($target_dir_absolute);
99 $target_dir_relative,
100 $target_dir_absolute
101 );
102 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
setFileTargetDirectories(?string $a_rel, ?string $a_abs)
Set file target directories.
$path
Definition: ltiservices.php:30

Referenced by getXmlRepresentation().

+ Here is the caller graph for this function:

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