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");
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" 172 if ($a_entity ==
"lm_tree") {
173 switch ($a_version) {
177 "Child" =>
"integer",
178 "Parent" =>
"integer",
179 "Depth" =>
"integer",
182 "ShortTitle" =>
"text",
183 "PublicAccess" =>
"text",
191 if ($a_entity ==
"lm_menu") {
192 switch ($a_version) {
196 "LinkType" =>
"text",
199 "LinkRefId" =>
"text",
205 if ($a_entity ==
"lm_data_transl") {
206 switch ($a_version) {
212 "ShortTitle" =>
"text" 224 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
228 if (!is_array($a_ids)) {
229 $a_ids =
array($a_ids);
232 if ($a_entity ==
"lm") {
233 switch ($a_version) {
235 $q =
"SELECT id, title, description," .
236 " default_layout, page_header, toc_active, lm_menu_active, toc_mode, print_view_active, numbering," .
237 " hist_user_comments, public_access_mode, header_page, footer_page, layout_per_page, rating, " .
238 " hide_head_foot_print, disable_def_feedback, rating_pages, store_tries, restrict_forw_nav, progr_icons, stylesheet style_id" .
239 " FROM content_object JOIN object_data ON (content_object.id = object_data.obj_id)" .
240 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer");
242 $set =
$ilDB->query($q);
244 while ($rec =
$ilDB->fetchAssoc($set)) {
246 include_once(
"./Services/Notes/classes/class.ilNote.php");
250 $rec[
"for_translation"] = 1;
253 foreach ($rec as $k => $v) {
259 $this->
data[] = $rec;
268 if ($a_entity ==
"lm_tree") {
269 switch ($a_version) {
273 $q =
"SELECT lm_tree.lm_id, child, parent, depth, type, title, short_title, public_access, active, layout, import_id" .
274 " FROM lm_tree JOIN lm_data ON (lm_tree.child = lm_data.obj_id)" .
275 " WHERE " .
$ilDB->in(
"lm_tree.lm_id", $a_ids,
false,
"integer") .
278 $set =
$ilDB->query($q);
281 while ($rec =
$ilDB->fetchAssoc($set)) {
282 $set2 =
$ilDB->query(
"SELECT for_translation FROM content_object WHERE id = " .
$ilDB->quote($rec[
"lm_id"],
"integer"));
283 $rec2 =
$ilDB->fetchAssoc($set2);
284 if (!$rec2[
"for_translation"]) {
285 $rec[
"import_id"] =
"il_" . IL_INST_ID .
"_" . $rec[
"type"] .
"_" . $rec[
"child"];
288 foreach ($rec as $k => $v) {
293 $obj_ids[] = $rec[
"Child"];
294 $this->
data[] = $rec;
298 $set3 =
$ilDB->query($q =
"SELECT lm_id, type, title, short_title, public_access, active, layout, import_id, obj_id child FROM lm_data " .
299 "WHERE " .
$ilDB->in(
"lm_id", $a_ids,
false,
"integer") .
300 " AND " .
$ilDB->in(
"obj_id", $obj_ids,
true,
"integer") .
301 " AND type = " .
$ilDB->quote(
"pg",
"text"));
302 while ($rec3 =
$ilDB->fetchAssoc($set3)) {
303 $set2 =
$ilDB->query(
"SELECT for_translation FROM content_object WHERE id = " .
$ilDB->quote($rec3[
"lm_id"],
"integer"));
304 $rec2 =
$ilDB->fetchAssoc($set2);
305 if (!$rec2[
"for_translation"]) {
306 $rec3[
"import_id"] =
"il_" . IL_INST_ID .
"_pg_" . $rec3[
"child"];
308 $rec3[
"type"] =
"free_pg";
312 foreach ($rec3 as $k => $v) {
316 $this->
data[] = $tmp;
322 if ($a_entity ==
"lm_menu") {
323 switch ($a_version) {
327 " WHERE " .
$ilDB->in(
"lm_id", $a_ids,
false,
"integer"));
332 if ($a_entity ==
"lm_data_transl") {
333 switch ($a_version) {
336 " FROM lm_data_transl " .
337 " WHERE " .
$ilDB->in(
"id", $a_ids,
false,
"integer"));
351 "lm_tree" =>
array(
"ids" => $a_rec[
"Id"]),
352 "lm_menu" =>
array(
"ids" => $a_rec[
"Id"])
360 "lm_data_transl" =>
array(
"ids" => $a_rec[
"Child"])
375 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
386 include_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
387 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
391 $newObj->setType(
"lm");
392 $newObj->create(
true);
393 $newObj->createLMTree();
396 $newObj->setTitle($a_rec[
"Title"]);
397 $newObj->setDescription($a_rec[
"Description"]);
398 $newObj->setLayout($a_rec[
"DefaultLayout"]);
399 $newObj->setPageHeader($a_rec[
"PageHeader"]);
401 $newObj->setActiveLMMenu(
ilUtil::yn2tf($a_rec[
"LmMenuActive"]));
402 $newObj->setTOCMode($a_rec[
"TocMode"]);
403 $newObj->setActivePrintView(
ilUtil::yn2tf($a_rec[
"PrintViewActive"]));
404 $newObj->setActiveNumbering(
ilUtil::yn2tf($a_rec[
"Numbering"]));
405 $newObj->setHistoryUserComments(
ilUtil::yn2tf($a_rec[
"HistUserComments"]));
406 $newObj->setPublicAccessMode($a_rec[
"PublicAccessMode"]);
409 $newObj->setLayoutPerPage($a_rec[
"LayoutPerPage"]);
410 $newObj->setRating($a_rec[
"Rating"]);
411 $newObj->setHideHeaderFooterPrint($a_rec[
"HideHeadFootPrint"]);
412 $newObj->setDisableDefaultFeedback($a_rec[
"DisableDefFeedback"]);
413 $newObj->setRatingPages($a_rec[
"RatingPages"]);
414 $newObj->setForTranslation($a_rec[
"ForTranslation"]);
415 $newObj->setProgressIcons($a_rec[
"ProgrIcons"]);
416 $newObj->setStoreTries($a_rec[
"StoreTries"]);
417 $newObj->setRestrictForwardNavigation($a_rec[
"RestrictForwNav"]);
418 if ($a_rec[
"HeaderPage"] > 0) {
419 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_header_page", $a_rec[
"HeaderPage"],
"-");
421 if ($a_rec[
"FooterPage"] > 0) {
422 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_footer_page", $a_rec[
"FooterPage"],
"-");
425 $newObj->update(
true);
426 $this->current_obj = $newObj;
429 include_once(
"./Services/Notes/classes/class.ilNote.php");
432 $a_mapping->addMapping(
"Modules/LearningModule",
"lm", $a_rec[
"Id"], $newObj->getId());
433 $a_mapping->addMapping(
"Modules/LearningModule",
"lm_style", $newObj->getId(), $a_rec[
"StyleId"]);
434 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
435 $a_mapping->addMapping(
438 $a_rec[
"Id"] .
":0:lm",
439 $newObj->getId() .
":0:lm" 445 include_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
446 include_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
447 include_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
448 switch ($a_rec[
"Type"]) {
450 $parent = (int) $a_mapping->getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Parent"]);
452 $st_obj->setType(
"st");
453 $st_obj->setLMId($this->current_obj->getId());
454 $st_obj->setTitle($a_rec[
"Title"]);
455 $st_obj->setShortTitle($a_rec[
"ShortTitle"]);
456 $st_obj->setImportId($a_rec[
"ImportId"]);
457 $st_obj->create(
true);
459 $a_mapping->addMapping(
460 "Modules/LearningModule",
465 $a_mapping->addMapping(
468 $a_rec[
"LmId"] .
":" . $a_rec[
"Child"] .
":st",
469 $this->current_obj->getId() .
":" . $st_obj->getId() .
":st" 474 $parent = (int) $a_mapping->getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Parent"]);
476 $pg_obj->setType(
"pg");
477 $pg_obj->setLMId($this->current_obj->getId());
478 $pg_obj->setTitle($a_rec[
"Title"]);
479 $pg_obj->setShortTitle($a_rec[
"ShortTitle"]);
480 $pg_obj->setImportId($a_rec[
"ImportId"]);
481 $pg_obj->create(
true,
true);
483 $a_mapping->addMapping(
484 "Modules/LearningModule",
489 $a_mapping->addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_obj->getId());
490 $this->lm_log->debug(
"add pg map (1), old : " . $a_rec[
"Child"] .
", new: " . $pg_obj->getId());
491 $a_mapping->addMapping(
494 "lm:" . $a_rec[
"Child"],
495 "lm:" . $pg_obj->getId()
497 $a_mapping->addMapping(
500 $a_rec[
"LmId"] .
":" . $a_rec[
"Child"] .
":pg",
501 $this->current_obj->getId() .
":" . $pg_obj->getId() .
":pg" 508 $pg_obj->setType(
"pg");
509 $pg_obj->setLMId($this->current_obj->getId());
510 $pg_obj->setTitle($a_rec[
"Title"]);
511 $pg_obj->setShortTitle($a_rec[
"ShortTitle"]);
512 $pg_obj->setImportId($a_rec[
"ImportId"]);
513 $pg_obj->create(
true,
true);
514 $a_mapping->addMapping(
515 "Modules/LearningModule",
520 $a_mapping->addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_obj->getId());
521 $this->lm_log->debug(
"add pg map (2), old : " . $a_rec[
"Child"] .
", new: " . $pg_obj->getId());
522 $a_mapping->addMapping(
525 "lm:" . $a_rec[
"Child"],
526 "lm:" . $pg_obj->getId()
528 $a_mapping->addMapping(
531 $a_rec[
"LmId"] .
":" . $a_rec[
"Child"] .
":pg",
532 $this->current_obj->getId() .
":" . $pg_obj->getId() .
":pg" 537 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
538 switch ($a_rec[
"Type"]) {
541 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
542 if ($imp_id[0] ==
"il" &&
543 (
int) $imp_id[1] == (
int) IL_INST_ID &&
547 if (ilLMObject::_lookupContObjId($st_id) == $this->
getTranslationLM()->getId()) {
549 $trans->setTitle($a_rec[
"Title"]);
551 $a_mapping->addMapping(
552 "Modules/LearningModule",
564 $imp_id = explode(
"_", $a_rec[
"ImportId"]);
565 if ($imp_id[0] ==
"il" &&
566 (
int) $imp_id[1] == (
int) IL_INST_ID &&
570 if (ilLMObject::_lookupContObjId($pg_id) == $this->
getTranslationLM()->getId()) {
572 $trans->setTitle($a_rec[
"Title"]);
574 $a_mapping->addMapping(
"Modules/LearningModule",
"pg", $a_rec[
"Child"], $pg_id);
575 $this->lm_log->debug(
"add pg map (3), old : " . $a_rec[
"Child"] .
", new: " . $pg_id);
576 $a_mapping->addMapping(
577 "Modules/LearningModule",
582 $a_mapping->addMapping(
585 "lm:" . $a_rec[
"Child"],
596 case "lm_data_transl":
597 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
600 $lm_obj_id = $a_mapping->getMapping(
"Modules/LearningModule",
"lm_tree", $a_rec[
"Id"]);
601 if ($lm_obj_id > 0) {
603 $t->setTitle($a_rec[
"Title"]);
604 $t->setShortTitle($a_rec[
"ShortTitle"]);
611 $lm_id = (int) $a_mapping->getMapping(
"Modules/LearningModule",
"lm", $a_rec[
"LmId"]);
614 $lm_menu_ed->setObjId($lm_id);
615 $lm_menu_ed->setTitle($a_rec[
"Title"]);
616 $lm_menu_ed->setTarget($a_rec[
"Target"]);
617 $lm_menu_ed->setLinkType($a_rec[
"LinkType"]);
618 $lm_menu_ed->setLinkRefId($a_rec[
"LinkRefId"]);
619 $lm_menu_ed->setActive($a_rec[
"Active"]);
620 $lm_menu_ed->create();
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.