ILIAS  release_8 Revision v8.24
class.ilCategoryExporter.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
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' => 'Services/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" => "Services/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 "7.0.0" => [
100 'namespace' => 'https://www.ilias.de/Modules/Category/cat/7_0',
101 'xsd_file' => 'ilias_cat_7_0.xsd',
102 'uses_dataset' => false,
103 'min' => '7.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
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...