ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilXmlExporter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11abstract class ilXmlExporter
12{
13 protected $dir_relative;
14 protected $dir_absolute;
15 protected $exp;
16
23 public function __construct()
24 {
25 }
26
32 public function setExport(ilExport $a_exp)
33 {
34 $this->exp = $a_exp;
35 }
36
42 public function getExport()
43 {
44 return $this->exp;
45 }
46
51 public static function lookupExportDirectory($a_obj_type, $a_obj_id, $a_export_type = 'xml', $a_entity = "")
52 {
53 $ent = ($a_entity == "")
54 ? ""
55 : "_" . $a_entity;
56
57 if ($a_export_type == 'xml') {
58 return ilUtil::getDataDir() . "/" . $a_obj_type . $ent . "_data" . "/" . $a_obj_type . "_" . $a_obj_id . "/export";
59 }
60 return ilUtil::getDataDir() . "/" . $a_obj_type . $ent . "_data" . "/" . $a_obj_type . "_" . $a_obj_id . "/export_" . $a_export_type;
61 }
62
71 abstract public function getXmlRepresentation($a_entity, $a_schema_version, $a_id);
72
73 abstract public function init();
74
75
82 public function setExportDirectories($a_dir_relative, $a_dir_absolute)
83 {
84 $this->dir_relative = $a_dir_relative;
85 $this->dir_absolute = $a_dir_absolute;
86 }
87
94 {
96 }
97
104 {
105 return $this->dir_absolute;
106 }
107
116 public function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
117 {
118 return array();
119 }
120
129 public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
130 {
131 return array();
132 }
133
150 abstract public function getValidSchemaVersions($a_entity);
151
158 final public function determineSchemaVersion($a_entity, $a_target_release)
159 {
160 $svs = $this->getValidSchemaVersions($a_entity);
161 $found = false;
162 foreach ($svs as $k => $sv) {
163 if (!$found) {
164 if (version_compare($sv["min"], ILIAS_VERSION_NUMERIC, "<=")
165 && ($sv["max"] == "" || version_compare($sv["max"], ILIAS_VERSION_NUMERIC, ">="))) {
166 $rsv = $sv;
167 $rsv["schema_version"] = $k;
168 $found = true;
169 }
170 }
171 }
172
173 return $rsv;
174 }
175}
An exception for terminatinating execution or to throw for unit testing.
static getDataDir()
get data directory (outside webspace)
Xml Exporter class.
getExport()
Get export.
setExport(ilExport $a_exp)
Set export object.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
getRelativeExportDirectory()
Get relative export directory.
determineSchemaVersion($a_entity, $a_target_release)
Determine schema version.
setExportDirectories($a_dir_relative, $a_dir_absolute)
Export directories.
getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
Get head dependencies.
__construct()
Constructor.
static lookupExportDirectory($a_obj_type, $a_obj_id, $a_export_type='xml', $a_entity="")
export directory lookup
getAbsoluteExportDirectory()
Get absolute export directory.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
const ILIAS_VERSION_NUMERIC