ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ...> ... </types> <set entity="table_name"> <rec> <field_1>content</field_1> <field_2>my_date</field_2> <field_3>my_number</field_3> </rec> ... </set> </dataset> 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 = ""
 

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.

Reimplemented from ilDataSet.

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

35 {
36 parent::__construct();
37
38 $this->lm_log = ilLoggerFactory::getLogger('lm');
39 }
static getLogger($a_component_id)
Get component logger.

References ilLoggerFactory\getLogger().

+ 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 376 of file class.ilLearningModuleDataSet.php.

377 {
378 switch ($a_entity)
379 {
380 case "lm":
381 return array (
382 "lm_tree" => array("ids" => $a_rec["Id"]),
383 "lm_menu" => array("ids" => $a_rec["Id"])
384 );
385
386 case "lm_tree":
387 if ($this->getMasterLanguageOnly())
388 {
389 return false;
390 }
391 else
392 {
393 return array (
394 "lm_data_transl" => array("ids" => $a_rec["Child"])
395 );
396 }
397 }
398
399 return false;
400 }
getMasterLanguageOnly()
Get master language only (export)

References getMasterLanguageOnly().

+ 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

return

Reimplemented from ilDataSet.

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

117 {
118 return array("5.1.0");
119 }

◆ getTranslationImportMode()

ilLearningModuleDataSet::getTranslationImportMode ( )

Get translation import mode.

Returns
bool check if translation import is activated

Definition at line 85 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 105 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 95 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

Reimplemented from ilDataSet.

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

140 {
141 if ($a_entity == "lm")
142 {
143 switch ($a_version)
144 {
145 case "5.1.0":
146 return array(
147 "Id" => "integer",
148 "Title" => "text",
149 "Description" => "text",
150 "DefaultLayout" => "text",
151 "PageHeader" => "text",
152 "TocActive" => "text",
153 "LMMenuActive" => "text",
154 "TOCMode" => "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"
173 );
174 }
175 }
176
177 if ($a_entity == "lm_tree")
178 {
179 switch ($a_version)
180 {
181 case "5.1.0":
182 return array(
183 "LmId" => "integer",
184 "Child" => "integer",
185 "Parent" => "integer",
186 "Depth" => "integer",
187 "Type" => "text",
188 "Title" => "text",
189 "PublicAccess" => "text",
190 "Active" => "text",
191 "Layout" => "text",
192 "ImportId" => "text"
193 );
194 }
195 }
196
197 if ($a_entity == "lm_menu")
198 {
199 switch ($a_version)
200 {
201 case "5.1.0":
202 return array(
203 "LmId" => "integer",
204 "LinkType" => "text",
205 "Title" => "text",
206 "Target" => "text",
207 "LinkRefId" => "text",
208 "Active" => "text"
209 );
210 }
211 }
212
213 if ($a_entity == "lm_data_transl")
214 {
215 switch ($a_version)
216 {
217 case "5.1.0":
218 return array(
219 "Id" => "integer",
220 "Lang" => "text",
221 "Title" => "text"
222 );
223 }
224 }
225
226 }

◆ getXmlNamespace()

ilLearningModuleDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters

return

Reimplemented from ilDataSet.

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

128 {
129 return "http://www.ilias.de/xml/Modules/LearningModule/".$a_entity;
130 }

◆ importRecord()

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

Import record.

Parameters

return

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

