37 $this->db = $DIC->database();
44 return array(
"4.1.0",
"4.3.0",
"4.4.0",
"5.1.0",
"5.4.0");
47 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
49 return "https://www.ilias.de/xml/Modules/Wiki/" . $a_entity;
52 protected function getTypes(
string $a_entity,
string $a_version): array
54 if ($a_entity ===
"wiki") {
60 "Description" =>
"text",
61 "StartPage" =>
"text",
63 "Introduction" =>
"text",
64 "Rating" =>
"integer");
70 "Description" =>
"text",
71 "StartPage" =>
"text",
73 "Introduction" =>
"text",
74 "Rating" =>
"integer",
75 "PublicNotes" =>
"integer",
77 "PageToc" =>
"integer",
78 "RatingSide" =>
"integer",
79 "RatingNew" =>
"integer",
80 "RatingExt" =>
"integer");
86 "Description" =>
"text",
87 "StartPage" =>
"text",
89 "Introduction" =>
"text",
90 "Rating" =>
"integer",
91 "PublicNotes" =>
"integer",
93 "PageToc" =>
"integer",
94 "RatingSide" =>
"integer",
95 "RatingNew" =>
"integer",
96 "RatingExt" =>
"integer",
97 "RatingOverall" =>
"integer");
103 "Description" =>
"text",
104 "StartPage" =>
"text",
106 "Introduction" =>
"text",
107 "Rating" =>
"integer",
108 "PublicNotes" =>
"integer",
110 "PageToc" =>
"integer",
111 "RatingSide" =>
"integer",
112 "RatingNew" =>
"integer",
113 "RatingExt" =>
"integer",
114 "RatingOverall" =>
"integer",
115 "LinkMdValues" =>
"integer" 122 "Description" =>
"text",
123 "StartPage" =>
"text",
125 "Introduction" =>
"text",
126 "Rating" =>
"integer",
127 "PublicNotes" =>
"integer",
129 "PageToc" =>
"integer",
130 "RatingSide" =>
"integer",
131 "RatingNew" =>
"integer",
132 "RatingExt" =>
"integer",
133 "RatingOverall" =>
"integer",
134 "LinkMdValues" =>
"integer",
135 "EmptyPageTempl" =>
"integer" 140 if ($a_entity ===
"wpg") {
141 switch ($a_version) {
146 "WikiId" =>
"integer");
154 "WikiId" =>
"integer",
155 "Blocked" =>
"integer",
156 "Rating" =>
"integer");
162 "WikiId" =>
"integer",
163 "Blocked" =>
"integer",
164 "Rating" =>
"integer",
165 "TemplateNewPages" =>
"integer",
166 "TemplateAddToPage" =>
"integer" 171 if ($a_entity ===
"wiki_imp_page") {
172 switch ($a_version) {
176 "WikiId" =>
"integer",
177 "PageId" =>
"integer",
179 "Indent" =>
"integer");
185 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
189 if (!is_array($a_ids)) {
190 $a_ids = array($a_ids);
193 if ($a_entity ===
"wiki") {
194 switch ($a_version) {
197 " startpage start_page, short, rating, introduction" .
198 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
199 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
204 " startpage start_page, short, rating, introduction," .
205 " public_notes, page_toc, rating_side, rating_new, rating_ext" .
206 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
207 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
212 " startpage start_page, short, rating, rating_overall, introduction," .
213 " public_notes, page_toc, rating_side, rating_new, rating_ext" .
214 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
215 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
220 " startpage start_page, short, rating, rating_overall, introduction," .
221 " public_notes, page_toc, rating_side, rating_new, rating_ext, link_md_values" .
222 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
223 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
228 " startpage start_page, short, rating, rating_overall, introduction," .
229 " public_notes, page_toc, rating_side, rating_new, rating_ext, link_md_values, empty_page_templ" .
230 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
231 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
236 if ($a_entity ===
"wpg") {
237 switch ($a_version) {
240 " FROM il_wiki_page" .
241 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
249 " FROM il_wiki_page" .
250 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
256 " FROM il_wiki_page" .
257 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
258 foreach ($this->data as $k => $v) {
259 $set =
$ilDB->queryF(
260 "SELECT * FROM wiki_page_template " .
261 " WHERE wiki_id = %s " .
262 " AND wpage_id = %s ",
263 [
"integer",
"integer"],
264 [$v[
"WikiId"], $v[
"Id"]]
266 if ($rec =
$ilDB->fetchAssoc($set)) {
267 $this->data[$k][
"TemplateNewPages"] = $rec[
"new_pages"];
268 $this->data[$k][
"TemplateAddToPage"] = $rec[
"add_to_page"];
275 if ($a_entity ===
"wiki_imp_page") {
276 switch ($a_version) {
280 " FROM il_wiki_imp_pages " .
281 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
290 ?array $a_rec = null,
296 "wpg" => array(
"ids" => $a_rec[
"Id"] ?? null),
297 "wiki_imp_page" => array(
"ids" => $a_rec[
"Id"] ?? null)
309 string $a_schema_version
315 if ($new_id = $a_mapping->
getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
319 $newObj->setType(
"wiki");
320 $newObj->create(
true);
323 $newObj->setTitle($a_rec[
"Title"]);
324 $newObj->setDescription($a_rec[
"Description"]);
325 $newObj->setShortTitle($a_rec[
"Short"]);
326 $newObj->setStartPage($a_rec[
"StartPage"]);
327 $newObj->setRatingOverall($a_rec[
"RatingOverall"]);
328 $newObj->setRating($a_rec[
"Rating"]);
329 $newObj->setIntroduction($a_rec[
"Introduction"]);
330 $newObj->setPublicNotes($a_rec[
"PublicNotes"]);
333 if (isset($a_rec[
"PageToc"])) {
334 $newObj->setPageToc($a_rec[
"PageToc"]);
335 $newObj->setRatingAsBlock($a_rec[
"RatingSide"]);
336 $newObj->setRatingForNewPages($a_rec[
"RatingNew"]);
337 $newObj->setRatingCategories($a_rec[
"RatingExt"]);
339 $newObj->setLinkMetadataValues($a_rec[
"LinkMdValues"]);
340 $newObj->setEmptyPageTemplate((
int) $a_rec[
"EmptyPageTempl"]);
342 $newObj->update(
true);
343 $this->current_obj = $newObj;
344 $a_mapping->
addMapping(
"Modules/Wiki",
"wiki", $a_rec[
"Id"], $newObj->getId());
345 $a_mapping->
addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
346 $a_mapping->
addMapping(
"Services/Rating",
"rating_category_parent_id", $a_rec[
"Id"], $newObj->getId());
347 $a_mapping->
addMapping(
"Services/AdvancedMetaData",
"parent", $a_rec[
"Id"], $newObj->getId());
351 $wiki_id = $a_mapping->
getMapping(
"Modules/Wiki",
"wiki", $a_rec[
"WikiId"]);
353 $wpage->setWikiId($wiki_id);
354 $wpage->setTitle($a_rec[
"Title"]);
357 if (isset($a_rec[
"Blocked"])) {
358 $wpage->setBlocked($a_rec[
"Blocked"]);
359 $wpage->setRating($a_rec[
"Rating"]);
362 $wpage->create(
true);
364 if (isset($a_rec[
"TemplateNewPages"]) || isset($a_rec[
"TemplateAddToPage"])) {
366 $wtpl->save($wpage->getId(), (
int) $a_rec[
"TemplateNewPages"], (
int) $a_rec[
"TemplateAddToPage"]);
369 $a_mapping->
addMapping(
"Modules/Wiki",
"wpg", $a_rec[
"Id"], $wpage->getId());
370 $a_mapping->
addMapping(
"Services/COPage",
"pg",
"wpg:" . $a_rec[
"Id"],
"wpg:" . $wpage->getId());
371 $a_mapping->
addMapping(
"Services/AdvancedMetaData",
"advmd_sub_item",
"advmd:wpg:" . $a_rec[
"Id"], $wpage->getId());
374 case "wiki_imp_page":
375 $wiki_id = $a_mapping->
getMapping(
"Modules/Wiki",
"wiki", $a_rec[
"WikiId"]);
376 $page_id = $a_mapping->
getMapping(
"Modules/Wiki",
"wpg", $a_rec[
"PageId"]);
377 if ($wiki_id > 0 && $page_id > 0 && is_object($this->current_obj) && $this->current_obj->getId() === (
int) $wiki_id) {
378 $this->current_obj->addImportantPage((
int) $page_id, (
int) $a_rec[
"Ord"], (
int) $a_rec[
"Indent"]);
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getXmlNamespace(string $a_entity, string $a_schema_version)
getTypes(string $a_entity, string $a_version)
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readData(string $a_entity, string $a_version, array $a_ids)
getMapping(string $a_comp, string $a_entity, string $a_old_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...
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
stripTags(array $rec, array $omit_keys=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...