ILIAS  release_8 Revision v8.24
ilLMObject Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct (ilObjLearningModule $a_content_obj, int $a_id=0)
 
 MDUpdateListener (string $a_element)
 Meta data update listener Important note: Do never call create() or update() method of ilObject here. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 setDataRecord (array $a_record)
 this method should only be called by class ilLMObjectFactory More...
 
 read ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setShortTitle (string $a_title)
 
 getShortTitle ()
 
 setDescription (string $a_description)
 
 getDescription ()
 
 setType (string $a_type)
 
 getType ()
 
 setLMId (int $a_lm_id)
 
 getLMId ()
 
 setContentObject (ilObjLearningModule $a_content_obj)
 
 getContentObject ()
 
 setId (int $a_id)
 
 getId ()
 
 getImportId ()
 
 setImportId (string $a_id)
 
 setLayout (string $a_val)
 
 getLayout ()
 
 create (bool $a_upload=false)
 
 update ()
 
 delete (bool $a_delete_meta_data=true)
 
 existsExportID (int $a_lm_id, int $a_exp_id, string $a_type="pg")
 Does export ID exist in lm? More...
 
 getExportIDInfo (int $a_lm_id, int $a_exp_id, string $a_type="pg")
 

Static Public Member Functions

static _lookupNID (int $a_lm_id, int $a_lm_obj_id, string $a_type)
 lookup named identifier (ILIAS_NID) More...
 
static preloadDataByLM (int $a_lm_id)
 Preload data records by lm. More...
 
static _lookupTitle (int $a_obj_id)
 
static _lookupShortTitle (int $a_obj_id)
 
static _lookupType (int $a_obj_id, int $a_lm_id=0)
 
static _writeTitle (int $a_obj_id, string $a_title)
 
static _writeImportId (int $a_id, string $a_import_id)
 
static _writePublicAccessStatus (array $a_pages, int $a_cont_obj_id)
 update public access flags in lm_data for all pages of a content object More...
 
static _isPagePublic (int $a_node_id, bool $a_check_public_mode=false)
 
static _getIdForImportId (string $a_import_id)
 get current object id for import id (static) More...
 
static _getAllObjectsForImportId (string $a_import_id, int $a_in_lm=0)
 Get all items for an import ID. More...
 
static _exists (int $a_id)
 checks wether a lm content object with specified id exists or not More...
 
static getObjectList (int $lm_id, string $type="")
 
static _deleteAllObjectData (ilObjLearningModule $a_cobj)
 delete all objects of content object (digi book / learning module) More...
 
static _lookupContObjID (int $a_id)
 get learning module id for lm object More...
 
static putInTree (ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
 put this object into content object tree More...
 
static getTree (int $a_cont_obj_id)
 Get learning module tree. More...
 
static clipboardCut (int $a_cont_obj_id, array $a_ids)
 Copy a set of chapters/pages into the clipboard. More...
 
static clipboardCopy (int $a_cont_obj_id, array $a_ids)
 Copy a set of chapters/pages into the clipboard. More...
 
static saveTitles (ilObjLearningModule $a_lm, array $a_titles, string $a_lang="-")
 Save titles for lm objects. More...
 
static updateInternalLinks (array $a_copied_nodes, string $a_parent_type="lm")
 Update internal links, after multiple pages have been copied. More...
 
static uniqueTypesCheck (array $a_items)
 Check for unique types (all pages or all chapters) More...
 
static writeLayout (int $a_obj_id, string $a_layout, ?ilObjLearningModule $a_lm=null)
 Write layout setting. More...
 
static lookupLayout (int $a_obj_id)
 Lookup type. More...
 
static getPagesOfChapter (int $a_lm_id, int $a_chap_id)
 Get pages of chapter. More...
 
static _getAllLMObjectsOfLM (int $a_lm_id, string $a_type="")
 Get all objects of learning module. More...
 
static saveExportId (int $a_lm_id, int $a_lmobj_id, string $a_exp_id, string $a_type="pg")
 
static getExportId (int $a_lm_id, int $a_lmobj_id, string $a_type="pg")
 
static getDuplicateExportIDs (int $a_lm_id, string $a_type="pg")
 Get duplicate export IDs (count export ID usages) More...
 
static _getNodePresentationTitle (array $a_node, string $a_mode=self::PAGE_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-")
 
static getShortTitles (int $a_lm_id, string $a_lang="-")
 
static writeShortTitle (int $a_id, string $a_short_title, string $a_lang="-")
 

Data Fields

const CHAPTER_TITLE = "st_title"
 
const PAGE_TITLE = "pg_title"
 
const NO_HEADER = "none"
 
int $lm_id = 0
 
string $type = ""
 
int $id = 0
 
array $data_record
 
ilObjLearningModule $content_object
 
string $title = ""
 
string $short_title = ""
 
string $description = ""
 
bool $active = true
 

Static Protected Member Functions

static _lookup (int $a_obj_id, string $a_field)
 

Protected Attributes

string $layout = ""
 
string $import_id = ""
 
ilObjUser $user
 
ilDBInterface $db
 

Static Protected Attributes

static $data_records = array()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilLMObject

Base class for ilStructureObjects and ilPageObjects (see ILIAS DTD)

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilLMObject::__construct ( ilObjLearningModule  $a_content_obj,
int  $a_id = 0 
)

Reimplemented in ilStructureObject.

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

50 {
51 global $DIC;
52 $this->user = $DIC->user();
53
54 $this->db = $DIC->database();
55
56 $this->id = $a_id;
57 $this->setContentObject($a_content_obj);
58 $this->setLMId($a_content_obj->getId());
59 if ($a_id != 0) {
60 $this->read();
61 }
62 }
setContentObject(ilObjLearningModule $a_content_obj)
setLMId(int $a_lm_id)
global $DIC
Definition: feed.php:28

References $DIC, ilObject\getId(), read(), setContentObject(), setLMId(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteAllObjectData()

static ilLMObject::_deleteAllObjectData ( ilObjLearningModule  $a_cobj)
static

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

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

669 : void {
670 global $DIC;
671
672 $ilDB = $DIC->database();
673
674 $query = "SELECT * FROM lm_data " .
675 "WHERE lm_id= " . $ilDB->quote($a_cobj->getId(), "integer");
676 $obj_set = $ilDB->query($query);
677
678 while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
679 $lm_obj = ilLMObjectFactory::getInstance($a_cobj, $obj_rec["obj_id"], false);
680
681 if (is_object($lm_obj)) {
682 $lm_obj->delete(true);
683 }
684 }
685 }
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
$query

References ilLMObjectFactory\getInstance().

+ Here is the call graph for this function:

◆ _exists()

static ilLMObject::_exists ( int  $a_id)
static

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

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

616 : bool
617 {
618 global $DIC;
619
620 $ilDB = $DIC->database();
621
622 if (is_int(strpos($a_id, "_"))) {
624 }
625
626 $q = "SELECT * FROM lm_data WHERE obj_id = " .
627 $ilDB->quote($a_id, "integer");
628 $obj_set = $ilDB->query($q);
629 if ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
630 return true;
631 } else {
632 return false;
633 }
634 }

References $DIC, $ilDB, and ilInternalLink\_extractObjIdOfTarget().

Referenced by ilCourseObjectiveMaterials\__read(), ilInternalLink\_exists(), ilLinksTableGUI\fillRow(), 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 ( int  $a_lm_id,
string  $a_type = "" 
)
static

Get all objects of learning module.

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

1250 : array {
1251 global $DIC;
1252
1253 $ilDB = $DIC->database();
1254
1255 $and = ($a_type != "")
1256 ? " AND type = " . $ilDB->quote($a_type, "text")
1257 : "";
1258
1259 $set = $ilDB->query("SELECT obj_id FROM lm_data " .
1260 " WHERE lm_id = " . $ilDB->quote($a_lm_id, "integer") . $and);
1261 $obj_ids = array();
1262 while ($rec = $ilDB->fetchAssoc($set)) {
1263 $obj_ids[] = $rec["obj_id"];
1264 }
1265
1266 return $obj_ids;
1267 }

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

+ Here is the caller graph for this function:

◆ _getAllObjectsForImportId()

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

Get all items for an import ID.

(only for items notnot in trash)

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

587 : array {
588 global $DIC;
589
590 $ilDB = $DIC->database();
591
592 $where = ($a_in_lm > 0)
593 ? " AND lm_id = " . $ilDB->quote($a_in_lm, "integer") . " "
594 : "";
595
596 $q = "SELECT * FROM lm_data WHERE import_id = " .
597 $ilDB->quote($a_import_id, "text") . " " .
598 $where .
599 " ORDER BY create_date DESC";
600 $obj_set = $ilDB->query($q);
601
602 $items = array();
603 while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
604 // check, whether lm is not trashed
605 if (ilObject::_hasUntrashedReference($obj_rec["lm_id"])) {
606 $items[] = $obj_rec;
607 }
608 }
609
610 return $items;
611 }
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash

Referenced by updateInternalLinks().

+ Here is the caller graph for this function:

◆ _getIdForImportId()

static ilLMObject::_getIdForImportId ( string  $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

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

555 : int
556 {
557 global $DIC;
558
559 $ilDB = $DIC->database();
560
561 $q = "SELECT obj_id FROM lm_data WHERE import_id = " .
562 $ilDB->quote($a_import_id, "text") . " " .
563 " ORDER BY create_date DESC";
564 $obj_set = $ilDB->query($q);
565 while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
566 $lm_id = ilLMObject::_lookupContObjID($obj_rec["obj_id"]);
567
568 // link only in learning module, that is not trashed
569 $ref_ids = ilObject::_getAllReferences($lm_id); // will be 0 if import of lm is in progress (new import)
570 if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($lm_id) ||
572 return $obj_rec["obj_id"];
573 }
574 }
575
576 return 0;
577 }
static _lookupContObjID(int $a_id)
get learning module id for lm object
static isHelpLM(int $a_lm_id)
Check if LM is a help LM.
static _getAllReferences(int $id)
get all reference ids for object ID

References $DIC, $ilDB, 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:

◆ _getNodePresentationTitle()

static ilLMObject::_getNodePresentationTitle ( array  $a_node,
string  $a_mode = self::PAGE_TITLE,
bool  $a_include_numbers = false,
bool  $a_time_scheduled_activation = false,
bool  $a_force_content = false,
int  $a_lm_id = 0,
string  $a_lang = "-" 
)
static

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

1390 : string {
1391 if ($a_lang == "") {
1392 $a_lang = "-";
1393 }
1394
1395 if ($a_node["type"] == "st") {
1397 $a_node["child"],
1398 self::CHAPTER_TITLE,
1399 $a_include_numbers,
1400 $a_time_scheduled_activation,
1401 $a_force_content,
1402 $a_lm_id,
1403 $a_lang
1404 );
1405 } else {
1407 $a_node["child"],
1408 $a_mode,
1409 $a_include_numbers,
1410 $a_time_scheduled_activation,
1411 $a_force_content,
1412 $a_lm_id,
1413 $a_lang
1414 );
1415 }
1416 }
static _getPresentationTitle(int $a_pg_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static _getPresentationTitle(int $a_st_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)

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

+ Here is the caller graph for this function:

◆ _isPagePublic()

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

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

504 : bool {
505 global $DIC;
506
507 $ilDB = $DIC->database();
508 $ilLog = $DIC["ilLog"];
509
510 if (empty($a_node_id)) {
511 $message = 'ilLMObject::_isPagePublic(): Invalid parameter! $a_node_id is empty';
512 $ilLog->write($message, $ilLog->WARNING);
513 return false;
514 }
515
516 if ($a_check_public_mode === true) {
518
519 $q = "SELECT public_access_mode FROM content_object WHERE id = " .
520 $ilDB->quote($lm_id, "integer");
521 $r = $ilDB->query($q);
522 $row = $ilDB->fetchAssoc($r);
523
524 if ($row["public_access_mode"] == "complete") {
525 return true;
526 }
527 }
528
529 $q = "SELECT public_access FROM lm_data WHERE obj_id=" .
530 $ilDB->quote($a_node_id, "integer");
531 $r = $ilDB->query($q);
532 $row = $ilDB->fetchAssoc($r);
533
534 return ilUtil::yn2tf($row["public_access"]);
535 }
static yn2tf(string $a_yn)
$message
Definition: xapiexit.php:32

References $message.

Referenced by ilLMContentRendererGUI\determineStatus(), ilLMNavigationStatus\determineStatus(), ilLMNavigationStatus\getPredecessorPageId(), ilLMNavigationStatus\getSuccessorPageId(), ilLMTOCExplorerGUI\isNodeClickable(), ilLMPresentationGUI\showPrintView(), and ilLMPresentationGUI\showPrintViewSelection().

+ Here is the caller graph for this function:

◆ _lookup()

static ilLMObject::_lookup ( int  $a_obj_id,
string  $a_field 
)
staticprotected

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

242 : string
243 {
244 global $DIC;
245
246 $ilDB = $DIC->database();
247
248 if (isset(self::$data_records[$a_obj_id])) {
249 return self::$data_records[$a_obj_id][$a_field] ?? "";
250 }
251
252 $query = "SELECT " . $a_field . " FROM lm_data WHERE obj_id = " .
253 $ilDB->quote($a_obj_id, "integer");
254 $obj_set = $ilDB->query($query);
255 $obj_rec = $ilDB->fetchAssoc($obj_set);
256
257 return $obj_rec[$a_field] ?? "";
258 }

References $DIC, $ilDB, and $query.

Referenced by _lookupShortTitle(), and _lookupTitle().

+ Here is the caller graph for this function:

◆ _lookupContObjID()

static ilLMObject::_lookupContObjID ( int  $a_id)
static

get learning module id for lm object

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

690 : int
691 {
692 global $DIC;
693
694 $ilDB = $DIC->database();
695
696 if (isset(self::$data_records[$a_id])) {
697 return self::$data_records[$a_id]["lm_id"];
698 }
699
700 $query = "SELECT lm_id FROM lm_data WHERE obj_id = " .
701 $ilDB->quote($a_id, "integer");
702 $obj_set = $ilDB->query($query);
703 $obj_rec = $ilDB->fetchAssoc($obj_set);
704
705 return (int) ($obj_rec["lm_id"] ?? 0);
706 }

References $DIC, $ilDB, and $query.

Referenced by ilStartUpGUI\_checkGoto(), ilObjContentObjectAccess\_checkGoto(), _getIdForImportId(), ilStructureObject\_getPresentationTitle(), ilLMPageObjectGUI\_goto(), ilLMEditorGUI\checkRequestParameters(), ilLMNavigationStatus\determineStatus(), ilLinksTableGUI\fillRow(), ilLearningModuleImporter\finalProcessing(), ilLMPageObjectGUI\getLinkXML(), ilPageLinker\getLinkXML(), ilLearningModuleDataSet\importRecord(), ilLMEditShortTitlesGUI\save(), and updateInternalLinks().

+ Here is the caller graph for this function:

◆ _lookupNID()

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

lookup named identifier (ILIAS_NID)

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

109 : ?string
110 {
111 $md = new ilMD($a_lm_id, $a_lm_obj_id, $a_type);
112 $md_gen = $md->getGeneral();
113 if (is_object($md_gen)) {
114 foreach ($md_gen->getIdentifierIds() as $id) {
115 $md_id = $md_gen->getIdentifier($id);
116 if ($md_id->getCatalog() == "ILIAS_NID") {
117 return $md_id->getEntry();
118 }
119 }
120 }
121
122 return null;
123 }

References $id.

◆ _lookupShortTitle()

static ilLMObject::_lookupShortTitle ( int  $a_obj_id)
static

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

265 : string
266 {
267 return self::_lookup($a_obj_id, "short_title");
268 }
static _lookup(int $a_obj_id, string $a_field)

References _lookup().

+ Here is the call graph for this function:

◆ _lookupTitle()

◆ _lookupType()

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

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

270 : string
271 {
272 global $DIC;
273
274 $ilDB = $DIC->database();
275
276 if (isset(self::$data_records[$a_obj_id])) {
277 if ($a_lm_id == 0 || self::$data_records[$a_obj_id]["lm_id"] == $a_lm_id) {
278 return self::$data_records[$a_obj_id]["type"];
279 }
280 }
281
282 $and = "";
283 if ($a_lm_id) {
284 $and = ' AND lm_id = ' . $ilDB->quote($a_lm_id, 'integer');
285 }
286
287 $query = "SELECT type FROM lm_data WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") . $and;
288 $obj_set = $ilDB->query($query);
289 $obj_rec = $ilDB->fetchAssoc($obj_set);
290
291 return $obj_rec["type"] ?? "";
292 }