410 {
411//var_dump($a_rec);
412
413 switch ($a_entity)
414 {
415 case "lm":
416
417 if ($this->getTranslationImportMode())
418 {
419 return;
420 }
421
422 include_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
423 if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id']))
424 {
425 $newObj = ilObjectFactory::getInstanceByObjId($new_id,false);
426 }
427 else
428 {
429 $newObj = new ilObjLearningModule();
430 $newObj->setType("lm");
431 $newObj->create(true);
432 $newObj->createLMTree();
433 }
434
435 $newObj->setTitle($a_rec["Title"]);
436 $newObj->setDescription($a_rec["Description"]);
437 $newObj->setLayout($a_rec["DefaultLayout"]);
438 $newObj->setPageHeader($a_rec["PageHeader"]);
439 $newObj->setActiveTOC(ilUtil::yn2tf($a_rec["TocActive"]));
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"]);
446 $newObj->setPublicNotes(ilUtil::yn2tf($a_rec["PubNotes"]));
447 // Header Page/ Footer Page ???
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)
458 {
459 $a_mapping->addMapping("Modules/LearningModule", "lm_header_page", $a_rec["HeaderPage"], "-");
460 }
461 if ($a_rec["FooterPage"] > 0)
462 {
463 $a_mapping->addMapping("Modules/LearningModule", "lm_footer_page", $a_rec["FooterPage"], "-");
464 }
465
466 $newObj->update(true);
467 $this->current_obj = $newObj;
468
469 // activated comments
470 include_once("./Services/Notes/classes/class.ilNote.php");
471 ilNote::activateComments($newObj->getId(), 0, "lm", (int) $a_rec["Comments"]);
472
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");
478 break;
479
480 case "lm_tree":
481 if (!$this->getTranslationImportMode())
482 {
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"])
487 {
488 case "st":
489 $parent = (int) $a_mapping->getMapping("Modules/LearningModule", "lm_tree", $a_rec["Parent"]);
490 $st_obj = new ilStructureObject($this->current_obj);
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);
496 ilLMObject::putInTree($st_obj, $parent, IL_LAST_NODE);
497 $a_mapping->addMapping("Modules/LearningModule", "lm_tree", $a_rec["Child"],
498 $st_obj->getId());
499 $a_mapping->addMapping("Services/MetaData", "md",
500 $a_rec["LmId"].":".$a_rec["Child"].":st", $this->current_obj->getId().":".$st_obj->getId().":st");
501 break;
502
503 case "pg":
504 $parent = (int) $a_mapping->getMapping("Modules/LearningModule", "lm_tree", $a_rec["Parent"]);
505 $pg_obj = new ilLMPageObject($this->current_obj);
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);
511 ilLMObject::putInTree($pg_obj, $parent, IL_LAST_NODE);
512 $a_mapping->addMapping("Modules/LearningModule", "lm_tree", $a_rec["Child"],
513 $pg_obj->getId());
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");
520 break;
521
522 // add free pages #18976
523 case "free_pg":
524 $pg_obj = new ilLMPageObject($this->current_obj);
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"],
531 $pg_obj->getId());
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");
538 break;
539 }
540 }
541 else
542 {
543 include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
544 switch ($a_rec["Type"])
545 {
546 case "st":
547 //"il_inst_st_66"
548 $imp_id = explode("_", $a_rec["ImportId"]);
549 if ($imp_id[0] == "il" &&
550 (int) $imp_id[1] == (int) IL_INST_ID &&
551 $imp_id[2] == "st"
552 )
553 {
554 $st_id = $imp_id[3];
555 if (ilLMObject::_lookupContObjId($st_id) == $this->getTranslationLM()->getId())
556 {
557 $trans = new ilLMObjTranslation($st_id, $this->getTranslationLang());
558 $trans->setTitle($a_rec["Title"]);
559 $trans->save();
560 $a_mapping->addMapping("Modules/LearningModule", "link",
561 "il_".$this->getCurrentInstallationId()."_".$a_rec["Type"]."_".$a_rec["Child"], $a_rec["ImportId"]);
562 }
563 }
564 // no meta-data mapping, since we do not want to import metadata
565 break;
566
567 case "pg":
568 //"il_inst_pg_66"
569 $imp_id = explode("_", $a_rec["ImportId"]);
570 if ($imp_id[0] == "il" &&
571 (int) $imp_id[1] == (int) IL_INST_ID &&
572 $imp_id[2] == "pg"
573 )
574 {
575 $pg_id = $imp_id[3];
576 if (ilLMObject::_lookupContObjId($pg_id) == $this->getTranslationLM()->getId())
577 {
578 $trans = new ilLMObjTranslation($pg_id, $this->getTranslationLang());
579 $trans->setTitle($a_rec["Title"]);
580 $trans->save();
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",
584 "il_".$this->getCurrentInstallationId()."_".$a_rec["Type"]."_".$a_rec["Child"], $a_rec["ImportId"]);
585 $a_mapping->addMapping("Services/COPage", "pg", "lm:".$a_rec["Child"],
586 "lm:".$pg_id);
587 }
588 }
589 // no meta-data mapping, since we do not want to import metadata
590 break;
591 }
592 }
593 break;
594
595 case "lm_data_transl":
596 include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
597 if (!$this->getTranslationImportMode())
598 {
599 // save page/chapter title translation
600 $lm_obj_id = $a_mapping->getMapping("Modules/LearningModule", "lm_tree", $a_rec["Id"]);
601 if ($lm_obj_id > 0)
602 {
603 $t = new ilLMObjTranslation($lm_obj_id, $a_rec["Lang"]);
604 $t->setTitle($a_rec["Title"]);
605 $t->save();
606 }
607 }
608 break;
609 }
610 }
const IL_LAST_NODE
Definition: class.ilTree.php:4
getCurrentInstallationId()
Get current installation id.
Translation information on lm object.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
Class ilLMPageObject.
getTranslationLang()
Get translation language (import.
getTranslationLM()
Get translation lm (import.
getTranslationImportMode()
Get translation import mode.
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
Class ilObjLearningModule.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilStructreObject.
static yn2tf($a_yn)
convert "y"/"n" to true/false

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

+ Here is the call graph for this function:

◆ readData()

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

Read data.

Parameters

return

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

235 {
236 global $ilDB;
237
238 if (!is_array($a_ids))
239 {
240 $a_ids = array($a_ids);
241 }
242
243 if ($a_entity == "lm")
244 {
245 switch ($a_version)
246 {
247 case "5.1.0":
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");
254
255 $set = $ilDB->query($q);
256 $this->data = array();
257 while ($rec = $ilDB->fetchAssoc($set))
258 {
259 // comments activated?
260 include_once("./Services/Notes/classes/class.ilNote.php");
261 $rec["comments"] = ilNote::commentsActivated($rec["id"], 0, "lm");
262
263 if ($this->getMasterLanguageOnly())
264 {
265 $rec["for_translation"] = 1;
266 }
267 $tmp = array();
268 foreach ($rec as $k => $v)
269 {
270 $tmp[$this->convertToLeadingUpper($k)]
271 = $v;
272 }
273 $rec = $tmp;
274
275 $this->data[] = $rec;
276 }
277 break;
278
279
280 break;
281 }
282 }
283
284 if ($a_entity == "lm_tree")
285 {
286 switch ($a_version)
287 {
288 case "5.1.0":
289 // the order by lft is very important, this ensures that parent nodes are written before
290 // their childs and that the import can add nodes simply with a "add at last child" target
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").
294 " ORDER BY lft";
295
296 $set = $ilDB->query($q);
297 $this->data = array();
298 $obj_ids = array();
299 while ($rec = $ilDB->fetchAssoc($set))
300 {
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"])
304 {
305 $rec["import_id"] = "il_".IL_INST_ID."_".$rec["type"]."_".$rec["child"];
306 }
307 $tmp = array();
308 foreach ($rec as $k => $v)
309 {
310 $tmp[$this->convertToLeadingUpper($k)]
311 = $v;
312 }
313 $rec = $tmp;
314 $obj_ids[] = $rec["Child"];
315 $this->data[] = $rec;
316 }
317
318 // add free pages #18976
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))
324 {
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"])
328 {
329 $rec3["import_id"] = "il_".IL_INST_ID."_pg_".$rec3["child"];
330 }
331 $rec3["type"] = "free_pg";
332 $rec3["depth"] = 0;
333 $rec3["parent"] = 0;
334 $tmp = array();
335 foreach ($rec3 as $k => $v)
336 {
337 $tmp[$this->convertToLeadingUpper($k)]
338 = $v;
339 }
340 $this->data[] = $tmp;
341 }
342 break;
343 }
344 }
345
346 if ($a_entity == "lm_menu")
347 {
348 switch ($a_version)
349 {
350 case "5.1.0":
351 $this->getDirectDataFromQuery("SELECT lm_id, link_type, title, target, link_ref_id, active".
352 " FROM lm_menu ".
353 " WHERE ".$ilDB->in("lm_id", $a_ids, false, "integer"));
354 break;
355 }
356 }
357
358 if ($a_entity == "lm_data_transl")
359 {
360 switch ($a_version)
361 {
362 case "5.1.0":
363 $this->getDirectDataFromQuery("SELECT id, lang, title".
364 " FROM lm_data_transl ".
365 " WHERE ".$ilDB->in("id", $a_ids, false, "integer"));
366 break;
367 }
368 }
369
370
371 }
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.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
global $ilDB

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

+ 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 {
70 $this->transl_into = true;
71 $this->transl_into_lm = $a_lm;
72 $this->transl_lang = $a_lang;
73 }
74 else
75 {
76 $this->transl_into = false;
77 }
78 }

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: