ILIAS  release_8 Revision v8.24
class.ilFileExporter.php
Go to the documentation of this file.
1<?php
26{
30 public function init(): void
31 {
32 }
33
34
42 public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): 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 }
62
63
71 public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): 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 }
91
92
98 public function getValidSchemaVersions(string $a_entity): 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 }
109}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
Get xml representation.
init()
Initialisation.
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$xml
Definition: metadata.php:351