ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilXmlExporter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27abstract class ilXmlExporter
28{
29 protected ilExport $exp;
30
31 public function __construct()
32 {
33 }
34
35 public function setExport(ilExport $a_exp): void
36 {
37 $this->exp = $a_exp;
38 }
39
40 public function getExport(): ilExport
41 {
42 return $this->exp;
43 }
44
45 public static function lookupExportDirectory(
46 string $a_obj_type,
47 int $a_obj_id,
48 string $a_export_type = 'xml',
49 string $a_entity = ""
50 ): string {
51 $ent = ($a_entity == "")
52 ? ""
53 : "_" . $a_entity;
54
55 if ($a_export_type == 'xml') {
56 return ilFileUtils::getDataDir() . "/" . $a_obj_type . $ent . "_data" . "/" . $a_obj_type . "_" . $a_obj_id . "/export";
57 }
58 return ilFileUtils::getDataDir() . "/" . $a_obj_type . $ent . "_data" . "/" . $a_obj_type . "_" . $a_obj_id . "/export_" . $a_export_type;
59 }
60
61 abstract public function getXmlRepresentation(
62 string $a_entity,
63 string $a_schema_version,
64 string $a_id
65 ): string;
66
67 abstract public function init(): void;
68
69 public function setExportDirectories(string $a_dir_relative, string $a_dir_absolute): void
70 {
71 $this->exp->setExportDirectories($a_dir_relative, $a_dir_absolute);
72 }
73
74 public function getRelativeExportDirectory(): string
75 {
76 return $this->exp->getRelativeExportDirectory();
77 }
78
79 public function getAbsoluteExportDirectory(): string
80 {
81 return $this->exp->getAbsoluteExportDirectory();
82 }
83
89 string $a_entity,
90 string $a_target_release,
91 array $a_ids
92 ): array {
93 return [];
94 }
95
101 string $a_entity,
102 string $a_target_release,
103 array $a_ids
104 ): array {
105 return array();
106 }
107
120 abstract public function getValidSchemaVersions(string $a_entity): array;
121
122 final public function determineSchemaVersion(
123 string $a_entity,
124 string $a_target_release
125 ): array {
126 $svs = $this->getValidSchemaVersions($a_entity);
127 $rsv = [];
128 foreach ($svs as $k => $sv) {
129 $min_version = $sv["min"] ?? "";
130 $max_version = $sv["max"] ?? "";
131 if (
132 ($min_version === "" || version_compare($min_version, ILIAS_VERSION_NUMERIC, "<=")) &&
133 ($max_version === "" || version_compare($max_version, ILIAS_VERSION_NUMERIC, ">="))
134 ) {
135 $rsv = $sv;
136 $rsv["schema_version"] = $k;
137 break;
138 }
139 }
140 return $rsv;
141 }
142}
static getDataDir()
get data directory (outside webspace)
Xml Exporter class.
setExport(ilExport $a_exp)
static lookupExportDirectory(string $a_obj_type, int $a_obj_id, string $a_export_type='xml', string $a_entity="")
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
determineSchemaVersion(string $a_entity, string $a_target_release)
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
getXmlExportHeadDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get head dependencies.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
setExportDirectories(string $a_dir_relative, string $a_dir_absolute)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ILIAS_VERSION_NUMERIC