ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCategoryExporter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
35 public function getXmlExportHeadDependencies(string $a_entity, string $a_target_release, array $a_ids): array
36 {
37 // always trigger container because of co-page(s)
38 return [
39 [
40 'component' => 'components/ILIAS/Container',
41 'entity' => 'struct',
42 'ids' => $a_ids
43 ]
44 ];
45 }
46
47 public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
48 {
49 if ($a_entity === "cat") {
50 $tax_ids = [];
51 foreach ($a_ids as $id) {
53 if (count($t_ids) > 0) {
54 $tax_ids[$t_ids[0]] = $t_ids[0];
55 }
56 }
57
58 return [
59 [
60 "component" => "components/ILIAS/Taxonomy",
61 "entity" => "tax",
62 "ids" => $tax_ids
63 ]
64 ];
65 }
66 return [];
67 }
68
73 public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
74 {
75 $all_ref = ilObject::_getAllReferences((int) $a_id);
76 $cat_ref_id = end($all_ref);
77 $category = ilObjectFactory::getInstanceByRefId($cat_ref_id, false);
78
79 if (!$category instanceof ilObjCategory) {
80 $GLOBALS['ilLog']->write(__METHOD__ . $a_id . ' is not instance of type category!');
81 return '';
82 }
83
84
85 $writer = new ilCategoryXmlWriter($category);
86 $writer->setMode(ilCategoryXmlWriter::MODE_EXPORT);
87 $writer->export(false);
88 return $writer->getXml();
89 }
90
96 public function getValidSchemaVersions(string $a_entity): array
97 {
98 return [
99 "9.0.0" => [
100 'namespace' => 'https://www.ilias.de/Modules/Category/cat/9_0',
101 'xsd_file' => 'ilias_cat_9_0.xsd',
102 'uses_dataset' => false,
103 'min' => '9.0',
104 'max' => ''
105 ],
106 "4.3.0" => [
107 "namespace" => "https://www.ilias.de/Modules/Category/cat/4_3",
108 "xsd_file" => "ilias_cat_4_3.xsd",
109 "uses_dataset" => false,
110 "min" => "4.3.0",
111 "max" => ""
112 ]
113 ];
114 }
115
119 public function init(): void
120 {
121 }
122}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Class for category export.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
getXmlExportHeadDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get head dependencies.
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
Class for category export.
Class ilObjCategory.
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getAllReferences(int $id)
get all reference ids for object ID
Xml Exporter class.
$GLOBALS["DIC"]
Definition: wac.php:54