ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLMObject Class Reference

Class ilLMObject. More...

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

Public Member Functions

 __construct ($a_content_obj, $a_id=0)
 
 MDUpdateListener ($a_element)
 Meta data update listener. 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...
 
 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...
 
 create ($a_upload=false)
 
 update ()
 update complete object More...
 
 delete ($a_delete_meta_data=true)
 delete lm object data 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 _lookupNID ($a_lm_id, $a_lm_obj_id, $a_type)
 lookup named identifier (ILIAS_NID) More...
 
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...
 
static _writeTitle ($a_obj_id, $a_title)
 
static _writeImportId ($a_id, $a_import_id)
 write import id to db (static) More...
 
static _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 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllObjectsForImportId ($a_import_id, $a_in_lm=0)
 Get all items for an import ID. More...
 
static _exists ($a_id)
 checks wether a lm content object with specified id exists or not More...
 
static getObjectList ($lm_id, $type="")
 static More...
 
static _deleteAllObjectData (&$a_cobj)
 delete all objects of content object (digi book / learning module) More...
 
static _lookupContObjID ($a_id)
 get learning module / digibook id for lm object More...
 
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 clipboardCut ($a_cont_obj_id, $a_ids)
 Copy a set of chapters/pages into the clipboard. 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.

Constructor & Destructor Documentation

◆ __construct()

