ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMetaDataExporter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22use ILIAS\MetaData\XML\Writer\WriterInterface as StandardXMLWriter;
24
26{
27 protected StandardXMLWriter $writer;
29
30 public function init(): void
31 {
32 global $DIC;
33
34 $services = new InternalServices($DIC);
35
36 $this->writer = $services->xml()->standardWriter();
37 $this->repository = $services->repository()->repository();
38 }
39
40 public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
41 {
42 $id = explode(":", $a_id);
43
44 $obj_id = (int) $id[0];
45 $sub_id = (int) $id[1];
46 $type = (string) $id[2];
47
48 if ($sub_id === 0) {
49 $sub_id = $obj_id;
50 }
51
52 $md = $this->repository->getMD($obj_id, $sub_id, $type);
53 $xml = $this->writer->write($md);
54
55 return trim(str_replace('<?xml version="1.0"?>', '', $xml->asXML()));
56 }
57
64 public function getValidSchemaVersions(string $a_entity): array
65 {
66 return [
67 "10.0" => [
68 "namespace" => "http://www.ilias.de/Services/MetaData/md/10_0",
69 "xsd_file" => "ilias_md_10_0.xsd",
70 "min" => "10.0",
71 "max" => ""
72 ],
73 "4.1.0" => [
74 "namespace" => "http://www.ilias.de/Services/MetaData/md/4_1",
75 "xsd_file" => "ilias_md_4_1.xsd",
76 "min" => "4.1.0",
77 "max" => "9.99"
78 ]
79 ];
80 }
81}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
RepositoryInterface $repository
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
Xml Exporter class.
global $DIC
Definition: shib_login.php:26