ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilLMObject Class Reference

Class ilLMObject. More...

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

Public Member Functions

 __construct ($a_content_obj, $a_id=0)
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 setDataRecord ($a_record)
 this method should only be called by class ilLMObjectFactory More...
 
 read ()
 
 setTitle ($a_title)
 set title of lm object More...
 
 getTitle ()
 get title of lm object More...
 
 setShortTitle ($a_title)
 set short title of lm object More...
 
 getShortTitle ()
 get short title of lm object More...
 
 setDescription ($a_description)
 
 getDescription ()
 
 setType ($a_type)
 
 getType ()
 
 setLMId ($a_lm_id)
 
 getLMId ()
 
 setContentObject (&$a_content_obj)
 
getContentObject ()
 
 setId ($a_id)
 
 getId ()
 
 getImportId ()
 
 setImportId ($a_id)
 
 setLayout ($a_val)
 Set layout. More...
 
 getLayout ()
 Get layout. More...
 
 create ($a_upload=false)
 
 update ()
 update complete object More...
 
 delete ($a_delete_meta_data=true)
 delete lm object data More...
 
 existsExportID ($a_lm_id, $a_exp_id, $a_type="pg")
 Does export ID exist in lm? More...
 
 getExportIDInfo ($a_lm_id, $a_exp_id, $a_type="pg")
 Does export ID exist in lm? More...
 

Static Public Member Functions

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

Data Fields

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

Static Protected Member Functions

static _lookup ($a_obj_id, $a_field)
 Lookup title. More...
 

Protected Attributes

 $user
 
 $db
 

Static Protected Attributes

static $data_records = array()
 

Detailed Description

Class ilLMObject.

Base class for ilStructureObjects and ilPageObjects (see ILIAS DTD)

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, read(), setContentObject(), setLMId(), and user().

45  {
46  global $DIC;
47  $this->user = $DIC->user();
48 
49  $this->db = $DIC->database();
50 
51  $this->id = $a_id;
52  $this->setContentObject($a_content_obj);
53  $this->setLMId($a_content_obj->getId());
54  if ($a_id != 0) {
55  $this->read();
56  }
57  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
setContentObject(&$a_content_obj)
setLMId($a_lm_id)
+ Here is the call graph for this function:

Member Function Documentation

◆ _deleteAllObjectData()

static ilLMObject::_deleteAllObjectData ( $a_cobj)
static

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

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

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

Referenced by ilObjContentObject\delete().

772  {
773  global $DIC;
774 
775  $ilDB = $DIC->database();
776 
777  $query = "SELECT * FROM lm_data " .
778  "WHERE lm_id= " . $ilDB->quote($a_cobj->getId(), "integer");
779  $obj_set = $ilDB->query($query);
780 
781  require_once("./Modules/LearningModule/classes/class.ilLMObjectFactory.php");
782  while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
783  $lm_obj = ilLMObjectFactory::getInstance($a_cobj, $obj_rec["obj_id"], false);
784 
785  if (is_object($lm_obj)) {
786  $lm_obj->delete(true);
787  }
788  }
789 
790  return true;
791  }
global $DIC
Definition: saml.php:7
static getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _exists()

static ilLMObject::_exists (   $a_id)
static

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

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

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

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

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

719  {
720  global $DIC;
721 
722  $ilDB = $DIC->database();
723 
724  include_once("./Services/Link/classes/class.ilInternalLink.php");
725  if (is_int(strpos($a_id, "_"))) {
727  }
728 
729  $q = "SELECT * FROM lm_data WHERE obj_id = " .
730  $ilDB->quote($a_id, "integer");
731  $obj_set = $ilDB->query($q);
732  if ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
733  return true;
734  } else {
735  return false;
736  }
737  }
global $DIC
Definition: saml.php:7
global $ilDB
+ 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

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

References $a_type, $DIC, $ilDB, and array.

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

1365  {
1366  global $DIC;
1367 
1368  $ilDB = $DIC->database();
1369 
1370  $and = ($a_type != "")
1371  ? " AND type = " . $ilDB->quote($a_type, "text")
1372  : "";
1373 
1374  $set = $ilDB->query("SELECT obj_id FROM lm_data " .
1375  " WHERE lm_id = " . $ilDB->quote($a_lm_id, "integer") . $and);
1376  $obj_ids = array();
1377  while ($rec = $ilDB->fetchAssoc($set)) {
1378  $obj_ids[] = $rec["obj_id"];
1379  }
1380 
1381  return $obj_ids;
1382  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getAllObjectsForImportId()

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

Get all items for an import ID.

(only for items notnot in trash)

Parameters
int$a_import_idimport id
Returns
int id

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

References $DIC, $ilDB, ilObject\_hasUntrashedReference(), and array.

Referenced by updateInternalLinks().

685  {
686  global $DIC;
687 
688  $ilDB = $DIC->database();
689 
690  $where = ($a_in_lm > 0)
691  ? " AND lm_id = " . $ilDB->quote($a_in_lm, "integer") . " "
692  : "";
693 
694  $q = "SELECT * FROM lm_data WHERE import_id = " .
695  $ilDB->quote($a_import_id, "text") . " " .
696  $where .
697  " ORDER BY create_date DESC";
698  $obj_set = $ilDB->query($q);
699 
700  $items = array();
701  while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
702  // check, whether lm is not trashed
703  if (ilObject::_hasUntrashedReference($obj_rec["lm_id"])) {
704  $items[] = $obj_rec;
705  }
706  }
707 
708  return $items;
709  }
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIdForImportId()

static ilLMObject::_getIdForImportId (   $a_import_id)
static

get current object id for import id (static)

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

Parameters
int$a_import_idimport id
Returns
int id

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

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

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

