ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilFileExporter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Export/classes/class.ilXmlExporter.php");
5
14{
15
19 public function init()
20 {
21 }
22
23
33 public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
34 {
35 $md_ids = [];
36 foreach ($a_ids as $file_id) {
37 $md_ids[] = $file_id . ":0:file";
38 }
39
40 return [
41 [
42 "component" => "Services/MetaData",
43 "entity" => "md",
44 "ids" => $md_ids,
45 ],
46 [
47 "component" => "Services/Object",
48 "entity" => "common",
49 "ids" => $a_ids
50 ]
51 ];
52 }
53
54
64 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
65 {
66 include_once("./Modules/File/classes/class.ilObjFile.php");
67 include_once("./Modules/File/classes/class.ilFileXMLWriter.php");
68 if (ilObject::_lookupType($a_id) == "file") {
69 $file = new ilObjFile($a_id, false);
70 $writer = new ilFileXMLWriter();
71 $writer->setFile($file);
72 $writer->setOmitHeader(true);
73 $writer->setAttachFileContents(ilFileXMLWriter::$CONTENT_ATTACH_COPY);
75 $writer->setFileTargetDirectories(
78 );
79 $writer->start();
80 $xml .= $writer->getXml();
81 }
82
83 return $xml;
84 }
85
86
94 public function getValidSchemaVersions($a_entity)
95 {
96 return array(
97 "4.1.0" => array(
98 "namespace" => "http://www.ilias.de/Modules/File/file/4_1",
99 "xsd_file" => "ilias_file_4_1.xsd",
100 "min" => "4.1.0",
101 "max" => "",
102 ),
103 );
104 }
105}
An exception for terminatinating execution or to throw for unit testing.
Exporter class for files.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
init()
Initialisation.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
XML writer class.
Class ilObjFile.
static _lookupType($a_id, $a_reference=false)
lookup object type
static makeDirParents($a_dir)
Create a new directory and all parent directories.
Xml Exporter class.
getRelativeExportDirectory()
Get relative export directory.
getAbsoluteExportDirectory()
Get absolute export directory.
$xml
Definition: metadata.php:332