ilLMObject::__construct (   $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:

Member Function Documentation

◆ _deleteAllObjectData()

static ilLMObject::_deleteAllObjectData ( $a_cobj)
static

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

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

722 {
723 global $ilDB;
724
725 $query = "SELECT * FROM lm_data ".
726 "WHERE lm_id= ".$ilDB->quote($a_cobj->getId(), "integer");
727 $obj_set = $ilDB->query($query);
728
729 require_once("./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
730 while ($obj_rec = $ilDB->fetchAssoc($obj_set))
731 {
732 $lm_obj = ilLMObjectFactory::getInstance($a_cobj, $obj_rec["obj_id"],false);
733
734 if (is_object($lm_obj))
735 {
736 $lm_obj->delete(true);
737 }
738 }
739
740 return true;
741 }
static 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()

static ilLMObject::_exists (   $a_id)
static

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 666 of file class.ilLMObject.php.

667 {
668 global $ilDB;
669
670 include_once("./Services/Link/classes/class.ilInternalLink.php");
671 if (is_int(strpos($a_id, "_")))
672 {
674 }
675
676 $q = "SELECT * FROM lm_data WHERE obj_id = ".
677 $ilDB->quote($a_id, "integer");
678 $obj_set = $ilDB->query($q);
679 if ($obj_rec = $ilDB->fetchAssoc($obj_set))
680 {
681 return true;
682 }
683 else
684 {
685 return false;
686 }
687
688 }

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 1359 of file class.ilLMObject.php.

1360 {
1361 global $ilDB;
1362
1363 $and = ($a_type != "")
1364 ? " AND type = ".$ilDB->quote($a_type, "text")
1365 : "";
1366
1367 $set = $ilDB->query("SELECT obj_id FROM lm_data ".
1368 " WHERE lm_id = ".$ilDB->quote($a_lm_id, "integer").$and);
1369 $obj_ids = array();
1370 while ($rec = $ilDB->fetchAssoc($set))
1371 {
1372 $obj_ids[] = $rec["obj_id"];
1373 }
1374
1375 return $obj_ids;
1376 }
$a_type
Definition: workflow.php:93

References $a_type, and $ilDB.

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

+ Here is the caller graph for this function:

◆ _getAllObjectsForImportId()

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

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 632 of file class.ilLMObject.php.

633 {
634 global $ilDB;
635
636 $where = ($a_in_lm > 0)
637 ? " AND lm_id = ".$ilDB->quote($a_in_lm, "integer")." "
638 : "";
639
640 $q = "SELECT * FROM lm_data WHERE import_id = ".
641 $ilDB->quote($a_import_id, "text")." ".
642 $where.
643 " ORDER BY create_date DESC";
644 $obj_set = $ilDB->query($q);
645
646 $items = array();
647 while ($obj_rec = $ilDB->fetchAssoc($obj_set))
648 {
649 // check, whether lm is not trashed
650 if (ilObject::_hasUntrashedReference($obj_rec["lm_id"]))
651 {
652 $items[] = $obj_rec;
653 }
654 }
655
656 return $items;
657 }
static _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()

static ilLMObject::_getIdForImportId (   $a_import_id)
static

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 598 of file class.ilLMObject.php.

599 {
600 global $ilDB;
601
602 $q = "SELECT obj_id FROM lm_data WHERE import_id = ".
603 $ilDB->quote($a_import_id, "text")." ".
604 " ORDER BY create_date DESC";
605 $obj_set = $ilDB->query($q);
606 while ($obj_rec = $ilDB->fetchAssoc($obj_set))
607 {
608 $lm_id = ilLMObject::_lookupContObjID($obj_rec["obj_id"]);
609
610 // link only in learning module, that is not trashed
611 include_once("./Services/Help/classes/class.ilObjHelpSettings.php");
612 $ref_ids = ilObject::_getAllReferences($lm_id); // will be 0 if import of lm is in progress (new import)
613 if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($lm_id) ||
615 {
616 return $obj_rec["obj_id"];
617 }
618 }
619
620 return 0;
621 }
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static isHelpLM($a_lm_id)
Check if LM is a help LM.
static _getAllReferences($a_id)
get all reference ids of object

References $ilDB, $lm_id, ilObject\_getAllReferences(), 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, and ilStructureObject.

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

1523 {
1524 if ($a_lang == "")
1525 {
1526 $a_lang = "-";
1527 }
1528
1529 if ($a_node["type"] == "st")
1530 {
1531 include_once './Modules/LearningModule/classes/class.ilStructureObject.php';
1533 $a_include_numbers, $a_time_scheduled_activation, $a_force_content, $a_lm_id, $a_lang);
1534 }
1535 else
1536 {
1537 include_once './Modules/LearningModule/classes/class.ilLMPageObject.php';
1538 return ilLMPageObject::_getPresentationTitle($a_node["child"],
1539 $a_mode, $a_include_numbers, $a_time_scheduled_activation,
1540 $a_force_content, $a_lm_id, $a_lang);
1541 }
1542 }
const IL_CHAPTER_TITLE
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_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-")
get presentation title

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

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 539 of file class.ilLMObject.php.

540 {
541 global $ilDB,$ilLog;
542
543 if (empty($a_node_id))
544 {
545 $message = sprintf('ilLMObject::_isPagePublic(): Invalid parameter! $a_node_id is empty');
546 $ilLog->write($message,$ilLog->WARNING);
547 return false;
548 }
549
550 if ($a_check_public_mode === true)
551 {
552 $lm_id = ilLMObject::_lookupContObjId($a_node_id);
553
554 $q = "SELECT public_access_mode FROM content_object WHERE id = ".
555 $ilDB->quote($lm_id, "integer");
556 $r = $ilDB->query($q);
557 $row = $ilDB->fetchAssoc($r);
558
559 if ($row["public_access_mode"] == "complete")
560 {
561 return true;
562 }
563 }
564
565 $q = "SELECT public_access FROM lm_data WHERE obj_id=".
566 $ilDB->quote($a_node_id, "integer");
567 $r = $ilDB->query($q);
568 $row = $ilDB->fetchAssoc($r);
569
570 return ilUtil::yn2tf($row["public_access"]);
571 }
sprintf('%.4f', $callTime)
static yn2tf($a_yn)
convert "y"/"n" to true/false
$r
Definition: example_031.php:79

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

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

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

◆ _lookupContObjID()

static ilLMObject::_lookupContObjID (   $a_id)
static

◆ _lookupNID()

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

lookup named identifier (ILIAS_NID)

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

102 {
103 include_once 'Services/MetaData/classes/class.ilMD.php';
104//echo "-".$a_lm_id."-".$a_lm_obj_id."-".$a_type."-";
105 $md = new ilMD($a_lm_id, $a_lm_obj_id, $a_type);
106 $md_gen = $md->getGeneral();
107 if (is_object($md_gen))
108 {
109 foreach($md_gen->getIdentifierIds() as $id)
110 {
111 $md_id = $md_gen->getIdentifier($id);
112 if ($md_id->getCatalog() == "ILIAS_NID")
113 {
114 return $md_id->getEntry();
115 }
116 }
117 }
118
119 return false;
120 }

References $a_type, and $id.

◆ _lookupTitle()

◆ _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 285 of file class.ilLMObject.php.

286 {
287 global $ilDB;
288
289 if (isset(self::$data_records[$a_obj_id]))
290 {
291 if ($a_lm_id == 0 || self::$data_records[$a_obj_id]["lm_id"] == $a_lm_id)
292 {
293 return self::$data_records[$a_obj_id]["type"];
294 }
295 }
296
297 if($a_lm_id)
298 {
299 $and = ' AND lm_id = '.$ilDB->quote($a_lm_id,'integer');
300 }
301
302 $query = "SELECT type FROM lm_data WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer").$and;
303 $obj_set = $ilDB->query($query);
304 $obj_rec = $ilDB->fetchAssoc($obj_set);
305
306 return $obj_rec["type"];
307 }

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(), ilSCORM2004Node\pasteTree(), ilObjContentObjectGUI\saveExportIds(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showTableOfContents(), uniqueTypesCheck(), updateInternalLinks(), ilCourseObjectivesGUI\updateMaterialAssignment(), and writeLayout().

+ Here is the caller graph for this function:

◆ _writeImportId()

static ilLMObject::_writeImportId (   $a_id,
  $a_import_id 
)
static

write import id to db (static)

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

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

410 {
411 global $ilDB;
412
413 $q = "UPDATE lm_data ".
414 "SET ".
415 "import_id = ".$ilDB->quote($a_import_id, "text").",".
416 "last_update = ".$ilDB->now()." ".
417 "WHERE obj_id = ".$ilDB->quote($a_id, "integer");
418
419 $ilDB->manipulate($q);
420 }

References $ilDB.

Referenced by ilContObjParser\handlerEndTag().

+ Here is the caller graph for this function:

◆ _writePublicAccessStatus()

static 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 478 of file class.ilLMObject.php.

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

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

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

+ Here is the caller graph for this function:

◆ _writeTitle()

static ilLMObject::_writeTitle (   $a_obj_id,
  $a_title 
)
static

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

311 {
312 global $ilDB;
313
314 $query = "UPDATE lm_data SET ".
315 " title = ".$ilDB->quote($a_title, "text").
316 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
317 $ilDB->manipulate($query);
318 }

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 885 of file class.ilLMObject.php.

886 {
887 global $ilUser;
888
889 $tree = ilLMObject::getTree($a_cont_obj_id);
890
891 $ilUser->clipboardDeleteObjectsOfType("pg");
892 $ilUser->clipboardDeleteObjectsOfType("st");
893
894 // put them into the clipboard
895 $time = date("Y-m-d H:i:s", time());
896 $order = 0;
897 foreach ($a_ids as $id)
898 {
899 $curnode = array();
900 if ($tree->isInTree($id))
901 {
902 $curnode = $tree->getNodeData($id);
903 $subnodes = $tree->getSubTree($curnode);
904 foreach($subnodes as $subnode)
905 {
906 if ($subnode["child"] != $id)
907 {
908 $ilUser->addObjectToClipboard($subnode["child"],
909 $subnode["type"], $subnode["title"],
910 $subnode["parent"], $time, $subnode["lft"]);
911 }
912 }
913 }
914 $order = ($curnode["lft"] > 0)
915 ? $curnode["lft"]
916 : (int) ($order + 1);
917 $ilUser->addObjectToClipboard($id,
919 $order);
920 }
921 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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.
$ilUser
Definition: imgupload.php:18

References $id, $ilUser, _lookupTitle(), _lookupType(), date, 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()

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

Copy a set of chapters/pages into the clipboard.

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

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

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 ilStructureObject.

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

423 {
424 global $ilDB;
425
426 // insert object data
427 $this->setId($ilDB->nextId("lm_data"));
428 $query = "INSERT INTO lm_data (obj_id, title, type, layout, lm_id, import_id, create_date) ".
429 "VALUES (".
430 $ilDB->quote($this->getId(), "integer").",".
431 $ilDB->quote($this->getTitle(), "text").",".
432 $ilDB->quote($this->getType(), "text").", ".
433 $ilDB->quote($this->getLayout(), "text").", ".
434 $ilDB->quote($this->getLMId(), "integer").",".
435 $ilDB->quote($this->getImportId(), "text").
436 ", ".$ilDB->now().")";
437 $ilDB->manipulate($query);
438
439 // create history entry
440 include_once("./Services/History/classes/class.ilHistory.php");
441 ilHistory::_createEntry($this->getId(), "create", "",
442 $this->content_object->getType().":".$this->getType());
443
444 if (!$a_upload)
445 {
446 $this->createMetaData();
447 }
448
449 }
static _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 126 of file class.ilLMObject.php.

127 {
128 include_once 'Services/MetaData/classes/class.ilMDCreator.php';
129
130 global $ilUser;
131
132 $md_creator = new ilMDCreator($this->getLMId(), $this->getId(), $this->getType());
133 $md_creator->setTitle($this->getTitle());
134 $md_creator->setTitleLanguage($ilUser->getPref('language'));
135 $md_creator->setDescription($this->getDescription());
136 $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
137 $md_creator->setKeywordLanguage($ilUser->getPref('language'));
138 $md_creator->setLanguage($ilUser->getPref('language'));
139 $md_creator->create();
140
141 return true;
142 }

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 576 of file class.ilLMObject.php.

577 {
578 global $ilDB;
579
580 $query = "DELETE FROM lm_data WHERE obj_id = ".
581 $ilDB->quote($this->getId(), "integer");
582 $ilDB->manipulate($query);
583
584 $this->deleteMetaData();
585 }
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 173 of file class.ilLMObject.php.

174 {
175 // Delete meta data
176 include_once('Services/MetaData/classes/class.ilMD.php');
177 $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
178 $md->deleteAll();
179 }

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 1474 of file class.ilLMObject.php.

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

References $a_type, and 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 357 of file class.ilLMObject.php.

358 {
360 }

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 326 of file class.ilLMObject.php.

327 {
328 return $this->description;
329 }

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 1483 of file class.ilLMObject.php.

1484 {
1485 include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1486 $entries = ilMDIdentifier::_getEntriesForRbacObj($a_lm_id, $a_type);
1487 $res = array();
1488 foreach ($entries as $e)
1489 {
1490 if ($e["catalog"] == "ILIAS_NID")
1491 {
1492 if (ilLMObject::_exists($e["obj_id"]))
1493 {
1494 $res[trim($e["entry"])]++;
1495 }
1496 }
1497 }
1498 return $res;
1499 }
static _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 $a_type, $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 1452 of file class.ilLMObject.php.

1453 {
1454 // look for export id
1455 include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1457 $a_lm_id, $a_lmobj_id, $a_type);
1458
1459 foreach ($entries as $e)
1460 {
1461 if ($e["catalog"] == "ILIAS_NID")
1462 {
1463 return $e["entry"];
1464 }
1465 }
1466 }
static _getEntriesForObj($a_rbac_id, $a_obj_id, $a_obj_type)
Get IDs for an object.

References $a_type, and 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 1507 of file class.ilLMObject.php.

1508 {
1509 include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1510 $data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1511 return $data;
1512 }
static readIdData($a_rbac_id, $a_obj_type, $a_catalog, $a_entry)
Does id entry exist in rbac object?

References $a_type, $data, and ilMDIdentifier\readIdData().

+ Here is the call graph for this function:

◆ getId()

◆ getImportId()

ilLMObject::getImportId ( )

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

373 {
374 return $this->import_id;
375 }

Referenced by create().

+ Here is the caller graph for this function:

◆ getLayout()

ilLMObject::getLayout ( )

Get layout.

Returns
string layout

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

398 {
399 return $this->layout;
400 }

References $layout.

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

+ Here is the caller graph for this function:

◆ getLMId()

◆ getObjectList()

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

static

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

694 {
695 global $ilDB;
696
697 $type_str = ($type != "")
698 ? "AND type = ".$ilDB->quote($type, "text")." "
699 : "";
700
701 $query = "SELECT * FROM lm_data ".
702 "WHERE lm_id= ".$ilDB->quote($lm_id, "integer")." ".
703 $type_str." ".
704 "ORDER BY title";
705 $obj_set = $ilDB->query($query);
706 $obj_list = array();
707 while($obj_rec = $ilDB->fetchAssoc($obj_set))
708 {
709 $obj_list[] = array("obj_id" => $obj_rec["obj_id"],
710 "title" => $obj_rec["title"],
711 "import_id" => $obj_rec["import_id"],
712 "type" => $obj_rec["type"]);
713 }
714 return $obj_list;
715 }

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

Referenced by ilLMPageObject\getPageList(), ilLearningModuleExporter\getXmlExportTailDependencies(), ilHelpExporter\getXmlExportTailDependencies(), and ilObjHelpSettings\uploadHelpModule().

+ 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 1340 of file class.ilLMObject.php.

1341 {
1342 // update structure entries: if at least one page of a chapter is public set chapter to public too
1343 $lm_tree = new ilTree($a_lm_id);
1344 $lm_tree->setTableNames('lm_tree','lm_data');
1345 $lm_tree->setTreeTablePK("lm_id");
1346 $lm_tree->readRootId();
1347
1348 $childs = $lm_tree->getChildsByType($a_chap_id, "pg");
1349
1350 return $childs;
1351 }

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 251 of file class.ilLMObject.php.

252 {
253 return $this->title;
254 }

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 824 of file class.ilLMObject.php.

825 {
826 $tree = new ilTree($a_cont_obj_id);
827 $tree->setTableNames('lm_tree', 'lm_data');
828 $tree->setTreeTablePK("lm_id");
829 $tree->readRootId();
830
831 return $tree;
832 }

Referenced by clipboardCopy(), and clipboardCut().

+ Here is the caller graph for this function:

◆ getType()

◆ lookupLayout()

static ilLMObject::lookupLayout (   $a_obj_id)
static

Lookup type.

Parameters
intlm object id

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

1323 {
1324 global $ilDB;
1325
1326 $query = "SELECT layout FROM lm_data WHERE obj_id = ".
1327 $ilDB->quote($a_obj_id, "integer");
1328 $obj_set = $ilDB->query($query);
1329 $obj_rec = $ilDB->fetchAssoc($obj_set);
1330
1331 return $obj_rec["layout"];
1332 }

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 break;
80
81 case 'Educational':
82 include_once("./Services/Object/classes/class.ilObjectLP.php");
83 $obj_lp = ilObjectLP::getInstance($this->getLMId());
84 if(in_array($obj_lp->getCurrentMode(),
86 {
87 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
89 }
90 break;
91
92 default:
93 }
94 return true;
95 }
static _writeTitle($a_obj_id, $a_title)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static getInstance($a_obj_id)

References $id, ilLPStatusWrapper\_refreshStatus(), _writeTitle(), getId(), ilObjectLP\getInstance(), getLMId(), getType(), ilLPObjSettings\LP_MODE_COLLECTION_TLT, and ilLPObjSettings\LP_MODE_TLT.

+ 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 926 of file class.ilLMObject.php.

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

222 {
223 global $ilDB;
224
225 $set = $ilDB->query("SELECT * FROM lm_data ".
226 " WHERE lm_id = ".$ilDB->quote($a_lm_id, "integer")
227 );
228 while ($rec = $ilDB->fetchAssoc($set))
229 {
230 self::$data_records[$rec["obj_id"]] = $rec;
231 }
232 return count(self::$data_records);
233 }

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 766 of file class.ilLMObject.php.

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

References $ilLog, $target, and IL_FIRST_NODE.

Referenced by ilObjContentObject\addFirstChapterAndPage(), ilLearningModuleDataSet\importRecord(), 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 191 of file class.ilLMObject.php.

192 {
193 global $ilBench, $ilDB;
194
195 $ilBench->start("ContentPresentation", "ilLMObject_read");
196
197 if(!isset($this->data_record))
198 {
199 $query = "SELECT * FROM lm_data WHERE obj_id = ".
200 $ilDB->quote($this->id, "integer");
201 $obj_set = $ilDB->query($query);
202 $this->data_record = $ilDB->fetchAssoc($obj_set);
203 }
204
205 $this->type = $this->data_record["type"];
206 $this->setImportId($this->data_record["import_id"]);
207 $this->setTitle($this->data_record["title"]);
208 $this->setLayout($this->data_record["layout"]);
209 //$this->setActive(ilUtil::yn2tf($this->data_record["active"]));
210
211 $ilBench->stop("ContentPresentation", "ilLMObject_read");
212 }
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 __construct().

+ 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 1389 of file class.ilLMObject.php.

1390 {
1391 global $ilDB;
1392
1393 include_once("Services/MetaData/classes/class.ilMDIdentifier.php");
1394
1395 if (trim($a_exp_id) == "")
1396 {
1397 // delete export ids, if existing
1399 $a_lm_id, $a_lmobj_id, $a_type);
1400
1401 foreach ($entries as $id => $e)
1402 {
1403 if ($e["catalog"] == "ILIAS_NID")
1404 {
1405 $identifier = new ilMDIdentifier();
1406 $identifier->setMetaId($id);
1407 $identifier->delete();
1408 }
1409 }
1410 }
1411 else
1412 {
1413 // update existing entry
1415 $a_lm_id, $a_lmobj_id, $a_type);
1416
1417 $updated = false;
1418 foreach ($entries as $id => $e)
1419 {
1420 if ($e["catalog"] == "ILIAS_NID")
1421 {
1422 $identifier = new ilMDIdentifier();
1423 $identifier->setMetaId($id);
1424 $identifier->read();
1425 $identifier->setEntry($a_exp_id);
1426 $identifier->update();
1427 $updated = true;
1428 }
1429 }
1430
1431 // nothing updated? create a new one
1432 if (!$updated)
1433 {
1434 include_once("./Services/MetaData/classes/class.ilMD.php");
1435 $md = new ilMD($a_lm_id, $a_lmobj_id, $a_type);
1436 $md_gen = $md->getGeneral();
1437 $identifier = $md_gen->addIdentifier();
1438 $identifier->setEntry($a_exp_id);
1439 $identifier->setCatalog("ILIAS_NID");
1440 $identifier->save();
1441 }
1442 }
1443
1444 }

