ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 721 of file class.ilLMObject.php.

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

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

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 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 }
_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 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 }
_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.

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

1522 {
1523 if ($a_lang == "")
1524 {
1525 $a_lang = "-";
1526 }
1527
1528 if ($a_node["type"] == "st")
1529 {
1530 include_once './Modules/LearningModule/classes/class.ilStructureObject.php';
1531 return ilStructureObject::_getPresentationTitle($a_node["child"],
1532 $a_include_numbers, $a_time_scheduled_activation, $a_lm_id, $a_lang);
1533 }
1534 else
1535 {
1536 include_once './Modules/LearningModule/classes/class.ilLMPageObject.php';
1537 return ilLMPageObject::_getPresentationTitle($a_node["child"],
1538 $a_mode, $a_include_numbers, $a_time_scheduled_activation,
1539 $a_force_content, $a_lm_id, $a_lang);
1540 }
1541 }
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 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 }
static yn2tf($a_yn)
convert "y"/"n" to true/false
$r
Definition: example_031.php:79

References $ilDB, $ilLog, $lm_id, $r, $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)

◆ _lookupNID()

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

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 $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()

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 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()

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

References $ilDB, $ilErr, $ilLog, $r, 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 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 887 of file class.ilLMObject.php.

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

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

1474 {
1475 include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1476 return ilMDIdentifier::existsIdInRbacObject($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1477 }
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 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 1482 of file class.ilLMObject.php.

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

1452 {
1453 // look for export id
1454 include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1456 $a_lm_id, $a_lmobj_id, $a_type);
1457
1458 foreach ($entries as $e)
1459 {
1460 if ($e["catalog"] == "ILIAS_NID")
1461 {
1462 return $e["entry"];
1463 }
1464 }
1465 }
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 1506 of file class.ilLMObject.php.

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

References $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 }

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

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

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

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

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

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

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 }
_writeTitle($a_obj_id, $a_title)
_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 928 of file class.ilLMObject.php.

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

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

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

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

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

1022 {
1023 include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
1024
1025 if ($a_lang == "")
1026 {
1027 $a_lang = "-";
1028 }
1029 if (is_array($a_titles))
1030 {
1031 include_once("./Services/MetaData/classes/class.ilMD.php");
1032 foreach($a_titles as $id => $title)
1033 {
1034 if ($a_lang == "-")
1035 {
1036 $lmobj = ilLMObjectFactory::getInstance($a_lm, $id, false);
1037 if (is_object($lmobj))
1038 {
1039 // Update Title and description
1040 $md = new ilMD($a_lm->getId(), $id, $lmobj->getType());
1041 $md_gen = $md->getGeneral();
1042 if (is_object($md_gen)) // see bug #0015843
1043 {
1044 $md_gen->setTitle($title);
1045 $md_gen->update();
1046 $md->update();
1047 }
1049 }
1050 }
1051 else
1052 {
1053 $lmobjtrans = new ilLMObjTranslation($id, $a_lang);
1054 $lmobjtrans->setTitle($title);
1055 $lmobjtrans->save();
1056 }
1057 }
1058 }
1059 }
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 352 of file class.ilLMObject.php.

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

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 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 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 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 }

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

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

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

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

References $l, $mobs, $t, 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 1283 of file class.ilLMObject.php.

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

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: