ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLearningModuleDataSet Class Reference

LearningModule Data set class. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 setMasterLanguageOnly ($a_val)
 Set master language only (export) More...
 
 getMasterLanguageOnly ()
 Get master language only (export) More...
 
 setTranslationImportMode ($a_lm, $a_lang="")
 Set translation import mode. More...
 
 getTranslationImportMode ()
 Get translation import mode. More...
 
 getTranslationLM ()
 Get translation lm (import. More...
 
 getTranslationLang ()
 Get translation language (import. More...
 
 getSupportedVersions ()
 Get supported versions. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data. More...
 
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor. More...
 
 init ($a_entity, $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 Get supported version. More...
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB. More...
 
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix. More...
 
 getDSPrefix ()
 Get XML dataset namespace prefix. More...
 
 getDSPrefixString ()
 
 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 fields. More...
 
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getJsonRepresentation ()
 Get json representation. More...
 
 getXmlRepresentation ( $a_entity, $a_schema_version, $a_ids, $a_field="", $a_omit_header=false, $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 ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml. More...
 
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record. More...
 
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version. More...
 
 getJsonRecord ($a_set)
 Get json record for version. More...
 
 getXmlTypes ($a_entity, $a_version)
 Get xml types. More...
 
 getJsonTypes ($a_entity, $a_version)
 Get json types. More...
 
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag. More...
 
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten) More...
 
 setImport ($a_val)
 Set import object. More...
 
 getImport ()
 Get import object. More...
 
 setCurrentInstallationId ($a_val)
 Set current installation id. More...
 
 getCurrentInstallationId ()
 Get current installation id. More...
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity. More...
 
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data. More...
 
- Protected Member Functions inherited from ilDataSet
 getTypes ($a_entity, $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 createObjectExportId ($a_type, $a_id)
 Build ilias export id. More...
 
 parseObjectExportId ($a_id, $a_fallback_id=null)
 Parse export id. More...
 

Protected Attributes

 $master_lang_only = false
 
 $transl_into = false
 
 $transl_into_lm = null
 
 $transl_lang = ""
 
 $lm_log
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt
 
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
 

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
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilLearningModuleDataSet::__construct ( )

Constructor.

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

References ilLoggerFactory\getLogger().

35  {
36  parent::__construct();
37 
38  $this->lm_log = ilLoggerFactory::getLogger('lm');
39  }
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Member Function Documentation

◆ getDependencies()

ilLearningModuleDataSet::getDependencies (   $a_entity,
  $a_version,
  $a_rec,
  $a_ids 
)
protected

Determine the dependent sets of data.

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

References getMasterLanguageOnly().

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

◆ getMasterLanguageOnly()

ilLearningModuleDataSet::getMasterLanguageOnly ( )

Get master language only (export)

Returns
bool export only master language

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

References $master_lang_only.

Referenced by getDependencies(), and readData().

+ Here is the caller graph for this function:

◆ getSupportedVersions()

ilLearningModuleDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

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

114  {
115  return array("5.1.0", "5.4.0");
116  }

◆ getTranslationImportMode()

ilLearningModuleDataSet::getTranslationImportMode ( )

Get translation import mode.

Returns
bool check if translation import is activated

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

References $transl_into.

Referenced by importRecord().

+ Here is the caller graph for this function:

◆ getTranslationLang()

ilLearningModuleDataSet::getTranslationLang ( )

Get translation language (import.

Returns
string language

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

References $transl_lang.

Referenced by importRecord().

+ Here is the caller graph for this function:

◆ getTranslationLM()

ilLearningModuleDataSet::getTranslationLM ( )

Get translation lm (import.

Returns
ilObjLearningModule learning module

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

References $transl_into_lm.

Referenced by importRecord().

+ Here is the caller graph for this function:

◆ getTypes()

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

Get field types for entity.

Parameters
string$a_entityentity
string$a_versionversion number
Returns
array types array

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

137  {
138  if ($a_entity == "lm") {
139  switch ($a_version) {
140  case "5.1.0":
141  return array(
142  "Id" => "integer",
143  "Title" => "text",
144  "Description" => "text",
145  "DefaultLayout" => "text",
146  "PageHeader" => "text",
147  "TocActive" => "text",
148  "LMMenuActive" => "text",
149  "TOCMode" => "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"
168  );
169 
170  case "5.4.0":
171  return array(
172  "Id" => "integer",
173  "Title" => "text",
174  "Description" => "text",
175  "DefaultLayout" => "text",
176  "PageHeader" => "text",
177  "TocActive" => "text",
178  "LMMenuActive" => "text",
179  "TOCMode" => "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"
199  );
200 
201  }
202  }
203 
204  if ($a_entity == "lm_tree") {
205  switch ($a_version) {
206  case "5.1.0":
207  case "5.4.0":
208  return array(
209  "LmId" => "integer",
210  "Child" => "integer",
211  "Parent" => "integer",
212  "Depth" => "integer",
213  "Type" => "text",
214  "Title" => "text",
215  "ShortTitle" => "text",
216  "PublicAccess" => "text",
217  "Active" => "text",
218  "Layout" => "text",
219  "ImportId" => "text"
220  );
221  }
222  }
223 
224  if ($a_entity == "lm_menu") {
225  switch ($a_version) {
226  case "5.1.0":
227  case "5.4.0":
228  return array(
229  "LmId" => "integer",
230  "LinkType" => "text",
231  "Title" => "text",
232  "Target" => "text",
233  "LinkRefId" => "text",
234  "Active" => "text"
235  );
236  }
237  }
238 
239  if ($a_entity == "lm_data_transl") {
240  switch ($a_version) {
241  case "5.1.0":
242  case "5.4.0":
243  return array(
244  "Id" => "integer",
245  "Lang" => "text",
246  "Title" => "text",
247  "ShortTitle" => "text"
248  );
249  }
250  }
251  }

◆ getXmlNamespace()

ilLearningModuleDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

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

125  {
126  return "http://www.ilias.de/xml/Modules/LearningModule/" . $a_entity;
127  }

◆ importRecord()

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

Import record.

Parameters

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

References $t, ilNote\activateComments(), ilDataSet\getCurrentInstallationId(), ilObjectFactory\getInstanceByObjId(), getTranslationImportMode(), getTranslationLang(), getTranslationLM(), IL_LAST_NODE, ilLMObject\putInTree(), and ilUtil\yn2tf().

428  {
429  //var_dump($a_rec);
430 
431  switch ($a_entity) {
432  case "lm":
433 
434  if ($this->getTranslationImportMode()) {
435  return;
436  }
437 
438  include_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
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"]));
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"]);
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(true);
479  $this->current_obj = $newObj;
480 
481  // activated comments
482  include_once("./Services/Notes/classes/class.ilNote.php");
483  ilNote::activateComments($newObj->getId(), 0, "lm", (int) $a_rec["Comments"]);
484 
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(
489  "Services/MetaData",
490  "md",
491  $a_rec["Id"] . ":0:lm",
492  $newObj->getId() . ":0:lm"
493  );
494  break;
495 
496  case "lm_tree":
497  if (!$this->getTranslationImportMode()) {
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"]) {
502  case "st":
503  $parent = (int) $a_mapping->getMapping("Modules/LearningModule", "lm_tree", $a_rec["Parent"]);
504  $st_obj = new ilStructureObject($this->current_obj);
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);
511  ilLMObject::putInTree($st_obj, $parent, IL_LAST_NODE);
512  $a_mapping->addMapping(
513  "Modules/LearningModule",
514  "lm_tree",
515  $a_rec["Child"],
516  $st_obj->getId()
517  );
518  $a_mapping->addMapping(
519  "Services/MetaData",
520  "md",
521  $a_rec["LmId"] . ":" . $a_rec["Child"] . ":st",
522  $this->current_obj->getId() . ":" . $st_obj->getId() . ":st"
523  );
524  break;
525 
526  case "pg":
527  $parent = (int) $a_mapping->getMapping("Modules/LearningModule", "lm_tree", $a_rec["Parent"]);
528  $pg_obj = new ilLMPageObject($this->current_obj);
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);
535  ilLMObject::putInTree($pg_obj, $parent, IL_LAST_NODE);
536  $a_mapping->addMapping(
537  "Modules/LearningModule",
538  "lm_tree",
539  $a_rec["Child"],
540  $pg_obj->getId()
541  );
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(
545  "Services/COPage",
546  "pg",
547  "lm:" . $a_rec["Child"],
548  "lm:" . $pg_obj->getId()
549  );
550  $a_mapping->addMapping(
551  "Services/MetaData",
552  "md",
553  $a_rec["LmId"] . ":" . $a_rec["Child"] . ":pg",
554  $this->current_obj->getId() . ":" . $pg_obj->getId() . ":pg"
555  );
556  break;
557 
558  // add free pages #18976
559  case "free_pg":
560  $pg_obj = new ilLMPageObject($this->current_obj);
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",
569  "lm_tree",
570  $a_rec["Child"],
571  $pg_obj->getId()
572  );
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(
576  "Services/COPage",
577  "pg",
578  "lm:" . $a_rec["Child"],
579  "lm:" . $pg_obj->getId()
580  );
581  $a_mapping->addMapping(
582  "Services/MetaData",
583  "md",
584  $a_rec["LmId"] . ":" . $a_rec["Child"] . ":pg",
585  $this->current_obj->getId() . ":" . $pg_obj->getId() . ":pg"
586  );
587  break;
588  }
589  } else {
590  include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
591  switch ($a_rec["Type"]) {
592  case "st":
593  //"il_inst_st_66"
594  $imp_id = explode("_", $a_rec["ImportId"]);
595  if ($imp_id[0] == "il" &&
596  (int) $imp_id[1] == (int) IL_INST_ID &&
597  $imp_id[2] == "st"
598  ) {
599  $st_id = $imp_id[3];
600  if (ilLMObject::_lookupContObjId($st_id) == $this->getTranslationLM()->getId()) {
601  $trans = new ilLMObjTranslation($st_id, $this->getTranslationLang());
602  $trans->setTitle($a_rec["Title"]);
603  $trans->save();
604  $a_mapping->addMapping(
605  "Modules/LearningModule",
606  "link",
607  "il_" . $this->getCurrentInstallationId() . "_" . $a_rec["Type"] . "_" . $a_rec["Child"],
608  $a_rec["ImportId"]
609  );
610  }
611  }
612  // no meta-data mapping, since we do not want to import metadata
613  break;
614 
615  case "pg":
616  //"il_inst_pg_66"
617  $imp_id = explode("_", $a_rec["ImportId"]);
618  if ($imp_id[0] == "il" &&
619  (int) $imp_id[1] == (int) IL_INST_ID &&
620  $imp_id[2] == "pg"
621  ) {
622  $pg_id = $imp_id[3];
623  if (ilLMObject::_lookupContObjId($pg_id) == $this->getTranslationLM()->getId()) {
624  $trans = new ilLMObjTranslation($pg_id, $this->getTranslationLang());
625  $trans->setTitle($a_rec["Title"]);
626  $trans->save();
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",
631  "link",
632  "il_" . $this->getCurrentInstallationId() . "_" . $a_rec["Type"] . "_" . $a_rec["Child"],
633  $a_rec["ImportId"]
634  );
635  $a_mapping->addMapping(
636  "Services/COPage",
637  "pg",
638  "lm:" . $a_rec["Child"],
639  "lm:" . $pg_id
640  );
641  }
642  }
643  // no meta-data mapping, since we do not want to import metadata
644  break;
645  }
646  }
647  break;
648 
649  case "lm_data_transl":
650  include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
651  if (!$this->getTranslationImportMode()) {
652  // save page/chapter title translation
653  $lm_obj_id = $a_mapping->getMapping("Modules/LearningModule", "lm_tree", $a_rec["Id"]);
654  if ($lm_obj_id > 0) {
655  $t = new ilLMObjTranslation($lm_obj_id, $a_rec["Lang"]);
656  $t->setTitle($a_rec["Title"]);
657  $t->setShortTitle($a_rec["ShortTitle"]);
658  $t->save();
659  }
660  }
661  break;
662 
663  case "lm_menu":
664  $lm_id = (int) $a_mapping->getMapping("Modules/LearningModule", "lm", $a_rec["LmId"]);
665  if ($lm_id > 0) {
666  $lm_menu_ed = new ilLMMenuEditor();
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();
674  }
675  break;
676 
677  }
678  }
Class ilObjLearningModule.
getTranslationLM()
Get translation lm (import.
Class ilLMPageObject.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
class for editing lm menu
getCurrentInstallationId()
Get current installation id.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
const IL_LAST_NODE
Definition: class.ilTree.php:4
getTranslationImportMode()
Get translation import mode.
Class ilStructreObject.
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
static yn2tf($a_yn)
convert "y"/"n" to true/false
Translation information on lm object.
getTranslationLang()
Get translation language (import.
+ Here is the call graph for this function:

◆ readData()

ilLearningModuleDataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters

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

References ilDataSet\$db, $ilDB, ilNote\commentsActivated(), ilDataSet\convertToLeadingUpper(), data, ilDataSet\getDirectDataFromQuery(), and getMasterLanguageOnly().

260  {
261  $ilDB = $this->db;
262 
263  if (!is_array($a_ids)) {
264  $a_ids = array($a_ids);
265  }
266 
267  if ($a_entity == "lm") {
268  switch ($a_version) {
269  case "5.1.0":
270  case "5.4.0":
271  switch ($a_version) {
272  case "5.1.0":
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");
279  break;
280 
281  case "5.4.0":
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");
288 
289  }
290 
291  $set = $ilDB->query($q);
292  $this->data = array();
293  while ($rec = $ilDB->fetchAssoc($set)) {
294  // comments activated?
295  include_once("./Services/Notes/classes/class.ilNote.php");
296  $rec["comments"] = ilNote::commentsActivated($rec["id"], 0, "lm");
297 
298  if ($this->getMasterLanguageOnly()) {
299  $rec["for_translation"] = 1;
300  }
301  $tmp = array();
302  foreach ($rec as $k => $v) {
303  $tmp[$this->convertToLeadingUpper($k)]
304  = $v;
305  }
306  $rec = $tmp;
307 
308  $this->data[] = $rec;
309  }
310  break;
311 
312 
313  break;
314  }
315  }
316 
317  if ($a_entity == "lm_tree") {
318  switch ($a_version) {
319  case "5.1.0":
320  case "5.4.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  $this->getDirectDataFromQuery("SELECT lm_id, link_type, title, target, link_ref_id, active" .
377  " FROM lm_menu " .
378  " WHERE " . $ilDB->in("lm_id", $a_ids, false, "integer"));
379  break;
380  }
381  }
382 
383  if ($a_entity == "lm_data_transl") {
384  switch ($a_version) {
385  case "5.1.0":
386  case "5.4.0":
387  $this->getDirectDataFromQuery("SELECT id, lang, title, short_title" .
388  " FROM lm_data_transl " .
389  " WHERE " . $ilDB->in("id", $a_ids, false, "integer"));
390  break;
391  }
392  }
393  }
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 ...
convertToLeadingUpper($a_str)
Make xyz_abc a XyzAbc string.
$this data['403_header']
global $ilDB
getMasterLanguageOnly()
Get master language only (export)
+ Here is the call graph for this function:

◆ setMasterLanguageOnly()

ilLearningModuleDataSet::setMasterLanguageOnly (   $a_val)

Set master language only (export)

Parameters
bool$a_valexport only master language

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

46  {
47  $this->master_lang_only = $a_val;
48  }

◆ setTranslationImportMode()

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

Set translation import mode.

Parameters
ilObjLearningModule$a_lmlearning module
string$a_langlanguage

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

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

Field Documentation

◆ $lm_log

ilLearningModuleDataSet::$lm_log
protected

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

◆ $master_lang_only

ilLearningModuleDataSet::$master_lang_only = false
protected

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

Referenced by getMasterLanguageOnly().

◆ $transl_into

ilLearningModuleDataSet::$transl_into = false
protected

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

Referenced by getTranslationImportMode().

◆ $transl_into_lm

ilLearningModuleDataSet::$transl_into_lm = null
protected

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

Referenced by getTranslationLM().

◆ $transl_lang

ilLearningModuleDataSet::$transl_lang = ""
protected

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

Referenced by getTranslationLang().


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