References $a_type, $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 1019 of file class.ilLMObject.php.

1020 {
1021 include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
1022
1023 if ($a_lang == "")
1024 {
1025 $a_lang = "-";
1026 }
1027 if (is_array($a_titles))
1028 {
1029 include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
1030 include_once("./Services/MetaData/classes/class.ilMD.php");
1031 foreach($a_titles as $id => $title)
1032 {
1033 // see #20375
1035 if ($a_lang == "-")
1036 {
1037 $lmobj = ilLMObjectFactory::getInstance($a_lm, $id, false);
1038 if (is_object($lmobj))
1039 {
1040 // Update Title and description
1041 $md = new ilMD($a_lm->getId(), $id, $lmobj->getType());
1042 $md_gen = $md->getGeneral();
1043 if (is_object($md_gen)) // see bug #0015843
1044 {
1045 $md_gen->setTitle($title);
1046 $md_gen->update();
1047 $md->update();
1048 }
1050 }
1051 }
1052 else
1053 {
1054 $lmobjtrans = new ilLMObjTranslation($id, $a_lang);
1055 $lmobjtrans->setTitle($title);
1056 $lmobjtrans->save();
1057 }
1058 }
1059 }
1060 }
static removeProhibitedCharacters($a_text)
Remove prohibited characters see #19159.
Translation information on lm object.

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

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 352 of file class.ilLMObject.php.