References $DIC, $ilDB, and $query.

Referenced by ilStructureObjectGUI\activatePages(), ilLMContentRendererGUI\determineStatus(), ilLMNavigationStatus\determineStatus(), ilObjLearningModuleSubItemListGUI\getHTML(), ilLMTOCExplorerGUI\getRootNode(), ilLMNavigationStatus\getSuccessorPageId(), ilPageObject\moveIntLinks(), ilObjContentObjectGUI\saveExportIds(), ilLMPresentationGUI\showPrintView(), uniqueTypesCheck(), updateInternalLinks(), and ilCourseObjectivesGUI\updateMaterialAssignment().

+ Here is the caller graph for this function:

◆ _writeImportId()

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

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

378 : void
379 {
380 global $DIC;
381
382 $ilDB = $DIC->database();
383
384 $q = "UPDATE lm_data " .
385 "SET " .
386 "import_id = " . $ilDB->quote($a_import_id, "text") . "," .
387 "last_update = " . $ilDB->now() . " " .
388 "WHERE obj_id = " . $ilDB->quote($a_id, "integer");
389
390 $ilDB->manipulate($q);
391 }

References $DIC, and $ilDB.

Referenced by ilQuestionPageParser\handlerEndTag().

+ Here is the caller graph for this function:

◆ _writePublicAccessStatus()

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

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

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

447 : void {
448 global $DIC;
449
450 $ilDB = $DIC->database();
451 $ilLog = $DIC["ilLog"];
452 $ilErr = $DIC["ilErr"];
453
454 if (!is_array($a_pages)) {
455 $a_pages = array(0);
456 }
457
458 if (empty($a_cont_obj_id)) {
459 $message = 'ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_cont_obj_id is empty';
460 $ilLog->write($message, $ilLog->WARNING);
461 $ilErr->raiseError($message, $ilErr->MESSAGE);
462 return;
463 }
464
465 // update structure entries: if at least one page of a chapter is public set chapter to public too
466 $lm_tree = new ilTree($a_cont_obj_id);
467 $lm_tree->setTableNames('lm_tree', 'lm_data');
468 $lm_tree->setTreeTablePK("lm_id");
469 $lm_tree->readRootId();
470
471 // get all st entries of cont_obj
472 $q = "SELECT obj_id FROM lm_data " .
473 "WHERE lm_id = " . $ilDB->quote($a_cont_obj_id, "integer") . " " .
474 "AND type = 'st'";
475 $r = $ilDB->query($q);
476
477 // add chapters with a public page to a_pages
478 while ($row = $ilDB->fetchAssoc($r)) {
479 $childs = $lm_tree->getChilds($row["obj_id"]);
480
481 foreach ($childs as $page) {
482 if ($page["type"] === "pg" and in_array($page["obj_id"], $a_pages)) {
483 $a_pages[] = $row["obj_id"];
484 break;
485 }
486 }
487 }
488
489 // update public access status of all pages of cont_obj
490 $q = "UPDATE lm_data SET " .
491 "public_access = CASE " .
492 "WHEN " . $ilDB->in("obj_id", $a_pages, false, "integer") . " " .
493 "THEN " . $ilDB->quote("y", "text") .
494 "ELSE " . $ilDB->quote("n", "text") .
495 "END " .
496 "WHERE lm_id = " . $ilDB->quote($a_cont_obj_id, "integer") . " " .
497 "AND " . $ilDB->in("type", array("pg", "st"), false, "text");
498 $ilDB->manipulate($q);
499 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ilErr
Definition: raiseError.php:17

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

+ Here is the caller graph for this function:

◆ _writeTitle()

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

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

295 : void
296 {
297 global $DIC;
298
299 $ilDB = $DIC->database();
300
301 $query = "UPDATE lm_data SET " .
302 " title = " . $ilDB->quote($a_title, "text") .
303 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
304 $ilDB->manipulate($query);
305 }

References $DIC, $ilDB, and $query.

Referenced by MDUpdateListener().

+ Here is the caller graph for this function:

◆ clipboardCopy()

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

Copy a set of chapters/pages into the clipboard.

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

814 : void {
815 global $DIC;
816
817 $ilUser = $DIC->user();
818
819 $tree = ilLMObject::getTree($a_cont_obj_id);
820
821 $ilUser->clipboardDeleteObjectsOfType("pg");
822 $ilUser->clipboardDeleteObjectsOfType("st");
823
824 // put them into the clipboard
825 $time = date("Y-m-d H:i:s", time());
826 $order = 0;
827 foreach ($a_ids as $id) {
828 $curnode = array();
829 if ($tree->isInTree($id)) {
830 $curnode = $tree->getNodeData($id);
831 $subnodes = $tree->getSubTree($curnode);
832 foreach ($subnodes as $subnode) {
833 if ($subnode["child"] != $id) {
834 $ilUser->addObjectToClipboard(
835 $subnode["child"],
836 $subnode["type"],
837 ilStr::subStr($subnode["title"], 0, 70),
838 $subnode["parent"],
839 $time,
840 $subnode["lft"]
841 );
842 }
843 }
844 }
845 $order = (($curnode["lft"] ?? 0) > 0)
846 ? $curnode["lft"]
847 : (int) ($order + 1);
848 $ilUser->addObjectToClipboard(
849 $id,
850 self::_lookupType($id),
851 ilStr::subStr(self::_lookupTitle($id), 0, 70),
852 0,
853 $time,
854 $order
855 );
856 }
857 }
static getTree(int $a_cont_obj_id)
Get learning module tree.
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Definition: class.ilStr.php:24
$ilUser
Definition: imgupload.php:34

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

+ Here is the caller graph for this function:

◆ clipboardCut()

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

Copy a set of chapters/pages into the clipboard.

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

773 : void {
774 $tree = ilLMObject::getTree($a_cont_obj_id);
775 $cut_ids = [];
776
777 if (!is_array($a_ids)) {
778 return;
779 } else {
780 // get all "top" ids, i.e. remove ids, that have a selected parent
781 foreach ($a_ids as $id) {
782 $path = $tree->getPathId($id);
783 $take = true;
784 foreach ($path as $path_id) {
785 if ($path_id != $id && in_array($path_id, $a_ids)) {
786 $take = false;
787 }
788 }
789 if ($take) {
790 $cut_ids[] = $id;
791 }
792 }
793 }
794
795 ilLMObject::clipboardCopy($a_cont_obj_id, $cut_ids);
796
797 // remove the objects from the tree
798 // note: we are getting chapters which are *not* in the tree
799 // we do not delete any pages/chapters here
800 foreach ($cut_ids as $id) {
801 $curnode = $tree->getNodeData($id);
802 if ($tree->isInTree($id)) {
803 $tree->deleteTree($curnode);
804 }
805 }
806 }
static clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
$path
Definition: ltiservices.php:32

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

+ Here is the caller graph for this function:

◆ create()

ilLMObject::create ( bool  $a_upload = false)

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

393 : void
394 {
396
397 // insert object data
398 $this->setId($ilDB->nextId("lm_data"));
399 $query = "INSERT INTO lm_data (obj_id, title, type, layout, lm_id, import_id, short_title, create_date) " .
400 "VALUES (" .
401 $ilDB->quote($this->getId(), "integer") . "," .
402 $ilDB->quote($this->getTitle(), "text") . "," .
403 $ilDB->quote($this->getType(), "text") . ", " .
404 $ilDB->quote($this->getLayout(), "text") . ", " .
405 $ilDB->quote($this->getLMId(), "integer") . "," .
406 $ilDB->quote($this->getImportId(), "text") . "," .
407 $ilDB->quote($this->getShortTitle(), "text") .
408 ", " . $ilDB->now() . ")";
409 $ilDB->manipulate($query);
410
411 // create history entry
413 $this->getId(),
414 "create",
415 [],
416 $this->content_object->getType() . ":" . $this->getType()
417 );
418
419 if (!$a_upload) {
420 $this->createMetaData();
421 }
422 }
static _createEntry(int $a_obj_id, string $a_action, array $a_info_params=[], string $a_obj_type="", string $a_user_comment="", bool $a_update_last=false)
Creates a new history entry for an object.
setId(int $a_id)
ilDBInterface $db
createMetaData()
create meta data entry

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

+ Here is the call graph for this function:

◆ createMetaData()

ilLMObject::createMetaData ( )

create meta data entry

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

129 : void
130 {
132
133 $md_creator = new ilMDCreator($this->getLMId(), $this->getId(), $this->getType());
134 $md_creator->setTitle($this->getTitle());
135 $md_creator->setTitleLanguage($ilUser->getPref('language'));
136 $md_creator->setDescription($this->getDescription());
137 $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
138 $md_creator->setKeywordLanguage($ilUser->getPref('language'));
139 $md_creator->setLanguage($ilUser->getPref('language'));
140 $md_creator->create();
141 }
ilObjUser $user

References $ilUser, $user, 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 ( bool  $a_delete_meta_data = true)

Reimplemented in ilLMPageObject, and ilStructureObject.

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

537 : void
538 {
540
541 $query = "DELETE FROM lm_data WHERE obj_id = " .
542 $ilDB->quote($this->getId(), "integer");
543 $ilDB->manipulate($query);
544
545 $this->deleteMetaData();
546 }
deleteMetaData()
delete meta data entry

References $ilDB, $query, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ deleteMetaData()

ilLMObject::deleteMetaData ( )

delete meta data entry

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

166 : void
167 {
168 // Delete meta data
169 $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
170 $md->deleteAll();
171 }

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

+ Here is the call graph for this function:

◆ existsExportID()

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

Does export ID exist in lm?

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

1349 : bool {
1350 return ilMDIdentifier::existsIdInRbacObject($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1351 }
static existsIdInRbacObject(int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)

◆ getContentObject()

ilLMObject::getContentObject ( )

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

344 {
346 }
ilObjLearningModule $content_object
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $content_object.

◆ getDescription()

ilLMObject::getDescription ( )

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

313 : string
314 {
315 return $this->description;
316 }
string $description

References $description.

Referenced by createMetaData().

+ Here is the caller graph for this function:

◆ getDuplicateExportIDs()

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

Get duplicate export IDs (count export ID usages)

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

1359 : array {
1360 $entries = ilMDIdentifier::_getEntriesForRbacObj($a_lm_id, $a_type);
1361 $res = array();
1362 foreach ($entries as $e) {
1363 if ($e["catalog"] == "ILIAS_NID") {
1364 if (ilLMObject::_exists($e["obj_id"])) {
1365 $res[trim($e["entry"])] = ($res[trim($e["entry"])] ?? 0) + 1;
1366 }
1367 }
1368 }
1369 return $res;
1370 }
static _exists(int $a_id)
checks wether a lm content object with specified id exists or not
static _getEntriesForRbacObj(int $a_rbac_id, string $a_obj_type="")
$res
Definition: ltiservices.php:69

Referenced by ilExportIDTableGUI\__construct().

+ Here is the caller graph for this function:

◆ getExportId()

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

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

1326 : string {
1327 // look for export id
1329 $a_lm_id,
1330 $a_lmobj_id,
1331 $a_type
1332 );
1333
1334 foreach ($entries as $e) {
1335 if ($e["catalog"] == "ILIAS_NID") {
1336 return $e["entry"];
1337 }
1338 }
1339 return "";
1340 }
static _getEntriesForObj(int $a_rbac_id, int $a_obj_id, string $a_obj_type)

