ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
4 include_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 = array();
36  foreach ($a_ids as $file_id) {
37  $md_ids[] = $file_id . ":0:file";
38  }
39 
40  return array(
41  array(
42  "component" => "Services/MetaData",
43  "entity" => "md",
44  "ids" => $md_ids,
45  ),
46  );
47  }
48 
49 
59  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
60  {
61  include_once("./Modules/File/classes/class.ilObjFile.php");
62  include_once("./Modules/File/classes/class.ilFileXMLWriter.php");
63  if (ilObject::_lookupType($a_id) == "file") {
64  $file = new ilObjFile($a_id, false);
65  $writer = new ilFileXMLWriter();
66  $writer->setFile($file);
67  $writer->setOmitHeader(true);
68  $writer->setAttachFileContents(ilFileXMLWriter::$CONTENT_ATTACH_COPY);
70  $writer->setFileTargetDirectories(
73  );
74  $writer->start();
75  $xml .= $writer->getXml();
76  }
77 
78  return $xml;
79  }
80 
81 
89  public function getValidSchemaVersions($a_entity)
90  {
91  return array(
92  "4.1.0" => array(
93  "namespace" => "http://www.ilias.de/Modules/File/file/4_1",
94  "xsd_file" => "ilias_file_4_1.xsd",
95  "min" => "4.1.0",
96  "max" => "",
97  ),
98  );
99  }
100 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getRelativeExportDirectory()
Get relative export directory.
Exporter class for files.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
Xml Exporter class.
init()
Initialisation.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
getAbsoluteExportDirectory()
Get absolute export directory.
static _lookupType($a_id, $a_reference=false)
lookup object type
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
XML writer class.