38 $this->db = $DIC->database();
41 $this->imp_page_repo = $DIC->wiki()->internal()->repo()->importantPage();
46 return array(
"4.1.0",
"4.3.0",
"4.4.0",
"5.1.0",
"5.4.0",
"8.0");
49 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
51 return "https://www.ilias.de/xml/Modules/Wiki/" . $a_entity;
54 protected function getTypes(
string $a_entity,
string $a_version): array
56 if ($a_entity ===
"wiki") {
62 "Description" =>
"text",
63 "StartPage" =>
"text",
65 "Introduction" =>
"text",
66 "Rating" =>
"integer");
72 "Description" =>
"text",
73 "StartPage" =>
"text",
75 "Introduction" =>
"text",
76 "Rating" =>
"integer",
77 "PublicNotes" =>
"integer",
79 "PageToc" =>
"integer",
80 "RatingSide" =>
"integer",
81 "RatingNew" =>
"integer",
82 "RatingExt" =>
"integer");
88 "Description" =>
"text",
89 "StartPage" =>
"text",
91 "Introduction" =>
"text",
92 "Rating" =>
"integer",
93 "PublicNotes" =>
"integer",
95 "PageToc" =>
"integer",
96 "RatingSide" =>
"integer",
97 "RatingNew" =>
"integer",
98 "RatingExt" =>
"integer",
99 "RatingOverall" =>
"integer");
105 "Description" =>
"text",
106 "StartPage" =>
"text",
108 "Introduction" =>
"text",
109 "Rating" =>
"integer",
110 "PublicNotes" =>
"integer",
112 "PageToc" =>
"integer",
113 "RatingSide" =>
"integer",
114 "RatingNew" =>
"integer",
115 "RatingExt" =>
"integer",
116 "RatingOverall" =>
"integer",
117 "LinkMdValues" =>
"integer" 125 "Description" =>
"text",
126 "StartPage" =>
"text",
128 "Introduction" =>
"text",
129 "Rating" =>
"integer",
130 "PublicNotes" =>
"integer",
132 "PageToc" =>
"integer",
133 "RatingSide" =>
"integer",
134 "RatingNew" =>
"integer",
135 "RatingExt" =>
"integer",
136 "RatingOverall" =>
"integer",
137 "LinkMdValues" =>
"integer",
138 "EmptyPageTempl" =>
"integer" 143 if ($a_entity ===
"wpg") {
144 switch ($a_version) {
149 "WikiId" =>
"integer");
157 "WikiId" =>
"integer",
158 "Blocked" =>
"integer",
159 "Rating" =>
"integer");
165 "WikiId" =>
"integer",
166 "Blocked" =>
"integer",
167 "Rating" =>
"integer",
168 "TemplateNewPages" =>
"integer",
169 "TemplateAddToPage" =>
"integer" 176 "WikiId" =>
"integer",
177 "Blocked" =>
"integer",
178 "Rating" =>
"integer",
179 "TemplateNewPages" =>
"integer",
180 "TemplateAddToPage" =>
"integer",
186 if ($a_entity ===
"wiki_imp_page") {
187 switch ($a_version) {
192 "WikiId" =>
"integer",
193 "PageId" =>
"integer",
195 "Indent" =>
"integer");
201 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
205 if (!is_array($a_ids)) {
206 $a_ids = array($a_ids);
209 if ($a_entity ===
"wiki") {
210 switch ($a_version) {
213 " startpage start_page, short, rating, introduction" .
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, introduction," .
221 " public_notes, page_toc, rating_side, rating_new, rating_ext" .
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" .
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 " startpage start_page, short, rating, rating_overall, introduction," .
237 " public_notes, page_toc, rating_side, rating_new, rating_ext, link_md_values" .
238 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
239 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
245 " startpage start_page, short, rating, rating_overall, introduction," .
246 " public_notes, page_toc, rating_side, rating_new, rating_ext, link_md_values, empty_page_templ" .
247 " FROM il_wiki_data JOIN object_data ON (il_wiki_data.id = object_data.obj_id)" .
248 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
253 if ($a_entity ===
"wpg") {
254 switch ($a_version) {
257 " FROM il_wiki_page" .
258 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
266 " FROM il_wiki_page" .
267 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
273 " FROM il_wiki_page" .
274 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
275 foreach ($this->data as $k => $v) {
276 $set =
$ilDB->queryF(
277 "SELECT * FROM wiki_page_template " .
278 " WHERE wiki_id = %s " .
279 " AND wpage_id = %s ",
280 [
"integer",
"integer"],
281 [$v[
"WikiId"], $v[
"Id"]]
283 if ($rec =
$ilDB->fetchAssoc($set)) {
284 $this->data[$k][
"TemplateNewPages"] = $rec[
"new_pages"];
285 $this->data[$k][
"TemplateAddToPage"] = $rec[
"add_to_page"];
292 " blocked, rating, lang" .
293 " FROM il_wiki_page" .
294 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
295 foreach ($this->data as $k => $v) {
296 $set =
$ilDB->queryF(
297 "SELECT * FROM wiki_page_template " .
298 " WHERE wiki_id = %s " .
299 " AND wpage_id = %s ",
300 [
"integer",
"integer"],
301 [$v[
"WikiId"], $v[
"Id"]]
303 if ($rec =
$ilDB->fetchAssoc($set)) {
304 $this->data[$k][
"TemplateNewPages"] = $rec[
"new_pages"];
305 $this->data[$k][
"TemplateAddToPage"] = $rec[
"add_to_page"];
312 if ($a_entity ===
"wiki_imp_page") {
313 switch ($a_version) {
318 " FROM il_wiki_imp_pages " .
319 " WHERE " .
$ilDB->in(
"wiki_id", $a_ids,
false,
"integer"));
328 ?array $a_rec =
null,
334 "wpg" => array(
"ids" => $a_rec[
"Id"] ??
null),
335 "wiki_imp_page" => array(
"ids" => $a_rec[
"Id"] ?? null)
347 string $a_schema_version
353 if ($new_id = $a_mapping->
getMapping(
'components/ILIAS/Container',
'objs', $a_rec[
'Id'])) {
357 $newObj->setType(
"wiki");
358 $newObj->create(
true);
361 $newObj->setTitle($a_rec[
"Title"]);
362 $newObj->setDescription($a_rec[
"Description"]);
363 $newObj->setShortTitle($a_rec[
"Short"]);
364 $newObj->setStartPage($a_rec[
"StartPage"]);
365 $newObj->setRatingOverall($a_rec[
"RatingOverall"]);
366 $newObj->setRating($a_rec[
"Rating"]);
367 $newObj->setIntroduction($a_rec[
"Introduction"]);
368 $newObj->setPublicNotes($a_rec[
"PublicNotes"]);
371 if (isset($a_rec[
"PageToc"])) {
372 $newObj->setPageToc($a_rec[
"PageToc"]);
373 $newObj->setRatingAsBlock($a_rec[
"RatingSide"]);
374 $newObj->setRatingForNewPages($a_rec[
"RatingNew"]);
375 $newObj->setRatingCategories($a_rec[
"RatingExt"]);
377 $newObj->setLinkMetadataValues($a_rec[
"LinkMdValues"]);
378 $newObj->setEmptyPageTemplate((
int) $a_rec[
"EmptyPageTempl"]);
380 $newObj->update(
true);
381 $this->current_obj = $newObj;
382 $a_mapping->
addMapping(
"components/ILIAS/Wiki",
"wiki", $a_rec[
"Id"], $newObj->getId());
383 $a_mapping->
addMapping(
"components/ILIAS/ILIASObject",
"obj", $a_rec[
"Id"], $newObj->getId());
384 $a_mapping->
addMapping(
"components/ILIAS/Rating",
"rating_category_parent_id", $a_rec[
"Id"], $newObj->getId());
385 $a_mapping->
addMapping(
"components/ILIAS/AdvancedMetaData",
"parent", $a_rec[
"Id"], $newObj->getId());
389 $wiki_id = $a_mapping->
getMapping(
"components/ILIAS/Wiki",
"wiki", $a_rec[
"WikiId"]);
390 $lang = ($a_rec[
"Lang"] ??
"");
392 if (!in_array(
$lang, [
"",
"-"])) {
393 $wpage->setLanguage(
$lang);
395 $wpage->setWikiId($wiki_id);
396 $wpage->setTitle($a_rec[
"Title"]);
399 if (isset($a_rec[
"Blocked"])) {
400 $wpage->setBlocked($a_rec[
"Blocked"]);
401 $wpage->setRating($a_rec[
"Rating"]);
404 $wpage->create(
true);
406 if (isset($a_rec[
"TemplateNewPages"]) || isset($a_rec[
"TemplateAddToPage"])) {
408 $wtpl->save($wpage->getId(), (
int) $a_rec[
"TemplateNewPages"], (
int) $a_rec[
"TemplateAddToPage"]);
411 $a_mapping->
addMapping(
"components/ILIAS/Wiki",
"wpg", $a_rec[
"Id"], $wpage->getId());
412 $a_mapping->
addMapping(
"components/ILIAS/COPage",
"pg",
"wpg:" . $a_rec[
"Id"],
"wpg:" . $wpage->getId());
413 $a_mapping->
addMapping(
"components/ILIAS/AdvancedMetaData",
"advmd_sub_item",
"advmd:wpg:" . $a_rec[
"Id"], $wpage->getId());
416 case "wiki_imp_page":
417 $wiki_id = $a_mapping->
getMapping(
"components/ILIAS/Wiki",
"wiki", $a_rec[
"WikiId"]);
418 $page_id = $a_mapping->
getMapping(
"components/ILIAS/Wiki",
"wpg", $a_rec[
"PageId"]);
419 if ($wiki_id > 0 && $page_id > 0 && is_object($this->current_obj) && $this->current_obj->getId() === (
int) $wiki_id) {
420 $this->imp_page_repo->add($this->current_obj->getId(), (
int) $page_id, (
int) $a_rec[
"Ord"], (
int) $a_rec[
"Indent"]);
static getLogger(string $a_component_id)
Get component logger.
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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=[])
ILIAS Wiki Navigation ImportantPageDBRepository $imp_page_repo