References Vendor\Package\$e.

Referenced by ILIAS\LearningModule\Export\LMHtmlExport\exportHTMLPages(), ilExportIDTableGUI\fillRow(), and ilLMTOCExplorerGUI\getNodeHref().

+ Here is the caller graph for this function:

◆ getExportIDInfo()

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

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

1376 : array {
1377 $data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1378 return $data;
1379 }
static readIdData(int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)

◆ getId()

ilLMObject::getId ( )

Reimplemented in ilLMPageObject.

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

353 : int
354 {
355 return $this->id;
356 }

References $id.

Referenced by create(), createMetaData(), ilStructureObject\delete(), deleteMetaData(), MDUpdateListener(), update(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getImportId()

ilLMObject::getImportId ( )

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

358 : string
359 {
360 return $this->import_id;
361 }

References $import_id.

Referenced by create().

+ Here is the caller graph for this function:

◆ getLayout()

ilLMObject::getLayout ( )

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

373 : string
374 {
375 return $this->layout;
376 }

References $layout.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getLMId()

ilLMObject::getLMId ( )

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

333 : int
334 {
335 return $this->lm_id;
336 }

References $lm_id.

Referenced by ilStructureObject\__construct(), create(), createMetaData(), deleteMetaData(), MDUpdateListener(), update(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getObjectList()

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

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

639 : array {
640 global $DIC;
641
642 $ilDB = $DIC->database();
643
644 $type_str = ($type != "")
645 ? "AND type = " . $ilDB->quote($type, "text") . " "
646 : "";
647
648 $query = "SELECT * FROM lm_data " .
649 "WHERE lm_id= " . $ilDB->quote($lm_id, "integer") . " " .
650 $type_str . " " .
651 "ORDER BY title";
652 $obj_set = $ilDB->query($query);
653 $obj_list = array();
654 while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
655 $obj_list[] = array("obj_id" => $obj_rec["obj_id"],
656 "title" => $obj_rec["title"],
657 "import_id" => $obj_rec["import_id"],
658 "type" => $obj_rec["type"]);
659 }
660 return $obj_list;
661 }

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

+ Here is the caller graph for this function:

◆ getPagesOfChapter()

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

Get pages of chapter.

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

1232 : array {
1233 // update structure entries: if at least one page of a chapter is public set chapter to public too
1234 $lm_tree = new ilTree($a_lm_id);
1235 $lm_tree->setTableNames('lm_tree', 'lm_data');
1236 $lm_tree->setTreeTablePK("lm_id");
1237 $lm_tree->readRootId();
1238
1239 $childs = $lm_tree->getChildsByType($a_chap_id, "pg");
1240
1241 return $childs;
1242 }

Referenced by ilHelpGUI\showHelp().

+ Here is the caller graph for this function:

◆ getShortTitle()

ilLMObject::getShortTitle ( )

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

237 : string
238 {
239 return $this->short_title;
240 }
string $short_title

References $short_title.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getShortTitles()

static ilLMObject::getShortTitles ( int  $a_lm_id,
string  $a_lang = "-" 
)
static

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

1421 : array {
1422 global $DIC;
1423
1424 $db = $DIC->database();
1425
1426 $title_data = array();
1427 if ($a_lang == "-") {
1428 $set = $db->query("SELECT t.child, d.obj_id, d.title, d.short_title FROM lm_data d LEFT JOIN lm_tree t ON (d.obj_id = t.child) WHERE d.lm_id = " .
1429 $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1430 } else {
1431 $set = $db->query("SELECT t.child, d.obj_id, tr.title, tr.short_title, d.title default_title, d.short_title default_short_title FROM lm_data d " .
1432 " LEFT JOIN lm_tree t ON (d.obj_id = t.child) " .
1433 " LEFT JOIN lm_data_transl tr ON (tr.id = d.obj_id AND tr.lang=" . $db->quote($a_lang, "text") . ") WHERE d.lm_id = " .
1434 $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1435 }
1436 while ($rec = $db->fetchAssoc($set)) {
1437 $title_data[] = $rec;
1438 }
1439 return $title_data;
1440 }
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)

Referenced by ilLMEditShortTitlesTableGUI\__construct().

+ Here is the caller graph for this function:

◆ getTitle()

ilLMObject::getTitle ( )

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

227 : string
228 {
229 return $this->title;
230 }

References $title.

Referenced by create(), createMetaData(), update(), and updateMetaData().

+ Here is the caller graph for this function:

◆ getTree()

static ilLMObject::getTree ( int  $a_cont_obj_id)
static

Get learning module tree.

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

760 : ilLMTree {
761 $tree = new ilLMTree($a_cont_obj_id);
762 $tree->readRootId();
763
764 return $tree;
765 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ getType()

ilLMObject::getType ( )

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

323 : string
324 {
325 return $this->type;
326 }

References $type.

Referenced by create(), createMetaData(), deleteMetaData(), MDUpdateListener(), and updateMetaData().

+ Here is the caller graph for this function:

◆ lookupLayout()

static ilLMObject::lookupLayout ( int  $a_obj_id)
static

Lookup type.

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

1212 : string
1213 {
1214 global $DIC;
1215
1216 $ilDB = $DIC->database();
1217
1218 $query = "SELECT layout FROM lm_data WHERE obj_id = " .
1219 $ilDB->quote($a_obj_id, "integer");
1220 $obj_set = $ilDB->query($query);
1221 $obj_rec = $ilDB->fetchAssoc($obj_set);
1222
1223 return $obj_rec["layout"];
1224 }

References $DIC, $ilDB, and $query.

Referenced by ilLMPagesTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ MDUpdateListener()

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

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

73 : void
74 {
75 switch ($a_element) {
76 case 'General':
77
78 // Update Title and description
79 $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
80 $md_gen = $md->getGeneral();
81
82 ilLMObject::_writeTitle($this->getId(), $md_gen->getTitle());
83
84 foreach ($md_gen->getDescriptionIds() as $id) {
85 $md_des = $md_gen->getDescription($id);
86 // ilLMObject::_writeDescription($this->getId(),$md_des->getDescription());
87 break;
88 }
89 break;
90
91 case 'Educational':
92 $obj_lp = ilObjectLP::getInstance($this->getLMId());
93 if (in_array(
94 $obj_lp->getCurrentMode(),
96 )) {
98 }
99 break;
100
101 default:
102 }
103 }
static _writeTitle(int $a_obj_id, string $a_title)
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
static getInstance(int $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:

◆ preloadDataByLM()

static ilLMObject::preloadDataByLM ( int  $a_lm_id)
static

Preload data records by lm.

Returns
int number of preloaded records

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

206 : int
207 {
208 global $DIC;
209
210 $ilDB = $DIC->database();
211
212 $set = $ilDB->query(
213 "SELECT * FROM lm_data " .
214 " WHERE lm_id = " . $ilDB->quote($a_lm_id, "integer")
215 );
216 while ($rec = $ilDB->fetchAssoc($set)) {
217 self::$data_records[$rec["obj_id"]] = $rec;
218 }
219 return count(self::$data_records);
220 }

References $DIC, and $ilDB.

Referenced by ilLMExplorerGUI\__construct().

+ Here is the caller graph for this function:

◆ putInTree()

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

put this object into content object tree

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

715 : void {
716 global $DIC;
717
718 $ilLog = $DIC["ilLog"];
719
720 $tree = new ilLMTree($a_obj->getContentObject()->getId());
721
722 // determine parent
723 $parent_id = ($a_parent_id != 0)
724 ? $a_parent_id
725 : $tree->getRootId();
726
727 // determine target
728 if ($a_target_node_id != 0) {
729 $target = $a_target_node_id;
730 } else {
731 // determine last child that serves as predecessor
732 if ($a_obj->getType() == "st") {
733 $s_types = array("st", "pg");
734 $childs = $tree->getChildsByTypeFilter($parent_id, $s_types);
735 } else {
736 $s_types = "pg";
737 $childs = $tree->getChildsByType($parent_id, $s_types);
738 }
739
740 if (count($childs) == 0) {
741 $target = ilTree::POS_FIRST_NODE;
742 } else {
743 $target = $childs[count($childs) - 1]["obj_id"];
744 }
745 }
746
747 if ($tree->isInTree($parent_id) && !$tree->isInTree($a_obj->getId())) {
748 $ilLog->write("LMObject::putInTree: insertNode, ID: " . $a_obj->getId() .
749 "Parent ID: " . $parent_id . ", Target: " . $target);
750
751 $tree->insertNode($a_obj->getId(), $parent_id, $target);
752 }
753 }
const POS_FIRST_NODE

Referenced by ilLearningModuleDataSet\importRecord(), ilObjContentObjectGUI\insertChapter(), and ilStructureObjectGUI\insertPage().

+ Here is the caller graph for this function:

◆ read()

ilLMObject::read ( )

Reimplemented in ilLMPageObject.

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

183 : void
184 {
186
187 if (!isset($this->data_record)) {
188 $query = "SELECT * FROM lm_data WHERE obj_id = " .
189 $ilDB->quote($this->id, "integer");
190 $obj_set = $ilDB->query($query);
191 $this->data_record = $ilDB->fetchAssoc($obj_set);
192 }
193
194 $this->type = $this->data_record["type"];
195 $this->setImportId((string) $this->data_record["import_id"]);
196 $this->setTitle((string) $this->data_record["title"]);
197 $this->setShortTitle((string) $this->data_record["short_title"]);
198 $this->setLayout((string) $this->data_record["layout"]);
199 }
setShortTitle(string $a_title)
setImportId(string $a_id)
setLayout(string $a_val)
setTitle(string $a_title)

References $db, $ilDB, $query, setImportId(), setLayout(), setShortTitle(), 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 ( int  $a_lm_id,
int  $a_lmobj_id,
string  $a_exp_id,
string  $a_type = "pg" 
)
static

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

1279 : void {
1281 $a_lm_id,
1282 $a_lmobj_id,
1283 $a_type
1284 );
1285 if (trim($a_exp_id) == "") {
1286 // delete export ids, if existing
1287
1288 foreach ($entries as $id => $e) {
1289 if ($e["catalog"] == "ILIAS_NID") {
1290 $identifier = new ilMDIdentifier();
1291 $identifier->setMetaId($id);
1292 $identifier->delete();
1293 }
1294 }
1295 } else {
1296 // update existing entry
1297
1298 $updated = false;
1299 foreach ($entries as $id => $e) {
1300 if ($e["catalog"] == "ILIAS_NID") {
1301 $identifier = new ilMDIdentifier();
1302 $identifier->setMetaId($id);
1303 $identifier->read();
1304 $identifier->setEntry($a_exp_id);
1305 $identifier->update();
1306 $updated = true;
1307 }
1308 }
1309
1310 // nothing updated? create a new one
1311 if (!$updated) {
1312 $md = new ilMD($a_lm_id, $a_lmobj_id, $a_type);
1313 $md_gen = $md->getGeneral();
1314 $identifier = $md_gen->addIdentifier();
1315 $identifier->setEntry($a_exp_id);
1316 $identifier->setCatalog("ILIAS_NID");
1317 $identifier->save();
1318 }
1319 }
1320 }
int $updated
Timestamp for when the object was last updated.
Definition: System.php:158

References Vendor\Package\$e, and $id.

Referenced by ilObjContentObjectGUI\saveExportIds().

+ Here is the caller graph for this function:

◆ saveTitles()

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

Save titles for lm objects.

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

960 : void {
961 if ($a_lang == "") {
962 $a_lang = "-";
963 }
964 if (is_array($a_titles)) {
965 foreach ($a_titles as $id => $title) {
966 // see #20375
968 if ($a_lang == "-") {
969 $lmobj = ilLMObjectFactory::getInstance($a_lm, $id, false);
970 if (is_object($lmobj)) {
971 // Update Title and description
972 $md = new ilMD($a_lm->getId(), $id, $lmobj->getType());
973 $md_gen = $md->getGeneral();
974 if (is_object($md_gen)) { // see bug #0015843
975 $md_gen->setTitle($title);
976 $md_gen->update();
977 $md->update();
978 }
980 }
981 } else {
982 $lmobjtrans = new ilLMObjTranslation($id, $a_lang);
983 $lmobjtrans->setTitle($title);
984 $lmobjtrans->save();
985 }
986 }
987 }
988 }
static removeProhibitedCharacters(string $a_text)
Remove prohibited characters see #19159.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the caller graph for this function:

◆ setContentObject()

ilLMObject::setContentObject ( ilObjLearningModule  $a_content_obj)

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

338 : void
339 {
340 $this->content_object = $a_content_obj;
341 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setDataRecord()

ilLMObject::setDataRecord ( array  $a_record)

this method should only be called by class ilLMObjectFactory

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

178 : void
179 {
180 $this->data_record = $a_record;
181 }

◆ setDescription()

ilLMObject::setDescription ( string  $a_description)

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

308 : void
309 {
310 $this->description = $a_description;
311 }

◆ setId()

ilLMObject::setId ( int  $a_id)

Reimplemented in ilLMPageObject.

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

348 : void
349 {
350 $this->id = $a_id;
351 }

Referenced by create().

+ Here is the caller graph for this function:

◆ setImportId()

ilLMObject::setImportId ( string  $a_id)

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

363 : void
364 {
365 $this->import_id = $a_id;
366 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLayout()

ilLMObject::setLayout ( string  $a_val)

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

368 : void
369 {
370 $this->layout = $a_val;
371 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLMId()

ilLMObject::setLMId ( int  $a_lm_id)

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

328 : void
329 {
330 $this->lm_id = $a_lm_id;
331 }

Referenced by __construct(), and ilLMPageObjectGUI\setLMPageObject().

+ Here is the caller graph for this function:

◆ setShortTitle()

ilLMObject::setShortTitle ( string  $a_title)

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

232 : void
233 {
234 $this->short_title = $a_title;
235 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilLMObject::setTitle ( string  $a_title)

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

222 : void
223 {
224 $this->title = $a_title;
225 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilLMObject::setType ( string  $a_type)

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

318 : void
319 {
320 $this->type = $a_type;
321 }

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

+ Here is the caller graph for this function:

◆ uniqueTypesCheck()

static ilLMObject::uniqueTypesCheck ( array  $a_items)
static

Check for unique types (all pages or all chapters)

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

1158 : bool
1159 {
1160 $types = array();
1161 if (is_array($a_items)) {
1162 foreach ($a_items as $item) {
1164 $types[$type] = $type;
1165 }
1166 }
1167
1168 if (count($types) > 1) {
1169 return false;
1170 }
1171 return true;
1172 }
static _lookupType(int $a_obj_id, int $a_lm_id=0)

References $type, and _lookupType().

+ Here is the call graph for this function:

◆ update()

ilLMObject::update ( )

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

424 : void
425 {
427
428 $this->updateMetaData();
429
430 $query = "UPDATE lm_data SET " .
431 " lm_id = " . $ilDB->quote($this->getLMId(), "integer") .
432 " ,title = " . $ilDB->quote($this->getTitle(), "text") .
433 " ,short_title = " . $ilDB->quote($this->getShortTitle(), "text") .
434 " ,layout = " . $ilDB->quote($this->getLayout(), "text") .
435 " WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
436
437 $ilDB->manipulate($query);
438 }
updateMetaData()
update meta data entry

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

+ Here is the call graph for this function:

◆ updateInternalLinks()

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

Update internal links, after multiple pages have been copied.

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

996 : void {
997 $all_fixes = array();
998 foreach ($a_copied_nodes as $original_id => $copied_id) {
999 $copied_type = ilLMObject::_lookupType($copied_id);
1000 $copy_lm = ilLMObject::_lookupContObjID($copied_id);
1001
1002 if ($copied_type == "pg") {
1003 foreach (ilPageObject::lookupTranslations($a_parent_type, $copied_id) as $l) {
1004 //
1005 // 1. Outgoing links from the copied page.
1006 //
1007 //$targets = ilInternalLink::_getTargetsOfSource($a_parent_type.":pg", $copied_id);
1008 $tpg = new ilLMPage($copied_id, 0, $l);
1009 $tpg->buildDom();
1010 $il = $tpg->getInternalLinks();
1011 $targets = array();
1012 foreach ($il as $l2) {
1013 $targets[] = array("type" => ilInternalLink::_extractTypeOfTarget($l2["Target"]),
1014 "id" => (int) ilInternalLink::_extractObjIdOfTarget($l2["Target"]),
1015 "inst" => (int) ilInternalLink::_extractInstOfTarget($l2["Target"]));
1016 }
1017 $fix = array();
1018 foreach ($targets as $target) {
1019 if (($target["inst"] == 0 || $target["inst"] = IL_INST_ID) &&
1020 ($target["type"] == "pg" || $target["type"] == "st")) {
1021 // first check, whether target is also within the copied set
1022 if (($a_copied_nodes[$target["id"]] ?? 0) > 0) {
1023 $fix[$target["id"]] = $a_copied_nodes[$target["id"]];
1024 } else {
1025 // now check, if a copy if the target is already in the same lm
1026
1027 // only if target is not already in the same lm!
1028 $trg_lm = ilLMObject::_lookupContObjID($target["id"]);
1029 if ($trg_lm != $copy_lm) {
1030 $lm_data = ilLMObject::_getAllObjectsForImportId("il__" . $target["type"] . "_" . $target["id"]);
1031 $found = false;
1032
1033 foreach ($lm_data as $item) {
1034 if (!$found && ($item["lm_id"] == $copy_lm)) {
1035 $fix[$target["id"]] = $item["obj_id"];
1036 $found = true;
1037 }
1038 }
1039 }
1040 }
1041 }
1042 }
1043
1044 // outgoing links to be fixed
1045 if (count($fix) > 0) {
1046 //echo "<br>--".$copied_id;
1047 //var_dump($fix);
1048 $t = ilObject::_lookupType($copy_lm);
1049 if (isset($all_fixes[$t . ":" . $copied_id])) {
1050 $all_fixes[$t . ":" . $copied_id] += $fix;
1051 } else {
1052 $all_fixes[$t . ":" . $copied_id] = $fix;
1053 }
1054 }
1055 }
1056 }
1057
1058 if ($copied_type == "pg" ||
1059 $copied_type == "st") {
1060
1061 //
1062 // 2. Incoming links to the original pages
1063 //
1064 // A->B A2 (A+B currently copied)
1065 // A->C B2
1066 // B->A
1067 // C->A C2->A (C already copied)
1068 $original_lm = ilLMObject::_lookupContObjID($original_id);
1069 $original_type = ilObject::_lookupType($original_lm);
1070
1071 if ($original_lm != $copy_lm) {
1072
1073 // This gets sources that link to A+B (so we have C here)
1074 // (this also does already the trick when instance map areas are given in C)
1075 // int_link, where target_type, target_id, target_inst -> ok
1077 $copied_type,
1078 $original_id,
1079 0
1080 );
1081
1082 // mobs linking to $original_id
1083 // map_area, where link_type, target -> ok
1084 $mobs = ilMapArea::_getMobsForTarget("int", "il__" . $copied_type .
1085 "_" . $original_id);
1086
1087 // pages using these mobs
1088 foreach ($mobs as $mob) {
1089 // mob_usage, where id -> ok
1090 // mep_item, where foreign_id, type -> ok
1091 // mep_tree, where child -> already existed
1092 // il_news_item, where mob_id -> ok
1093 // map_area, where link_type, target -> aready existed
1094 // media_item, where id -> already existed
1095 // personal_clipboard, where item_id, type -> ok
1096 $usages = ilObjMediaObject::lookupUsages($mob);
1097 foreach ($usages as $usage) {
1098 if ($usage["type"] == "lm:pg" | $usage["type"] == "lm:st") {
1099 $sources[] = $usage;
1100 }
1101 }
1102 }
1103 $fix = array();
1104 foreach ($sources as $source) {
1105 $stype = explode(":", $source["type"]);
1106 $source_type = $stype[1] ?? "";
1107
1108 if ($source_type == "pg" || $source_type == "st") {
1109 // first of all: source must be in original lm
1110 $src_lm = ilLMObject::_lookupContObjID($source["id"]);
1111
1112 if ($src_lm == $original_lm) {
1113 // check, if a copy if the source is already in the same lm
1114 // now we look for the latest copy of C in LM2
1116 "il__" . $source_type . "_" . $source["id"],
1117 $copy_lm
1118 );
1119 $found = false;
1120 foreach ($lm_data as $item) {
1121 if (!$found) {
1122 $fix[$item["obj_id"]][$original_id] = $copied_id;
1123 $found = true;
1124 }
1125 }
1126 }
1127 }
1128 }
1129 // outgoing links to be fixed
1130 if (count($fix) > 0) {
1131 foreach ($fix as $page_id => $fix_array) {
1132 $t = ilObject::_lookupType($copy_lm);
1133 if (isset($all_fixes[$t . ":" . $page_id])) {
1134 $all_fixes[$t . ":" . $page_id] += $fix_array;
1135 } else {
1136 $all_fixes[$t . ":" . $page_id] = $fix_array;
1137 }
1138 }
1139 }
1140 }
1141 }
1142 }
1143
1144 foreach ($all_fixes as $pg => $fixes) {
1145 $pg = explode(":", $pg);
1146 foreach (ilPageObject::lookupTranslations($pg[0], $pg[1]) as $l) {
1147 $page = ilPageObjectFactory::getInstance($pg[0], $pg[1], 0, $l);
1148 if ($page->moveIntLinks($fixes)) {
1149 $page->update(true, true);
1150 }
1151 }
1152 }
1153 }
static _getAllObjectsForImportId(string $a_import_id, int $a_in_lm=0)
Get all items for an import ID.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getMobsForTarget(string $a_type, string $a_target)
Get areas for a certain target.
static lookupUsages(int $a_id, bool $a_include_history=true)
Lookup usages of media object.
static _lookupType(int $id, bool $reference=false)
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.
const IL_INST_ID
Definition: constants.php:40
$mobs
Definition: imgupload.php:70
$source
Definition: metadata.php:93

References $mobs, $source, ilInternalLink\_extractInstOfTarget(), ilInternalLink\_extractObjIdOfTarget(), ilInternalLink\_extractTypeOfTarget(), _getAllObjectsForImportId(), ilMapArea\_getMobsForTarget(), ilInternalLink\_getSourcesOfTarget(), _lookupContObjID(), _lookupType(), ilObject\_lookupType(), IL_INST_ID, ilPageObject\lookupTranslations(), and ilObjMediaObject\lookupUsages().

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

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

146 : void
147 {
148 $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
149 $md_gen = $md->getGeneral();
150 $md_gen->setTitle($this->getTitle());
151
152 // sets first description (maybe not appropriate)
153 $md_des_ids = $md_gen->getDescriptionIds();
154 if (count($md_des_ids) > 0) {
155 $md_des = $md_gen->getDescription($md_des_ids[0]);
156 // $md_des->setDescription($this->getDescription());
157 $md_des->update();
158 }
159 $md_gen->update();
160 }

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 ( int  $a_obj_id,
string  $a_layout,
?ilObjLearningModule  $a_lm = null 
)
static

Write layout setting.

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

1181 : void {
1182 global $DIC;
1183
1184 $ilDB = $DIC->database();
1185
1186 $t = ilLMObject::_lookupType($a_obj_id);
1187
1188 if ($t == "pg") {
1189 $query = "UPDATE lm_data SET " .
1190 " layout = " . $ilDB->quote($a_layout, "text") .
1191 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
1192 $ilDB->manipulate($query);
1193 } elseif ($t == "st" && is_object($a_lm)) {
1194 $node = $a_lm->getLMTree()->getNodeData($a_obj_id);
1195 $child_nodes = $a_lm->getLMTree()->getSubTree($node);
1196 if (is_array($child_nodes) && count($child_nodes) > 0) {
1197 foreach ($child_nodes as $c) {
1198 if ($c["type"] == "pg") {
1199 $query = "UPDATE lm_data SET " .
1200 " layout = " . $ilDB->quote($a_layout, "text") .
1201 " WHERE obj_id = " . $ilDB->quote($c["child"], "integer");
1202 $ilDB->manipulate($query);
1203 }
1204 }
1205 }
1206 }
1207 }
$c
Definition: cli.php:38

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

+ Here is the caller graph for this function:

◆ writeShortTitle()

static ilLMObject::writeShortTitle ( int  $a_id,
string  $a_short_title,
string  $a_lang = "-" 
)
static

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

1446 : void {
1447 global $DIC;
1448
1449 $db = $DIC->database();
1450
1451 if ($a_lang != "-" && $a_lang != "") {
1452 $trans = new ilLMObjTranslation($a_id, $a_lang);
1453 $trans->setShortTitle($a_short_title);
1454 $trans->save();
1455 } else {
1456 $db->manipulate(
1457 "UPDATE lm_data SET " .
1458 " short_title = " . $db->quote($a_short_title, "text") .
1459 " WHERE obj_id = " . $db->quote($a_id, "integer")
1460 );
1461 }
1462 }
manipulate(string $query)
Run a (write) Query on the database.

Referenced by ilLMEditShortTitlesGUI\save().

+ Here is the caller graph for this function:

Field Documentation

◆ $active

bool ilLMObject::$active = true

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

◆ $content_object

ilObjLearningModule ilLMObject::$content_object

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

Referenced by getContentObject().

◆ $data_record

array ilLMObject::$data_record

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

◆ $data_records

ilLMObject::$data_records = array()
staticprotected

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

◆ $db

ilDBInterface ilLMObject::$db
protected

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

Referenced by create(), read(), and update().

◆ $description

string ilLMObject::$description = ""

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

Referenced by getDescription().

◆ $id

int ilLMObject::$id = 0

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

Referenced by _lookupNID(), getId(), and MDUpdateListener().

◆ $import_id

string ilLMObject::$import_id = ""
protected

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

Referenced by getImportId().

◆ $layout

string ilLMObject::$layout = ""
protected

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

Referenced by getLayout().

◆ $lm_id

int ilLMObject::$lm_id = 0

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

Referenced by getLMId().

◆ $short_title

string ilLMObject::$short_title = ""

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

Referenced by getShortTitle().

◆ $title

string ilLMObject::$title = ""

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

Referenced by getTitle().

◆ $type

string ilLMObject::$type = ""

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

Referenced by getType().

◆ $user

ilObjUser ilLMObject::$user
protected

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

Referenced by createMetaData().

◆ CHAPTER_TITLE

◆ NO_HEADER

const ilLMObject::NO_HEADER = "none"

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

◆ PAGE_TITLE


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