ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  }
27 
33  function setExport(ilExport $a_exp)
34  {
35  $this->exp = $a_exp;
36  }
37 
43  function getExport()
44  {
45  return $this->exp;
46  }
47 
52  public static function lookupExportDirectory($a_obj_type, $a_obj_id, $a_export_type = 'xml', $a_entity = "")
53  {
54  $ent = ($a_entity == "")
55  ? ""
56  : "_".$a_entity;
57 
58  if($a_export_type == 'xml')
59  {
60  return ilUtil::getDataDir()."/".$a_obj_type.$ent."_data"."/".$a_obj_type."_".$a_obj_id."/export";
61  }
62  return ilUtil::getDataDir()."/".$a_obj_type.$ent."_data"."/".$a_obj_type."_".$a_obj_id."/export_".$a_export_type;
63  }
64 
73  abstract public function getXmlRepresentation($a_entity, $a_schema_version, $a_id);
74 
75  abstract public function init();
76 
77 
84  public function setExportDirectories($a_dir_relative, $a_dir_absolute)
85  {
86  $this->dir_relative = $a_dir_relative;
87  $this->dir_absolute = $a_dir_absolute;
88  }
89 
95  public function getRelativeExportDirectory()
96  {
97  return $this->dir_relative;
98  }
99 
105  public function getAbsoluteExportDirectory()
106  {
107  return $this->dir_absolute;
108  }
109 
118  public function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
119  {
120  return array();
121  }
122 
131  public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
132  {
133  return array();
134  }
135 
152  abstract public function getValidSchemaVersions($a_entity);
153 
160  public final function determineSchemaVersion($a_entity, $a_target_release)
161  {
162  $svs = $this->getValidSchemaVersions($a_entity);
163  $found = false;
164  foreach ($svs as $k => $sv)
165  {
166  if (!$found)
167  {
168  if (version_compare($sv["min"], ILIAS_VERSION_NUMERIC, "<=")
169  && ($sv["max"] == "" || version_compare($sv["max"], ILIAS_VERSION_NUMERIC, ">=")))
170  {
171  $rsv = $sv;
172  $rsv["schema_version"] = $k;
173  $found = true;
174  }
175  }
176  }
177 
178  return $rsv;
179  }
180 }
181 ?>
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.