ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilMetaDataExporter.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
24 
26 {
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 }
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
global $DIC
Definition: shib_login.php:22
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
RepositoryInterface $repository