4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
36 parent::__construct();
47 $this->master_lang_only = $a_val;
70 $this->transl_into =
true;
71 $this->transl_into_lm = $a_lm;
72 $this->transl_lang = $a_lang;
76 $this->transl_into =
false;
118 return array(
"5.1.0");
129 return "http://www.ilias.de/xml/Modules/LearningModule/".$a_entity;
141 if ($a_entity ==
"lm")
149 "Description" =>
"text",
150 "DefaultLayout" =>
"text",
151 "PageHeader" =>
"text",
152 "TocActive" =>
"text",
153 "LMMenuActive" =>
"text",
155 "PrintViewActive" =>
"text",
156 "Numbering" =>
"text",
157 "HistUserComments" =>
"text",
158 "PublicAccessMode" =>
"text",
159 "PubNotes" =>
"text",
160 "HeaderPage" =>
"integer",
161 "FooterPage" =>
"integer",
162 "LayoutPerPage" =>
"integer",
163 "Rating" =>
"integer",
164 "HideHeadFootPrint" =>
"integer",
165 "DisableDefFeedback" =>
"integer",
166 "RatingPages" =>
"integer",
167 "ProgrIcons" =>
"integer",
168 "StoreTries" =>
"integer",
169 "RestrictForwNav" =>
"integer",
170 "Comments" =>
"integer",
171 "ForTranslation" =>
"integer",
172 "StyleId" =>
"integer" 177 if ($a_entity ==
"lm_tree")
184 "Child" =>
"integer",
185 "Parent" =>
"integer",
186 "Depth" =>
"integer",
189 "PublicAccess" =>
"text",
197 if ($a_entity ==
"lm_menu")
204 "LinkType" =>
"text",
207 "LinkRefId" =>
"text",
213 if ($a_entity ==
"lm_data_transl")
234 function readData($a_entity, $a_version, $a_ids, $a_field =
"")
238 if (!is_array($a_ids))
240 $a_ids =
array($a_ids);
243 if ($a_entity ==
"lm")
248 $q =
"SELECT id, title, description,".
249 " default_layout, page_header, toc_active, lm_menu_active, toc_mode, print_view_active, numbering,".
250 " hist_user_comments, public_access_mode, header_page, footer_page, layout_per_page, rating, ".
251 " hide_head_foot_print, disable_def_feedback, rating_pages, store_tries, restrict_forw_nav, progr_icons, stylesheet style_id".
252 " FROM content_object JOIN object_data ON (content_object.id = object_data.obj_id)".
253 " WHERE ".$ilDB->in(
"id", $a_ids,
false,
"integer");
255 $set = $ilDB->query($q);
257 while ($rec = $ilDB->fetchAssoc($set))
260 include_once(
"./Services/Notes/classes/class.ilNote.php");
265 $rec[
"for_translation"] = 1;
268 foreach ($rec as $k => $v)
275 $this->
data[] = $rec;
284 if ($a_entity ==
"lm_tree")
291 $q =
"SELECT lm_tree.lm_id, child, parent, depth, type, title, public_access, active, layout, import_id".
292 " FROM lm_tree JOIN lm_data ON (lm_tree.child = lm_data.obj_id)".
293 " WHERE ".$ilDB->in(
"lm_tree.lm_id", $a_ids,
false,
"integer").
296 $set = $ilDB->query($q);
299 while ($rec = $ilDB->fetchAssoc($set))
301 $set2 = $ilDB->query(
"SELECT for_translation FROM content_object WHERE id = ".$ilDB->quote($rec[
"lm_id"],
"integer"));
302 $rec2 = $ilDB->fetchAssoc($set2);
303 if (!$rec2[
"for_translation"])
305 $rec[
"import_id"] =
"il_".IL_INST_ID.
"_".$rec[
"type"].
"_".$rec[
"child"];
308 foreach ($rec as $k => $v)
314 $obj_ids[] = $rec[
"Child"];
315 $this->
data[] = $rec;
319 $set3 = $ilDB->query($q =
"SELECT lm_id, type, title, public_access, active, layout, import_id, obj_id child FROM lm_data ".
320 "WHERE ".$ilDB->in(
"lm_id", $a_ids,
false,
"integer").
321 " AND ".$ilDB->in(
"obj_id", $obj_ids,
true,
"integer").
322 " AND type = ".$ilDB->quote(
"pg",
"text"));
323 while ($rec3 = $ilDB->fetchAssoc($set3))
325 $set2 = $ilDB->query(
"SELECT for_translation FROM content_object WHERE id = ".$ilDB->quote($rec3[
"lm_id"],
"integer"));
326 $rec2 = $ilDB->fetchAssoc($set2);
327 if (!$rec2[
"for_translation"])
329 $rec3[
"import_id"] =
"il_".IL_INST_ID.
"_pg_".$rec3[
"child"];
331 $rec3[
"type"] =
"free_pg";
335 foreach ($rec3 as $k => $v)
340 $this->
data[] = $tmp;
346 if ($a_entity ==
"lm_menu")
353 " WHERE ".$ilDB->in(
"lm_id", $a_ids,
false,
"integer"));
358 if ($a_entity ==
"lm_data_transl")
364 " FROM lm_data_transl ".
365 " WHERE ".$ilDB->in(
"id", $a_ids,
false,
"integer"));
382 "lm_tree" =>
array(
"ids" => $a_rec[
"Id"]),
383 "lm_menu" =>
array(
"ids" => $a_rec[
"Id"])
394 "lm_data_transl" =>
array(
"ids" => $a_rec[
"Child"])
409 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
422 include_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
423 if($new_id = $a_mapping->getMapping(
'Services/Container',
'objs',$a_rec[
'Id']))
430 $newObj->setType(
"lm");
431 $newObj->create(
true);
432 $newObj->createLMTree();
435 $newObj->setTitle($a_rec[
"Title"]);
436 $newObj->setDescription($a_rec[
"Description"]);
437 $newObj->setLayout($a_rec[
"DefaultLayout"]);
438 $newObj->setPageHeader($a_rec[
"PageHeader"]);
440 $newObj->setActiveLMMenu(
ilUtil::yn2tf($a_rec[
"LmMenuActive"]));
441 $newObj->setTOCMode($a_rec[
"TocMode"]);
442 $newObj->setActivePrintView(
ilUtil::yn2tf($a_rec[
"PrintViewActive"]));
443 $newObj->setActiveNumbering(
ilUtil::yn2tf($a_rec[
"Numbering"]));
444 $newObj->setHistoryUserComments(
ilUtil::yn2tf($a_rec[
"HistUserComments"]));
445 $newObj->setPublicAccessMode($a_rec[
"PublicAccessMode"]);
448 $newObj->setLayoutPerPage($a_rec[
"LayoutPerPage"]);
449 $newObj->setRating($a_rec[
"Rating"]);
450 $newObj->setHideHeaderFooterPrint($a_rec[
"HideHeadFootPrint"]);
451 $newObj->setDisableDefaultFeedback($a_rec[
"DisableDefFeedback"]);
452 $newObj->setRatingPages($a_rec[
"RatingPages"]);
453 $newObj->setForTranslation($a_rec[
"ForTranslation"]);
454 $newObj->setProgressIcons($a_rec[
"ProgrIcons"]);
455 $newObj->setStoreTries($a_rec[
"StoreTries"]);
456 $newObj->setRestrictForwardNavigation($a_rec[
"RestrictForwNav"]);
457 if ($a_rec[
"HeaderPage"] > 0)
459 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_header_page", $a_rec[
"HeaderPage"],
"-");
461 if ($a_rec[
"FooterPage"] > 0)
463 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_footer_page", $a_rec[
"FooterPage"],
"-");
466 $newObj->update(
true);
467 $this->current_obj = $newObj;
470 include_once(
"./Services/Notes/classes/class.ilNote.php");
473 $a_mapping->addMapping(
"Modules/LearningModule",
"lm", $a_rec[
"Id"], $newObj->getId());
474 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_style", $newObj->getId(), $a_rec[
"StyleId"]);
475 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
476 $a_mapping->addMapping(
"Services/MetaData",
"md",
477 $a_rec[
"Id"].
":0:lm", $newObj->getId().
":0:lm");
483 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
484 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
485 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
486 switch ($a_rec[
"Type"])
489 $parent = (int) $a_mapping->getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Parent"]);
491 $st_obj->setType(
"st");
492 $st_obj->setLMId($this->current_obj->getId());
493 $st_obj->setTitle($a_rec[
"Title"]);
494 $st_obj->setImportId($a_rec[
"ImportId"]);
495 $st_obj->create(
true);
497 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Child"],
499 $a_mapping->addMapping(
"Services/MetaData",
"md",
500 $a_rec[
"LmId"].
":".$a_rec[
"Child"].
":st", $this->current_obj->getId().
":".$st_obj->getId().
":st");
504 $parent = (int) $a_mapping->getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Parent"]);
506 $pg_obj->setType(
"pg");
507 $pg_obj->setLMId($this->current_obj->getId());
508 $pg_obj->setTitle($a_rec[
"Title"]);
509 $pg_obj->setImportId($a_rec[
"ImportId"]);
510 $pg_obj->create(
true,
true);
512 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Child"],
514 $a_mapping->addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_obj->getId());
515 $this->lm_log->debug(
"add pg map (1), old : ".$a_rec[
"Child"].
", new: ".$pg_obj->getId());
516 $a_mapping->addMapping(
"Services/COPage",
"pg",
"lm:".$a_rec[
"Child"],
517 "lm:".$pg_obj->getId());
518 $a_mapping->addMapping(
"Services/MetaData",
"md",
519 $a_rec[
"LmId"].
":".$a_rec[
"Child"].
":pg", $this->current_obj->getId().
":".$pg_obj->getId().
":pg");
525 $pg_obj->setType(
"pg");
526 $pg_obj->setLMId($this->current_obj->getId());
527 $pg_obj->setTitle($a_rec[
"Title"]);
528 $pg_obj->setImportId($a_rec[
"ImportId"]);
529 $pg_obj->create(
true,
true);
530 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Child"],
532 $a_mapping->addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_obj->getId());
533 $this->lm_log->debug(
"add pg map (2), old : ".$a_rec[
"Child"].
", new: ".$pg_obj->getId());
534 $a_mapping->addMapping(
"Services/COPage",
"pg",
"lm:".$a_rec[
"Child"],
535 "lm:".$pg_obj->getId());
536 $a_mapping->addMapping(
"Services/MetaData",
"md",
537 $a_rec[
"LmId"].
":".$a_rec[
"Child"].
":pg", $this->current_obj->getId().
":".$pg_obj->getId().
":pg");
543 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
544 switch ($a_rec[
"Type"])
548 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
549 if ($imp_id[0] ==
"il" &&
550 (
int) $imp_id[1] == (
int) IL_INST_ID &&
555 if (ilLMObject::_lookupContObjId($st_id) == $this->
getTranslationLM()->getId())
558 $trans->setTitle($a_rec[
"Title"]);
560 $a_mapping->addMapping(
"Modules/LearningModule",
"link",
569 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
570 if ($imp_id[0] ==
"il" &&
571 (
int) $imp_id[1] == (
int) IL_INST_ID &&
576 if (ilLMObject::_lookupContObjId($pg_id) == $this->
getTranslationLM()->getId())
579 $trans->setTitle($a_rec[
"Title"]);
581 $a_mapping->addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_id);
582 $this->lm_log->debug(
"add pg map (3), old : ".$a_rec[
"Child"].
", new: ".$pg_id);
583 $a_mapping->addMapping(
"Modules/LearningModule",
"link",
585 $a_mapping->addMapping(
"Services/COPage",
"pg",
"lm:".$a_rec[
"Child"],
595 case "lm_data_transl":
596 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
600 $lm_obj_id = $a_mapping->getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Id"]);
604 $t->setTitle($a_rec[
"Title"]);
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
Class ilObjLearningModule.
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
Create styles array
The data for the language used.
getSupportedVersions()
Get supported versions.
getTranslationImportMode()
Get translation import mode.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
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.