ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLearningModuleDataSet Class Reference

LearningModule Data set class. More...

+ Inheritance diagram for ilLearningModuleDataSet:
+ Collaboration diagram for ilLearningModuleDataSet:

Public Member Functions

 __construct ()
 
 setMasterLanguageOnly (bool $a_val)
 
 getMasterLanguageOnly ()
 
 setTranslationImportMode (ilObjLearningModule $a_lm, string $a_lang="")
 
 getTranslationImportMode ()
 
 getTranslationLM ()
 
 getTranslationLang ()
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 
 init (string $a_entity, string $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 Read data from DB. More...
 
 setExportDirectories (string $a_relative, string $a_absolute)
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setDSPrefix (string $a_val)
 
 getDSPrefix ()
 
 getDSPrefixString ()
 
 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 fields. More...
 
 convertToLeadingUpper (string $a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, ?array $a_ids, string $a_field="", bool $a_omit_header=false, bool $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text"> <ftype name="field_2" type="date"> <ftype name="field_3" type="integer"> </types> <types ...> ... More...
 
 addRecordsXml (ilXmlWriter $a_writer, array $a_prefixes, string $a_entity, string $a_schema_version, array $a_ids, ?string $a_field="")
 
 afterXmlRecordWriting (string $a_entity, string $a_version, array $a_set)
 
 getNamespaces (array &$namespaces, string $a_entity, string $a_schema_version)
 
 getXmlRecord (string $a_entity, string $a_version, array $a_set)
 Get xml record for version. More...
 
 getXmlTypes (string $a_entity, string $a_version)
 Get xml types. More...
 
 getXMLEntityName (string $a_entity, string $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag (string $a_entity, string $a_schema_version)
 Get entity tag. More...
 
 setImport (ilSurveyImporter $a_val)
 
 getImport ()
 
 setCurrentInstallationId (string $a_val)
 
 getCurrentInstallationId ()
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 

Protected Member Functions

 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getTypes (string $a_entity, string $a_version)
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
- Protected Member Functions inherited from ilDataSet
 getTypes (string $a_entity, string $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
 createObjectExportId (string $a_type, string $a_id)
 Build ilias export id. More...
 
 parseObjectExportId (string $a_id, ?string $a_fallback_id=null)
 Parse export id. More...
 
 stripTags (array $rec, array $omit_keys=[])
 

Protected Attributes

ReadingTimeManager $reading_time_manager
 
ILIAS Notes Service $notes
 
ilObjLearningModule $current_obj
 
bool $master_lang_only = false
 
bool $transl_into = false
 
ilObjLearningModule $transl_into_lm = null
 
string $transl_lang = ""
 
ilLogger $lm_log
 
- Protected Attributes inherited from ilDataSet
string $current_installation_id = ""
 
array $data = []
 
ilDBInterface $db
 
ilLogger $ds_log
 
string $import_directory = ""
 
string $entity = ""
 
string $schema_version = ""
 
string $relative_export_dir = ""
 
string $absolute_export_dir = ""
 
string $ds_prefix = "ds"
 
string $version = ""
 
ilSurveyImporter $import
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
const EXPORT_NO_INST_ID = 1
 
const EXPORT_ID_ILIAS_LOCAL = 2
 
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
 
const EXPORT_ID_ILIAS_REMOTE = 4
 
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
 
const EXPORT_ID = 6
 
const EXPORT_ID_INVALID = 7
 
int $dircnt = 0
 

Detailed Description

LearningModule Data set class.

This class implements the following entities:

  • lm: data from content_object
  • lm_tree: data from lm_tree/lm_data
  • lm_data_transl: data from lm_data_transl
  • lm_menu: data from lm_menu
Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 32 of file class.ilLearningModuleDataSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilLearningModuleDataSet::__construct ( )

Definition at line 43 of file class.ilLearningModuleDataSet.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ilLoggerFactory\getLogger().

44  {
45  global $DIC;
46 
48  $this->lm_log = ilLoggerFactory::getLogger('lm');
49  $this->notes = $DIC->notes();
50  $this->reading_time_manager = new ReadingTimeManager();
51  }
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getDependencies()

ilLearningModuleDataSet::getDependencies ( string  $a_entity,
string  $a_version,
?array  $a_rec = null,
?array  $a_ids = null 
)
protected

Definition at line 397 of file class.ilLearningModuleDataSet.php.

References getMasterLanguageOnly().

402  : array {
403  switch ($a_entity) {
404  case "lm":
405  return array(
406  "lm_tree" => array("ids" => $a_rec["Id"] ?? null),
407  "lm_menu" => array("ids" => $a_rec["Id"] ?? null)
408  );
409 
410  case "lm_tree":
411  if ($this->getMasterLanguageOnly()) {
412  return [];
413  } else {
414  return array(
415  "lm_data_transl" => array("ids" => $a_rec["Child"] ?? null)
416  );
417  }
418  }
419 
420  return [];
421  }
+ Here is the call graph for this function:

◆ getMasterLanguageOnly()

ilLearningModuleDataSet::getMasterLanguageOnly ( )

Definition at line 58 of file class.ilLearningModuleDataSet.php.

References $master_lang_only.

Referenced by getDependencies(), and readData().

58  : bool
59  {
61  }
+ Here is the caller graph for this function:

◆ getSupportedVersions()

ilLearningModuleDataSet::getSupportedVersions ( )

Definition at line 91 of file class.ilLearningModuleDataSet.php.

91  : array
92  {
93  return array("5.1.0", "5.4.0");
94  }

◆ getTranslationImportMode()

ilLearningModuleDataSet::getTranslationImportMode ( )

Definition at line 76 of file class.ilLearningModuleDataSet.php.

References $transl_into.

Referenced by importRecord().

76  : bool
77  {
78  return $this->transl_into;
79  }
+ Here is the caller graph for this function:

◆ getTranslationLang()

ilLearningModuleDataSet::getTranslationLang ( )

Definition at line 86 of file class.ilLearningModuleDataSet.php.

References $transl_lang.

Referenced by importRecord().

86  : string
87  {
88  return $this->transl_lang;
89  }
+ Here is the caller graph for this function:

◆ getTranslationLM()

ilLearningModuleDataSet::getTranslationLM ( )

Definition at line 81 of file class.ilLearningModuleDataSet.php.

References $transl_into_lm.

Referenced by importRecord().

82  {
83  return $this->transl_into_lm;
84  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getTypes()

ilLearningModuleDataSet::getTypes ( string  $a_entity,
string  $a_version 
)
protected

Definition at line 101 of file class.ilLearningModuleDataSet.php.

101  : array
102  {
103  if ($a_entity == "lm") {
104  switch ($a_version) {
105  case "5.1.0":
106  return array(
107  "Id" => "integer",
108  "Title" => "text",
109  "Description" => "text",
110  "DefaultLayout" => "text",
111  "PageHeader" => "text",
112  "TocActive" => "text",
113  "LMMenuActive" => "text",
114  "TOCMode" => "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"
133  );
134 
135  case "5.4.0":
136  return array(
137  "Id" => "integer",
138  "Title" => "text",
139  "Description" => "text",
140  "DefaultLayout" => "text",
141  "PageHeader" => "text",
142  "TocActive" => "text",
143  "LMMenuActive" => "text",
144  "TOCMode" => "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"
164  );
165 
166  case "8.0":
167  return array(
168  "Id" => "integer",
169  "Title" => "text",
170  "Description" => "text",
171  "DefaultLayout" => "text",
172  "PageHeader" => "text",
173  "TocActive" => "text",
174  "LMMenuActive" => "text",
175  "TOCMode" => "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"
196  );
197 
198  }
199  }
200 
201  if ($a_entity == "lm_tree") {
202  switch ($a_version) {
203  case "5.1.0":
204  case "5.4.0":
205  case "8.0":
206  return array(
207  "LmId" => "integer",
208  "Child" => "integer",
209  "Parent" => "integer",
210  "Depth" => "integer",
211  "Type" => "text",
212  "Title" => "text",
213  "ShortTitle" => "text",
214  "PublicAccess" => "text",
215  "Active" => "text",
216  "Layout" => "text",
217  "ImportId" => "text"
218  );
219  }
220  }
221 
222  if ($a_entity == "lm_menu") {
223  switch ($a_version) {
224  case "5.1.0":
225  case "5.4.0":
226  case "8.0":
227  return array(
228  "LmId" => "integer",
229  "LinkType" => "text",
230  "Title" => "text",
231  "Target" => "text",
232  "LinkRefId" => "text",
233  "Active" => "text"
234  );
235  }
236  }
237 
238  if ($a_entity == "lm_data_transl") {
239  switch ($a_version) {
240  case "5.1.0":
241  case "5.4.0":
242  case "8.0":
243  return array(
244  "Id" => "integer",
245  "Lang" => "text",
246  "Title" => "text",
247  "ShortTitle" => "text"
248  );
249  }
250  }
251  return [];
252  }

◆ getXmlNamespace()

ilLearningModuleDataSet::getXmlNamespace ( string  $a_entity,
string  $a_schema_version 
)
protected

Definition at line 96 of file class.ilLearningModuleDataSet.php.

96  : string
97  {
98  return "https://www.ilias.de/xml/Modules/LearningModule/" . $a_entity;
99  }

◆ importRecord()

ilLearningModuleDataSet::importRecord ( string  $a_entity,
array  $a_types,
array  $a_rec,
ilImportMapping  $a_mapping,
string  $a_schema_version 
)

Definition at line 423 of file class.ilLearningModuleDataSet.php.

References ilLMObject\_lookupContObjID(), ilImportMapping\addMapping(), ilDataSet\getCurrentInstallationId(), ILIAS\Survey\Mode\getId(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), getTranslationImportMode(), getTranslationLang(), getTranslationLM(), IL_INST_ID, ILIAS\Repository\int(), ilTree\POS_LAST_NODE, ilLMObject\putInTree(), ilDataSet\stripTags(), and ilUtil\yn2tf().

429  : void {
430  $a_rec = $this->stripTags($a_rec);
431 
432  switch ($a_entity) {
433  case "lm":
434 
435  if ($this->getTranslationImportMode()) {
436  return;
437  }
438 
439  if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
440  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
441  } else {
442  $newObj = new ilObjLearningModule();
443  $newObj->setType("lm");
444  $newObj->create(true);
445  $newObj->createLMTree();
446  }
447 
448  $newObj->setTitle($a_rec["Title"]);
449  $newObj->setDescription($a_rec["Description"]);
450  $newObj->setLayout($a_rec["DefaultLayout"]);
451  $newObj->setPageHeader($a_rec["PageHeader"]);
452  $newObj->setActiveTOC(ilUtil::yn2tf($a_rec["TocActive"]));
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"]);
460  $newObj->setPublicNotes(ilUtil::yn2tf($a_rec["PubNotes"] ?? "n"));
461  // Header Page/ Footer Page ???
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"] ?? false);
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"], "-");
473  }
474  if ($a_rec["FooterPage"] > 0) {
475  $a_mapping->addMapping("Modules/LearningModule", "lm_footer_page", $a_rec["FooterPage"], "-");
476  }
477 
478  $newObj->update();
479  $this->current_obj = $newObj;
480 
481  // activated comments
482  $this->notes->domain()->activateComments($newObj->getId());
483  if ($a_rec["EstimatedReadingTime"] ?? false) {
484  $this->reading_time_manager->activate($newObj->getId(), true);
485  }
486 
487  $a_mapping->addMapping("Modules/LearningModule", "lm", $a_rec["Id"], $newObj->getId());
488  $a_mapping->addMapping("Modules/LearningModule", "lm_style", $newObj->getId(), $a_rec["StyleId"]);
489  $a_mapping->addMapping("Services/Object", "obj", $a_rec["Id"], $newObj->getId());
490  $a_mapping->addMapping(
491  "Services/MetaData",
492  "md",
493  $a_rec["Id"] . ":0:lm",
494  $newObj->getId() . ":0:lm"
495  );
496  break;
497 
498  case "lm_tree":
499  if (!$this->getTranslationImportMode()) {
500  switch ($a_rec["Type"]) {
501  case "st":
502  $parent = (int) $a_mapping->getMapping("Modules/LearningModule", "lm_tree", $a_rec["Parent"]);
503  $st_obj = new ilStructureObject($this->current_obj);
504  $st_obj->setType("st");
505  $st_obj->setLMId($this->current_obj->getId());
506  $st_obj->setTitle($a_rec["Title"]);
507  $st_obj->setShortTitle($a_rec["ShortTitle"]);
508  $st_obj->setImportId($a_rec["ImportId"]);
509  $st_obj->create(true);
510  ilLMObject::putInTree($st_obj, $parent, ilTree::POS_LAST_NODE);
511  $a_mapping->addMapping(
512  "Modules/LearningModule",
513  "lm_tree",
514  $a_rec["Child"],
515  $st_obj->getId()
516  );
517  $a_mapping->addMapping(
518  "Services/MetaData",
519  "md",
520  $a_rec["LmId"] . ":" . $a_rec["Child"] . ":st",
521  $this->current_obj->getId() . ":" . $st_obj->getId() . ":st"
522  );
523  break;
524 
525  case "pg":
526  $parent = (int) $a_mapping->getMapping("Modules/LearningModule", "lm_tree", $a_rec["Parent"]);
527  $pg_obj = new ilLMPageObject($this->current_obj);
528  $pg_obj->setType("pg");
529  $pg_obj->setLMId($this->current_obj->getId());
530  $pg_obj->setTitle($a_rec["Title"]);
531  $pg_obj->setShortTitle($a_rec["ShortTitle"]);
532  $pg_obj->setImportId($a_rec["ImportId"]);
533  $pg_obj->create(true, true);
534  ilLMObject::putInTree($pg_obj, $parent, ilTree::POS_LAST_NODE);
535  $a_mapping->addMapping(
536  "Modules/LearningModule",
537  "lm_tree",
538  $a_rec["Child"],
539  $pg_obj->getId()
540  );
541  $a_mapping->addMapping("Modules/LearningModule", "pg", $a_rec["Child"], $pg_obj->getId());
542  $this->lm_log->debug("add pg map (1), old : " . $a_rec["Child"] . ", new: " . $pg_obj->getId());
543  $a_mapping->addMapping(
544  "Services/COPage",
545  "pg",
546  "lm:" . $a_rec["Child"],
547  "lm:" . $pg_obj->getId()
548  );
549  $a_mapping->addMapping(
550  "Services/MetaData",
551  "md",
552  $a_rec["LmId"] . ":" . $a_rec["Child"] . ":pg",
553  $this->current_obj->getId() . ":" . $pg_obj->getId() . ":pg"
554  );
555  break;
556 
557  // add free pages #18976
558  case "free_pg":
559  $pg_obj = new ilLMPageObject($this->current_obj);
560  $pg_obj->setType("pg");
561  $pg_obj->setLMId($this->current_obj->getId());
562  $pg_obj->setTitle($a_rec["Title"]);
563  $pg_obj->setShortTitle($a_rec["ShortTitle"]);
564  $pg_obj->setImportId($a_rec["ImportId"]);
565  $pg_obj->create(true, true);
566  $a_mapping->addMapping(
567  "Modules/LearningModule",
568  "lm_tree",
569  $a_rec["Child"],
570  $pg_obj->getId()
571  );
572  $a_mapping->addMapping("Modules/LearningModule", "pg", $a_rec["Child"], $pg_obj->getId());
573  $this->lm_log->debug("add pg map (2), old : " . $a_rec["Child"] . ", new: " . $pg_obj->getId());
574  $a_mapping->addMapping(
575  "Services/COPage",
576  "pg",
577  "lm:" . $a_rec["Child"],
578  "lm:" . $pg_obj->getId()
579  );
580  $a_mapping->addMapping(
581  "Services/MetaData",
582  "md",
583  $a_rec["LmId"] . ":" . $a_rec["Child"] . ":pg",
584  $this->current_obj->getId() . ":" . $pg_obj->getId() . ":pg"
585  );
586  break;
587  }
588  } else {
589  switch ($a_rec["Type"]) {
590  case "st":
591  //"il_inst_st_66"
592  $imp_id = explode("_", $a_rec["ImportId"]);
593  if ($imp_id[0] == "il" &&
594  (int) $imp_id[1] == (int) IL_INST_ID &&
595  $imp_id[2] == "st"
596  ) {
597  $st_id = $imp_id[3];
598  if (ilLMObject::_lookupContObjID($st_id) == $this->getTranslationLM()->getId()) {
599  $trans = new ilLMObjTranslation($st_id, $this->getTranslationLang());
600  $trans->setTitle($a_rec["Title"]);
601  $trans->save();
602  $a_mapping->addMapping(
603  "Modules/LearningModule",
604  "link",
605  "il_" . $this->getCurrentInstallationId() . "_" . $a_rec["Type"] . "_" . $a_rec["Child"],
606  $a_rec["ImportId"]
607  );
608  }
609  }
610  // no meta-data mapping, since we do not want to import metadata
611  break;
612 
613  case "pg":
614  //"il_inst_pg_66"
615  $imp_id = explode("_", $a_rec["ImportId"]);
616  if ($imp_id[0] == "il" &&
617  (int) $imp_id[1] == (int) IL_INST_ID &&
618  $imp_id[2] == "pg"
619  ) {
620  $pg_id = $imp_id[3];
621  if (ilLMObject::_lookupContObjID($pg_id) == $this->getTranslationLM()->getId()) {
622  $trans = new ilLMObjTranslation($pg_id, $this->getTranslationLang());
623  $trans->setTitle($a_rec["Title"]);
624  $trans->save();
625  $a_mapping->addMapping("Modules/LearningModule", "pg", $a_rec["Child"], $pg_id);
626  $this->lm_log->debug("add pg map (3), old : " . $a_rec["Child"] . ", new: " . $pg_id);
627  $a_mapping->addMapping(
628  "Modules/LearningModule",
629  "link",
630  "il_" . $this->getCurrentInstallationId() . "_" . $a_rec["Type"] . "_" . $a_rec["Child"],
631  $a_rec["ImportId"]
632  );
633  $a_mapping->addMapping(
634  "Services/COPage",
635  "pg",
636  "lm:" . $a_rec["Child"],
637  "lm:" . $pg_id
638  );
639  }
640  }
641  // no meta-data mapping, since we do not want to import metadata
642  break;
643  }
644  }
645  break;
646 
647  case "lm_data_transl":
648  if (!$this->getTranslationImportMode()) {
649  // save page/chapter title translation
650  $lm_obj_id = $a_mapping->getMapping("Modules/LearningModule", "lm_tree", $a_rec["Id"]);
651  if ($lm_obj_id > 0) {
652  $t = new ilLMObjTranslation($lm_obj_id, $a_rec["Lang"]);
653  $t->setTitle($a_rec["Title"]);
654  $t->setShortTitle($a_rec["ShortTitle"]);
655  $t->save();
656  }
657  }
658  break;
659 
660  case "lm_menu":
661  $lm_id = (int) $a_mapping->getMapping("Modules/LearningModule", "lm", $a_rec["LmId"]);
662  if ($lm_id > 0) {
663  $lm_menu_ed = new ilLMMenuEditor();
664  $lm_menu_ed->setObjId($lm_id);
665  $lm_menu_ed->setTitle($a_rec["Title"]);
666  $lm_menu_ed->setTarget($a_rec["Target"]);
667  $lm_menu_ed->setLinkType($a_rec["LinkType"]);
668  $lm_menu_ed->setLinkRefId($a_rec["LinkRefId"]);
669  $lm_menu_ed->setActive($a_rec["Active"]);
670  $lm_menu_ed->create();
671  }
672  break;
673  }
674  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_INST_ID
Definition: constants.php:40
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
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...
getCurrentInstallationId()
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
const POS_LAST_NODE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
+ Here is the call graph for this function:

◆ readData()

ilLearningModuleDataSet::readData ( string  $a_entity,
string  $a_version,
array  $a_ids 
)

Definition at line 254 of file class.ilLearningModuleDataSet.php.

References ilDataSet\$db, $ilDB, ilDataSet\convertToLeadingUpper(), ilDataSet\getDirectDataFromQuery(), getMasterLanguageOnly(), and IL_INST_ID.

254  : void
255  {
256  $ilDB = $this->db;
257 
258  if (!is_array($a_ids)) {
259  $a_ids = array($a_ids);
260  }
261 
262  $q = "";
263  if ($a_entity == "lm") {
264  switch ($a_version) {
265  case "5.1.0":
266  case "5.4.0":
267  case "8.0":
268  switch ($a_version) {
269  case "5.1.0":
270  $q = "SELECT id, title, description," .
271  " default_layout, page_header, toc_active, lm_menu_active, toc_mode, print_view_active, numbering," .
272  " hist_user_comments, public_access_mode, header_page, footer_page, layout_per_page, rating, " .
273  " hide_head_foot_print, disable_def_feedback, rating_pages, store_tries, restrict_forw_nav, progr_icons, stylesheet style_id" .
274  " FROM content_object JOIN object_data ON (content_object.id = object_data.obj_id)" .
275  " WHERE " . $ilDB->in("id", $a_ids, false, "integer");
276  break;
277 
278  case "5.4.0":
279  case "8.0":
280  $q = "SELECT id, title, description," .
281  " default_layout, page_header, toc_active, lm_menu_active, toc_mode, print_view_active, numbering," .
282  " hist_user_comments, public_access_mode, no_glo_appendix, header_page, footer_page, layout_per_page, rating, " .
283  " hide_head_foot_print, disable_def_feedback, rating_pages, store_tries, restrict_forw_nav, progr_icons, stylesheet style_id" .
284  " FROM content_object JOIN object_data ON (content_object.id = object_data.obj_id)" .
285  " WHERE " . $ilDB->in("id", $a_ids, false, "integer");
286 
287  }
288 
289  $set = $ilDB->query($q);
290  $this->data = array();
291  while ($rec = $ilDB->fetchAssoc($set)) {
292  // comments activated?
293  $rec["comments"] = (string) (int)
294  $this->notes->domain()->commentsActive((int) $rec["id"]);
295 
296  if ($a_version === "8.0") {
297  $rec["estimated_reading_time"] = (string) (int)
298  $this->reading_time_manager->isActivated((int) $rec["id"]);
299  }
300 
301  if ($this->getMasterLanguageOnly()) {
302  $rec["for_translation"] = 1;
303  }
304  $tmp = array();
305  foreach ($rec as $k => $v) {
306  $tmp[$this->convertToLeadingUpper($k)]
307  = $v;
308  }
309  $rec = $tmp;
310  $this->data[] = $rec;
311  }
312  break;
313  }
314  }
315 
316  if ($a_entity == "lm_tree") {
317  switch ($a_version) {
318  case "5.1.0":
319  case "5.4.0":
320  case "8.0":
321  // the order by lft is very important, this ensures that parent nodes are written before
322  // their childs and that the import can add nodes simply with a "add at last child" target
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") .
326  " ORDER BY lft";
327 
328  $set = $ilDB->query($q);
329  $this->data = array();
330  $obj_ids = 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"];
336  }
337  $tmp = array();
338  foreach ($rec as $k => $v) {
339  $tmp[$this->convertToLeadingUpper($k)]
340  = $v;
341  }
342  $rec = $tmp;
343  $obj_ids[] = $rec["Child"];
344  $this->data[] = $rec;
345  }
346 
347  // add free pages #18976
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"];
357  }
358  $rec3["type"] = "free_pg";
359  $rec3["depth"] = 0;
360  $rec3["parent"] = 0;
361  $tmp = array();
362  foreach ($rec3 as $k => $v) {
363  $tmp[$this->convertToLeadingUpper($k)]
364  = $v;
365  }
366  $this->data[] = $tmp;
367  }
368  break;
369  }
370  }
371 
372  if ($a_entity == "lm_menu") {
373  switch ($a_version) {
374  case "5.1.0":
375  case "5.4.0":
376  case "8.0":
377  $this->getDirectDataFromQuery("SELECT lm_id, link_type, title, target, link_ref_id, active" .
378  " FROM lm_menu " .
379  " WHERE " . $ilDB->in("lm_id", $a_ids, false, "integer"));
380  break;
381  }
382  }
383 
384  if ($a_entity == "lm_data_transl") {
385  switch ($a_version) {
386  case "5.1.0":
387  case "5.4.0":
388  case "8.0":
389  $this->getDirectDataFromQuery("SELECT id, lang, title, short_title" .
390  " FROM lm_data_transl " .
391  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
392  break;
393  }
394  }
395  }
convertToLeadingUpper(string $a_str)
Make xyz_abc a XyzAbc string.
const IL_INST_ID
Definition: constants.php:40
ilDBInterface $db
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 ...
+ Here is the call graph for this function:

◆ setMasterLanguageOnly()

ilLearningModuleDataSet::setMasterLanguageOnly ( bool  $a_val)

Definition at line 53 of file class.ilLearningModuleDataSet.php.

53  : void
54  {
55  $this->master_lang_only = $a_val;
56  }

◆ setTranslationImportMode()

ilLearningModuleDataSet::setTranslationImportMode ( ilObjLearningModule  $a_lm,
string  $a_lang = "" 
)

Definition at line 63 of file class.ilLearningModuleDataSet.php.

66  : void {
67  if ($a_lm != null) {
68  $this->transl_into = true;
69  $this->transl_into_lm = $a_lm;
70  $this->transl_lang = $a_lang;
71  } else {
72  $this->transl_into = false;
73  }
74  }

Field Documentation

◆ $current_obj

ilObjLearningModule ilLearningModuleDataSet::$current_obj
protected

Definition at line 36 of file class.ilLearningModuleDataSet.php.

◆ $lm_log

ilLogger ilLearningModuleDataSet::$lm_log
protected

Definition at line 41 of file class.ilLearningModuleDataSet.php.

◆ $master_lang_only

bool ilLearningModuleDataSet::$master_lang_only = false
protected

Definition at line 37 of file class.ilLearningModuleDataSet.php.

Referenced by getMasterLanguageOnly().

◆ $notes

ILIAS Notes Service ilLearningModuleDataSet::$notes
protected

Definition at line 35 of file class.ilLearningModuleDataSet.php.

◆ $reading_time_manager

ReadingTimeManager ilLearningModuleDataSet::$reading_time_manager
protected

Definition at line 34 of file class.ilLearningModuleDataSet.php.

◆ $transl_into

bool ilLearningModuleDataSet::$transl_into = false
protected

Definition at line 38 of file class.ilLearningModuleDataSet.php.

Referenced by getTranslationImportMode().

◆ $transl_into_lm

ilObjLearningModule ilLearningModuleDataSet::$transl_into_lm = null
protected

Definition at line 39 of file class.ilLearningModuleDataSet.php.

Referenced by getTranslationLM().

◆ $transl_lang

string ilLearningModuleDataSet::$transl_lang = ""
protected

Definition at line 40 of file class.ilLearningModuleDataSet.php.

Referenced by getTranslationLang().


The documentation for this class was generated from the following file: