ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilFileExporter.php
Go to the documentation of this file.
1 <?php
26 {
30  public function init(): void
31  {
32  }
33 
41  public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
42  {
43  $md_ids = [];
44  foreach ($a_ids as $file_id) {
45  $md_ids[] = $file_id . ":0:file";
46  }
47 
48  return [
49  [
50  "component" => "Services/MetaData",
51  "entity" => "md",
52  "ids" => $md_ids,
53  ],
54  [
55  "component" => "Services/Object",
56  "entity" => "common",
57  "ids" => $a_ids
58  ]
59  ];
60  }
61 
69  public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
70  {
71  $xml = '';
72  if (ilObject::_lookupType($a_id) == "file") {
73  $file = new ilObjFile($a_id, false);
74  $writer = new ilFileXMLWriter();
75  $writer->setFile($file);
76  $writer->setOmitHeader(true);
77  $writer->setAttachFileContents(ilFileXMLWriter::$CONTENT_ATTACH_COPY);
79  $writer->setFileTargetDirectories(
82  );
83  $writer->start();
84  $xml = $writer->getXml();
85  }
86 
87  return $xml;
88  }
89 
95  public function getValidSchemaVersions(string $a_entity): array
96  {
97  return [
98  "4.1.0" => [
99  "namespace" => "http://www.ilias.de/Modules/File/file/4_1",
100  "xsd_file" => "ilias_file_4_1.xsd",
101  "min" => "4.1.0",
102  "max" => ""
103  ]
104  ];
105  }
106 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
Get xml representation.
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...
init()
Initialisation.
Class ilObjFile.
static int $CONTENT_ATTACH_COPY
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.
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
static _lookupType(int $id, bool $reference=false)