ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilGlossaryExporter.php
Go to the documentation of this file.
1<?php
2
25{
27 protected \ILIAS\Glossary\Metadata\MetadataManager $metadata;
28
29 public function init(): void
30 {
31 global $DIC;
32
33 $this->ds = new ilGlossaryDataSet();
34 $this->ds->initByExporter($this);
35 $this->ds->setDSPrefix("ds");
36 $this->metadata = $DIC->glossary()->internal()->domain()->metadata();
37 }
38
40 string $a_entity,
41 string $a_target_release,
42 array $a_ids
43 ): array {
44 if ($a_entity == "glo") {
45 // definition related ids
46 $page_ids = array();
47 foreach ($a_ids as $id) {
48 // workaround for #0023923
50 $ref_id = current($all_refs);
51
52 // see #29014, we include referenced terms in the export as well
54 [$ref_id],
55 "",
56 "",
57 "",
58 0,
59 false,
60 null,
61 true
62 );
63
64 foreach ($terms as $t) {
65 $page_ids[] = "term:" . $t["id"];
66 }
67 }
68 // definition pages and their metadat
69 $deps = array(
70 array(
71 "component" => "components/ILIAS/COPage",
72 "entity" => "pg",
73 "ids" => $page_ids)
74 );
75
76 // taxonomy
77 $tax_ids = array();
78 foreach ($a_ids as $id) {
80 if (count($t_ids) > 0) {
81 $tax_ids[$t_ids[0]] = $t_ids[0];
82 }
83 }
84 if (count($tax_ids)) {
85 $deps[] = array(
86 "component" => "components/ILIAS/Taxonomy",
87 "entity" => "tax",
88 "ids" => $tax_ids
89 );
90 }
91
92 // advanced metadata
93 $advmd_ids = array();
94 foreach ($a_ids as $id) {
95 $rec_ids = $this->getActiveAdvMDRecords($id);
96 if (count($rec_ids)) {
97 foreach ($rec_ids as $rec_id) {
98 $advmd_ids[] = $id . ":" . $rec_id->getRecordId();
99 }
100 }
101 }
102 if (count($advmd_ids)) {
103 $deps[] = array(
104 "component" => "components/ILIAS/AdvancedMetaData",
105 "entity" => "advmd",
106 "ids" => $advmd_ids
107 );
108 }
109
110 // style
111 $obj_ids = (is_array($a_ids))
112 ? $a_ids
113 : array($a_ids);
114 $deps[] = array(
115 "component" => "components/ILIAS/Style",
116 "entity" => "object_style",
117 "ids" => $obj_ids
118 );
119
120 // service settings
121 $deps[] = array(
122 "component" => "components/ILIAS/ILIASObject",
123 "entity" => "common",
124 "ids" => $a_ids);
125
126 $md_ids = [];
127 foreach ($a_ids as $crs_id) {
128 $md_ids[] = $crs_id . ":0:glo";
129 }
130 if ($md_ids !== []) {
131 $deps[] = [
132 "component" => "components/ILIAS/MetaData",
133 "entity" => "md",
134 "ids" => $md_ids
135 ];
136 }
137
138 return $deps;
139 }
140 return array();
141 }
142
143 protected function getActiveAdvMDRecords(int $a_id): array
144 {
145 $active = [];
146 foreach (ilObject::_getAllReferences($a_id) as $ref_id) {
147 foreach ($this->metadata->getActiveAdvMDRecords($ref_id) as $rec) {
148 $active[$rec->getRecordId()] = $rec;
149 }
150 }
151 return $active;
152
153 $active = array();
154 // selected globals
155 $sel_globals = ilAdvancedMDRecord::getObjRecSelection($a_id, "term");
156
157 foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType("glo", "term") as $record_obj) {
158 // local ones and globally activated for the object
159 if ($record_obj->getParentObject() == $a_id || in_array($record_obj->getRecordId(), $sel_globals)) {
160 $active[] = $record_obj->getRecordId();
161 }
162 }
163
164 return $active;
165 }
166
167 public function getXmlRepresentation(
168 string $a_entity,
169 string $a_schema_version,
170 string $a_id
171 ): string {
172 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
173 }
174
175 public function getValidSchemaVersions(string $a_entity): array
176 {
177 return array(
178 "9.0.0" => array(
179 "namespace" => "https://www.ilias.de/Modules/Glossary/htlm/9_0",
180 "xsd_file" => "ilias_glo_9_0.xsd",
181 "uses_dataset" => true,
182 "min" => "9.0.0",
183 "max" => ""),
184 "5.4.0" => array(
185 "namespace" => "https://www.ilias.de/Modules/Glossary/htlm/5_4",
186 "xsd_file" => "ilias_glo_5_4.xsd",
187 "uses_dataset" => true,
188 "min" => "5.4.0",
189 "max" => ""),
190 "5.1.0" => array(
191 "namespace" => "https://www.ilias.de/Modules/Glossary/htlm/5_1",
192 "xsd_file" => "ilias_glo_5_1.xsd",
193 "uses_dataset" => true,
194 "min" => "5.1.0",
195 "max" => ""),
196 "4.1.0" => array(
197 "namespace" => "https://www.ilias.de/Modules/Glossary/htlm/4_1",
198 "xsd_file" => "ilias_glo_4_1.xsd",
199 "uses_dataset" => false,
200 "min" => "4.1.0",
201 "max" => "")
202 );
203 }
204}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
return true
static getObjRecSelection(int $a_obj_id, string $a_sub_type="")
Get repository object record selection.
static _getActivatedRecordsByObjectType(string $a_obj_type, string $a_sub_type="", bool $a_only_optional=false)
Get activated records by object type.
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...
ILIAS Glossary Metadata MetadataManager $metadata
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
static getTermList(array $a_glo_ref_id, string $searchterm="", string $a_first_letter="", string $a_def="", int $a_tax_node=0, bool $a_add_amet_fields=false, ?array $a_amet_filter=null, bool $a_include_references=false)
Get all terms for given set of glossary ids.
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
static _getAllReferences(int $id)
get all reference ids for object ID
Xml Exporter class.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:66
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26