4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
36 parent::__construct();
47 $this->master_lang_only = $a_val;
69 $this->transl_into =
true;
70 $this->transl_into_lm = $a_lm;
71 $this->transl_lang = $a_lang;
73 $this->transl_into =
false;
115 return array(
"5.1.0",
"5.4.0");
126 return "http://www.ilias.de/xml/Modules/LearningModule/" . $a_entity;
138 if ($a_entity ==
"lm") {
139 switch ($a_version) {
144 "Description" =>
"text",
145 "DefaultLayout" =>
"text",
146 "PageHeader" =>
"text",
147 "TocActive" =>
"text",
148 "LMMenuActive" =>
"text",
150 "PrintViewActive" =>
"text",
151 "Numbering" =>
"text",
152 "HistUserComments" =>
"text",
153 "PublicAccessMode" =>
"text",
154 "PubNotes" =>
"text",
155 "HeaderPage" =>
"integer",
156 "FooterPage" =>
"integer",
157 "LayoutPerPage" =>
"integer",
158 "Rating" =>
"integer",
159 "HideHeadFootPrint" =>
"integer",
160 "DisableDefFeedback" =>
"integer",
161 "RatingPages" =>
"integer",
162 "ProgrIcons" =>
"integer",
163 "StoreTries" =>
"integer",
164 "RestrictForwNav" =>
"integer",
165 "Comments" =>
"integer",
166 "ForTranslation" =>
"integer",
167 "StyleId" =>
"integer" 174 "Description" =>
"text",
175 "DefaultLayout" =>
"text",
176 "PageHeader" =>
"text",
177 "TocActive" =>
"text",
178 "LMMenuActive" =>
"text",
180 "PrintViewActive" =>
"text",
181 "NoGloAppendix" =>
"text",
182 "Numbering" =>
"text",
183 "HistUserComments" =>
"text",
184 "PublicAccessMode" =>
"text",
185 "PubNotes" =>
"text",
186 "HeaderPage" =>
"integer",
187 "FooterPage" =>
"integer",
188 "LayoutPerPage" =>
"integer",
189 "Rating" =>
"integer",
190 "HideHeadFootPrint" =>
"integer",
191 "DisableDefFeedback" =>
"integer",
192 "RatingPages" =>
"integer",
193 "ProgrIcons" =>
"integer",
194 "StoreTries" =>
"integer",
195 "RestrictForwNav" =>
"integer",
196 "Comments" =>
"integer",
197 "ForTranslation" =>
"integer",
198 "StyleId" =>
"integer" 204 if ($a_entity ==
"lm_tree") {
205 switch ($a_version) {
210 "Child" =>
"integer",
211 "Parent" =>
"integer",
212 "Depth" =>
"integer",
215 "ShortTitle" =>
"text",
216 "PublicAccess" =>
"text",
224 if ($a_entity ==
"lm_menu") {
225 switch ($a_version) {
230 "LinkType" =>
"text",
233 "LinkRefId" =>
"text",
239 if ($a_entity ==
"lm_data_transl") {
240 switch ($a_version) {
247 "ShortTitle" =>
"text" 259 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
263 if (!is_array($a_ids)) {
264 $a_ids = array($a_ids);
267 if ($a_entity ==
"lm") {
268 switch ($a_version) {
271 switch ($a_version) {
273 $q =
"SELECT id, title, description," .
274 " default_layout, page_header, toc_active, lm_menu_active, toc_mode, print_view_active, numbering," .
275 " hist_user_comments, public_access_mode, header_page, footer_page, layout_per_page, rating, " .
276 " hide_head_foot_print, disable_def_feedback, rating_pages, store_tries, restrict_forw_nav, progr_icons, stylesheet style_id" .
277 " FROM content_object JOIN object_data ON (content_object.id = object_data.obj_id)" .
278 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer");
282 $q =
"SELECT id, title, description," .
283 " default_layout, page_header, toc_active, lm_menu_active, toc_mode, print_view_active, numbering," .
284 " hist_user_comments, public_access_mode, no_glo_appendix, header_page, footer_page, layout_per_page, rating, " .
285 " hide_head_foot_print, disable_def_feedback, rating_pages, store_tries, restrict_forw_nav, progr_icons, stylesheet style_id" .
286 " FROM content_object JOIN object_data ON (content_object.id = object_data.obj_id)" .
287 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer");
291 $set =
$ilDB->query($q);
292 $this->
data = array();
293 while ($rec =
$ilDB->fetchAssoc($set)) {
295 include_once(
"./Services/Notes/classes/class.ilNote.php");
299 $rec[
"for_translation"] = 1;
302 foreach ($rec as $k => $v) {
308 $this->
data[] = $rec;
317 if ($a_entity ==
"lm_tree") {
318 switch ($a_version) {
323 $q =
"SELECT lm_tree.lm_id, child, parent, depth, type, title, short_title, public_access, active, layout, import_id" .
324 " FROM lm_tree JOIN lm_data ON (lm_tree.child = lm_data.obj_id)" .
325 " WHERE " .
$ilDB->in(
"lm_tree.lm_id", $a_ids,
false,
"integer") .
328 $set =
$ilDB->query($q);
329 $this->
data = array();
331 while ($rec =
$ilDB->fetchAssoc($set)) {
332 $set2 =
$ilDB->query(
"SELECT for_translation FROM content_object WHERE id = " .
$ilDB->quote($rec[
"lm_id"],
"integer"));
333 $rec2 =
$ilDB->fetchAssoc($set2);
334 if (!$rec2[
"for_translation"]) {
335 $rec[
"import_id"] =
"il_" . IL_INST_ID .
"_" . $rec[
"type"] .
"_" . $rec[
"child"];
338 foreach ($rec as $k => $v) {
343 $obj_ids[] = $rec[
"Child"];
344 $this->
data[] = $rec;
348 $set3 =
$ilDB->query($q =
"SELECT lm_id, type, title, short_title, public_access, active, layout, import_id, obj_id child FROM lm_data " .
349 "WHERE " .
$ilDB->in(
"lm_id", $a_ids,
false,
"integer") .
350 " AND " .
$ilDB->in(
"obj_id", $obj_ids,
true,
"integer") .
351 " AND type = " .
$ilDB->quote(
"pg",
"text"));
352 while ($rec3 =
$ilDB->fetchAssoc($set3)) {
353 $set2 =
$ilDB->query(
"SELECT for_translation FROM content_object WHERE id = " .
$ilDB->quote($rec3[
"lm_id"],
"integer"));
354 $rec2 =
$ilDB->fetchAssoc($set2);
355 if (!$rec2[
"for_translation"]) {
356 $rec3[
"import_id"] =
"il_" . IL_INST_ID .
"_pg_" . $rec3[
"child"];
358 $rec3[
"type"] =
"free_pg";
362 foreach ($rec3 as $k => $v) {
366 $this->
data[] = $tmp;
372 if ($a_entity ==
"lm_menu") {
373 switch ($a_version) {
378 " WHERE " .
$ilDB->in(
"lm_id", $a_ids,
false,
"integer"));
383 if ($a_entity ==
"lm_data_transl") {
384 switch ($a_version) {
388 " FROM lm_data_transl " .
389 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
403 "lm_tree" => array(
"ids" => $a_rec[
"Id"]),
404 "lm_menu" => array(
"ids" => $a_rec[
"Id"])
412 "lm_data_transl" => array(
"ids" => $a_rec[
"Child"])
427 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
438 include_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
439 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
443 $newObj->setType(
"lm");
444 $newObj->create(
true);
445 $newObj->createLMTree();
448 $newObj->setTitle($a_rec[
"Title"]);
449 $newObj->setDescription($a_rec[
"Description"]);
450 $newObj->setLayout($a_rec[
"DefaultLayout"]);
451 $newObj->setPageHeader($a_rec[
"PageHeader"]);
453 $newObj->setActiveLMMenu(
ilUtil::yn2tf($a_rec[
"LmMenuActive"]));
454 $newObj->setTOCMode($a_rec[
"TocMode"]);
455 $newObj->setActivePrintView(
ilUtil::yn2tf($a_rec[
"PrintViewActive"]));
456 $newObj->setActivePreventGlossaryAppendix(
ilUtil::yn2tf($a_rec[
"NoGloAppendix"]));
457 $newObj->setActiveNumbering(
ilUtil::yn2tf($a_rec[
"Numbering"]));
458 $newObj->setHistoryUserComments(
ilUtil::yn2tf($a_rec[
"HistUserComments"]));
459 $newObj->setPublicAccessMode($a_rec[
"PublicAccessMode"]);
462 $newObj->setLayoutPerPage($a_rec[
"LayoutPerPage"]);
463 $newObj->setRating($a_rec[
"Rating"]);
464 $newObj->setHideHeaderFooterPrint($a_rec[
"HideHeadFootPrint"]);
465 $newObj->setDisableDefaultFeedback($a_rec[
"DisableDefFeedback"]);
466 $newObj->setRatingPages($a_rec[
"RatingPages"]);
467 $newObj->setForTranslation($a_rec[
"ForTranslation"]);
468 $newObj->setProgressIcons($a_rec[
"ProgrIcons"]);
469 $newObj->setStoreTries($a_rec[
"StoreTries"]);
470 $newObj->setRestrictForwardNavigation($a_rec[
"RestrictForwNav"]);
471 if ($a_rec[
"HeaderPage"] > 0) {
472 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_header_page", $a_rec[
"HeaderPage"],
"-");
474 if ($a_rec[
"FooterPage"] > 0) {
475 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_footer_page", $a_rec[
"FooterPage"],
"-");
478 $newObj->update(
true);
479 $this->current_obj = $newObj;
482 include_once(
"./Services/Notes/classes/class.ilNote.php");
485 $a_mapping->addMapping(
"Modules/LearningModule",
"lm", $a_rec[
"Id"], $newObj->getId());
486 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_style", $newObj->getId(), $a_rec[
"StyleId"]);
487 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
488 $a_mapping->addMapping(
491 $a_rec[
"Id"] .
":0:lm",
492 $newObj->getId() .
":0:lm" 498 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
499 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
500 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
501 switch ($a_rec[
"Type"]) {
503 $parent = (int) $a_mapping->getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Parent"]);
505 $st_obj->setType(
"st");
506 $st_obj->setLMId($this->current_obj->getId());
507 $st_obj->setTitle($a_rec[
"Title"]);
508 $st_obj->setShortTitle($a_rec[
"ShortTitle"]);
509 $st_obj->setImportId($a_rec[
"ImportId"]);
510 $st_obj->create(
true);
512 $a_mapping->addMapping(
513 "Modules/LearningModule",
518 $a_mapping->addMapping(
521 $a_rec[
"LmId"] .
":" . $a_rec[
"Child"] .
":st",
522 $this->current_obj->getId() .
":" . $st_obj->getId() .
":st" 527 $parent = (int) $a_mapping->getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Parent"]);
529 $pg_obj->setType(
"pg");
530 $pg_obj->setLMId($this->current_obj->getId());
531 $pg_obj->setTitle($a_rec[
"Title"]);
532 $pg_obj->setShortTitle($a_rec[
"ShortTitle"]);
533 $pg_obj->setImportId($a_rec[
"ImportId"]);
534 $pg_obj->create(
true,
true);
536 $a_mapping->addMapping(
537 "Modules/LearningModule",
542 $a_mapping->addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_obj->getId());
543 $this->lm_log->debug(
"add pg map (1), old : " . $a_rec[
"Child"] .
", new: " . $pg_obj->getId());
544 $a_mapping->addMapping(
547 "lm:" . $a_rec[
"Child"],
548 "lm:" . $pg_obj->getId()
550 $a_mapping->addMapping(
553 $a_rec[
"LmId"] .
":" . $a_rec[
"Child"] .
":pg",
554 $this->current_obj->getId() .
":" . $pg_obj->getId() .
":pg" 561 $pg_obj->setType(
"pg");
562 $pg_obj->setLMId($this->current_obj->getId());
563 $pg_obj->setTitle($a_rec[
"Title"]);
564 $pg_obj->setShortTitle($a_rec[
"ShortTitle"]);
565 $pg_obj->setImportId($a_rec[
"ImportId"]);
566 $pg_obj->create(
true,
true);
567 $a_mapping->addMapping(
568 "Modules/LearningModule",
573 $a_mapping->addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_obj->getId());
574 $this->lm_log->debug(
"add pg map (2), old : " . $a_rec[
"Child"] .
", new: " . $pg_obj->getId());
575 $a_mapping->addMapping(
578 "lm:" . $a_rec[
"Child"],
579 "lm:" . $pg_obj->getId()
581 $a_mapping->addMapping(
584 $a_rec[
"LmId"] .
":" . $a_rec[
"Child"] .
":pg",
585 $this->current_obj->getId() .
":" . $pg_obj->getId() .
":pg" 590 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
591 switch ($a_rec[
"Type"]) {
594 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
595 if ($imp_id[0] ==
"il" &&
596 (
int) $imp_id[1] == (
int) IL_INST_ID &&
600 if (ilLMObject::_lookupContObjId($st_id) == $this->
getTranslationLM()->getId()) {
602 $trans->setTitle($a_rec[
"Title"]);
604 $a_mapping->addMapping(
605 "Modules/LearningModule",
617 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
618 if ($imp_id[0] ==
"il" &&
619 (
int) $imp_id[1] == (
int) IL_INST_ID &&
623 if (ilLMObject::_lookupContObjId($pg_id) == $this->
getTranslationLM()->getId()) {
625 $trans->setTitle($a_rec[
"Title"]);
627 $a_mapping->addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_id);
628 $this->lm_log->debug(
"add pg map (3), old : " . $a_rec[
"Child"] .
", new: " . $pg_id);
629 $a_mapping->addMapping(
630 "Modules/LearningModule",
635 $a_mapping->addMapping(
638 "lm:" . $a_rec[
"Child"],
649 case "lm_data_transl":
650 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
653 $lm_obj_id = $a_mapping->getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Id"]);
654 if ($lm_obj_id > 0) {
656 $t->setTitle($a_rec[
"Title"]);
657 $t->setShortTitle($a_rec[
"ShortTitle"]);
664 $lm_id = (int) $a_mapping->getMapping(
"Modules/LearningModule",
"lm", $a_rec[
"LmId"]);
667 $lm_menu_ed->setObjId($lm_id);
668 $lm_menu_ed->setTitle($a_rec[
"Title"]);
669 $lm_menu_ed->setTarget($a_rec[
"Target"]);
670 $lm_menu_ed->setLinkType($a_rec[
"LinkType"]);
671 $lm_menu_ed->setLinkRefId($a_rec[
"LinkRefId"]);
672 $lm_menu_ed->setActive($a_rec[
"Active"]);
673 $lm_menu_ed->create();
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
Class ilObjLearningModule.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
setTranslationImportMode($a_lm, $a_lang="")
Set translation import mode.
getTranslationLM()
Get translation lm (import.
convertToLeadingUpper($a_str)
Make xyz_abc a XyzAbc string.
getTypes($a_entity, $a_version)
Get field types for entity.
__construct()
Constructor.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
setMasterLanguageOnly($a_val)
Set master language only (export)
getCurrentInstallationId()
Get current installation id.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getSupportedVersions()
Get supported versions.
getTranslationImportMode()
Get translation import mode.
LearningModule Data set class.
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
static getLogger($a_component_id)
Get component logger.
static yn2tf($a_yn)
convert "y"/"n" to true/false
A dataset contains in data in a common structure that can be shared and transformed for different pur...
Translation information on lm object.
getMasterLanguageOnly()
Get master language only (export)
getTranslationLang()
Get translation language (import.