353 {
354 $this->content_object = $a_content_obj;
355 }

Referenced by __construct().

+ 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 186 of file class.ilLMObject.php.

187 {
188 $this->data_record = $a_record;
189 }

◆ setDescription()

ilLMObject::setDescription (   $a_description)

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

322 {
323 $this->description = $a_description;
324 }

◆ setId()

ilLMObject::setId (   $a_id)

Reimplemented in ilLMPageObject.

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

363 {
364 $this->id = $a_id;
365 }

Referenced by create().

+ Here is the caller graph for this function:

◆ setImportId()

ilLMObject::setImportId (   $a_id)

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

378 {
379 $this->import_id = $a_id;
380 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLayout()

ilLMObject::setLayout (   $a_val)

Set layout.

Parameters
stringlayout

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

388 {
389 $this->layout = $a_val;
390 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLMId()

ilLMObject::setLMId (   $a_lm_id)

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

342 {
343 $this->lm_id = $a_lm_id;
344
345 }

Referenced by __construct().

+ 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 241 of file class.ilLMObject.php.

242 {
243 $this->title = $a_title;
244 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilLMObject::setType (   $a_type)

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

332 {
333 $this->type = $a_type;
334 }

References $a_type.

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

+ 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 1259 of file class.ilLMObject.php.

1260 {
1261 $types = array();
1262 if (is_array($a_items))
1263 {
1264 foreach($a_items as $item)
1265 {
1267 $types[$type] = $type;
1268 }
1269 }
1270
1271 if (count($types) > 1)
1272 {
1273 return false;
1274 }
1275 return true;
1276 }

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 454 of file class.ilLMObject.php.

455 {
456 global $ilDB;
457
458 $this->updateMetaData();
459
460 $query = "UPDATE lm_data SET ".
461 " lm_id = ".$ilDB->quote($this->getLMId(), "integer").
462 " ,title = ".$ilDB->quote($this->getTitle(), "text").
463 " ,layout = ".$ilDB->quote($this->getLayout(), "text").
464 " WHERE obj_id = ".$ilDB->quote($this->getId(), "integer");
465
466 $ilDB->manipulate($query);
467 }
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 1065 of file class.ilLMObject.php.

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

References $l, $mobs, $t, $target, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), ilInternalLink\_extractTypeOfTarget(), _getAllObjectsForImportId(), ilMapArea\_getMobsForTarget(), ilInternalLink\_getSourcesOfTarget(), _lookupContObjID(), ilObject\_lookupType(), _lookupType(), ilPageObjectFactory\getInstance(), ilPageObject\lookupTranslations(), 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 147 of file class.ilLMObject.php.

148 {
149 include_once("Services/MetaData/classes/class.ilMD.php");
150 include_once("Services/MetaData/classes/class.ilMDGeneral.php");
151 include_once("Services/MetaData/classes/class.ilMDDescription.php");
152
153 $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
154 $md_gen = $md->getGeneral();
155 $md_gen->setTitle($this->getTitle());
156
157 // sets first description (maybe not appropriate)
158 $md_des_ids = $md_gen->getDescriptionIds();
159 if (count($md_des_ids) > 0)
160 {
161 $md_des = $md_gen->getDescription($md_des_ids[0]);
162// $md_des->setDescription($this->getDescription());
163 $md_des->update();
164 }
165 $md_gen->update();
166
167 }

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 1284 of file class.ilLMObject.php.

1285 {
1286 global $ilDB;
1287
1288 $t = ilLMObject::_lookupType($a_obj_id);
1289
1290 if ($t == "pg")
1291 {
1292 $query = "UPDATE lm_data SET ".
1293 " layout = ".$ilDB->quote($a_layout, "text").
1294 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
1295 $ilDB->manipulate($query);
1296 }
1297 else if ($t == "st" && is_object($a_lm))
1298 {
1299 $node = $a_lm->getLMTree()->getNodeData($a_obj_id);
1300 $child_nodes = $a_lm->getLMTree()->getSubTree($node);
1301 if (is_array($child_nodes) && count($child_nodes) > 0)
1302 {
1303 foreach ($child_nodes as $c)
1304 {
1305 if ($c["type"] == "pg")
1306 {
1307 $query = "UPDATE lm_data SET ".
1308 " layout = ".$ilDB->quote($a_layout, "text").
1309 " WHERE obj_id = ".$ilDB->quote($c["child"], "integer");
1310 $ilDB->manipulate($query);
1311 }
1312 }
1313 }
1314 }
1315 }

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 __construct(), 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: