ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWikiExporter.php
Go to the documentation of this file.
1<?php
2
25{
27 protected \ILIAS\Wiki\InternalRepoService $page_repo;
28 protected \ILIAS\Style\Content\DomainService $content_style_domain;
30
31 public function init(): void
32 {
33 global $DIC;
34
35 $repo = $DIC->wiki()->internal()->repo();
36 $this->ds = new ilWikiDataSet();
37 $this->ds->initByExporter($this);
38 $this->ds->setDSPrefix("ds");
39 $this->wiki_log = ilLoggerFactory::getLogger('wiki');
40 $this->content_style_domain = $DIC->contentStyle()
41 ->domain();
42 $this->page_repo = $repo;
43 }
44
46 string $a_entity,
47 string $a_target_release,
48 array $a_ids
49 ): array {
50 $pg_ids = array();
51 foreach ($a_ids as $id) {
52 foreach ($this->page_repo->page()->getWikiPages($id) as $page) {
53 if ($this->page_repo->page()->exists($page->getId())) {
54 $pg_ids[] = "wpg:" . $page->getId();
55 }
56 }
57 }
58
59 $deps = array(
60 array(
61 "component" => "components/ILIAS/COPage",
62 "entity" => "pg",
63 "ids" => $pg_ids),
64 array(
65 "component" => "components/ILIAS/Rating",
66 "entity" => "rating_category",
67 "ids" => $a_ids
68 )
69 );
70
71 $advmd_ids = array();
72 foreach ($a_ids as $id) {
73 $rec_ids = $this->getActiveAdvMDRecords($id);
74 $this->wiki_log->debug("advmd rec ids: wiki id:" . $id . ", adv rec ids" . print_r($rec_ids, true));
75 if (count($rec_ids)) {
76 foreach ($rec_ids as $rec_id) {
77 $advmd_ids[] = $id . ":" . $rec_id;
78 }
79 }
80 }
81
82 $this->wiki_log->debug("advmd ids: " . print_r($advmd_ids, true));
83
84 if (count($advmd_ids)) {
85 $deps[] = array(
86 "component" => "components/ILIAS/AdvancedMetaData",
87 "entity" => "advmd",
88 "ids" => $advmd_ids
89 );
90 }
91
92 // style
93 /*
94 $obj_ids = (is_array($a_ids))
95 ? $a_ids
96 : array($a_ids);
97 $deps[] = array(
98 "component" => "components/ILIAS/Style",
99 "entity" => "object_style",
100 "ids" => $obj_ids
101 );*/
102
103 // style
104 foreach ($a_ids as $id) {
105 $style_id = $this->content_style_domain->styleForObjId($id)->getExportStyleId();
106 if ($style_id > 0) {
107 $deps[] = array(
108 "component" => "components/ILIAS/Style",
109 "entity" => "sty",
110 "ids" => $style_id
111 );
112 }
113 }
114
115 // service settings
116 $deps[] = array(
117 "component" => "components/ILIAS/ILIASObject",
118 "entity" => "common",
119 "ids" => $a_ids);
120
121 // Learning Object Metadata
122 $md_ids = [];
123 foreach ($a_ids as $id) {
124 $md_ids[] = $id . ':0:wiki';
125 }
126 if (!empty($md_ids)) {
127 $deps[] = [
128 'component' => 'components/ILIAS/MetaData',
129 'entity' => 'md',
130 'ids' => $md_ids,
131 ];
132 }
133
134 return $deps;
135 }
136
137 protected function getActiveAdvMDRecords(int $a_id): array
138 {
139 $active = array();
140 // selected globals
141 $sel_globals = ilAdvancedMDRecord::getObjRecSelection($a_id, "wpg");
142
143 foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType("wiki", "wpg") as $record_obj) {
144 // local ones and globally activated for the object
145 if ($record_obj->getParentObject() === $a_id || in_array($record_obj->getRecordId(), $sel_globals)) {
146 $active[] = $record_obj->getRecordId();
147 }
148 }
149
150 $this->wiki_log->debug("active md rec: " . print_r($active, true));
151
152 return $active;
153 }
154
155 public function getXmlRepresentation(
156 string $a_entity,
157 string $a_schema_version,
158 string $a_id
159 ): string {
160 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
161 }
162
163 public function getValidSchemaVersions(string $a_entity): array
164 {
165 return array(
166 "5.4.0" => array(
167 "namespace" => "https://www.ilias.de/Modules/Wiki/wiki/5_4",
168 "xsd_file" => "ilias_wiki_5_4.xsd",
169 "uses_dataset" => true,
170 "min" => "5.4.0",
171 "max" => ""),
172 "4.1.0" => array(
173 "namespace" => "https://www.ilias.de/Modules/Wiki/wiki/4_1",
174 "xsd_file" => "ilias_wiki_4_1.xsd",
175 "uses_dataset" => true,
176 "min" => "4.1.0",
177 "max" => "4.2.99"),
178 "4.3.0" => array(
179 "namespace" => "https://www.ilias.de/Modules/Wiki/wiki/4_3",
180 "xsd_file" => "ilias_wiki_4_3.xsd",
181 "uses_dataset" => true,
182 "min" => "4.3.0",
183 "max" => "4.3.99"),
184 "4.4.0" => array(
185 "namespace" => "https://www.ilias.de/Modules/Wiki/wiki/4_4",
186 "xsd_file" => "ilias_wiki_4_4.xsd",
187 "uses_dataset" => true,
188 "min" => "4.4.0",
189 "max" => "5.0.99"),
190 "5.1.0" => array(
191 "namespace" => "https://www.ilias.de/Modules/Wiki/wiki/5_1",
192 "xsd_file" => "ilias_wiki_5_1.xsd",
193 "uses_dataset" => true,
194 "min" => "5.1.0",
195 "max" => "5.3.99")
196 );
197 }
198}
$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.
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
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 Style Content DomainService $content_style_domain
getActiveAdvMDRecords(int $a_id)
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
ILIAS Wiki InternalRepoService $page_repo
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...
global $DIC
Definition: shib_login.php:26