ILIAS  release_8 Revision v8.24
class.ilXmlExporter.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
27abstract class ilXmlExporter
28{
29 protected string $dir_relative = "";
30 protected string $dir_absolute = "";
31 protected ilExport $exp;
32
33 public function __construct()
34 {
35 }
36
37 public function setExport(ilExport $a_exp): void
38 {
39 $this->exp = $a_exp;
40 }
41
42 public function getExport(): ilExport
43 {
44 return $this->exp;
45 }
46
47 public static function lookupExportDirectory(
48 string $a_obj_type,
49 int $a_obj_id,
50 string $a_export_type = 'xml',
51 string $a_entity = ""
52 ): string {
53 $ent = ($a_entity == "")
54 ? ""
55 : "_" . $a_entity;
56
57 if ($a_export_type == 'xml') {
58 return ilFileUtils::getDataDir() . "/" . $a_obj_type . $ent . "_data" . "/" . $a_obj_type . "_" . $a_obj_id . "/export";
59 }
60 return ilFileUtils::getDataDir() . "/" . $a_obj_type . $ent . "_data" . "/" . $a_obj_type . "_" . $a_obj_id . "/export_" . $a_export_type;
61 }
62
63 abstract public function getXmlRepresentation(
64 string $a_entity,
65 string $a_schema_version,
66 string $a_id
67 ): string;
68
69 abstract public function init(): void;
70
71 public function setExportDirectories(string $a_dir_relative, string $a_dir_absolute): void
72 {
73 $this->dir_relative = $a_dir_relative;
74 $this->dir_absolute = $a_dir_absolute;
75 }
76
77 public function getRelativeExportDirectory(): string
78 {
79 return $this->dir_relative;
80 }
81
82 public function getAbsoluteExportDirectory(): string
83 {
84 return $this->dir_absolute;
85 }
86
92 string $a_entity,
93 string $a_target_release,
94 array $a_ids
95 ): array {
96 return [];
97 }
98
104 string $a_entity,
105 string $a_target_release,
106 array $a_ids
107 ): array {
108 return array();
109 }
110
123 abstract public function getValidSchemaVersions(string $a_entity): array;
124
125 final public function determineSchemaVersion(
126 string $a_entity,
127 string $a_target_release
128 ): array {
129 $svs = $this->getValidSchemaVersions($a_entity);
130 $found = false;
131 $rsv = [];
132 foreach ($svs as $k => $sv) {
133 if (!$found) {
134 if (version_compare($sv["min"], ILIAS_VERSION_NUMERIC, "<=")
135 && ($sv["max"] == "" || version_compare($sv["max"], ILIAS_VERSION_NUMERIC, ">="))) {
136 $rsv = $sv;
137 $rsv["schema_version"] = $k;
138 $found = true;
139 }
140 }
141 }
142 return $rsv;
143 }
144}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getDataDir()
get data directory (outside webspace)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
const ILIAS_VERSION_NUMERIC