651  {
652  global $DIC;
653 
654  $ilDB = $DIC->database();
655 
656  $q = "SELECT obj_id FROM lm_data WHERE import_id = " .
657  $ilDB->quote($a_import_id, "text") . " " .
658  " ORDER BY create_date DESC";
659  $obj_set = $ilDB->query($q);
660  while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
661  $lm_id = ilLMObject::_lookupContObjID($obj_rec["obj_id"]);
662 
663  // link only in learning module, that is not trashed
664  include_once("./Services/Help/classes/class.ilObjHelpSettings.php");
665  $ref_ids = ilObject::_getAllReferences($lm_id); // will be 0 if import of lm is in progress (new import)
666  if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($lm_id) ||
668  return $obj_rec["obj_id"];
669  }
670  }
671 
672  return 0;
673  }
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
global $DIC
Definition: saml.php:7
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static isHelpLM($a_lm_id)
Check if LM is a help LM.
static _getAllReferences($a_id)
get all reference ids of object
global $ilDB
+ 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

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

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

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

1531  {
1532  if ($a_lang == "") {
1533  $a_lang = "-";
1534  }
1535 
1536  if ($a_node["type"] == "st") {
1537  include_once './Modules/LearningModule/classes/class.ilStructureObject.php';
1539  $a_node["child"],
1541  $a_include_numbers,
1542  $a_time_scheduled_activation,
1543  $a_force_content,
1544  $a_lm_id,
1545  $a_lang
1546  );
1547  } else {
1548  include_once './Modules/LearningModule/classes/class.ilLMPageObject.php';
1550  $a_node["child"],
1551  $a_mode,
1552  $a_include_numbers,
1553  $a_time_scheduled_activation,
1554  $a_force_content,
1555  $a_lm_id,
1556  $a_lang
1557  );
1558  }
1559  }
static _getPresentationTitle( $a_st_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
get presentation title
static _getPresentationTitle( $a_pg_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
const IL_CHAPTER_TITLE
+ 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 591 of file class.ilLMObject.php.

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

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

592  {
593  global $DIC;
594 
595  $ilDB = $DIC->database();
596  $ilLog = $DIC["ilLog"];
597 
598  if (empty($a_node_id)) {
599  $message = sprintf('ilLMObject::_isPagePublic(): Invalid parameter! $a_node_id is empty');
600  $ilLog->write($message, $ilLog->WARNING);
601  return false;
602  }
603 
604  if ($a_check_public_mode === true) {
605  $lm_id = ilLMObject::_lookupContObjId($a_node_id);
606 
607  $q = "SELECT public_access_mode FROM content_object WHERE id = " .
608  $ilDB->quote($lm_id, "integer");
609  $r = $ilDB->query($q);
610  $row = $ilDB->fetchAssoc($r);
611 
612  if ($row["public_access_mode"] == "complete") {
613  return true;
614  }
615  }
616 
617  $q = "SELECT public_access FROM lm_data WHERE obj_id=" .
618  $ilDB->quote($a_node_id, "integer");
619  $r = $ilDB->query($q);
620  $row = $ilDB->fetchAssoc($r);
621 
622  return ilUtil::yn2tf($row["public_access"]);
623  }
global $DIC
Definition: saml.php:7
$r
Definition: example_031.php:79
catch(Exception $e) $message
global $ilDB
static yn2tf($a_yn)
convert "y"/"n" to true/false
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookup()

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

Lookup title.

Parameters
intlm object id

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

References $DIC, $ilDB, and $query.

286  {
287  global $DIC;
288 
289  $ilDB = $DIC->database();
290 
291  if (isset(self::$data_records[$a_obj_id])) {
292  return self::$data_records[$a_obj_id][$a_field];
293  }
294 
295  $query = "SELECT " . $a_field . " FROM lm_data WHERE obj_id = " .
296  $ilDB->quote($a_obj_id, "integer");
297  $obj_set = $ilDB->query($query);
298  $obj_rec = $ilDB->fetchAssoc($obj_set);
299 
300  return $obj_rec[$a_field];
301  }
global $DIC
Definition: saml.php:7
$query
global $ilDB

◆ _lookupContObjID()

static ilLMObject::_lookupContObjID (   $a_id)
static

get learning module / digibook id for lm object

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

References $DIC, $ilDB, and $query.

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

797  {
798  global $DIC;
799 
800  $ilDB = $DIC->database();
801 
802  if (isset(self::$data_records[$a_id])) {
803  return self::$data_records[$a_id]["lm_id"];
804  }
805 
806  $query = "SELECT lm_id FROM lm_data WHERE obj_id = " .
807  $ilDB->quote($a_id, "integer");
808  $obj_set = $ilDB->query($query);
809  $obj_rec = $ilDB->fetchAssoc($obj_set);
810 
811  return $obj_rec["lm_id"];
812  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _lookupNID()

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

lookup named identifier (ILIAS_NID)

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

References $a_type, and $id.

113  {
114  include_once 'Services/MetaData/classes/class.ilMD.php';
115  //echo "-".$a_lm_id."-".$a_lm_obj_id."-".$a_type."-";
116  $md = new ilMD($a_lm_id, $a_lm_obj_id, $a_type);
117  $md_gen = $md->getGeneral();
118  if (is_object($md_gen)) {
119  foreach ($md_gen->getIdentifierIds() as $id) {
120  $md_id = $md_gen->getIdentifier($id);
121  if ($md_id->getCatalog() == "ILIAS_NID") {
122  return $md_id->getEntry();
123  }
124  }
125  }
126 
127  return false;
128  }
$a_type
Definition: workflow.php:92

◆ _lookupShortTitle()

static ilLMObject::_lookupShortTitle (   $a_obj_id)
static

Lookup short title.

Parameters
int$a_obj_idobject id
Returns
string

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

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

321  {
322  return self::_lookup($a_obj_id, "short_title");
323  }
+ Here is the caller graph for this function:

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

References $DIC, $ilDB, and $query.

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

332  {
333  global $DIC;
334 
335  $ilDB = $DIC->database();
336 
337  if (isset(self::$data_records[$a_obj_id])) {
338  if ($a_lm_id == 0 || self::$data_records[$a_obj_id]["lm_id"] == $a_lm_id) {
339  return self::$data_records[$a_obj_id]["type"];
340  }
341  }
342 
343  if ($a_lm_id) {
344  $and = ' AND lm_id = ' . $ilDB->quote($a_lm_id, 'integer');
345  }
346 
347  $query = "SELECT type FROM lm_data WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") . $and;
348  $obj_set = $ilDB->query($query);
349  $obj_rec = $ilDB->fetchAssoc($obj_set);
350 
351  return $obj_rec["type"];
352  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the caller graph for this function:

◆ _writeImportId()

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

write import id to db (static)

Parameters
int$a_idlm object id
string$a_import_idimport id public

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

References $DIC, and $ilDB.

Referenced by ilContObjParser\handlerEndTag().

456  {
457  global $DIC;
458 
459  $ilDB = $DIC->database();
460 
461  $q = "UPDATE lm_data " .
462  "SET " .
463  "import_id = " . $ilDB->quote($a_import_id, "text") . "," .
464  "last_update = " . $ilDB->now() . " " .
465  "WHERE obj_id = " . $ilDB->quote($a_id, "integer");
466 
467  $ilDB->manipulate($q);
468  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ _writePublicAccessStatus()

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

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

public

Parameters
arraypage ids
integercontent object id
Returns
of the jedi

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

References $DIC, $ilDB, $ilErr, $ilLog, $message, $r, $row, and array.

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

531  {
532  global $DIC;
533 
534  $ilDB = $DIC->database();
535  $ilLog = $DIC["ilLog"];
536  $ilErr = $DIC["ilErr"];
537 
538  if (!is_array($a_pages)) {
539  $a_pages = array(0);
540  /*$message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_pages must be an array');
541  $ilLog->write($message,$ilLog->WARNING);
542  $ilErr->raiseError($message,$ilErr->MESSAGE);
543  return false;*/
544  }
545 
546  if (empty($a_cont_obj_id)) {
547  $message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_cont_obj_id is empty');
548  $ilLog->write($message, $ilLog->WARNING);
549  $ilErr->raiseError($message, $ilErr->MESSAGE);
550  return false;
551  }
552 
553  // update structure entries: if at least one page of a chapter is public set chapter to public too
554  $lm_tree = new ilTree($a_cont_obj_id);
555  $lm_tree->setTableNames('lm_tree', 'lm_data');
556  $lm_tree->setTreeTablePK("lm_id");
557  $lm_tree->readRootId();
558 
559  // get all st entries of cont_obj
560  $q = "SELECT obj_id FROM lm_data " .
561  "WHERE lm_id = " . $ilDB->quote($a_cont_obj_id, "integer") . " " .
562  "AND type = 'st'";
563  $r = $ilDB->query($q);
564 
565  // add chapters with a public page to a_pages
566  while ($row = $ilDB->fetchAssoc($r)) {
567  $childs = $lm_tree->getChilds($row["obj_id"]);
568 
569  foreach ($childs as $page) {
570  if ($page["type"] == "pg" and in_array($page["obj_id"], $a_pages)) {
571  array_push($a_pages, $row["obj_id"]);
572  break;
573  }
574  }
575  }
576 
577  // update public access status of all pages of cont_obj
578  $q = "UPDATE lm_data SET " .
579  "public_access = CASE " .
580  "WHEN " . $ilDB->in("obj_id", $a_pages, false, "integer") . " " .
581  "THEN " . $ilDB->quote("y", "text") .
582  "ELSE " . $ilDB->quote("n", "text") .
583  "END " .
584  "WHERE lm_id = " . $ilDB->quote($a_cont_obj_id, "integer") . " " .
585  "AND " . $ilDB->in("type", array("pg", "st"), false, "text");
586  $ilDB->manipulate($q);
587 
588  return true;
589  }
global $ilErr
Definition: raiseError.php:16
global $DIC
Definition: saml.php:7
$r
Definition: example_031.php:79
catch(Exception $e) $message
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _writeTitle()

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

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

References $DIC, $ilDB, and $query.

Referenced by MDUpdateListener(), and saveTitles().

356  {
357  global $DIC;
358 
359  $ilDB = $DIC->database();
360 
361  $query = "UPDATE lm_data SET " .
362  " title = " . $ilDB->quote($a_title, "text") .
363  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
364  $ilDB->manipulate($query);
365  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ 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 918 of file class.ilLMObject.php.

References $DIC, $id, $ilUser, $time, _lookupTitle(), _lookupType(), array, date, getTree(), and time.

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

919  {
920  global $DIC;
921 
922  $ilUser = $DIC->user();
923 
924  $tree = ilLMObject::getTree($a_cont_obj_id);
925 
926  $ilUser->clipboardDeleteObjectsOfType("pg");
927  $ilUser->clipboardDeleteObjectsOfType("st");
928 
929  // put them into the clipboard
930  $time = date("Y-m-d H:i:s", time());
931  $order = 0;
932  foreach ($a_ids as $id) {
933  $curnode = array();
934  if ($tree->isInTree($id)) {
935  $curnode = $tree->getNodeData($id);
936  $subnodes = $tree->getSubTree($curnode);
937  foreach ($subnodes as $subnode) {
938  if ($subnode["child"] != $id) {
939  $ilUser->addObjectToClipboard(
940  $subnode["child"],
941  $subnode["type"],
942  $subnode["title"],
943  $subnode["parent"],
944  $time,
945  $subnode["lft"]
946  );
947  }
948  }
949  }
950  $order = ($curnode["lft"] > 0)
951  ? $curnode["lft"]
952  : (int) ($order + 1);
953  $ilUser->addObjectToClipboard(
954  $id,
957  0,
958  $time,
959  $order
960  );
961  }
962  }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
global $DIC
Definition: saml.php:7
static _lookupTitle($a_obj_id)
Lookup title.
static getTree($a_cont_obj_id)
Get learningmodule tree.
$time
Definition: cron.php:21
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clipboardCut()

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

Copy a set of chapters/pages into the clipboard.

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

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

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

881  {
882  $tree = ilLMObject::getTree($a_cont_obj_id);
883 
884  if (!is_array($a_ids)) {
885  return false;
886  } else {
887  // get all "top" ids, i.e. remove ids, that have a selected parent
888  foreach ($a_ids as $id) {
889  $path = $tree->getPathId($id);
890  $take = true;
891  foreach ($path as $path_id) {
892  if ($path_id != $id && in_array($path_id, $a_ids)) {
893  $take = false;
894  }
895  }
896  if ($take) {
897  $cut_ids[] = $id;
898  }
899  }
900  }
901 
902  ilLMObject::clipboardCopy($a_cont_obj_id, $cut_ids);
903 
904  // remove the objects from the tree
905  // note: we are getting chapters which are *not* in the tree
906  // we do not delete any pages/chapters here
907  foreach ($cut_ids as $id) {
908  $curnode = $tree->getNodeData($id);
909  if ($tree->isInTree($id)) {
910  $tree->deleteTree($curnode);
911  }
912  }
913  }
static getTree($a_cont_obj_id)
Get learningmodule tree.
static clipboardCopy($a_cont_obj_id, $a_ids)
Copy a set of chapters/pages into the clipboard.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilLMObject::create (   $a_upload = false)

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

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

471  {
472  $ilDB = $this->db;
473 
474  // insert object data
475  $this->setId($ilDB->nextId("lm_data"));
476  $query = "INSERT INTO lm_data (obj_id, title, type, layout, lm_id, import_id, short_title, create_date) " .
477  "VALUES (" .
478  $ilDB->quote($this->getId(), "integer") . "," .
479  $ilDB->quote($this->getTitle(), "text") . "," .
480  $ilDB->quote($this->getType(), "text") . ", " .
481  $ilDB->quote($this->getLayout(), "text") . ", " .
482  $ilDB->quote($this->getLMId(), "integer") . "," .
483  $ilDB->quote($this->getImportId(), "text") . "," .
484  $ilDB->quote($this->getShortTitle(), "text") .
485  ", " . $ilDB->now() . ")";
486  $ilDB->manipulate($query);
487 
488  // create history entry
489  include_once("./Services/History/classes/class.ilHistory.php");
491  $this->getId(),
492  "create",
493  "",
494  $this->content_object->getType() . ":" . $this->getType()
495  );
496 
497  if (!$a_upload) {
498  $this->createMetaData();
499  }
500  }
getShortTitle()
get short title of lm object
getLayout()
Get layout.
static _createEntry( $a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
$query
getTitle()
get title of lm object
createMetaData()
create meta data entry
global $ilDB
+ Here is the call graph for this function:

◆ createMetaData()

ilLMObject::createMetaData ( )

create meta data entry

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

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

Referenced by create().

135  {
136  include_once 'Services/MetaData/classes/class.ilMDCreator.php';
137 
139 
140  $md_creator = new ilMDCreator($this->getLMId(), $this->getId(), $this->getType());
141  $md_creator->setTitle($this->getTitle());
142  $md_creator->setTitleLanguage($ilUser->getPref('language'));
143  $md_creator->setDescription($this->getDescription());
144  $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
145  $md_creator->setKeywordLanguage($ilUser->getPref('language'));
146  $md_creator->setLanguage($ilUser->getPref('language'));
147  $md_creator->create();
148 
149  return true;
150  }
$ilUser
Definition: imgupload.php:18
getTitle()
get title of lm object
+ 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

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

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

629  {
630  $ilDB = $this->db;
631 
632  $query = "DELETE FROM lm_data WHERE obj_id = " .
633  $ilDB->quote($this->getId(), "integer");
634  $ilDB->manipulate($query);
635 
636  $this->deleteMetaData();
637  }
$query
global $ilDB
deleteMetaData()
delete meta data entry
+ Here is the call graph for this function:

◆ deleteMetaData()

ilLMObject::deleteMetaData ( )

delete meta data entry

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

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

Referenced by delete().

180  {
181  // Delete meta data
182  include_once('Services/MetaData/classes/class.ilMD.php');
183  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
184  $md->deleteAll();
185  }
+ 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

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

References $a_type, and ilMDIdentifier\existsIdInRbacObject().

Referenced by ilLMPageObject\copy().

1481  {
1482  include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1483  return ilMDIdentifier::existsIdInRbacObject($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1484  }
static existsIdInRbacObject($a_rbac_id, $a_obj_type, $a_catalog, $a_entry)
Does id entry exist in rbac object?
$a_type
Definition: workflow.php:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContentObject()

& ilLMObject::getContentObject ( )

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

References $content_object.

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

404  {
405  return $this->content_object;
406  }
+ Here is the caller graph for this function:

◆ getDescription()

ilLMObject::getDescription ( )

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

References $description.

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

374  {
375  return $this->description;
376  }
+ 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 1489 of file class.ilLMObject.php.

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

Referenced by ilExportIDTableGUI\__construct().

1490  {
1491  include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1492  $entries = ilMDIdentifier::_getEntriesForRbacObj($a_lm_id, $a_type);
1493  $res = array();
1494  foreach ($entries as $e) {
1495  if ($e["catalog"] == "ILIAS_NID") {
1496  if (ilLMObject::_exists($e["obj_id"])) {
1497  $res[trim($e["entry"])]++;
1498  }
1499  }
1500  }
1501  return $res;
1502  }
static _exists($a_id)
checks wether a lm content object with specified id exists or not
$a_type
Definition: workflow.php:92
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
static _getEntriesForRbacObj($a_rbac_id, $a_obj_type="")
Get IDs for an rbac object.
+ 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

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

References $a_type, and ilMDIdentifier\_getEntriesForObj().

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

1458  {
1459  // look for export id
1460  include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1462  $a_lm_id,
1463  $a_lmobj_id,
1464  $a_type
1465  );
1466 
1467  foreach ($entries as $e) {
1468  if ($e["catalog"] == "ILIAS_NID") {
1469  return $e["entry"];
1470  }
1471  }
1472  }
$a_type
Definition: workflow.php:92
static _getEntriesForObj($a_rbac_id, $a_obj_id, $a_obj_type)
Get IDs for an object.
+ 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

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

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

1511  {
1512  include_once("./Services/MetaData/classes/class.ilMDIdentifier.php");
1513  $data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1514  return $data;
1515  }
$a_type
Definition: workflow.php:92
static readIdData($a_rbac_id, $a_obj_type, $a_catalog, $a_entry)
Does id entry exist in rbac object?
+ Here is the call graph for this function:

◆ getId()

◆ getImportId()

ilLMObject::getImportId ( )

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

Referenced by create().

419  {
420  return $this->import_id;
421  }
+ Here is the caller graph for this function:

◆ getLayout()

ilLMObject::getLayout ( )

Get layout.

Returns
string layout

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

References $layout.

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

444  {
445  return $this->layout;
446  }
+ Here is the caller graph for this function:

◆ getLMId()

◆ getObjectList()

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

static

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

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

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

743  {
744  global $DIC;
745 
746  $ilDB = $DIC->database();
747 
748  $type_str = ($type != "")
749  ? "AND type = " . $ilDB->quote($type, "text") . " "
750  : "";
751 
752  $query = "SELECT * FROM lm_data " .
753  "WHERE lm_id= " . $ilDB->quote($lm_id, "integer") . " " .
754  $type_str . " " .
755  "ORDER BY title";
756  $obj_set = $ilDB->query($query);
757  $obj_list = array();
758  while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
759  $obj_list[] = array("obj_id" => $obj_rec["obj_id"],
760  "title" => $obj_rec["title"],
761  "import_id" => $obj_rec["import_id"],
762  "type" => $obj_rec["type"]);
763  }
764  return $obj_list;
765  }
global $DIC
Definition: saml.php:7
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getPagesOfChapter()

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

Get pages of chapter.

Parameters

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

Referenced by ilHelpGUI\showHelp().

1346  {
1347  // update structure entries: if at least one page of a chapter is public set chapter to public too
1348  $lm_tree = new ilTree($a_lm_id);
1349  $lm_tree->setTableNames('lm_tree', 'lm_data');
1350  $lm_tree->setTreeTablePK("lm_id");
1351  $lm_tree->readRootId();
1352 
1353  $childs = $lm_tree->getChildsByType($a_chap_id, "pg");
1354 
1355  return $childs;
1356  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the caller graph for this function:

◆ getShortTitle()

ilLMObject::getShortTitle ( )

get short title of lm object

Returns
string short title of chapter or page

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

References $short_title.

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

275  {
276  return $this->short_title;
277  }
+ Here is the caller graph for this function:

◆ getShortTitles()

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

Get short titles.

Parameters

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

References $db, $DIC, and array.

Referenced by ilLMEditShortTitlesTableGUI\__construct().

1568  {
1569  global $DIC;
1570 
1571  $db = $DIC->database();
1572 
1573  $title_data = array();
1574  if ($a_lang == "-") {
1575  $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 = " .
1576  $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1577  } else {
1578  $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 " .
1579  " LEFT JOIN lm_tree t ON (d.obj_id = t.child) " .
1580  " LEFT JOIN lm_data_transl tr ON (tr.id = d.obj_id AND tr.lang=" . $db->quote($a_lang, "text") . ") WHERE d.lm_id = " .
1581  $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1582  }
1583  while ($rec = $db->fetchAssoc($set)) {
1584  $title_data[] = $rec;
1585  }
1586  return $title_data;
1587  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
+ 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 254 of file class.ilLMObject.php.

References $title.

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

255  {
256  return $this->title;
257  }
+ 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 867 of file class.ilLMObject.php.

Referenced by clipboardCopy(), and clipboardCut().

868  {
869  $tree = new ilTree($a_cont_obj_id);
870  $tree->setTableNames('lm_tree', 'lm_data');
871  $tree->setTreeTablePK("lm_id");
872  $tree->readRootId();
873 
874  return $tree;
875  }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
+ Here is the caller graph for this function:

◆ getType()

◆ lookupLayout()

static ilLMObject::lookupLayout (   $a_obj_id)
static

Lookup type.

Parameters
intlm object id

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

References $DIC, $ilDB, and $query.

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

1326  {
1327  global $DIC;
1328 
1329  $ilDB = $DIC->database();
1330 
1331  $query = "SELECT layout FROM lm_data WHERE obj_id = " .
1332  $ilDB->quote($a_obj_id, "integer");
1333  $obj_set = $ilDB->query($query);
1334  $obj_rec = $ilDB->fetchAssoc($obj_set);
1335 
1336  return $obj_rec["layout"];
1337  }
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ 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 71 of file class.ilLMObject.php.

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

72  {
73  include_once 'Services/MetaData/classes/class.ilMD.php';
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  include_once("./Services/Object/classes/class.ilObjectLP.php");
93  $obj_lp = ilObjectLP::getInstance($this->getLMId());
94  if (in_array(
95  $obj_lp->getCurrentMode(),
97  )) {
98  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
100  }
101  break;
102 
103  default:
104  }
105  return true;
106  }
static _writeTitle($a_obj_id, $a_title)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
Create styles array
The data for the language used.
static getInstance($a_obj_id)
+ 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 967 of file class.ilLMObject.php.

References $DIC, $ilLog, $ilUser, _lookupContObjID(), _lookupType(), ilMD\cloneMD(), ilObjectFactory\getInstanceByObjId(), IL_LAST_NODE, and putInTree().

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

976  {
977  global $DIC;
978 
979  $ilUser = $DIC->user();
980  $ilLog = $DIC["ilLog"];
981 
982  include_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
983  include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
984 
985  $item_lm_id = ilLMObject::_lookupContObjID($a_item_id);
986  $item_type = ilLMObject::_lookupType($a_item_id);
987  $lm_obj = ilObjectFactory::getInstanceByObjId($item_lm_id);
988  if ($item_type == "st") {
989  $item = new ilStructureObject($lm_obj, $a_item_id);
990  } elseif ($item_type == "pg") {
991  $item = new ilLMPageObject($lm_obj, $a_item_id);
992  }
993 
994  $ilLog->write("Getting from clipboard type " . $item_type . ", " .
995  "Item ID: " . $a_item_id . ", of original LM: " . $item_lm_id);
996 
997  if ($item_lm_id != $a_target_lm->getId() && !$a_as_copy) {
998  // @todo: check whether st is NOT in tree
999 
1000  // "move" metadata to new lm
1001  include_once("Services/MetaData/classes/class.ilMD.php");
1002  $md = new ilMD($item_lm_id, $item->getId(), $item->getType());
1003  $new_md = $md->cloneMD($a_target_lm->getId(), $item->getId(), $item->getType());
1004 
1005  // update lm object
1006  $item->setLMId($a_target_lm->getId());
1007  $item->setContentObject($a_target_lm);
1008  $item->update();
1009 
1010  // delete old meta data set
1011  $md->deleteAll();
1012 
1013  if ($item_type == "pg") {
1014  $page = $item->getPageObject();
1015  $page->buildDom();
1016  $page->setParentId($a_target_lm->getId());
1017  $page->update();
1018  }
1019  }
1020 
1021  if ($a_as_copy) {
1022  $target_item = $item->copy($a_target_lm);
1023  $a_copied_nodes[$item->getId()] = $target_item->getId();
1024  } else {
1025  $target_item = $item;
1026  }
1027 
1028  $ilLog->write("Putting into tree type " . $target_item->getType() .
1029  "Item ID: " . $target_item->getId() . ", Parent: " . $a_parent_id . ", " .
1030  "Target: " . $a_target . ", Item LM:" . $target_item->getContentObject()->getId());
1031 
1032  ilLMObject::putInTree($target_item, $a_parent_id, $a_target);
1033 
1034  if ($a_source_lm == null) {
1035  $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
1036  } else {
1037  $childs = $a_source_lm->lm_tree->getChilds($item->getId());
1038  foreach ($childs as $k => $child) {
1039  $childs[$k]["id"] = $childs[$k]["child"];
1040  }
1041  }
1042 
1043  foreach ($childs as $child) {
1045  $a_target_lm,
1046  $child["id"],
1047  $target_item->getId(),
1048  IL_LAST_NODE,
1049  $a_insert_time,
1050  $a_copied_nodes,
1051  $a_as_copy,
1052  $a_source_lm
1053  );
1054  }
1055 
1056  return $target_item->getId();
1057  // @todo: write history (see pastePage)
1058  }
& cloneMD($a_rbac_id, $a_obj_id, $a_obj_type)
Definition: class.ilMD.php:326
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
global $DIC
Definition: saml.php:7
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
Class ilLMPageObject.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
$ilUser
Definition: imgupload.php:18
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
const IL_LAST_NODE
Definition: class.ilTree.php:4
Class ilStructreObject.
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.
+ 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 222 of file class.ilLMObject.php.

References $DIC, and $ilDB.

Referenced by ilLMExplorerGUI\__construct().

223  {
224  global $DIC;
225 
226  $ilDB = $DIC->database();
227 
228  $set = $ilDB->query(
229  "SELECT * FROM lm_data " .
230  " WHERE lm_id = " . $ilDB->quote($a_lm_id, "integer")
231  );
232  while ($rec = $ilDB->fetchAssoc($set)) {
233  self::$data_records[$rec["obj_id"]] = $rec;
234  }
235  return count(self::$data_records);
236  }
global $DIC
Definition: saml.php:7
global $ilDB
+ 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 817 of file class.ilLMObject.php.

References $DIC, $ilLog, $target, array, IL_FIRST_NODE, and ilTree\setTableNames().

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

818  {
819  global $DIC;
820 
821  $ilLog = $DIC["ilLog"];
822 
823  $tree = new ilTree($a_obj->getContentObject()->getId());
824  $tree->setTableNames('lm_tree', 'lm_data');
825  $tree->setTreeTablePK("lm_id");
826 
827  // determine parent
828  $parent_id = ($a_parent_id != "")
829  ? $a_parent_id
830  : $tree->getRootId();
831 
832  // determine target
833  if ($a_target_node_id != "") {
834  $target = $a_target_node_id;
835  } else {
836  // determine last child that serves as predecessor
837  if ($a_obj->getType() == "st") {
838  $s_types = array("st", "pg");
839  $childs = $tree->getChildsByTypeFilter($parent_id, $s_types);
840  } else {
841  $s_types = "pg";
842  $childs = $tree->getChildsByType($parent_id, $s_types);
843  }
844 
845  if (count($childs) == 0) {
847  } else {
848  $target = $childs[count($childs) - 1]["obj_id"];
849  }
850  }
851 
852  if ($tree->isInTree($parent_id) && !$tree->isInTree($a_obj->getId())) {
853  $ilLog->write("LMObject::putInTree: insertNode, ID: " . $a_obj->getId() .
854  "Parent ID: " . $parent_id . ", Target: " . $target);
855 
856  $tree->insertNode($a_obj->getId(), $parent_id, $target);
857  }
858  }
global $DIC
Definition: saml.php:7
const IL_FIRST_NODE
Definition: class.ilTree.php:5
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilLMObject::read ( )

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

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

Referenced by __construct().

198  {
199  $ilDB = $this->db;
200 
201  if (!isset($this->data_record)) {
202  $query = "SELECT * FROM lm_data WHERE obj_id = " .
203  $ilDB->quote($this->id, "integer");
204  $obj_set = $ilDB->query($query);
205  $this->data_record = $ilDB->fetchAssoc($obj_set);
206  }
207 
208  $this->type = $this->data_record["type"];
209  $this->setImportId($this->data_record["import_id"]);
210  $this->setTitle($this->data_record["title"]);
211  $this->setShortTitle($this->data_record["short_title"]);
212  $this->setLayout($this->data_record["layout"]);
213  }
setLayout($a_val)
Set layout.
setTitle($a_title)
set title of lm object
$query
setShortTitle($a_title)
set short title of lm object
global $ilDB
+ 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

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

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

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

1396  {
1397  global $DIC;
1398 
1399  $ilDB = $DIC->database();
1400 
1401  include_once("Services/MetaData/classes/class.ilMDIdentifier.php");
1402 
1403  if (trim($a_exp_id) == "") {
1404  // delete export ids, if existing
1406  $a_lm_id,
1407  $a_lmobj_id,
1408  $a_type
1409  );
1410 
1411  foreach ($entries as $id => $e) {
1412  if ($e["catalog"] == "ILIAS_NID") {
1413  $identifier = new ilMDIdentifier();
1414  $identifier->setMetaId($id);
1415  $identifier->delete();
1416  }
1417  }
1418  } else {
1419  // update existing entry
1421  $a_lm_id,
1422  $a_lmobj_id,
1423  $a_type
1424  );
1425 
1426  $updated = false;
1427  foreach ($entries as $id => $e) {
1428  if ($e["catalog"] == "ILIAS_NID") {
1429  $identifier = new ilMDIdentifier();
1430  $identifier->setMetaId($id);
1431  $identifier->read();
1432  $identifier->setEntry($a_exp_id);
1433  $identifier->update();
1434  $updated = true;
1435  }
1436  }
1437 
1438  // nothing updated? create a new one
1439  if (!$updated) {
1440  include_once("./Services/MetaData/classes/class.ilMD.php");
1441  $md = new ilMD($a_lm_id, $a_lmobj_id, $a_type);
1442  $md_gen = $md->getGeneral();
1443  $identifier = $md_gen->addIdentifier();
1444  $identifier->setEntry($a_exp_id);
1445  $identifier->setCatalog("ILIAS_NID");
1446  $identifier->save();
1447  }
1448  }
1449  }
global $DIC
Definition: saml.php:7
$a_type
Definition: workflow.php:92
static _getEntriesForObj($a_rbac_id, $a_obj_id, $a_obj_type)
Get IDs for an object.
global $ilDB
+ 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 1065 of file class.ilLMObject.php.

References $id, $title, _writeTitle(), ilMD\getGeneral(), ilLMObjectFactory\getInstance(), ilFormPropertyGUI\removeProhibitedCharacters(), and ilMDBase\update().

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

1066  {
1067  include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
1068 
1069  if ($a_lang == "") {
1070  $a_lang = "-";
1071  }
1072  if (is_array($a_titles)) {
1073  include_once("./Services/Form/classes/class.ilFormPropertyGUI.php");
1074  include_once("./Services/MetaData/classes/class.ilMD.php");
1075  foreach ($a_titles as $id => $title) {
1076  // see #20375
1078  if ($a_lang == "-") {
1079  $lmobj = ilLMObjectFactory::getInstance($a_lm, $id, false);
1080  if (is_object($lmobj)) {
1081  // Update Title and description
1082  $md = new ilMD($a_lm->getId(), $id, $lmobj->getType());
1083  $md_gen = $md->getGeneral();
1084  if (is_object($md_gen)) { // see bug #0015843
1085  $md_gen->setTitle($title);
1086  $md_gen->update();
1087  $md->update();
1088  }
1090  }
1091  } else {
1092  $lmobjtrans = new ilLMObjTranslation($id, $a_lang);
1093  $lmobjtrans->setTitle($title);
1094  $lmobjtrans->save();
1095  }
1096  }
1097  }
1098  }
static _writeTitle($a_obj_id, $a_title)
static removeProhibitedCharacters($a_text)
Remove prohibited characters see #19159.
static getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
& getGeneral()
Definition: class.ilMD.php:40
Translation information on lm object.
+ 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 398 of file class.ilLMObject.php.

Referenced by __construct().

399  {
400  $this->content_object = $a_content_obj;
401  }
+ 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 192 of file class.ilLMObject.php.

193  {
194  $this->data_record = $a_record;
195  }

◆ setDescription()

ilLMObject::setDescription (   $a_description)

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

369  {
370  $this->description = $a_description;
371  }

◆ setId()

ilLMObject::setId (   $a_id)

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

Referenced by create().

409  {
410  $this->id = $a_id;
411  }
+ Here is the caller graph for this function:

◆ setImportId()

ilLMObject::setImportId (   $a_id)

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

Referenced by read().

424  {
425  $this->import_id = $a_id;
426  }
+ Here is the caller graph for this function:

◆ setLayout()

ilLMObject::setLayout (   $a_val)

Set layout.

Parameters
stringlayout

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

Referenced by read().

434  {
435  $this->layout = $a_val;
436  }
+ Here is the caller graph for this function:

◆ setLMId()

ilLMObject::setLMId (   $a_lm_id)

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

Referenced by __construct().

389  {
390  $this->lm_id = $a_lm_id;
391  }
+ Here is the caller graph for this function:

◆ setShortTitle()

ilLMObject::setShortTitle (   $a_title)

set short title of lm object

Parameters
string$a_titleshort title of chapter or page

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

Referenced by read().

265  {
266  $this->short_title = $a_title;
267  }
+ 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 244 of file class.ilLMObject.php.

Referenced by read().

245  {
246  $this->title = $a_title;
247  }
+ Here is the caller graph for this function:

◆ setType()

ilLMObject::setType (   $a_type)

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

References $a_type.

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

379  {
380  $this->type = $a_type;
381  }
$a_type
Definition: workflow.php:92
+ 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 1269 of file class.ilLMObject.php.

References $type, _lookupType(), and array.

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

1270  {
1271  $types = array();
1272  if (is_array($a_items)) {
1273  foreach ($a_items as $item) {
1274  $type = ilLMObject::_lookupType($item);
1275  $types[$type] = $type;
1276  }
1277  }
1278 
1279  if (count($types) > 1) {
1280  return false;
1281  }
1282  return true;
1283  }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
Create styles array
The data for the language used.
+ 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 505 of file class.ilLMObject.php.

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

506  {
507  $ilDB = $this->db;
508 
509  $this->updateMetaData();
510 
511  $query = "UPDATE lm_data SET " .
512  " lm_id = " . $ilDB->quote($this->getLMId(), "integer") .
513  " ,title = " . $ilDB->quote($this->getTitle(), "text") .
514  " ,short_title = " . $ilDB->quote($this->getShortTitle(), "text") .
515  " ,layout = " . $ilDB->quote($this->getLayout(), "text") .
516  " WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
517 
518  $ilDB->manipulate($query);
519  }
getShortTitle()
get short title of lm object
getLayout()
Get layout.
$query
updateMetaData()
update meta data entry
getTitle()
get title of lm object
global $ilDB
+ 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 1103 of file class.ilLMObject.php.

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

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

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

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

Referenced by update().

156  {
157  include_once("Services/MetaData/classes/class.ilMD.php");
158  include_once("Services/MetaData/classes/class.ilMDGeneral.php");
159  include_once("Services/MetaData/classes/class.ilMDDescription.php");
160 
161  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
162  $md_gen = $md->getGeneral();
163  $md_gen->setTitle($this->getTitle());
164 
165  // sets first description (maybe not appropriate)
166  $md_des_ids = $md_gen->getDescriptionIds();
167  if (count($md_des_ids) > 0) {
168  $md_des = $md_gen->getDescription($md_des_ids[0]);
169  // $md_des->setDescription($this->getDescription());
170  $md_des->update();
171  }
172  $md_gen->update();
173  }
getTitle()
get title of lm object
+ 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 1291 of file class.ilLMObject.php.

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

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

1292  {
1293  global $DIC;
1294 
1295  $ilDB = $DIC->database();
1296 
1297  $t = ilLMObject::_lookupType($a_obj_id);
1298 
1299  if ($t == "pg") {
1300  $query = "UPDATE lm_data SET " .
1301  " layout = " . $ilDB->quote($a_layout, "text") .
1302  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
1303  $ilDB->manipulate($query);
1304  } elseif ($t == "st" && is_object($a_lm)) {
1305  $node = $a_lm->getLMTree()->getNodeData($a_obj_id);
1306  $child_nodes = $a_lm->getLMTree()->getSubTree($node);
1307  if (is_array($child_nodes) && count($child_nodes) > 0) {
1308  foreach ($child_nodes as $c) {
1309  if ($c["type"] == "pg") {
1310  $query = "UPDATE lm_data SET " .
1311  " layout = " . $ilDB->quote($a_layout, "text") .
1312  " WHERE obj_id = " . $ilDB->quote($c["child"], "integer");
1313  $ilDB->manipulate($query);
1314  }
1315  }
1316  }
1317  }
1318  }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
global $DIC
Definition: saml.php:7
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeShortTitle()

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

Write short title.

Parameters
integer$a_idobject id
string$a_short_titleshort title

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

References $db, and $DIC.

Referenced by ilLMEditShortTitlesGUI\save().

1596  {
1597  global $DIC;
1598 
1599  $db = $DIC->database();
1600 
1601  if ($a_lang != "-" && $a_lang != "") {
1602  $trans = new ilLMObjTranslation($a_id, $a_lang);
1603  $trans->setShortTitle($a_short_title);
1604  $trans->save();
1605  } else {
1606  $db->manipulate(
1607  "UPDATE lm_data SET " .
1608  " short_title = " . $db->quote($a_short_title, "text") .
1609  " WHERE obj_id = " . $db->quote($a_id, "integer")
1610  );
1611  }
1612  }
global $DIC
Definition: saml.php:7
Translation information on lm object.
+ Here is the caller graph for this function:

Field Documentation

◆ $active

ilLMObject::$active = true

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

Referenced by ilLMPageObject\_getPresentationTitle().

◆ $content_object

ilLMObject::$content_object

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

Referenced by getContentObject().

◆ $data_record

ilLMObject::$data_record

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

◆ $data_records

ilLMObject::$data_records = array()
staticprotected

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

◆ $db

ilLMObject::$db
protected

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

Referenced by create(), delete(), getShortTitles(), read(), update(), and writeShortTitle().

◆ $description

ilLMObject::$description

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

Referenced by getDescription().

◆ $id

ilLMObject::$id

◆ $lm_id

◆ $meta_data

ilLMObject::$meta_data

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

◆ $short_title

ilLMObject::$short_title

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

Referenced by getShortTitle().

◆ $title

◆ $type

◆ $user

ilLMObject::$user
protected

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

Referenced by createMetaData().


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