ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilLMObject Class Reference

Class ilLMObject. More...

+ Inheritance diagram for ilLMObject:
+ Collaboration diagram for ilLMObject:

Public Member Functions

 ilLMObject ($a_content_obj, $a_id=0)
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 _lookupNID ($a_lm_id, $a_lm_obj_id, $a_type)
 lookup named identifier (ILIAS_NID) More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 setDataRecord ($a_record)
 this method should only be called by class ilLMObjectFactory More...
 
 read ()
 
 setTitle ($a_title)
 set title of lm object More...
 
 getTitle ()
 get title of lm object More...
 
 _writeTitle ($a_obj_id, $a_title)
 
 setDescription ($a_description)
 
 getDescription ()
 
 setType ($a_type)
 
 getType ()
 
 setLMId ($a_lm_id)
 
 getLMId ()
 
 setContentObject (&$a_content_obj)
 
getContentObject ()
 
 setId ($a_id)
 
 getId ()
 
 getImportId ()
 
 setImportId ($a_id)
 
 setLayout ($a_val)
 Set layout. More...
 
 getLayout ()
 Get layout. More...
 
 _writeImportId ($a_id, $a_import_id)
 write import id to db (static) More...
 
 create ($a_upload=false)
 
 update ()
 update complete object More...
 
 delete ($a_delete_meta_data=true)
 delete lm object data More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _getAllObjectsForImportId ($a_import_id, $a_in_lm=0)
 Get all items for an import ID. More...
 
 _exists ($a_id)
 checks wether a lm content object with specified id exists or not More...
 
 getObjectList ($lm_id, $type="")
 static More...
 
 _deleteAllObjectData (&$a_cobj)
 delete all objects of content object (digi book / learning module) More...
 
 _lookupContObjID ($a_id)
 get learning module / digibook id for lm object More...
 
 clipboardCut ($a_cont_obj_id, $a_ids)
 Copy a set of chapters/pages into the clipboard. More...
 
 existsExportID ($a_lm_id, $a_exp_id, $a_type="pg")
 Does export ID exist in lm? More...
 
 getExportIDInfo ($a_lm_id, $a_exp_id, $a_type="pg")
 Does export ID exist in lm? More...
 

Static Public Member Functions

static preloadDataByLM ($a_lm_id)
 Preload data records by lm. More...
 
static _lookupTitle ($a_obj_id)
 Lookup title. More...
 
static _lookupType ($a_obj_id, $a_lm_id=0)
 Lookup type. More...
 
 _writePublicAccessStatus ($a_pages, $a_cont_obj_id)
 update public access flags in lm_data for all pages of a content object@access public More...
 
static _isPagePublic ($a_node_id, $a_check_public_mode=false)
 
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 put this object into content object tree More...
 
static getTree ($a_cont_obj_id)
 Get learningmodule tree. More...
 
static clipboardCopy ($a_cont_obj_id, $a_ids)
 Copy a set of chapters/pages into the clipboard. More...
 
static pasteTree ($a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_source_lm=null)
 Paste item (tree) from clipboard to current lm. More...
 
static saveTitles ($a_lm, $a_titles, $a_lang="-")
 Save titles for lm objects. More...
 
static updateInternalLinks ($a_copied_nodes, $a_parent_type="lm")
 Update internal links, after multiple pages have been copied. More...
 
static uniqueTypesCheck ($a_items)
 Check for unique types (all pages or all chapters) More...
 
static writeLayout ($a_obj_id, $a_layout, $a_lm=null)
 Write layout setting. More...
 
static lookupLayout ($a_obj_id)
 Lookup type. More...
 
static getPagesOfChapter ($a_lm_id, $a_chap_id)
 Get pages of chapter. More...
 
static _getAllLMObjectsOfLM ($a_lm_id, $a_type="")
 Get all objects of learning module. More...
 
static saveExportId ($a_lm_id, $a_lmobj_id, $a_exp_id, $a_type="pg")
 Save export id. More...
 
static getExportId ($a_lm_id, $a_lmobj_id, $a_type="pg")
 Get export ID. More...
 
static getDuplicateExportIDs ($a_lm_id, $a_type="pg")
 Get duplicate export IDs (count export ID usages) More...
 
static _getPresentationTitle ($a_node, $a_mode=IL_PAGE_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-")
 Get affective title. More...
 

Data Fields

 $ilias
 
 $lm_id
 
 $type
 
 $id
 
 $meta_data
 
 $data_record
 
 $content_object
 
 $title
 
 $description
 
 $active = true
 

Static Protected Attributes

static $data_records = array()
 

Detailed Description

Class ilLMObject.

Base class for ilStructureObjects and ilPageObjects (see ILIAS DTD)

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 17 of file class.ilLMObject.php.

Member Function Documentation

◆ _deleteAllObjectData()

ilLMObject::_deleteAllObjectData ( $a_cobj)

delete all objects of content object (digi book / learning module)

Definition at line 710 of file class.ilLMObject.php.

711 {
712 global $ilDB;
713
714 include_once './Services/Xml/classes/class.ilNestedSetXML.php';
715
716 $query = "SELECT * FROM lm_data ".
717 "WHERE lm_id= ".$ilDB->quote($a_cobj->getId(), "integer");
718 $obj_set = $ilDB->query($query);
719
720 require_once("./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
721 while ($obj_rec = $ilDB->fetchAssoc($obj_set))
722 {
723 $lm_obj = ilLMObjectFactory::getInstance($a_cobj, $obj_rec["obj_id"],false);
724
725 if (is_object($lm_obj))
726 {
727 $lm_obj->delete(true);
728 }
729 }
730
731 return true;
732 }
getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
global $ilDB

References $ilDB, $query, and ilLMObjectFactory\getInstance().

Referenced by ilObjContentObject\delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _exists()

ilLMObject::_exists (   $a_id)

checks wether a lm content object with specified id exists or not

Parameters
int$idid
Returns
boolean true, if lm content object exists

Definition at line 655 of file class.ilLMObject.php.

656 {
657 global $ilDB;
658
659 include_once("./Services/Link/classes/class.ilInternalLink.php");
660 if (is_int(strpos($a_id, "_")))
661 {
663 }
664
665 $q = "SELECT * FROM lm_data WHERE obj_id = ".
666 $ilDB->quote($a_id, "integer");
667 $obj_set = $ilDB->query($q);
668 if ($obj_rec = $ilDB->fetchAssoc($obj_set))
669 {
670 return true;
671 }
672 else
673 {
674 return false;
675 }
676
677 }

References $ilDB, and ilInternalLink\_extractObjIdOfTarget().

Referenced by ilInternalLink\_exists(), ilLinksTableGUI\fillRow(), getDuplicateExportIDs(), ilLMPresentationGUI\ilPage(), ilHelpGUI\showHelp(), and ilLMPresentationGUI\showPrintView().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAllLMObjectsOfLM()

static ilLMObject::_getAllLMObjectsOfLM (   $a_lm_id,
  $a_type = "" 
)
static

Get all objects of learning module.

Parameters

return

Definition at line 1342 of file class.ilLMObject.php.

1343 {
1344 global $ilDB;
1345
1346 $and = ($a_type != "")
1347 ? " AND type = ".$ilDB->quote($a_type, "text")
1348 : "";
1349
1350 $set = $ilDB->query("SELECT obj_id FROM lm_data ".
1351 " WHERE lm_id = ".$ilDB->quote($a_lm_id, "integer").$and);
1352 $obj_ids = array();
1353 while ($rec = $ilDB->fetchAssoc($set))
1354 {
1355 $obj_ids[] = $rec["obj_id"];
1356 }
1357
1358 return $obj_ids;
1359 }

References $ilDB.

Referenced by ilLMTableOfContentsExplorerGUI\__construct(), and ilLMTracker\loadLMTrackingData().

+ Here is the caller graph for this function:

◆ _getAllObjectsForImportId()

ilLMObject::_getAllObjectsForImportId (   $a_import_id,
  $a_in_lm = 0 
)

Get all items for an import ID.

(only for items notnot in trash)

Parameters
int$a_import_idimport id
Returns
int id

Definition at line 621 of file class.ilLMObject.php.

622 {
623 global $ilDB;
624
625 $where = ($a_in_lm > 0)
626 ? " AND lm_id = ".$ilDB->quote($a_in_lm, "integer")." "
627 : "";
628
629 $q = "SELECT * FROM lm_data WHERE import_id = ".
630 $ilDB->quote($a_import_id, "text")." ".
631 $where.
632 " ORDER BY create_date DESC";
633 $obj_set = $ilDB->query($q);
634
635 $items = array();
636 while ($obj_rec = $ilDB->fetchAssoc($obj_set))
637 {
638 // check, whether lm is not trashed
639 if (ilObject::_hasUntrashedReference($obj_rec["lm_id"]))
640 {
641 $items[] = $obj_rec;
642 }
643 }
644
645 return $items;
646 }
_hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash

References $ilDB, and ilObject\_hasUntrashedReference().

Referenced by updateInternalLinks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIdForImportId()

ilLMObject::_getIdForImportId (   $a_import_id)

get current object id for import id (static)

import ids can exist multiple times (if the same learning module has been imported multiple times). we get the object id of the last imported object, that is not in trash

Parameters
int$a_import_idimport id
Returns
int id

Definition at line 588 of file class.ilLMObject.php.

589 {
590 global $ilDB;
591
592 $q = "SELECT obj_id FROM lm_data WHERE import_id = ".
593 $ilDB->quote($a_import_id, "text")." ".
594 " ORDER BY create_date DESC";
595 $obj_set = $ilDB->query($q);
596 while ($obj_rec = $ilDB->fetchAssoc($obj_set))
597 {
598 $lm_id = ilLMObject::_lookupContObjID($obj_rec["obj_id"]);
599
600 // link only in learning module, that is not trashed
601 include_once("./Services/Help/classes/class.ilObjHelpSettings.php");
604 {
605 return $obj_rec["obj_id"];
606 }
607 }
608
609 return 0;
610 }
_lookupContObjID($a_id)
get learning module / digibook id for lm object
static isHelpLM($a_lm_id)
Check if LM is a help LM.

References $ilDB, $lm_id, ilObject\_hasUntrashedReference(), _lookupContObjID(), and ilObjHelpSettings\isHelpLM().

Referenced by ilInternalLink\_getIdForImportId(), SurveyQuestion\_resolveInternalLink(), and assQuestion\_resolveInternalLink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getPresentationTitle()

static ilLMObject::_getPresentationTitle (   $a_node,
  $a_mode = IL_PAGE_TITLE,
  $a_include_numbers = false,
  $a_time_scheduled_activation = false,
  $a_force_content = false,
  $a_lm_id = 0,
  $a_lang = "-" 
)
static

Get affective title.

Parameters

return

Reimplemented in ilLMPageObject.

Definition at line 1503 of file class.ilLMObject.php.

1506 {
1507 if ($a_lang == "")
1508 {
1509 $a_lang = "-";
1510 }
1511
1512 if ($a_node["type"] == "st")
1513 {
1514 return ilStructureObject::_getPresentationTitle($a_node["child"],
1515 $a_include_numbers, $a_time_scheduled_activation, $a_lm_id, $a_lang);
1516 }
1517 else
1518 {
1519 return ilLMPageObject::_getPresentationTitle($a_node["child"],
1520 $a_mode, $a_include_numbers, $a_time_scheduled_activation,
1521 $a_force_content, $a_lm_id, $a_lang);
1522 }
1523 }
static _getPresentationTitle($a_pg_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-")
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static _getPresentationTitle($a_st_id, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_lm_id=0, $a_lang="-")
get presentation title

References ilLMPageObject\_getPresentationTitle(), and ilStructureObject\_getPresentationTitle().

Referenced by ilLMExplorerGUI\getNodeContent(), and ilPublicSectionExplorerGUI\getNodeContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isPagePublic()

static ilLMObject::_isPagePublic (   $a_node_id,
  $a_check_public_mode = false 
)
static

Definition at line 529 of file class.ilLMObject.php.

530 {
531 global $ilDB,$ilLog;
532
533 if (empty($a_node_id))
534 {
535 $message = sprintf('ilLMObject::_isPagePublic(): Invalid parameter! $a_node_id is empty');
536 $ilLog->write($message,$ilLog->WARNING);
537 return false;
538 }
539
540 if ($a_check_public_mode === true)
541 {
542 $lm_id = ilLMObject::_lookupContObjId($a_node_id);
543
544 $q = "SELECT public_access_mode FROM content_object WHERE id = ".
545 $ilDB->quote($lm_id, "integer");
546 $r = $ilDB->query($q);
547 $row = $ilDB->fetchAssoc($r);
548
549 if ($row["public_access_mode"] == "complete")
550 {
551 return true;
552 }
553 }
554
555 $q = "SELECT public_access FROM lm_data WHERE obj_id=".
556 $ilDB->quote($a_node_id, "integer");
557 $r = $ilDB->query($q);
558 $row = $ilDB->fetchAssoc($r);
559
560 return ilUtil::yn2tf($row["public_access"]);
561 }
static yn2tf($a_yn)
convert "y"/"n" to true/false

References $ilDB, $ilLog, $lm_id, $row, and ilUtil\yn2tf().

Referenced by ilLMPresentationGUI\executeCommand(), ilLMPresentationGUI\getCurrentPageId(), ilLMPresentationGUI\getSuccessorPage(), ilLMPresentationGUI\ilLMNavigation(), ilLMPresentationGUI\ilPage(), ilShopPublicSectionSelector\isClickable(), ilLMTOCExplorerGUI\isNodeClickable(), ilLMPresentationGUI\showPrintView(), and ilLMPresentationGUI\showPrintViewSelection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupContObjID()

ilLMObject::_lookupContObjID (   $a_id)

get learning module / digibook id for lm object

Definition at line 737 of file class.ilLMObject.php.

738 {
739 global $ilDB;
740
741 if (isset(self::$data_records[$a_id]))
742 {
743 return self::$data_records[$a_id]["lm_id"];
744 }
745
746 $query = "SELECT lm_id FROM lm_data WHERE obj_id = ".
747 $ilDB->quote($a_id, "integer");
748 $obj_set = $ilDB->query($query);
749 $obj_rec = $ilDB->fetchAssoc($obj_set);
750
751 return $obj_rec["lm_id"];
752 }

References $ilDB, and $query.

Referenced by ilObjContentObjectAccess\_checkGoto(), ilStartUpGUI\_checkGoto(), _getIdForImportId(), ilLMPageObject\_getPresentationTitle(), ilStructureObject\_getPresentationTitle(), ilLMPageObjectGUI\_goto(), ilStructureObjectGUI\_goto(), ilLMPageObject\_splitPage(), ilLMPageObject\_splitPageNext(), SurveyQuestion\addInternalLink(), ilWebAccessChecker\checkAccessGlossaryTerm(), ilLinksTableGUI\fillRow(), ilGlossaryPresentationGUI\getLinkXML(), ilLMPageObjectGUI\getLinkXML(), ilLMPresentationGUI\getLinkXML(), ilObjMediaObject\getParentObjectIdForUsage(), ilGlossaryPresentationGUI\listDefinitions(), ilObjContentObjectGUI\pastePage(), pasteTree(), ilPageObjectGUI\setDefaultLinkXml(), SurveyQuestion\setMaterial(), and updateInternalLinks().

+ Here is the caller graph for this function:

◆ _lookupNID()

ilLMObject::_lookupNID (   $a_lm_id,
  $a_lm_obj_id,
  $a_type 
)

lookup named identifier (ILIAS_NID)

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

92 {
93 include_once 'Services/MetaData/classes/class.ilMD.php';
94//echo "-".$a_lm_id."-".$a_lm_obj_id."-".$a_type."-";
95 $md = new ilMD($a_lm_id, $a_lm_obj_id, $a_type);
96 $md_gen = $md->getGeneral();
97 if (is_object($md_gen))
98 {
99 foreach($md_gen->getIdentifierIds() as $id)
100 {
101 $md_id = $md_gen->getIdentifier($id);
102 if ($md_id->getCatalog() == "ILIAS_NID")
103 {
104 return $md_id->getEntry();
105 }
106 }
107 }
108
109 return false;
110 }

References $id.

◆ _lookupTitle()

static ilLMObject::_lookupTitle (   $a_obj_id)
static

◆ _lookupType()

static ilLMObject::_lookupType (   $a_obj_id,
  $a_lm_id = 0 
)
static

Lookup type.

Parameters
intid of pg st
intid of lm object [optional]

Definition at line 275 of file class.ilLMObject.php.

276 {
277 global $ilDB;
278
279 if (isset(self::$data_records[$a_obj_id]))
280 {
281 if ($a_lm_id == 0 || self::$data_records[$a_obj_id]["lm_id"] == $a_lm_id)
282 {
283 return self::$data_records[$a_obj_id]["type"];
284 }
285 }
286
287 if($a_lm_id)
288 {
289 $and = ' AND lm_id = '.$ilDB->quote($a_lm_id,'integer');
290 }
291
292 $query = "SELECT type FROM lm_data WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").$and;
293 $obj_set = $ilDB->query($query);
294 $obj_rec = $ilDB->fetchAssoc($obj_set);
295
296 return $obj_rec["type"];
297 }

References $ilDB, and $query.

Referenced by ilStructureObjectGUI\activatePages(), clipboardCopy(), ilLMPresentationGUI\getCurrentPageId(), ilObjLearningModuleSubItemListGUI\getHTML(), ilLMTOCExplorerGUI\getRootNode(), ilLMPresentationGUI\getSuccessorPage(), ilLMPresentationGUI\ilLMNavigation(), ilLMPresentationGUI\ilPage(), ilLMPresentationGUI\ilTOC(), ilPageObject\moveIntLinks(), pasteTree(), ilObjContentObjectGUI\saveExportIds(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showTableOfContents(), uniqueTypesCheck(), updateInternalLinks(), ilCourseObjectivesGUI\updateMaterialAssignment(), and writeLayout().

+ Here is the caller graph for this function:

◆ _writeImportId()

ilLMObject::_writeImportId (   $a_id,
  $a_import_id 
)

write import id to db (static)

Parameters
int$a_idlm object id
string$a_import_idimport id @access public

Definition at line 399 of file class.ilLMObject.php.

400 {
401 global $ilDB;
402
403 $q = "UPDATE lm_data ".
404 "SET ".
405 "import_id = ".$ilDB->quote($a_import_id, "text").",".
406 "last_update = ".$ilDB->now()." ".
407 "WHERE obj_id = ".$ilDB->quote($a_id, "integer");
408
409 $ilDB->manipulate($q);
410 }

References $ilDB.

Referenced by ilContObjParser\handlerEndTag().

+ Here is the caller graph for this function:

◆ _writePublicAccessStatus()

ilLMObject::_writePublicAccessStatus (   $a_pages,
  $a_cont_obj_id 
)
static

update public access flags in lm_data for all pages of a content object@access public

Parameters
arraypage ids
integercontent object id
Returns
of the jedi

Definition at line 468 of file class.ilLMObject.php.

469 {
470 global $ilDB,$ilLog,$ilErr,$ilTree;
471
472 if (!is_array($a_pages))
473 {$a_pages = array(0);
474 /*$message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_pages must be an array');
475 $ilLog->write($message,$ilLog->WARNING);
476 $ilErr->raiseError($message,$ilErr->MESSAGE);
477 return false;*/
478 }
479
480 if (empty($a_cont_obj_id))
481 {
482 $message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_cont_obj_id is empty');
483 $ilLog->write($message,$ilLog->WARNING);
484 $ilErr->raiseError($message,$ilErr->MESSAGE);
485 return false;
486 }
487
488 // update structure entries: if at least one page of a chapter is public set chapter to public too
489 $lm_tree = new ilTree($a_cont_obj_id);
490 $lm_tree->setTableNames('lm_tree','lm_data');
491 $lm_tree->setTreeTablePK("lm_id");
492 $lm_tree->readRootId();
493
494 // get all st entries of cont_obj
495 $q = "SELECT obj_id FROM lm_data " .
496 "WHERE lm_id = ".$ilDB->quote($a_cont_obj_id, "integer")." " .
497 "AND type = 'st'";
498 $r = $ilDB->query($q);
499
500 // add chapters with a public page to a_pages
501 while ($row = $ilDB->fetchAssoc($r))
502 {
503 $childs = $lm_tree->getChilds($row["obj_id"]);
504
505 foreach ($childs as $page)
506 {
507 if ($page["type"] == "pg" and in_array($page["obj_id"],$a_pages))
508 {
509 array_push($a_pages, $row["obj_id"]);
510 break;
511 }
512 }
513 }
514
515 // update public access status of all pages of cont_obj
516 $q = "UPDATE lm_data SET " .
517 "public_access = CASE " .
518 "WHEN ".$ilDB->in("obj_id", $a_pages, false, "integer")." ".
519 "THEN ".$ilDB->quote("y", "text").
520 "ELSE ".$ilDB->quote("n", "text").
521 "END " .
522 "WHERE lm_id = ".$ilDB->quote($a_cont_obj_id, "integer")." " .
523 "AND ".$ilDB->in("type", array("pg", "st"), false, "text");
524 $ilDB->manipulate($q);
525
526 return true;
527 }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...

References $ilDB, $ilErr, $ilLog, and $row.

Referenced by ilObjContentObjectGUI\savePublicSection(), and ilObjContentObjectGUI\savePublicSectionPages().

+ Here is the caller graph for this function:

◆ _writeTitle()

ilLMObject::_writeTitle (   $a_obj_id,
  $a_title 
)

Definition at line 300 of file class.ilLMObject.php.

301 {
302 global $ilDB;
303
304 $query = "UPDATE lm_data SET ".
305 " title = ".$ilDB->quote($a_title, "text").
306 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
307 $ilDB->manipulate($query);
308 }

References $ilDB, and $query.

Referenced by MDUpdateListener(), and saveTitles().

+ Here is the caller graph for this function:

◆ clipboardCopy()

static ilLMObject::clipboardCopy (   $a_cont_obj_id,
  $a_ids 
)
static

Copy a set of chapters/pages into the clipboard.

Definition at line 876 of file class.ilLMObject.php.

877 {
878 global $ilUser;
879
880 $tree = ilLMObject::getTree($a_cont_obj_id);
881
882 $ilUser->clipboardDeleteObjectsOfType("pg");
883 $ilUser->clipboardDeleteObjectsOfType("st");
884
885 // put them into the clipboard
886 $time = date("Y-m-d H:i:s", time());
887 foreach ($a_ids as $id)
888 {
889 $curnode = "";
890 if ($tree->isInTree($id))
891 {
892 $curnode = $tree->getNodeData($id);
893 $subnodes = $tree->getSubTree($curnode);
894 foreach($subnodes as $subnode)
895 {
896 if ($subnode["child"] != $id)
897 {
898 $ilUser->addObjectToClipboard($subnode["child"],
899 $subnode["type"], $subnode["title"],
900 $subnode["parent"], $time, $subnode["lft"]);
901 }
902 }
903 }
904 $order = ($curnode["lft"] > 0)
905 ? $curnode["lft"]
906 : (int) ($order + 1);
907 $ilUser->addObjectToClipboard($id,
909 $order);
910 }
911 }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _lookupTitle($a_obj_id)
Lookup title.
static getTree($a_cont_obj_id)
Get learningmodule tree.
global $ilUser
Definition: imgupload.php:15

References $id, $ilUser, _lookupTitle(), _lookupType(), and getTree().

Referenced by clipboardCut(), ilStructureObjectGUI\copyItems(), ilObjContentObjectGUI\copyItems(), and ilObjContentObjectGUI\copyPage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clipboardCut()

ilLMObject::clipboardCut (   $a_cont_obj_id,
  $a_ids 
)

Copy a set of chapters/pages into the clipboard.

Definition at line 828 of file class.ilLMObject.php.

829 {
830 $tree = ilLMObject::getTree($a_cont_obj_id);
831
832 if (!is_array($a_ids))
833 {
834 return false;
835 }
836 else
837 {
838 // get all "top" ids, i.e. remove ids, that have a selected parent
839 foreach($a_ids as $id)
840 {
841 $path = $tree->getPathId($id);
842 $take = true;
843 foreach($path as $path_id)
844 {
845 if ($path_id != $id && in_array($path_id, $a_ids))
846 {
847 $take = false;
848 }
849 }
850 if ($take)
851 {
852 $cut_ids[] = $id;
853 }
854 }
855 }
856
857 ilLMObject::clipboardCopy($a_cont_obj_id, $cut_ids);
858
859 // remove the objects from the tree
860 // note: we are getting chapters which are *not* in the tree
861 // we do not delete any pages/chapters here
862 foreach ($cut_ids as $id)
863 {
864 $curnode = $tree->getNodeData($id);
865 if ($tree->isInTree($id))
866 {
867 $tree->deleteTree($curnode);
868 }
869 }
870
871 }
static clipboardCopy($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
$path
Definition: index.php:22

References $id, $path, clipboardCopy(), and getTree().

Referenced by ilObjContentObjectGUI\cutItems(), ilStructureObjectGUI\cutItems(), and ilObjContentObjectGUI\movePage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilLMObject::create (   $a_upload = false)

Reimplemented in ilLMPageObject, and ilStructureObject.

Definition at line 412 of file class.ilLMObject.php.

413 {
414 global $ilDB;
415
416 // insert object data
417 $this->setId($ilDB->nextId("lm_data"));
418 $query = "INSERT INTO lm_data (obj_id, title, type, layout, lm_id, import_id, create_date) ".
419 "VALUES (".
420 $ilDB->quote($this->getId(), "integer").",".
421 $ilDB->quote($this->getTitle(), "text").",".
422 $ilDB->quote($this->getType(), "text").", ".
423 $ilDB->quote($this->getLayout(), "text").", ".
424 $ilDB->quote($this->getLMId(), "integer").",".
425 $ilDB->quote($this->getImportId(), "text").
426 ", ".$ilDB->now().")";
427 $ilDB->manipulate($query);
428
429 // create history entry
430 include_once("./Services/History/classes/class.ilHistory.php");
431 ilHistory::_createEntry($this->getId(), "create", "",
432 $this->content_object->getType().":".$this->getType());
433
434 if (!$a_upload)
435 {
436 $this->createMetaData();
437 }
438
439 }
_createEntry($a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
getLayout()
Get layout.
getTitle()
get title of lm object
createMetaData()
create meta data entry

References $ilDB, $query, ilHistory\_createEntry(), createMetaData(), getId(), getImportId(), getLayout(), getLMId(), getTitle(), getType(), and setId().

+ Here is the call graph for this function:

◆ createMetaData()

ilLMObject::createMetaData ( )

create meta data entry

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

117 {
118 include_once 'Services/MetaData/classes/class.ilMDCreator.php';
119
120 global $ilUser;
121
122 $md_creator = new ilMDCreator($this->getLMId(), $this->getId(), $this->getType());
123 $md_creator->setTitle($this->getTitle());
124 $md_creator->setTitleLanguage($ilUser->getPref('language'));
125 $md_creator->setDescription($this->getDescription());
126 $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
127 $md_creator->setKeywordLanguage($ilUser->getPref('language'));
128 $md_creator->setLanguage($ilUser->getPref('language'));
129 $md_creator->create();
130
131 return true;
132 }

References $ilUser, getDescription(), getId(), getLMId(), getTitle(), and getType().

Referenced by create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilLMObject::delete (   $a_delete_meta_data = true)

delete lm object data

Reimplemented in ilLMPageObject, and ilStructureObject.

Definition at line 566 of file class.ilLMObject.php.

567 {
568 global $ilDB;
569
570 $query = "DELETE FROM lm_data WHERE obj_id = ".
571 $ilDB->quote($this->getId(), "integer");
572 $ilDB->manipulate($query);
573
574 $this->deleteMetaData();
575 }
deleteMetaData()
delete meta data entry

References $ilDB, $query, deleteMetaData(), and getId().

+ Here is the call graph for this function:

◆ deleteMetaData()

ilLMObject::deleteMetaData ( )

delete meta data entry

Definition at line 163 of file class.ilLMObject.php.

164 {
165 // Delete meta data
166 include_once('Services/MetaData/classes/class.ilMD.php');
167 $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
168 $md->deleteAll();
169 }

References getId(), getLMId(), and getType().

Referenced by delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ existsExportID()

ilLMObject::existsExportID (   $a_lm_id,
  $a_exp_id,
  $a_type = "pg" 
)

Does export ID exist in lm?

Parameters

return

Definition at line 1457 of file class.ilLMObject.php.

1458 {
1459 include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1460 return ilMDIdentifier::existsIdInRbacObject($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1461 }
static existsIdInRbacObject($a_rbac_id, $a_obj_type, $a_catalog, $a_entry)
Does id entry exist in rbac object?

References ilMDIdentifier\existsIdInRbacObject().

Referenced by ilLMPageObject\copy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContentObject()

& ilLMObject::getContentObject ( )

Definition at line 347 of file class.ilLMObject.php.

348 {
350 }

References $content_object.

Referenced by ilStructureObject\exportFOPageObjects(), ilLMPageObject\exportXMLPageContent(), and ilStructureObject\exportXMLStructureObjects().

+ Here is the caller graph for this function:

◆ getDescription()

ilLMObject::getDescription ( )

Definition at line 316 of file class.ilLMObject.php.

317 {
318 return $this->description;
319 }

References $description.

Referenced by ilLMPageObject\copy(), ilStructureObject\copy(), ilLMPageObject\copyToOtherContObject(), and createMetaData().

+ Here is the caller graph for this function:

◆ getDuplicateExportIDs()

static ilLMObject::getDuplicateExportIDs (   $a_lm_id,
  $a_type = "pg" 
)
static

Get duplicate export IDs (count export ID usages)

Definition at line 1466 of file class.ilLMObject.php.

1467 {
1468 include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1469 $entries = ilMDIdentifier::_getEntriesForRbacObj($a_lm_id, $a_type);
1470 $res = array();
1471 foreach ($entries as $e)
1472 {
1473 if ($e["catalog"] == "ILIAS_NID")
1474 {
1475 if (ilLMObject::_exists($e["obj_id"]))
1476 {
1477 $res[trim($e["entry"])]++;
1478 }
1479 }
1480 }
1481 return $res;
1482 }
_exists($a_id)
checks wether a lm content object with specified id exists or not
static _getEntriesForRbacObj($a_rbac_id, $a_obj_type="")
Get IDs for an rbac object.

References $res, _exists(), and ilMDIdentifier\_getEntriesForRbacObj().

Referenced by ilExportIDTableGUI\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExportId()

static ilLMObject::getExportId (   $a_lm_id,
  $a_lmobj_id,
  $a_type = "pg" 
)
static

Get export ID.

Parameters

return

Definition at line 1435 of file class.ilLMObject.php.

1436 {
1437 // look for export id
1438 include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1440 $a_lm_id, $a_lmobj_id, $a_type);
1441
1442 foreach ($entries as $e)
1443 {
1444 if ($e["catalog"] == "ILIAS_NID")
1445 {
1446 return $e["entry"];
1447 }
1448 }
1449 }
static _getEntriesForObj($a_rbac_id, $a_obj_id, $a_obj_type)
Get IDs for an object.

References ilMDIdentifier\_getEntriesForObj().

Referenced by ilLMPageObject\copy(), ilObjContentObject\exportHTMLPages(), ilExportIDTableGUI\fillRow(), ilLMPresentationGUI\getLink(), and ilLMTOCExplorerGUI\getNodeHref().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExportIDInfo()

ilLMObject::getExportIDInfo (   $a_lm_id,
  $a_exp_id,
  $a_type = "pg" 
)

Does export ID exist in lm?

Parameters

return

Definition at line 1490 of file class.ilLMObject.php.

1491 {
1492 include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1493 $data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1494 return $data;
1495 }
static readIdData($a_rbac_id, $a_obj_type, $a_catalog, $a_entry)
Does id entry exist in rbac object?

References $data, and ilMDIdentifier\readIdData().

+ Here is the call graph for this function:

◆ getId()

◆ getImportId()

ilLMObject::getImportId ( )

Definition at line 362 of file class.ilLMObject.php.

363 {
364 return $this->import_id;
365 }

Referenced by create().

+ Here is the caller graph for this function:

◆ getLayout()

ilLMObject::getLayout ( )

Get layout.

Returns
string layout

Definition at line 387 of file class.ilLMObject.php.

388 {
389 return $this->layout;
390 }

Referenced by ilLMPageObject\copy(), create(), and update().

+ Here is the caller graph for this function:

◆ getLMId()

◆ getObjectList()

ilLMObject::getObjectList (   $lm_id,
  $type = "" 
)

static

Definition at line 682 of file class.ilLMObject.php.

683 {
684 global $ilDB;
685
686 $type_str = ($type != "")
687 ? "AND type = ".$ilDB->quote($type, "text")." "
688 : "";
689
690 $query = "SELECT * FROM lm_data ".
691 "WHERE lm_id= ".$ilDB->quote($lm_id, "integer")." ".
692 $type_str." ".
693 "ORDER BY title";
694 $obj_set = $ilDB->query($query);
695 $obj_list = array();
696 while($obj_rec = $ilDB->fetchAssoc($obj_set))
697 {
698 $obj_list[] = array("obj_id" => $obj_rec["obj_id"],
699 "title" => $obj_rec["title"],
700 "import_id" => $obj_rec["import_id"],
701 "type" => $obj_rec["type"]);
702 }
703 return $obj_list;
704 }

References $ilDB, $lm_id, $query, and $type.

Referenced by ilLMPageObject\getPageList(), ilHelpExporter\getXmlExportTailDependencies(), and ilObjContentObject\importFromZipFile().

+ Here is the caller graph for this function:

◆ getPagesOfChapter()

static ilLMObject::getPagesOfChapter (   $a_lm_id,
  $a_chap_id 
)
static

Get pages of chapter.

Parameters

return

Definition at line 1323 of file class.ilLMObject.php.

1324 {
1325 // update structure entries: if at least one page of a chapter is public set chapter to public too
1326 $lm_tree = new ilTree($a_lm_id);
1327 $lm_tree->setTableNames('lm_tree','lm_data');
1328 $lm_tree->setTreeTablePK("lm_id");
1329 $lm_tree->readRootId();
1330
1331 $childs = $lm_tree->getChildsByType($a_chap_id, "pg");
1332
1333 return $childs;
1334 }

Referenced by ilHelpGUI\showHelp().

+ Here is the caller graph for this function:

◆ getTitle()

ilLMObject::getTitle ( )

get title of lm object

Returns
string title of chapter or page

Definition at line 241 of file class.ilLMObject.php.

242 {
243 return $this->title;
244 }

References $title.

Referenced by ilLMPageObject\copy(), ilStructureObject\copy(), ilLMPageObject\copyToOtherContObject(), create(), createMetaData(), ilStructureObject\exportFO(), update(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getTree()

static ilLMObject::getTree (   $a_cont_obj_id)
static

Get learningmodule tree.

Parameters
intlearning module object id
Returns
object tree object

Definition at line 815 of file class.ilLMObject.php.

816 {
817 $tree = new ilTree($a_cont_obj_id);
818 $tree->setTableNames('lm_tree', 'lm_data');
819 $tree->setTreeTablePK("lm_id");
820 $tree->readRootId();
821
822 return $tree;
823 }

Referenced by clipboardCopy(), and clipboardCut().

+ Here is the caller graph for this function:

◆ getType()

◆ ilLMObject()

ilLMObject::ilLMObject (   $a_content_obj,
  $a_id = 0 
)
Parameters
object$a_content_objcontent object (digi book or learning module)

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

35 {
36 global $ilias;
37
38 $this->id = $a_id;
39 $this->setContentObject($a_content_obj);
40 $this->setLMId($a_content_obj->getId());
41 if($a_id != 0)
42 {
43 $this->read();
44 }
45 }
setLMId($a_lm_id)
setContentObject(&$a_content_obj)

References $ilias, read(), setContentObject(), and setLMId().

+ Here is the call graph for this function:

◆ lookupLayout()

static ilLMObject::lookupLayout (   $a_obj_id)
static

Lookup type.

Parameters
intlm object id

Definition at line 1305 of file class.ilLMObject.php.

1306 {
1307 global $ilDB;
1308
1309 $query = "SELECT layout FROM lm_data WHERE obj_id = ".
1310 $ilDB->quote($a_obj_id, "integer");
1311 $obj_set = $ilDB->query($query);
1312 $obj_rec = $ilDB->fetchAssoc($obj_set);
1313
1314 return $obj_rec["layout"];
1315 }

References $ilDB, and $query.

Referenced by ilLMPresentationGUI\determineLayout(), and ilLMPagesTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ MDUpdateListener()

ilLMObject::MDUpdateListener (   $a_element)

Meta data update listener.

Important note: Do never call create() or update() method of ilObject here. It would result in an endless loop: update object -> update meta -> update object -> ... Use static _writeTitle() ... methods instead.

Parameters
string$a_elementmd element
Returns
boolean success

Definition at line 59 of file class.ilLMObject.php.

60 {
61 include_once 'Services/MetaData/classes/class.ilMD.php';
62
63 switch($a_element)
64 {
65 case 'General':
66
67 // Update Title and description
68 $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
69 $md_gen = $md->getGeneral();
70
71 ilLMObject::_writeTitle($this->getId(),$md_gen->getTitle());
72
73 foreach($md_gen->getDescriptionIds() as $id)
74 {
75 $md_des = $md_gen->getDescription($id);
76// ilLMObject::_writeDescription($this->getId(),$md_des->getDescription());
77 break;
78 }
79
80 break;
81
82 default:
83 }
84 return true;
85 }
_writeTitle($a_obj_id, $a_title)

References $id, _writeTitle(), getId(), getLMId(), and getType().

+ Here is the call graph for this function:

◆ pasteTree()

static ilLMObject::pasteTree (   $a_target_lm,
  $a_item_id,
  $a_parent_id,
  $a_target,
  $a_insert_time,
$a_copied_nodes,
  $a_as_copy = false,
  $a_source_lm = null 
)
static

Paste item (tree) from clipboard to current lm.

Definition at line 916 of file class.ilLMObject.php.

918 {
919 global $ilUser, $ilias, $ilLog;
920
921 include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
922 include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
923
924 $item_lm_id = ilLMObject::_lookupContObjID($a_item_id);
925 $item_type = ilLMObject::_lookupType($a_item_id);
926 $lm_obj = $ilias->obj_factory->getInstanceByObjId($item_lm_id);
927 if ($item_type == "st")
928 {
929 $item = new ilStructureObject($lm_obj, $a_item_id);
930 }
931 else if ($item_type == "pg")
932 {
933 $item = new ilLMPageObject($lm_obj, $a_item_id);
934 }
935
936 $ilLog->write("Getting from clipboard type ".$item_type.", ".
937 "Item ID: ".$a_item_id.", of original LM: ".$item_lm_id);
938
939 if ($item_lm_id != $a_target_lm->getId() && !$a_as_copy)
940 {
941 // @todo: check whether st is NOT in tree
942
943 // "move" metadata to new lm
944 include_once("Services/MetaData/classes/class.ilMD.php");
945 $md = new ilMD($item_lm_id, $item->getId(), $item->getType());
946 $new_md = $md->cloneMD($a_target_lm->getId(), $item->getId(), $item->getType());
947
948 // update lm object
949 $item->setLMId($a_target_lm->getId());
950 $item->setContentObject($a_target_lm);
951 $item->update();
952
953 // delete old meta data set
954 $md->deleteAll();
955
956 if ($item_type == "pg")
957 {
958 $page = $item->getPageObject();
959 $page->buildDom();
960 $page->setParentId($a_target_lm->getId());
961 $page->update();
962 }
963 }
964
965 if ($a_as_copy)
966 {
967 $target_item = $item->copy($a_target_lm);
968 $a_copied_nodes[$item->getId()] = $target_item->getId();
969 }
970 else
971 {
972 $target_item = $item;
973 }
974
975 $ilLog->write("Putting into tree type ".$target_item->getType().
976 "Item ID: ".$target_item->getId().", Parent: ".$a_parent_id.", ".
977 "Target: ".$a_target.", Item LM:".$target_item->getContentObject()->getId());
978
979 ilLMObject::putInTree($target_item, $a_parent_id, $a_target);
980
981 if ($a_source_lm == null)
982 {
983 $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
984 }
985 else
986 {
987 $childs = $a_source_lm->lm_tree->getChilds($item->getId());
988 foreach ($childs as $k => $child)
989 {
990 $childs[$k]["id"] = $childs[$k]["child"];
991 }
992 }
993
994 foreach($childs as $child)
995 {
996 ilLMObject::pasteTree($a_target_lm, $child["id"], $target_item->getId(),
997 IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy, $a_source_lm);
998 }
999
1000 return $target_item->getId();
1001 // @todo: write history (see pastePage)
1002 }
const IL_LAST_NODE
Definition: class.ilTree.php:4
static pasteTree($a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_source_lm=null)
Paste item (tree) from clipboard to current lm.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
Class ilLMPageObject.
Class ilStructreObject.

References $ilias, $ilLog, $ilUser, _lookupContObjID(), _lookupType(), IL_LAST_NODE, pasteTree(), and putInTree().

Referenced by ilObjContentObject\copyAllPagesAndChapters(), ilStructureObjectGUI\insertChapterClip(), ilObjContentObjectGUI\insertChapterClip(), ilStructureObjectGUI\insertPageClip(), and pasteTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ preloadDataByLM()

static ilLMObject::preloadDataByLM (   $a_lm_id)
static

Preload data records by lm.

Parameters
integer$a_lm_idlm id
Returns
int number of preloaded records

Definition at line 211 of file class.ilLMObject.php.

212 {
213 global $ilDB;
214
215 $set = $ilDB->query("SELECT * FROM lm_data ".
216 " WHERE lm_id = ".$ilDB->quote($a_lm_id, "integer")
217 );
218 while ($rec = $ilDB->fetchAssoc($set))
219 {
220 self::$data_records[$rec["obj_id"]] = $rec;
221 }
222 return count(self::$data_records);
223 }

References $ilDB.

Referenced by ilLMExplorerGUI\__construct().

+ Here is the caller graph for this function:

◆ putInTree()

static ilLMObject::putInTree (   $a_obj,
  $a_parent_id = "",
  $a_target_node_id = "" 
)
static

put this object into content object tree

Definition at line 757 of file class.ilLMObject.php.

758 {
759 global $ilLog;
760
761 $tree = new ilTree($a_obj->getContentObject()->getId());
762 $tree->setTableNames('lm_tree', 'lm_data');
763 $tree->setTreeTablePK("lm_id");
764
765 // determine parent
766 $parent_id = ($a_parent_id != "")
767 ? $a_parent_id
768 : $tree->getRootId();
769
770 // determine target
771 if ($a_target_node_id != "")
772 {
773 $target = $a_target_node_id;
774 }
775 else
776 {
777 // determine last child that serves as predecessor
778 if ($a_obj->getType() == "st")
779 {
780 $s_types = array("st", "pg");
781 $childs =& $tree->getChildsByTypeFilter($parent_id, $s_types);
782 }
783 else
784 {
785 $s_types = "pg";
786 $childs =& $tree->getChildsByType($parent_id, $s_types);
787 }
788
789 if (count($childs) == 0)
790 {
791 $target = IL_FIRST_NODE;
792 }
793 else
794 {
795 $target = $childs[count($childs) - 1]["obj_id"];
796 }
797 }
798
799 if ($tree->isInTree($parent_id) && !$tree->isInTree($a_obj->getId()))
800 {
801 $ilLog->write("LMObject::putInTree: insertNode, ID: ".$a_obj->getId().
802 "Parent ID: ".$parent_id.", Target: ".$target);
803
804 $tree->insertNode($a_obj->getId(), $parent_id, $target);
805 }
806 }
const IL_FIRST_NODE
Definition: class.ilTree.php:5

References $ilLog, and IL_FIRST_NODE.

Referenced by ilObjContentObject\addFirstChapterAndPage(), ilStructureObjectGUI\insertChapter(), ilObjContentObjectGUI\insertChapter(), ilStructureObjectGUI\insertPage(), and pasteTree().

+ Here is the caller graph for this function:

◆ read()

ilLMObject::read ( )

Reimplemented in ilLMPageObject.

Definition at line 181 of file class.ilLMObject.php.

182 {
183 global $ilBench, $ilDB;
184
185 $ilBench->start("ContentPresentation", "ilLMObject_read");
186
187 if(!isset($this->data_record))
188 {
189 $query = "SELECT * FROM lm_data WHERE obj_id = ".
190 $ilDB->quote($this->id, "integer");
191 $obj_set = $ilDB->query($query);
192 $this->data_record = $ilDB->fetchAssoc($obj_set);
193 }
194
195 $this->type = $this->data_record["type"];
196 $this->setImportId($this->data_record["import_id"]);
197 $this->setTitle($this->data_record["title"]);
198 $this->setLayout($this->data_record["layout"]);
199 //$this->setActive(ilUtil::yn2tf($this->data_record["active"]));
200
201 $ilBench->stop("ContentPresentation", "ilLMObject_read");
202 }
setTitle($a_title)
set title of lm object
setLayout($a_val)
Set layout.
global $ilBench
Definition: ilias.php:18

References $ilBench, $ilDB, $query, setImportId(), setLayout(), and setTitle().

Referenced by ilLMObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveExportId()

static ilLMObject::saveExportId (   $a_lm_id,
  $a_lmobj_id,
  $a_exp_id,
  $a_type = "pg" 
)
static

Save export id.

Parameters

return

Definition at line 1372 of file class.ilLMObject.php.

1373 {
1374 global $ilDB;
1375
1376 include_once("Services/MetaData/classes/class.ilMDIdentifier.php");
1377
1378 if (trim($a_exp_id) == "")
1379 {
1380 // delete export ids, if existing
1382 $a_lm_id, $a_lmobj_id, $a_type);
1383
1384 foreach ($entries as $id => $e)
1385 {
1386 if ($e["catalog"] == "ILIAS_NID")
1387 {
1388 $identifier = new ilMDIdentifier();
1389 $identifier->setMetaId($id);
1390 $identifier->delete();
1391 }
1392 }
1393 }
1394 else
1395 {
1396 // update existing entry
1398 $a_lm_id, $a_lmobj_id, $a_type);
1399
1400 $updated = false;
1401 foreach ($entries as $id => $e)
1402 {
1403 if ($e["catalog"] == "ILIAS_NID")
1404 {
1405 $identifier = new ilMDIdentifier();
1406 $identifier->setMetaId($id);
1407 $identifier->read();
1408 $identifier->setEntry($a_exp_id);
1409 $identifier->update();
1410 $updated = true;
1411 }
1412 }
1413
1414 // nothing updated? create a new one
1415 if (!$updated)
1416 {
1417 include_once("./Services/MetaData/classes/class.ilMD.php");
1418 $md = new ilMD($a_lm_id, $a_lmobj_id, $a_type);
1419 $md_gen = $md->getGeneral();
1420 $identifier = $md_gen->addIdentifier();
1421 $identifier->setEntry($a_exp_id);
1422 $identifier->setCatalog("ILIAS_NID");
1423 $identifier->save();
1424 }
1425 }
1426
1427 }

References $id, $ilDB, and ilMDIdentifier\_getEntriesForObj().

Referenced by ilLMPageObject\copy(), and ilObjContentObjectGUI\saveExportIds().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveTitles()

static ilLMObject::saveTitles (   $a_lm,
  $a_titles,
  $a_lang = "-" 
)
static

Save titles for lm objects.

Parameters
arraytitles (key is ID, value is title)

Definition at line 1009 of file class.ilLMObject.php.

1010 {
1011 include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
1012
1013 if ($a_lang == "")
1014 {
1015 $a_lang = "-";
1016 }
1017 if (is_array($a_titles))
1018 {
1019 include_once("./Services/MetaData/classes/class.ilMD.php");
1020 foreach($a_titles as $id => $title)
1021 {
1022 if ($a_lang == "-")
1023 {
1024 $lmobj = ilLMObjectFactory::getInstance($a_lm, $id, false);
1025 if (is_object($lmobj))
1026 {
1027 // Update Title and description
1028 $md = new ilMD($a_lm->getId(), $id, $lmobj->getType());
1029 $md_gen = $md->getGeneral();
1030 if (is_object($md_gen)) // see bug #0015843
1031 {
1032 $md_gen->setTitle($title);
1033 $md_gen->update();
1034 $md->update();
1035 }
1037 }
1038 }
1039 else
1040 {
1041 $lmobjtrans = new ilLMObjTranslation($id, $a_lang);
1042 $lmobjtrans->setTitle($title);
1043 $lmobjtrans->save();
1044 }
1045 }
1046 }
1047 }
Translation information on lm object.

References $id, $title, _writeTitle(), and ilLMObjectFactory\getInstance().

Referenced by ilObjContentObjectGUI\saveAllTitles(), and ilStructureObjectGUI\saveAllTitles().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContentObject()

ilLMObject::setContentObject ( $a_content_obj)

Definition at line 342 of file class.ilLMObject.php.

343 {
344 $this->content_object =& $a_content_obj;
345 }

Referenced by ilLMObject().

+ Here is the caller graph for this function:

◆ setDataRecord()

ilLMObject::setDataRecord (   $a_record)

this method should only be called by class ilLMObjectFactory

Definition at line 176 of file class.ilLMObject.php.

177 {
178 $this->data_record = $a_record;
179 }

◆ setDescription()

ilLMObject::setDescription (   $a_description)

Definition at line 311 of file class.ilLMObject.php.

312 {
313 $this->description = $a_description;
314 }

◆ setId()

ilLMObject::setId (   $a_id)

Reimplemented in ilLMPageObject.

Definition at line 352 of file class.ilLMObject.php.

353 {
354 $this->id = $a_id;
355 }

Referenced by create().

+ Here is the caller graph for this function:

◆ setImportId()

ilLMObject::setImportId (   $a_id)

Definition at line 367 of file class.ilLMObject.php.

368 {
369 $this->import_id = $a_id;
370 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLayout()

ilLMObject::setLayout (   $a_val)

Set layout.

Parameters
stringlayout

Definition at line 377 of file class.ilLMObject.php.

378 {
379 $this->layout = $a_val;
380 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLMId()

ilLMObject::setLMId (   $a_lm_id)

Definition at line 331 of file class.ilLMObject.php.

332 {
333 $this->lm_id = $a_lm_id;
334
335 }

Referenced by ilLMObject().

+ Here is the caller graph for this function:

◆ setTitle()

ilLMObject::setTitle (   $a_title)

set title of lm object

Parameters
string$a_titletitle of chapter or page

Definition at line 231 of file class.ilLMObject.php.

232 {
233 $this->title = $a_title;
234 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilLMObject::setType (   $a_type)

Definition at line 321 of file class.ilLMObject.php.

322 {
323 $this->type = $a_type;
324 }

Referenced by ilLMPageObject\ilLMPageObject(), and ilStructureObject\ilStructureObject().

+ Here is the caller graph for this function:

◆ uniqueTypesCheck()

static ilLMObject::uniqueTypesCheck (   $a_items)
static

Check for unique types (all pages or all chapters)

Definition at line 1242 of file class.ilLMObject.php.

1243 {
1244 $types = array();
1245 if (is_array($a_items))
1246 {
1247 foreach($a_items as $item)
1248 {
1250 $types[$type] = $type;
1251 }
1252 }
1253
1254 if (count($types) > 1)
1255 {
1256 return false;
1257 }
1258 return true;
1259 }

References $type, and _lookupType().

Referenced by ilStructureObjectGUI\copyItems(), and ilStructureObjectGUI\cutItems().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilLMObject::update ( )

update complete object

Definition at line 444 of file class.ilLMObject.php.

445 {
446 global $ilDB;
447
448 $this->updateMetaData();
449
450 $query = "UPDATE lm_data SET ".
451 " lm_id = ".$ilDB->quote($this->getLMId(), "integer").
452 " ,title = ".$ilDB->quote($this->getTitle(), "text").
453 " ,layout = ".$ilDB->quote($this->getLayout(), "text").
454 " WHERE obj_id = ".$ilDB->quote($this->getId(), "integer");
455
456 $ilDB->manipulate($query);
457 }
updateMetaData()
update meta data entry

References $ilDB, $query, getId(), getLayout(), getLMId(), getTitle(), and updateMetaData().

+ Here is the call graph for this function:

◆ updateInternalLinks()

static ilLMObject::updateInternalLinks (   $a_copied_nodes,
  $a_parent_type = "lm" 
)
static

Update internal links, after multiple pages have been copied.

Definition at line 1052 of file class.ilLMObject.php.

1053 {
1054 $all_fixes = array();
1055 foreach($a_copied_nodes as $original_id => $copied_id)
1056 {
1057 $copied_type = ilLMObject::_lookupType($copied_id);
1058 $copy_lm = ilLMObject::_lookupContObjID($copied_id);
1059
1060 if ($copied_type == "pg")
1061 {
1062 //
1063 // 1. Outgoing links from the copied page.
1064 //
1065 //$targets = ilInternalLink::_getTargetsOfSource($a_parent_type.":pg", $copied_id);
1066 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
1067 $tpg = new ilLMPage($copied_id);
1068 $tpg->buildDom();
1069 $il = $tpg->getInternalLinks();
1070 $targets = array();
1071 foreach($il as $l)
1072 {
1073 $targets[] = array("type" => ilInternalLink::_extractTypeOfTarget($l["Target"]),
1074 "id" => (int) ilInternalLink::_extractObjIdOfTarget($l["Target"]),
1075 "inst" => (int) ilInternalLink::_extractInstOfTarget($l["Target"]));
1076 }
1077 $fix = array();
1078 foreach($targets as $target)
1079 {
1080 if (($target["inst"] == 0 || $target["inst"] = IL_INST_ID) &&
1081 ($target["type"] == "pg" || $target["type"] == "st"))
1082 {
1083 // first check, whether target is also within the copied set
1084 if ($a_copied_nodes[$target["id"]] > 0)
1085 {
1086 $fix[$target["id"]] = $a_copied_nodes[$target["id"]];
1087 }
1088 else
1089 {
1090 // now check, if a copy if the target is already in the same lm
1091
1092 // only if target is not already in the same lm!
1093 $trg_lm = ilLMObject::_lookupContObjID($target["id"]);
1094 if ($trg_lm != $copy_lm)
1095 {
1096 $lm_data = ilLMObject::_getAllObjectsForImportId("il__".$target["type"]."_".$target["id"]);
1097 $found = false;
1098
1099 foreach($lm_data as $item)
1100 {
1101 if (!$found && ($item["lm_id"] == $copy_lm))
1102 {
1103 $fix[$target["id"]] = $item["obj_id"];
1104 $found = true;
1105 }
1106 }
1107 }
1108 }
1109 }
1110 }
1111
1112 // outgoing links to be fixed
1113 if (count($fix) > 0)
1114 {
1115//echo "<br>--".$copied_id;
1116//var_dump($fix);
1117 $t = ilObject::_lookupType($copy_lm);
1118 if (is_array($all_fixes[$t.":".$copied_id]))
1119 {
1120 $all_fixes[$t.":".$copied_id] += $fix;
1121 }
1122 else
1123 {
1124 $all_fixes[$t.":".$copied_id] = $fix;
1125 }
1126 }
1127 }
1128
1129 if ($copied_type == "pg" ||
1130 $copied_type == "st")
1131 {
1132
1133 //
1134 // 2. Incoming links to the original pages
1135 //
1136 // A->B A2 (A+B currently copied)
1137 // A->C B2
1138 // B->A
1139 // C->A C2->A (C already copied)
1140 $original_lm = ilLMObject::_lookupContObjID($original_id);
1141 $original_type = ilObject::_lookupType($original_lm);
1142
1143 if ($original_lm != $copy_lm)
1144 {
1145
1146 // This gets sources that link to A+B (so we have C here)
1147 // (this also does already the trick when instance map areas are given in C)
1148 // int_link, where target_type, target_id, target_inst -> ok
1149 $sources = ilInternalLink::_getSourcesOfTarget($copied_type,
1150 $original_id, 0);
1151
1152 // mobs linking to $original_id
1153 // map_area, where link_type, target -> ok
1154 $mobs = ilMapArea::_getMobsForTarget("int", "il__".$copied_type.
1155 "_".$original_id);
1156
1157 // pages using these mobs
1158 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1159 foreach($mobs as $mob)
1160 {
1161 // mob_usage, where id -> ok
1162 // mep_item, where foreign_id, type -> ok
1163 // mep_tree, where child -> already existed
1164 // il_news_item, where mob_id -> ok
1165 // map_area, where link_type, target -> aready existed
1166 // media_item, where id -> already existed
1167 // personal_clipboard, where item_id, type -> ok
1168 $usages = ilObjMediaObject::lookupUsages($mob);
1169 foreach($usages as $usage)
1170 {
1171 if ($usage["type"] == "lm:pg" | $usage["type"] == "lm:st")
1172 {
1173 $sources[] = $usage;
1174 }
1175 }
1176 }
1177 $fix = array();
1178 foreach($sources as $source)
1179 {
1180 $stype = explode(":", $source["type"]);
1181 $source_type = $stype[1];
1182
1183 if ($source_type == "pg" || $source_type == "st")
1184 {
1185 // first of all: source must be in original lm
1186 $src_lm = ilLMObject::_lookupContObjID($source["id"]);
1187
1188 if ($src_lm == $original_lm)
1189 {
1190 // check, if a copy if the source is already in the same lm
1191 // now we look for the latest copy of C in LM2
1192 $lm_data = ilLMObject::_getAllObjectsForImportId("il__".$source_type."_".$source["id"],
1193 $copy_lm);
1194 $found = false;
1195 foreach ($lm_data as $item)
1196 {
1197 if (!$found)
1198 {
1199 $fix[$item["obj_id"]][$original_id] = $copied_id;
1200 $found = true;
1201 }
1202 }
1203 }
1204 }
1205 }
1206 // outgoing links to be fixed
1207 if (count($fix) > 0)
1208 {
1209 foreach ($fix as $page_id => $fix_array)
1210 {
1211 $t = ilObject::_lookupType($copy_lm);
1212 if (is_array($all_fixes[$t.":".$page_id]))
1213 {
1214 $all_fixes[$t.":".$page_id] += $fix_array;
1215 }
1216 else
1217 {
1218 $all_fixes[$t.":".$page_id] = $fix_array;
1219 }
1220
1221 }
1222 }
1223 }
1224 }
1225 }
1226
1227 foreach ($all_fixes as $pg => $fixes)
1228 {
1229 $pg = explode(":", $pg);
1230 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
1231 $page = ilPageObjectFactory::getInstance($pg[0], $pg[1]);
1232 if ($page->moveIntLinks($fixes))
1233 {
1234 $page->update(true, true);
1235 }
1236 }
1237 }
_getAllObjectsForImportId($a_import_id, $a_in_lm=0)
Get all items for an import ID.
Extension of ilPageObject for learning modules.
static _getMobsForTarget($a_type, $a_target)
Get areas for a certain target.
lookupUsages($a_id, $a_include_history=true)
Lookup usages of media object.
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
$mobs

References $mobs, $t, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), ilInternalLink\_extractTypeOfTarget(), _getAllObjectsForImportId(), ilMapArea\_getMobsForTarget(), ilInternalLink\_getSourcesOfTarget(), _lookupContObjID(), ilObject\_lookupType(), _lookupType(), ilPageObjectFactory\getInstance(), and ilObjMediaObject\lookupUsages().

Referenced by ilObjContentObject\copyAllPagesAndChapters(), ilStructureObjectGUI\insertChapterClip(), ilObjContentObjectGUI\insertChapterClip(), ilStructureObjectGUI\insertPageClip(), and ilObjContentObjectGUI\pastePage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateMetaData()

ilLMObject::updateMetaData ( )

update meta data entry

Definition at line 137 of file class.ilLMObject.php.

138 {
139 include_once("Services/MetaData/classes/class.ilMD.php");
140 include_once("Services/MetaData/classes/class.ilMDGeneral.php");
141 include_once("Services/MetaData/classes/class.ilMDDescription.php");
142
143 $md =& new ilMD($this->getLMId(), $this->getId(), $this->getType());
144 $md_gen =& $md->getGeneral();
145 $md_gen->setTitle($this->getTitle());
146
147 // sets first description (maybe not appropriate)
148 $md_des_ids =& $md_gen->getDescriptionIds();
149 if (count($md_des_ids) > 0)
150 {
151 $md_des =& $md_gen->getDescription($md_des_ids[0]);
152// $md_des->setDescription($this->getDescription());
153 $md_des->update();
154 }
155 $md_gen->update();
156
157 }

References getId(), getLMId(), getTitle(), and getType().

Referenced by update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLayout()

static ilLMObject::writeLayout (   $a_obj_id,
  $a_layout,
  $a_lm = null 
)
static

Write layout setting.

Parameters
intlm object id
stringlayout

Definition at line 1267 of file class.ilLMObject.php.

1268 {
1269 global $ilDB;
1270
1271 $t = ilLMObject::_lookupType($a_obj_id);
1272
1273 if ($t == "pg")
1274 {
1275 $query = "UPDATE lm_data SET ".
1276 " layout = ".$ilDB->quote($a_layout, "text").
1277 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
1278 $ilDB->manipulate($query);
1279 }
1280 else if ($t == "st" && is_object($a_lm))
1281 {
1282 $node = $a_lm->getLMTree()->getNodeData($a_obj_id);
1283 $child_nodes = $a_lm->getLMTree()->getSubTree($node);
1284 if (is_array($child_nodes) && count($child_nodes) > 0)
1285 {
1286 foreach ($child_nodes as $c)
1287 {
1288 if ($c["type"] == "pg")
1289 {
1290 $query = "UPDATE lm_data SET ".
1291 " layout = ".$ilDB->quote($a_layout, "text").
1292 " WHERE obj_id = ".$ilDB->quote($c["child"], "integer");
1293 $ilDB->manipulate($query);
1294 }
1295 }
1296 }
1297 }
1298 }

References $ilDB, $query, $t, and _lookupType().

Referenced by ilLMPageObjectGUI\saveLayout(), ilObjContentObjectGUI\savePageLayout(), and ilStructureObjectGUI\savePageLayout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $active

ilLMObject::$active = true

Definition at line 28 of file class.ilLMObject.php.

Referenced by ilLMPageObject\_getPresentationTitle().

◆ $content_object

ilLMObject::$content_object

Definition at line 25 of file class.ilLMObject.php.

Referenced by getContentObject().

◆ $data_record

ilLMObject::$data_record

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

◆ $data_records

ilLMObject::$data_records = array()
staticprotected

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

◆ $description

ilLMObject::$description

Definition at line 27 of file class.ilLMObject.php.

Referenced by getDescription().

◆ $id

ilLMObject::$id

◆ $ilias

ilLMObject::$ilias

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

Referenced by ilLMObject(), and pasteTree().

◆ $lm_id

◆ $meta_data

ilLMObject::$meta_data

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

◆ $title

◆ $type


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