ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
11 abstract 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 
93  public function getRelativeExportDirectory()
94  {
95  return $this->dir_relative;
96  }
97 
103  public function getAbsoluteExportDirectory()
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 }
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
getRelativeExportDirectory()
Get relative export directory.
const ILIAS_VERSION_NUMERIC
static lookupExportDirectory($a_obj_type, $a_obj_id, $a_export_type='xml', $a_entity="")
export directory lookup
Xml Exporter class.
setExport(ilExport $a_exp)
Set export object.
getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
Get head dependencies.
getAbsoluteExportDirectory()
Get absolute export directory.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
Create styles array
The data for the language used.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
static getDataDir()
get data directory (outside webspace)
setExportDirectories($a_dir_relative, $a_dir_absolute)
Export directories.
__construct()
Constructor.
determineSchemaVersion($a_entity, $a_target_release)
Determine schema version.
getExport()
Get export.