35 protected \ILIAS\Notes\Service
$notes;
49 $this->notes = $DIC->notes();
55 $this->master_lang_only = $a_val;
68 $this->transl_into =
true;
69 $this->transl_into_lm = $a_lm;
70 $this->transl_lang = $a_lang;
72 $this->transl_into =
false;
93 return array(
"5.1.0",
"5.4.0");
96 protected function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
98 return "https://www.ilias.de/xml/Modules/LearningModule/" . $a_entity;
101 protected function getTypes(
string $a_entity,
string $a_version): array
103 if ($a_entity ==
"lm") {
104 switch ($a_version) {
109 "Description" =>
"text",
110 "DefaultLayout" =>
"text",
111 "PageHeader" =>
"text",
112 "TocActive" =>
"text",
113 "LMMenuActive" =>
"text",
115 "PrintViewActive" =>
"text",
116 "Numbering" =>
"text",
117 "HistUserComments" =>
"text",
118 "PublicAccessMode" =>
"text",
119 "PubNotes" =>
"text",
120 "HeaderPage" =>
"integer",
121 "FooterPage" =>
"integer",
122 "LayoutPerPage" =>
"integer",
123 "Rating" =>
"integer",
124 "HideHeadFootPrint" =>
"integer",
125 "DisableDefFeedback" =>
"integer",
126 "RatingPages" =>
"integer",
127 "ProgrIcons" =>
"integer",
128 "StoreTries" =>
"integer",
129 "RestrictForwNav" =>
"integer",
130 "Comments" =>
"integer",
131 "ForTranslation" =>
"integer",
132 "StyleId" =>
"integer" 139 "Description" =>
"text",
140 "DefaultLayout" =>
"text",
141 "PageHeader" =>
"text",
142 "TocActive" =>
"text",
143 "LMMenuActive" =>
"text",
145 "PrintViewActive" =>
"text",
146 "NoGloAppendix" =>
"text",
147 "Numbering" =>
"text",
148 "HistUserComments" =>
"text",
149 "PublicAccessMode" =>
"text",
150 "PubNotes" =>
"text",
151 "HeaderPage" =>
"integer",
152 "FooterPage" =>
"integer",
153 "LayoutPerPage" =>
"integer",
154 "Rating" =>
"integer",
155 "HideHeadFootPrint" =>
"integer",
156 "DisableDefFeedback" =>
"integer",
157 "RatingPages" =>
"integer",
158 "ProgrIcons" =>
"integer",
159 "StoreTries" =>
"integer",
160 "RestrictForwNav" =>
"integer",
161 "Comments" =>
"integer",
162 "ForTranslation" =>
"integer",
163 "StyleId" =>
"integer" 170 "Description" =>
"text",
171 "DefaultLayout" =>
"text",
172 "PageHeader" =>
"text",
173 "TocActive" =>
"text",
174 "LMMenuActive" =>
"text",
176 "PrintViewActive" =>
"text",
177 "NoGloAppendix" =>
"text",
178 "Numbering" =>
"text",
179 "HistUserComments" =>
"text",
180 "PublicAccessMode" =>
"text",
181 "PubNotes" =>
"text",
182 "HeaderPage" =>
"integer",
183 "FooterPage" =>
"integer",
184 "LayoutPerPage" =>
"integer",
185 "Rating" =>
"integer",
186 "HideHeadFootPrint" =>
"integer",
187 "DisableDefFeedback" =>
"integer",
188 "RatingPages" =>
"integer",
189 "ProgrIcons" =>
"integer",
190 "StoreTries" =>
"integer",
191 "RestrictForwNav" =>
"integer",
192 "Comments" =>
"integer",
193 "ForTranslation" =>
"integer",
194 "StyleId" =>
"integer",
195 "EstimatedReadingTime" =>
"integer" 200 if ($a_entity ==
"lm_tree") {
201 switch ($a_version) {
207 "Child" =>
"integer",
208 "Parent" =>
"integer",
209 "Depth" =>
"integer",
212 "ShortTitle" =>
"text",
213 "PublicAccess" =>
"text",
221 if ($a_entity ==
"lm_menu") {
222 switch ($a_version) {
228 "LinkType" =>
"text",
231 "LinkRefId" =>
"text",
237 if ($a_entity ==
"lm_data_transl") {
238 switch ($a_version) {
246 "ShortTitle" =>
"text" 253 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
257 if (!is_array($a_ids)) {
258 $a_ids = array($a_ids);
262 if ($a_entity ==
"lm") {
263 switch ($a_version) {
267 switch ($a_version) {
269 $q =
"SELECT id, title, description," .
270 " default_layout, page_header, toc_active, lm_menu_active, toc_mode, print_view_active, numbering," .
271 " hist_user_comments, public_access_mode, header_page, footer_page, layout_per_page, rating, " .
272 " hide_head_foot_print, disable_def_feedback, rating_pages, store_tries, restrict_forw_nav, progr_icons, stylesheet style_id" .
273 " FROM content_object JOIN object_data ON (content_object.id = object_data.obj_id)" .
274 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer");
279 $q =
"SELECT id, title, description," .
280 " default_layout, page_header, toc_active, lm_menu_active, toc_mode, print_view_active, numbering," .
281 " hist_user_comments, public_access_mode, no_glo_appendix, header_page, footer_page, layout_per_page, rating, " .
282 " hide_head_foot_print, disable_def_feedback, rating_pages, store_tries, restrict_forw_nav, progr_icons, stylesheet style_id" .
283 " FROM content_object JOIN object_data ON (content_object.id = object_data.obj_id)" .
284 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer");
289 $this->data = array();
290 while ($rec =
$ilDB->fetchAssoc($set)) {
292 $rec[
"comments"] = (string) (
int)
293 $this->notes->domain()->commentsActive((
int) $rec[
"id"]);
295 if ($a_version ===
"8.0") {
296 $rec[
"estimated_reading_time"] = (string) (
int)
297 $this->reading_time_manager->isActivated((
int) $rec[
"id"]);
301 $rec[
"for_translation"] = 1;
304 foreach ($rec as $k => $v) {
309 $this->data[] = $rec;
315 if ($a_entity ==
"lm_tree") {
316 switch ($a_version) {
322 $q =
"SELECT lm_tree.lm_id, child, parent, depth, type, title, short_title, public_access, active, layout, import_id" .
323 " FROM lm_tree JOIN lm_data ON (lm_tree.child = lm_data.obj_id)" .
324 " WHERE " .
$ilDB->in(
"lm_tree.lm_id", $a_ids,
false,
"integer") .
328 $this->data = array();
330 while ($rec =
$ilDB->fetchAssoc($set)) {
331 $set2 =
$ilDB->query(
"SELECT for_translation FROM content_object WHERE id = " .
$ilDB->quote($rec[
"lm_id"],
"integer"));
332 $rec2 =
$ilDB->fetchAssoc($set2);
333 if (!$rec2[
"for_translation"]) {
334 $rec[
"import_id"] =
"il_" .
IL_INST_ID .
"_" . $rec[
"type"] .
"_" . $rec[
"child"];
337 foreach ($rec as $k => $v) {
342 $obj_ids[] = $rec[
"Child"];
343 $this->data[] = $rec;
347 $set3 =
$ilDB->query(
$q =
"SELECT lm_id, type, title, short_title, public_access, active, layout, import_id, obj_id child FROM lm_data " .
348 "WHERE " .
$ilDB->in(
"lm_id", $a_ids,
false,
"integer") .
349 " AND " .
$ilDB->in(
"obj_id", $obj_ids,
true,
"integer") .
350 " AND type = " .
$ilDB->quote(
"pg",
"text"));
351 while ($rec3 =
$ilDB->fetchAssoc($set3)) {
352 $set2 =
$ilDB->query(
"SELECT for_translation FROM content_object WHERE id = " .
$ilDB->quote($rec3[
"lm_id"],
"integer"));
353 $rec2 =
$ilDB->fetchAssoc($set2);
354 if (!$rec2[
"for_translation"]) {
355 $rec3[
"import_id"] =
"il_" .
IL_INST_ID .
"_pg_" . $rec3[
"child"];
357 $rec3[
"type"] =
"free_pg";
361 foreach ($rec3 as $k => $v) {
365 $this->data[] = $tmp;
371 if ($a_entity ==
"lm_menu") {
372 switch ($a_version) {
378 " WHERE " .
$ilDB->in(
"lm_id", $a_ids,
false,
"integer"));
383 if ($a_entity ==
"lm_data_transl") {
384 switch ($a_version) {
389 " FROM lm_data_transl " .
390 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
399 ?array $a_rec = null,
405 "lm_tree" => array(
"ids" => $a_rec[
"Id"] ?? null),
406 "lm_menu" => array(
"ids" => $a_rec[
"Id"] ?? null)
414 "lm_data_transl" => array(
"ids" => $a_rec[
"Child"] ?? null)
427 string $a_schema_version
438 if ($new_id = $a_mapping->
getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
442 $newObj->setType(
"lm");
443 $newObj->create(
true);
444 $newObj->createLMTree();
447 $newObj->setTitle($a_rec[
"Title"]);
448 $newObj->setDescription($a_rec[
"Description"]);
449 $newObj->setLayout($a_rec[
"DefaultLayout"]);
450 $newObj->setPageHeader($a_rec[
"PageHeader"]);
452 $newObj->setActiveLMMenu(
ilUtil::yn2tf($a_rec[
"LmMenuActive"]));
453 $newObj->setTOCMode($a_rec[
"TocMode"]);
454 $newObj->setActivePrintView(
ilUtil::yn2tf($a_rec[
"PrintViewActive"]));
455 $newObj->setActivePreventGlossaryAppendix(
ilUtil::yn2tf($a_rec[
"NoGloAppendix"]));
456 $newObj->setActiveNumbering(
ilUtil::yn2tf($a_rec[
"Numbering"]));
457 $newObj->setHistoryUserComments(
ilUtil::yn2tf($a_rec[
"HistUserComments"]));
458 $newObj->setPublicAccessMode($a_rec[
"PublicAccessMode"]);
459 $newObj->setPublicNotes(
ilUtil::yn2tf($a_rec[
"PubNotes"] ??
"n"));
461 $newObj->setLayoutPerPage($a_rec[
"LayoutPerPage"]);
462 $newObj->setRating($a_rec[
"Rating"]);
463 $newObj->setHideHeaderFooterPrint($a_rec[
"HideHeadFootPrint"]);
464 $newObj->setDisableDefaultFeedback($a_rec[
"DisableDefFeedback"]);
465 $newObj->setRatingPages($a_rec[
"RatingPages"]);
466 $newObj->setForTranslation($a_rec[
"ForTranslation"] ??
false);
467 $newObj->setProgressIcons($a_rec[
"ProgrIcons"]);
468 $newObj->setStoreTries($a_rec[
"StoreTries"]);
469 $newObj->setRestrictForwardNavigation($a_rec[
"RestrictForwNav"]);
470 if ($a_rec[
"HeaderPage"] > 0) {
471 $a_mapping->
addMapping(
"Modules/LearningModule",
"lm_header_page", $a_rec[
"HeaderPage"],
"-");
473 if ($a_rec[
"FooterPage"] > 0) {
474 $a_mapping->
addMapping(
"Modules/LearningModule",
"lm_footer_page", $a_rec[
"FooterPage"],
"-");
478 $this->current_obj = $newObj;
481 $this->notes->domain()->activateComments($newObj->getId());
482 if ($a_rec[
"EstimatedReadingTime"] ??
false) {
483 $this->reading_time_manager->activate($newObj->getId(),
true);
486 $a_mapping->
addMapping(
"Modules/LearningModule",
"lm", $a_rec[
"Id"], $newObj->getId());
487 $a_mapping->
addMapping(
"Modules/LearningModule",
"lm_style", $newObj->getId(), $a_rec[
"StyleId"]);
488 $a_mapping->
addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
492 $a_rec[
"Id"] .
":0:lm",
493 $newObj->getId() .
":0:lm" 499 switch ($a_rec[
"Type"]) {
501 $parent = (
int) $a_mapping->
getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Parent"]);
503 $st_obj->setType(
"st");
504 $st_obj->setLMId($this->current_obj->getId());
505 $st_obj->setTitle($a_rec[
"Title"]);
506 $st_obj->setShortTitle($a_rec[
"ShortTitle"]);
507 $st_obj->setImportId($a_rec[
"ImportId"]);
508 $st_obj->create(
true);
511 "Modules/LearningModule",
519 $a_rec[
"LmId"] .
":" . $a_rec[
"Child"] .
":st",
520 $this->current_obj->getId() .
":" . $st_obj->getId() .
":st" 525 $parent = (
int) $a_mapping->
getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Parent"]);
527 $pg_obj->setType(
"pg");
528 $pg_obj->setLMId($this->current_obj->getId());
529 $pg_obj->setTitle($a_rec[
"Title"]);
530 $pg_obj->setShortTitle($a_rec[
"ShortTitle"]);
531 $pg_obj->setImportId($a_rec[
"ImportId"]);
532 $pg_obj->create(
true,
true);
535 "Modules/LearningModule",
540 $a_mapping->
addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_obj->getId());
541 $this->lm_log->debug(
"add pg map (1), old : " . $a_rec[
"Child"] .
", new: " . $pg_obj->getId());
545 "lm:" . $a_rec[
"Child"],
546 "lm:" . $pg_obj->getId()
551 $a_rec[
"LmId"] .
":" . $a_rec[
"Child"] .
":pg",
552 $this->current_obj->getId() .
":" . $pg_obj->getId() .
":pg" 559 $pg_obj->setType(
"pg");
560 $pg_obj->setLMId($this->current_obj->getId());
561 $pg_obj->setTitle($a_rec[
"Title"]);
562 $pg_obj->setShortTitle($a_rec[
"ShortTitle"]);
563 $pg_obj->setImportId($a_rec[
"ImportId"]);
564 $pg_obj->create(
true,
true);
566 "Modules/LearningModule",
571 $a_mapping->
addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_obj->getId());
572 $this->lm_log->debug(
"add pg map (2), old : " . $a_rec[
"Child"] .
", new: " . $pg_obj->getId());
576 "lm:" . $a_rec[
"Child"],
577 "lm:" . $pg_obj->getId()
582 $a_rec[
"LmId"] .
":" . $a_rec[
"Child"] .
":pg",
583 $this->current_obj->getId() .
":" . $pg_obj->getId() .
":pg" 588 switch ($a_rec[
"Type"]) {
591 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
592 if ($imp_id[0] ==
"il" &&
599 $trans->setTitle($a_rec[
"Title"]);
602 "Modules/LearningModule",
614 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
615 if ($imp_id[0] ==
"il" &&
622 $trans->setTitle($a_rec[
"Title"]);
624 $a_mapping->
addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_id);
625 $this->lm_log->debug(
"add pg map (3), old : " . $a_rec[
"Child"] .
", new: " . $pg_id);
627 "Modules/LearningModule",
635 "lm:" . $a_rec[
"Child"],
646 case "lm_data_transl":
649 $lm_obj_id = $a_mapping->
getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Id"]);
650 if ($lm_obj_id > 0) {
652 $t->setTitle($a_rec[
"Title"]);
653 $t->setShortTitle($a_rec[
"ShortTitle"]);
660 $lm_id = (
int) $a_mapping->
getMapping(
"Modules/LearningModule",
"lm", $a_rec[
"LmId"]);
663 $lm_menu_ed->setObjId($lm_id);
664 $lm_menu_ed->setTitle($a_rec[
"Title"]);
665 $lm_menu_ed->setTarget($a_rec[
"Target"]);
666 $lm_menu_ed->setLinkType($a_rec[
"LinkType"]);
667 $lm_menu_ed->setLinkRefId($a_rec[
"LinkRefId"]);
668 $lm_menu_ed->setActive($a_rec[
"Active"]);
669 $lm_menu_ed->create();
setMasterLanguageOnly(bool $a_val)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
convertToLeadingUpper(string $a_str)
Make xyz_abc a XyzAbc string.
readData(string $a_entity, string $a_version, array $a_ids)
ILIAS Notes Service $notes
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...
ilObjLearningModule $current_obj
ReadingTimeManager $reading_time_manager
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
setTranslationImportMode(ilObjLearningModule $a_lm, string $a_lang="")
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
ilObjLearningModule $transl_into_lm
getXmlNamespace(string $a_entity, string $a_schema_version)
getCurrentInstallationId()
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 ...
getTypes(string $a_entity, string $a_version)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
getTranslationImportMode()
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
LearningModule Data set class.
static _lookupContObjID(int $a_id)
get learning module id for lm object
static yn2tf(string $a_yn)
stripTags(array $rec, array $omit_keys=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...