ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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=self::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

const CHAPTER_TITLE = "st_title"
 
const PAGE_TITLE = "pg_title"
 
const NO_HEADER = "none"
 
 $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 15 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 46 of file class.ilLMObject.php.

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

47  {
48  global $DIC;
49  $this->user = $DIC->user();
50 
51  $this->db = $DIC->database();
52 
53  $this->id = $a_id;
54  $this->setContentObject($a_content_obj);
55  $this->setLMId($a_content_obj->getId());
56  if ($a_id != 0) {
57  $this->read();
58  }
59  }
user()
Definition: user.php:4
setContentObject(&$a_content_obj)
setLMId($a_lm_id)
$DIC
Definition: xapitoken.php:46
+ 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 757 of file class.ilLMObject.php.

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

Referenced by ilObjContentObject\delete().

758  {
759  global $DIC;
760 
761  $ilDB = $DIC->database();
762 
763  $query = "SELECT * FROM lm_data " .
764  "WHERE lm_id= " . $ilDB->quote($a_cobj->getId(), "integer");
765  $obj_set = $ilDB->query($query);
766 
767  while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
768  $lm_obj = ilLMObjectFactory::getInstance($a_cobj, $obj_rec["obj_id"], false);
769 
770  if (is_object($lm_obj)) {
771  $lm_obj->delete(true);
772  }
773  }
774 
775  return true;
776  }
static getInstance(&$a_content_obj, $a_id=0, $a_halt=true)
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 705 of file class.ilLMObject.php.

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

Referenced by ilCourseObjectiveMaterials\__read(), ilInternalLink\_exists(), ilLinksTableGUI\fillRow(), getDuplicateExportIDs(), ilLMContentRendererGUI\render(), ilHelpGUI\showHelp(), and ilLMPresentationGUI\showPrintView().

706  {
707  global $DIC;
708 
709  $ilDB = $DIC->database();
710 
711  if (is_int(strpos($a_id, "_"))) {
713  }
714 
715  $q = "SELECT * FROM lm_data WHERE obj_id = " .
716  $ilDB->quote($a_id, "integer");
717  $obj_set = $ilDB->query($q);
718  if ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
719  return true;
720  } else {
721  return false;
722  }
723  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 1338 of file class.ilLMObject.php.

References $a_type, $DIC, and $ilDB.

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

1339  {
1340  global $DIC;
1341 
1342  $ilDB = $DIC->database();
1343 
1344  $and = ($a_type != "")
1345  ? " AND type = " . $ilDB->quote($a_type, "text")
1346  : "";
1347 
1348  $set = $ilDB->query("SELECT obj_id FROM lm_data " .
1349  " WHERE lm_id = " . $ilDB->quote($a_lm_id, "integer") . $and);
1350  $obj_ids = array();
1351  while ($rec = $ilDB->fetchAssoc($set)) {
1352  $obj_ids[] = $rec["obj_id"];
1353  }
1354 
1355  return $obj_ids;
1356  }
$a_type
Definition: workflow.php:92
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 671 of file class.ilLMObject.php.

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

Referenced by updateInternalLinks().

672  {
673  global $DIC;
674 
675  $ilDB = $DIC->database();
676 
677  $where = ($a_in_lm > 0)
678  ? " AND lm_id = " . $ilDB->quote($a_in_lm, "integer") . " "
679  : "";
680 
681  $q = "SELECT * FROM lm_data WHERE import_id = " .
682  $ilDB->quote($a_import_id, "text") . " " .
683  $where .
684  " ORDER BY create_date DESC";
685  $obj_set = $ilDB->query($q);
686 
687  $items = array();
688  while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
689  // check, whether lm is not trashed
690  if (ilObject::_hasUntrashedReference($obj_rec["lm_id"])) {
691  $items[] = $obj_rec;
692  }
693  }
694 
695  return $items;
696  }
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 638 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().

639  {
640  global $DIC;
641 
642  $ilDB = $DIC->database();
643 
644  $q = "SELECT obj_id FROM lm_data WHERE import_id = " .
645  $ilDB->quote($a_import_id, "text") . " " .
646  " ORDER BY create_date DESC";
647  $obj_set = $ilDB->query($q);
648  while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
649  $lm_id = ilLMObject::_lookupContObjID($obj_rec["obj_id"]);
650 
651  // link only in learning module, that is not trashed
652  $ref_ids = ilObject::_getAllReferences($lm_id); // will be 0 if import of lm is in progress (new import)
653  if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($lm_id) ||
655  return $obj_rec["obj_id"];
656  }
657  }
658 
659  return 0;
660  }
static _hasUntrashedReference($a_obj_id)
checks wether an object has at least one reference that is not in trash
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
$DIC
Definition: xapitoken.php:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getPresentationTitle()

static ilLMObject::_getPresentationTitle (   $a_node,
  $a_mode = self::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 1490 of file class.ilLMObject.php.

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

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

1498  {
1499  if ($a_lang == "") {
1500  $a_lang = "-";
1501  }
1502 
1503  if ($a_node["type"] == "st") {
1505  $a_node["child"],
1506  self::CHAPTER_TITLE,
1507  $a_include_numbers,
1508  $a_time_scheduled_activation,
1509  $a_force_content,
1510  $a_lm_id,
1511  $a_lang
1512  );
1513  } else {
1515  $a_node["child"],
1516  $a_mode,
1517  $a_include_numbers,
1518  $a_time_scheduled_activation,
1519  $a_force_content,
1520  $a_lm_id,
1521  $a_lang
1522  );
1523  }
1524  }
static _getPresentationTitle( $a_pg_id, $a_mode=self::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...
static _getPresentationTitle( $a_st_id, $a_mode=self::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
+ 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 579 of file class.ilLMObject.php.

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

Referenced by ilLMNavigationStatus\determineStatus(), ilLMContentRendererGUI\determineStatus(), ilLMPresentationGUI\getCurrentPageId(), ilLMContentRendererGUI\getSuccessorPage(), ilLMPresentationGUI\getSuccessorPage(), ilLMTOCExplorerGUI\isNodeClickable(), ilLMNavigationRendererGUI\render(), ilLMPresentationGUI\showPrintView(), and ilLMPresentationGUI\showPrintViewSelection().

580  {
581  global $DIC;
582 
583  $ilDB = $DIC->database();
584  $ilLog = $DIC["ilLog"];
585 
586  if (empty($a_node_id)) {
587  $message = sprintf('ilLMObject::_isPagePublic(): Invalid parameter! $a_node_id is empty');
588  $ilLog->write($message, $ilLog->WARNING);
589  return false;
590  }
591 
592  if ($a_check_public_mode === true) {
593  $lm_id = ilLMObject::_lookupContObjId($a_node_id);
594 
595  $q = "SELECT public_access_mode FROM content_object WHERE id = " .
596  $ilDB->quote($lm_id, "integer");
597  $r = $ilDB->query($q);
598  $row = $ilDB->fetchAssoc($r);
599 
600  if ($row["public_access_mode"] == "complete") {
601  return true;
602  }
603  }
604 
605  $q = "SELECT public_access FROM lm_data WHERE obj_id=" .
606  $ilDB->quote($a_node_id, "integer");
607  $r = $ilDB->query($q);
608  $row = $ilDB->fetchAssoc($r);
609 
610  return ilUtil::yn2tf($row["public_access"]);
611  }
global $ilDB
$DIC
Definition: xapitoken.php:46
$message
Definition: xapiexit.php:14
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 274 of file class.ilLMObject.php.

References $DIC, $ilDB, and $query.

275  {
276  global $DIC;
277 
278  $ilDB = $DIC->database();
279 
280  if (isset(self::$data_records[$a_obj_id])) {
281  return self::$data_records[$a_obj_id][$a_field];
282  }
283 
284  $query = "SELECT " . $a_field . " FROM lm_data WHERE obj_id = " .
285  $ilDB->quote($a_obj_id, "integer");
286  $obj_set = $ilDB->query($query);
287  $obj_rec = $ilDB->fetchAssoc($obj_set);
288 
289  return $obj_rec[$a_field];
290  }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46

◆ _lookupContObjID()

static ilLMObject::_lookupContObjID (   $a_id)
static

get learning module / digibook id for lm object

Definition at line 781 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(), ilPageLinker\getLinkXML(), ilLMPageObjectGUI\getLinkXML(), ilLMPresentationLinker\getLinkXML(), ilObjMediaObject\getParentObjectIdForUsage(), ilGlossaryPresentationGUI\listDefinitions(), ilObjContentObjectGUI\pastePage(), pasteTree(), ilLMEditShortTitlesGUI\save(), SurveyQuestion\setMaterial(), and updateInternalLinks().

782  {
783  global $DIC;
784 
785  $ilDB = $DIC->database();
786 
787  if (isset(self::$data_records[$a_id])) {
788  return self::$data_records[$a_id]["lm_id"];
789  }
790 
791  $query = "SELECT lm_id FROM lm_data WHERE obj_id = " .
792  $ilDB->quote($a_id, "integer");
793  $obj_set = $ilDB->query($query);
794  $obj_rec = $ilDB->fetchAssoc($obj_set);
795 
796  return $obj_rec["lm_id"];
797  }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 110 of file class.ilLMObject.php.

References $a_type, and $id.

111  {
112  $md = new ilMD($a_lm_id, $a_lm_obj_id, $a_type);
113  $md_gen = $md->getGeneral();
114  if (is_object($md_gen)) {
115  foreach ($md_gen->getIdentifierIds() as $id) {
116  $md_id = $md_gen->getIdentifier($id);
117  if ($md_id->getCatalog() == "ILIAS_NID") {
118  return $md_id->getEntry();
119  }
120  }
121  }
122 
123  return false;
124  }
$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 309 of file class.ilLMObject.php.

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

310  {
311  return self::_lookup($a_obj_id, "short_title");
312  }
+ 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 320 of file class.ilLMObject.php.

References $DIC, $ilDB, and $query.

Referenced by ilStructureObjectGUI\activatePages(), clipboardCopy(), ilLMNavigationStatus\determineStatus(), ilLMContentRendererGUI\determineStatus(), ilLMPresentationGUI\getCurrentPageId(), ilLMTOCExplorerGUIFactory\getExplorer(), ilObjLearningModuleSubItemListGUI\getHTML(), ilLMTOCExplorerGUI\getRootNode(), ilLMContentRendererGUI\getSuccessorPage(), ilLMPresentationGUI\getSuccessorPage(), ilPageObject\moveIntLinks(), ilSCORM2004Node\pasteTree(), pasteTree(), ilLMNavigationRendererGUI\render(), ilObjContentObjectGUI\saveExportIds(), ilLMPresentationGUI\showPrintView(), uniqueTypesCheck(), updateInternalLinks(), ilCourseObjectivesGUI\updateMaterialAssignment(), and writeLayout().

321  {
322  global $DIC;
323 
324  $ilDB = $DIC->database();
325 
326  if (isset(self::$data_records[$a_obj_id])) {
327  if ($a_lm_id == 0 || self::$data_records[$a_obj_id]["lm_id"] == $a_lm_id) {
328  return self::$data_records[$a_obj_id]["type"];
329  }
330  }
331 
332  if ($a_lm_id) {
333  $and = ' AND lm_id = ' . $ilDB->quote($a_lm_id, 'integer');
334  }
335 
336  $query = "SELECT type FROM lm_data WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer") . $and;
337  $obj_set = $ilDB->query($query);
338  $obj_rec = $ilDB->fetchAssoc($obj_set);
339 
340  return $obj_rec["type"];
341  }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 444 of file class.ilLMObject.php.

References $DIC, and $ilDB.

Referenced by ilContObjParser\handlerEndTag().

445  {
446  global $DIC;
447 
448  $ilDB = $DIC->database();
449 
450  $q = "UPDATE lm_data " .
451  "SET " .
452  "import_id = " . $ilDB->quote($a_import_id, "text") . "," .
453  "last_update = " . $ilDB->now() . " " .
454  "WHERE obj_id = " . $ilDB->quote($a_id, "integer");
455 
456  $ilDB->manipulate($q);
457  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 518 of file class.ilLMObject.php.

References $DIC, $ilDB, $ilErr, $ilLog, and $message.

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

519  {
520  global $DIC;
521 
522  $ilDB = $DIC->database();
523  $ilLog = $DIC["ilLog"];
524  $ilErr = $DIC["ilErr"];
525 
526  if (!is_array($a_pages)) {
527  $a_pages = array(0);
528  /*$message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_pages must be an array');
529  $ilLog->write($message,$ilLog->WARNING);
530  $ilErr->raiseError($message,$ilErr->MESSAGE);
531  return false;*/
532  }
533 
534  if (empty($a_cont_obj_id)) {
535  $message = sprintf('ilLMObject::_writePublicAccessStatus(): Invalid parameter! $a_cont_obj_id is empty');
536  $ilLog->write($message, $ilLog->WARNING);
537  $ilErr->raiseError($message, $ilErr->MESSAGE);
538  return false;
539  }
540 
541  // update structure entries: if at least one page of a chapter is public set chapter to public too
542  $lm_tree = new ilTree($a_cont_obj_id);
543  $lm_tree->setTableNames('lm_tree', 'lm_data');
544  $lm_tree->setTreeTablePK("lm_id");
545  $lm_tree->readRootId();
546 
547  // get all st entries of cont_obj
548  $q = "SELECT obj_id FROM lm_data " .
549  "WHERE lm_id = " . $ilDB->quote($a_cont_obj_id, "integer") . " " .
550  "AND type = 'st'";
551  $r = $ilDB->query($q);
552 
553  // add chapters with a public page to a_pages
554  while ($row = $ilDB->fetchAssoc($r)) {
555  $childs = $lm_tree->getChilds($row["obj_id"]);
556 
557  foreach ($childs as $page) {
558  if ($page["type"] == "pg" and in_array($page["obj_id"], $a_pages)) {
559  array_push($a_pages, $row["obj_id"]);
560  break;
561  }
562  }
563  }
564 
565  // update public access status of all pages of cont_obj
566  $q = "UPDATE lm_data SET " .
567  "public_access = CASE " .
568  "WHEN " . $ilDB->in("obj_id", $a_pages, false, "integer") . " " .
569  "THEN " . $ilDB->quote("y", "text") .
570  "ELSE " . $ilDB->quote("n", "text") .
571  "END " .
572  "WHERE lm_id = " . $ilDB->quote($a_cont_obj_id, "integer") . " " .
573  "AND " . $ilDB->in("type", array("pg", "st"), false, "text");
574  $ilDB->manipulate($q);
575 
576  return true;
577  }
$ilErr
Definition: raiseError.php:18
global $ilDB
$DIC
Definition: xapitoken.php:46
$message
Definition: xapiexit.php:14
+ Here is the caller graph for this function:

◆ _writeTitle()

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

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

References $DIC, $ilDB, and $query.

Referenced by MDUpdateListener(), and saveTitles().

345  {
346  global $DIC;
347 
348  $ilDB = $DIC->database();
349 
350  $query = "UPDATE lm_data SET " .
351  " title = " . $ilDB->quote($a_title, "text") .
352  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
353  $ilDB->manipulate($query);
354  }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 903 of file class.ilLMObject.php.

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

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

904  {
905  global $DIC;
906 
907  $ilUser = $DIC->user();
908 
909  $tree = ilLMObject::getTree($a_cont_obj_id);
910 
911  $ilUser->clipboardDeleteObjectsOfType("pg");
912  $ilUser->clipboardDeleteObjectsOfType("st");
913 
914  // put them into the clipboard
915  $time = date("Y-m-d H:i:s", time());
916  $order = 0;
917  foreach ($a_ids as $id) {
918  $curnode = array();
919  if ($tree->isInTree($id)) {
920  $curnode = $tree->getNodeData($id);
921  $subnodes = $tree->getSubTree($curnode);
922  foreach ($subnodes as $subnode) {
923  if ($subnode["child"] != $id) {
924  $ilUser->addObjectToClipboard(
925  $subnode["child"],
926  $subnode["type"],
927  $subnode["title"],
928  $subnode["parent"],
929  $time,
930  $subnode["lft"]
931  );
932  }
933  }
934  }
935  $order = ($curnode["lft"] > 0)
936  ? $curnode["lft"]
937  : (int) ($order + 1);
938  $ilUser->addObjectToClipboard(
939  $id,
942  0,
943  $time,
944  $order
945  );
946  }
947  }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _lookupTitle($a_obj_id)
Lookup title.
static getTree($a_cont_obj_id)
Get learningmodule tree.
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
+ 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 865 of file class.ilLMObject.php.

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

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

866  {
867  $tree = ilLMObject::getTree($a_cont_obj_id);
868 
869  if (!is_array($a_ids)) {
870  return false;
871  } else {
872  // get all "top" ids, i.e. remove ids, that have a selected parent
873  foreach ($a_ids as $id) {
874  $path = $tree->getPathId($id);
875  $take = true;
876  foreach ($path as $path_id) {
877  if ($path_id != $id && in_array($path_id, $a_ids)) {
878  $take = false;
879  }
880  }
881  if ($take) {
882  $cut_ids[] = $id;
883  }
884  }
885  }
886 
887  ilLMObject::clipboardCopy($a_cont_obj_id, $cut_ids);
888 
889  // remove the objects from the tree
890  // note: we are getting chapters which are *not* in the tree
891  // we do not delete any pages/chapters here
892  foreach ($cut_ids as $id) {
893  $curnode = $tree->getNodeData($id);
894  if ($tree->isInTree($id)) {
895  $tree->deleteTree($curnode);
896  }
897  }
898  }
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 459 of file class.ilLMObject.php.

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

460  {
461  $ilDB = $this->db;
462 
463  // insert object data
464  $this->setId($ilDB->nextId("lm_data"));
465  $query = "INSERT INTO lm_data (obj_id, title, type, layout, lm_id, import_id, short_title, create_date) " .
466  "VALUES (" .
467  $ilDB->quote($this->getId(), "integer") . "," .
468  $ilDB->quote($this->getTitle(), "text") . "," .
469  $ilDB->quote($this->getType(), "text") . ", " .
470  $ilDB->quote($this->getLayout(), "text") . ", " .
471  $ilDB->quote($this->getLMId(), "integer") . "," .
472  $ilDB->quote($this->getImportId(), "text") . "," .
473  $ilDB->quote($this->getShortTitle(), "text") .
474  ", " . $ilDB->now() . ")";
475  $ilDB->manipulate($query);
476 
477  // create history entry
479  $this->getId(),
480  "create",
481  "",
482  $this->content_object->getType() . ":" . $this->getType()
483  );
484 
485  if (!$a_upload) {
486  $this->createMetaData();
487  }
488  }
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 130 of file class.ilLMObject.php.

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

Referenced by create().

131  {
133 
134  $md_creator = new ilMDCreator($this->getLMId(), $this->getId(), $this->getType());
135  $md_creator->setTitle($this->getTitle());
136  $md_creator->setTitleLanguage($ilUser->getPref('language'));
137  $md_creator->setDescription($this->getDescription());
138  $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
139  $md_creator->setKeywordLanguage($ilUser->getPref('language'));
140  $md_creator->setLanguage($ilUser->getPref('language'));
141  $md_creator->create();
142 
143  return true;
144  }
$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 616 of file class.ilLMObject.php.

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

617  {
618  $ilDB = $this->db;
619 
620  $query = "DELETE FROM lm_data WHERE obj_id = " .
621  $ilDB->quote($this->getId(), "integer");
622  $ilDB->manipulate($query);
623 
624  $this->deleteMetaData();
625  }
$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 169 of file class.ilLMObject.php.

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

Referenced by delete().

170  {
171  // Delete meta data
172  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
173  $md->deleteAll();
174  }
+ 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 1450 of file class.ilLMObject.php.

References $a_type, and ilMDIdentifier\existsIdInRbacObject().

Referenced by ilLMPageObject\copy().

1451  {
1452  return ilMDIdentifier::existsIdInRbacObject($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1453  }
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 392 of file class.ilLMObject.php.

References $content_object.

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

393  {
394  return $this->content_object;
395  }
+ Here is the caller graph for this function:

◆ getDescription()

ilLMObject::getDescription ( )

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

References $description.

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

363  {
364  return $this->description;
365  }
+ 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 1458 of file class.ilLMObject.php.

References $a_type, Vendor\Package\$e, $res, _exists(), and ilMDIdentifier\_getEntriesForRbacObj().

Referenced by ilExportIDTableGUI\__construct().

1459  {
1460  $entries = ilMDIdentifier::_getEntriesForRbacObj($a_lm_id, $a_type);
1461  $res = array();
1462  foreach ($entries as $e) {
1463  if ($e["catalog"] == "ILIAS_NID") {
1464  if (ilLMObject::_exists($e["obj_id"])) {
1465  $res[trim($e["entry"])]++;
1466  }
1467  }
1468  }
1469  return $res;
1470  }
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
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 1428 of file class.ilLMObject.php.

References $a_type, Vendor\Package\$e, and ilMDIdentifier\_getEntriesForObj().

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

1429  {
1430  // look for export id
1432  $a_lm_id,
1433  $a_lmobj_id,
1434  $a_type
1435  );
1436 
1437  foreach ($entries as $e) {
1438  if ($e["catalog"] == "ILIAS_NID") {
1439  return $e["entry"];
1440  }
1441  }
1442  }
$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 1478 of file class.ilLMObject.php.

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

1479  {
1480  $data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1481  return $data;
1482  }
$data
Definition: storeScorm.php:23
$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 407 of file class.ilLMObject.php.

Referenced by create().

408  {
409  return $this->import_id;
410  }
+ Here is the caller graph for this function:

◆ getLayout()

ilLMObject::getLayout ( )

Get layout.

Returns
string layout

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

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

433  {
434  return $this->layout;
435  }
+ Here is the caller graph for this function:

◆ getLMId()

◆ getObjectList()

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

static

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

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

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

729  {
730  global $DIC;
731 
732  $ilDB = $DIC->database();
733 
734  $type_str = ($type != "")
735  ? "AND type = " . $ilDB->quote($type, "text") . " "
736  : "";
737 
738  $query = "SELECT * FROM lm_data " .
739  "WHERE lm_id= " . $ilDB->quote($lm_id, "integer") . " " .
740  $type_str . " " .
741  "ORDER BY title";
742  $obj_set = $ilDB->query($query);
743  $obj_list = array();
744  while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
745  $obj_list[] = array("obj_id" => $obj_rec["obj_id"],
746  "title" => $obj_rec["title"],
747  "import_id" => $obj_rec["import_id"],
748  "type" => $obj_rec["type"]);
749  }
750  return $obj_list;
751  }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 1319 of file class.ilLMObject.php.

Referenced by ilHelpGUI\showHelp().

1320  {
1321  // update structure entries: if at least one page of a chapter is public set chapter to public too
1322  $lm_tree = new ilTree($a_lm_id);
1323  $lm_tree->setTableNames('lm_tree', 'lm_data');
1324  $lm_tree->setTreeTablePK("lm_id");
1325  $lm_tree->readRootId();
1326 
1327  $childs = $lm_tree->getChildsByType($a_chap_id, "pg");
1328 
1329  return $childs;
1330  }
+ 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 263 of file class.ilLMObject.php.

References $short_title.

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

264  {
265  return $this->short_title;
266  }
+ 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 1532 of file class.ilLMObject.php.

References $db, and $DIC.

Referenced by ilLMEditShortTitlesTableGUI\__construct().

1533  {
1534  global $DIC;
1535 
1536  $db = $DIC->database();
1537 
1538  $title_data = array();
1539  if ($a_lang == "-") {
1540  $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 = " .
1541  $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1542  } else {
1543  $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 " .
1544  " LEFT JOIN lm_tree t ON (d.obj_id = t.child) " .
1545  " LEFT JOIN lm_data_transl tr ON (tr.id = d.obj_id AND tr.lang=" . $db->quote($a_lang, "text") . ") WHERE d.lm_id = " .
1546  $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1547  }
1548  while ($rec = $db->fetchAssoc($set)) {
1549  $title_data[] = $rec;
1550  }
1551  return $title_data;
1552  }
$DIC
Definition: xapitoken.php:46
+ 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 243 of file class.ilLMObject.php.

References $title.

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

244  {
245  return $this->title;
246  }
+ 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 852 of file class.ilLMObject.php.

Referenced by clipboardCopy(), and clipboardCut().

853  {
854  $tree = new ilTree($a_cont_obj_id);
855  $tree->setTableNames('lm_tree', 'lm_data');
856  $tree->setTreeTablePK("lm_id");
857  $tree->readRootId();
858 
859  return $tree;
860  }
+ 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 1299 of file class.ilLMObject.php.

References $DIC, $ilDB, and $query.

Referenced by ilLMPagesTableGUI\fillRow().

1300  {
1301  global $DIC;
1302 
1303  $ilDB = $DIC->database();
1304 
1305  $query = "SELECT layout FROM lm_data WHERE obj_id = " .
1306  $ilDB->quote($a_obj_id, "integer");
1307  $obj_set = $ilDB->query($query);
1308  $obj_rec = $ilDB->fetchAssoc($obj_set);
1309 
1310  return $obj_rec["layout"];
1311  }
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 73 of file class.ilLMObject.php.

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

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  return true;
104  }
static _writeTitle($a_obj_id, $a_title)
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
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 952 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().

961  {
962  global $DIC;
963 
964  $ilUser = $DIC->user();
965  $ilLog = $DIC["ilLog"];
966 
967  $item_lm_id = ilLMObject::_lookupContObjID($a_item_id);
968  $item_type = ilLMObject::_lookupType($a_item_id);
969  $lm_obj = ilObjectFactory::getInstanceByObjId($item_lm_id);
970  if ($item_type == "st") {
971  $item = new ilStructureObject($lm_obj, $a_item_id);
972  } elseif ($item_type == "pg") {
973  $item = new ilLMPageObject($lm_obj, $a_item_id);
974  }
975 
976  $ilLog->write("Getting from clipboard type " . $item_type . ", " .
977  "Item ID: " . $a_item_id . ", of original LM: " . $item_lm_id);
978 
979  if ($item_lm_id != $a_target_lm->getId() && !$a_as_copy) {
980  // @todo: check whether st is NOT in tree
981 
982  // "move" metadata to new lm
983  $md = new ilMD($item_lm_id, $item->getId(), $item->getType());
984  $new_md = $md->cloneMD($a_target_lm->getId(), $item->getId(), $item->getType());
985 
986  // update lm object
987  $item->setLMId($a_target_lm->getId());
988  $item->setContentObject($a_target_lm);
989  $item->update();
990 
991  // delete old meta data set
992  $md->deleteAll();
993 
994  if ($item_type == "pg") {
995  $page = $item->getPageObject();
996  $page->buildDom();
997  $page->setParentId($a_target_lm->getId());
998  $page->update();
999  }
1000  }
1001 
1002  if ($a_as_copy) {
1003  $target_item = $item->copy($a_target_lm);
1004  $a_copied_nodes[$item->getId()] = $target_item->getId();
1005  } else {
1006  $target_item = $item;
1007  }
1008 
1009  $ilLog->write("Putting into tree type " . $target_item->getType() .
1010  "Item ID: " . $target_item->getId() . ", Parent: " . $a_parent_id . ", " .
1011  "Target: " . $a_target . ", Item LM:" . $target_item->getContentObject()->getId());
1012 
1013  ilLMObject::putInTree($target_item, $a_parent_id, $a_target);
1014 
1015  if ($a_source_lm == null) {
1016  $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
1017  } else {
1018  $childs = $a_source_lm->lm_tree->getChilds($item->getId());
1019  foreach ($childs as $k => $child) {
1020  $childs[$k]["id"] = $childs[$k]["child"];
1021  }
1022  }
1023 
1024  foreach ($childs as $child) {
1026  $a_target_lm,
1027  $child["id"],
1028  $target_item->getId(),
1029  IL_LAST_NODE,
1030  $a_insert_time,
1031  $a_copied_nodes,
1032  $a_as_copy,
1033  $a_source_lm
1034  );
1035  }
1036 
1037  return $target_item->getId();
1038  // @todo: write history (see pastePage)
1039  }
& 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.
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.
$DIC
Definition: xapitoken.php:46
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 211 of file class.ilLMObject.php.

References $DIC, and $ilDB.

Referenced by ilLMExplorerGUI\__construct().

212  {
213  global $DIC;
214 
215  $ilDB = $DIC->database();
216 
217  $set = $ilDB->query(
218  "SELECT * FROM lm_data " .
219  " WHERE lm_id = " . $ilDB->quote($a_lm_id, "integer")
220  );
221  while ($rec = $ilDB->fetchAssoc($set)) {
222  self::$data_records[$rec["obj_id"]] = $rec;
223  }
224  return count(self::$data_records);
225  }
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 802 of file class.ilLMObject.php.

References $DIC, $ilLog, and IL_FIRST_NODE.

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

803  {
804  global $DIC;
805 
806  $ilLog = $DIC["ilLog"];
807 
808  $tree = new ilTree($a_obj->getContentObject()->getId());
809  $tree->setTableNames('lm_tree', 'lm_data');
810  $tree->setTreeTablePK("lm_id");
811 
812  // determine parent
813  $parent_id = ($a_parent_id != "")
814  ? $a_parent_id
815  : $tree->getRootId();
816 
817  // determine target
818  if ($a_target_node_id != "") {
819  $target = $a_target_node_id;
820  } else {
821  // determine last child that serves as predecessor
822  if ($a_obj->getType() == "st") {
823  $s_types = array("st", "pg");
824  $childs = $tree->getChildsByTypeFilter($parent_id, $s_types);
825  } else {
826  $s_types = "pg";
827  $childs = $tree->getChildsByType($parent_id, $s_types);
828  }
829 
830  if (count($childs) == 0) {
831  $target = IL_FIRST_NODE;
832  } else {
833  $target = $childs[count($childs) - 1]["obj_id"];
834  }
835  }
836 
837  if ($tree->isInTree($parent_id) && !$tree->isInTree($a_obj->getId())) {
838  $ilLog->write("LMObject::putInTree: insertNode, ID: " . $a_obj->getId() .
839  "Parent ID: " . $parent_id . ", Target: " . $target);
840 
841  $tree->insertNode($a_obj->getId(), $parent_id, $target);
842  }
843  }
const IL_FIRST_NODE
Definition: class.ilTree.php:5
$DIC
Definition: xapitoken.php:46
+ Here is the caller graph for this function:

◆ read()

ilLMObject::read ( )

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

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

Referenced by __construct().

187  {
188  $ilDB = $this->db;
189 
190  if (!isset($this->data_record)) {
191  $query = "SELECT * FROM lm_data WHERE obj_id = " .
192  $ilDB->quote($this->id, "integer");
193  $obj_set = $ilDB->query($query);
194  $this->data_record = $ilDB->fetchAssoc($obj_set);
195  }
196 
197  $this->type = $this->data_record["type"];
198  $this->setImportId($this->data_record["import_id"]);
199  $this->setTitle($this->data_record["title"]);
200  $this->setShortTitle($this->data_record["short_title"]);
201  $this->setLayout($this->data_record["layout"]);
202  }
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 1369 of file class.ilLMObject.php.

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

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

1370  {
1371  global $DIC;
1372 
1373  $ilDB = $DIC->database();
1374 
1375  if (trim($a_exp_id) == "") {
1376  // delete export ids, if existing
1378  $a_lm_id,
1379  $a_lmobj_id,
1380  $a_type
1381  );
1382 
1383  foreach ($entries as $id => $e) {
1384  if ($e["catalog"] == "ILIAS_NID") {
1385  $identifier = new ilMDIdentifier();
1386  $identifier->setMetaId($id);
1387  $identifier->delete();
1388  }
1389  }
1390  } else {
1391  // update existing entry
1393  $a_lm_id,
1394  $a_lmobj_id,
1395  $a_type
1396  );
1397 
1398  $updated = false;
1399  foreach ($entries as $id => $e) {
1400  if ($e["catalog"] == "ILIAS_NID") {
1401  $identifier = new ilMDIdentifier();
1402  $identifier->setMetaId($id);
1403  $identifier->read();
1404  $identifier->setEntry($a_exp_id);
1405  $identifier->update();
1406  $updated = true;
1407  }
1408  }
1409 
1410  // nothing updated? create a new one
1411  if (!$updated) {
1412  $md = new ilMD($a_lm_id, $a_lmobj_id, $a_type);
1413  $md_gen = $md->getGeneral();
1414  $identifier = $md_gen->addIdentifier();
1415  $identifier->setEntry($a_exp_id);
1416  $identifier->setCatalog("ILIAS_NID");
1417  $identifier->save();
1418  }
1419  }
1420  }
$a_type
Definition: workflow.php:92
static _getEntriesForObj($a_rbac_id, $a_obj_id, $a_obj_type)
Get IDs for an object.
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 1046 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().

1047  {
1048  if ($a_lang == "") {
1049  $a_lang = "-";
1050  }
1051  if (is_array($a_titles)) {
1052  foreach ($a_titles as $id => $title) {
1053  // see #20375
1055  if ($a_lang == "-") {
1056  $lmobj = ilLMObjectFactory::getInstance($a_lm, $id, false);
1057  if (is_object($lmobj)) {
1058  // Update Title and description
1059  $md = new ilMD($a_lm->getId(), $id, $lmobj->getType());
1060  $md_gen = $md->getGeneral();
1061  if (is_object($md_gen)) { // see bug #0015843
1062  $md_gen->setTitle($title);
1063  $md_gen->update();
1064  $md->update();
1065  }
1067  }
1068  } else {
1069  $lmobjtrans = new ilLMObjTranslation($id, $a_lang);
1070  $lmobjtrans->setTitle($title);
1071  $lmobjtrans->save();
1072  }
1073  }
1074  }
1075  }
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 387 of file class.ilLMObject.php.

Referenced by __construct().

388  {
389  $this->content_object = $a_content_obj;
390  }
+ 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 181 of file class.ilLMObject.php.

182  {
183  $this->data_record = $a_record;
184  }

◆ setDescription()

ilLMObject::setDescription (   $a_description)

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

358  {
359  $this->description = $a_description;
360  }

◆ setId()

ilLMObject::setId (   $a_id)

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

Referenced by create().

398  {
399  $this->id = $a_id;
400  }
+ Here is the caller graph for this function:

◆ setImportId()

ilLMObject::setImportId (   $a_id)

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

Referenced by read().

413  {
414  $this->import_id = $a_id;
415  }
+ Here is the caller graph for this function:

◆ setLayout()

ilLMObject::setLayout (   $a_val)

Set layout.

Parameters
stringlayout

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

Referenced by read().

423  {
424  $this->layout = $a_val;
425  }
+ Here is the caller graph for this function:

◆ setLMId()

ilLMObject::setLMId (   $a_lm_id)

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

Referenced by __construct().

378  {
379  $this->lm_id = $a_lm_id;
380  }
+ 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 253 of file class.ilLMObject.php.

Referenced by read().

254  {
255  $this->short_title = $a_title;
256  }
+ 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 233 of file class.ilLMObject.php.

Referenced by read().

234  {
235  $this->title = $a_title;
236  }
+ Here is the caller graph for this function:

◆ setType()

ilLMObject::setType (   $a_type)

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

References $a_type.

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

368  {
369  $this->type = $a_type;
370  }
$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 1243 of file class.ilLMObject.php.

References $type, and _lookupType().

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

1244  {
1245  $types = array();
1246  if (is_array($a_items)) {
1247  foreach ($a_items as $item) {
1248  $type = ilLMObject::_lookupType($item);
1249  $types[$type] = $type;
1250  }
1251  }
1252 
1253  if (count($types) > 1) {
1254  return false;
1255  }
1256  return true;
1257  }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
+ 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 493 of file class.ilLMObject.php.

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

494  {
495  $ilDB = $this->db;
496 
497  $this->updateMetaData();
498 
499  $query = "UPDATE lm_data SET " .
500  " lm_id = " . $ilDB->quote($this->getLMId(), "integer") .
501  " ,title = " . $ilDB->quote($this->getTitle(), "text") .
502  " ,short_title = " . $ilDB->quote($this->getShortTitle(), "text") .
503  " ,layout = " . $ilDB->quote($this->getLayout(), "text") .
504  " WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
505 
506  $ilDB->manipulate($query);
507  }
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 1080 of file class.ilLMObject.php.

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

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

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

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

Referenced by update().

150  {
151  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
152  $md_gen = $md->getGeneral();
153  $md_gen->setTitle($this->getTitle());
154 
155  // sets first description (maybe not appropriate)
156  $md_des_ids = $md_gen->getDescriptionIds();
157  if (count($md_des_ids) > 0) {
158  $md_des = $md_gen->getDescription($md_des_ids[0]);
159  // $md_des->setDescription($this->getDescription());
160  $md_des->update();
161  }
162  $md_gen->update();
163  }
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 1265 of file class.ilLMObject.php.

References Vendor\Package\$c, $DIC, $ilDB, $query, and _lookupType().

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

1266  {
1267  global $DIC;
1268 
1269  $ilDB = $DIC->database();
1270 
1271  $t = ilLMObject::_lookupType($a_obj_id);
1272 
1273  if ($t == "pg") {
1274  $query = "UPDATE lm_data SET " .
1275  " layout = " . $ilDB->quote($a_layout, "text") .
1276  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
1277  $ilDB->manipulate($query);
1278  } elseif ($t == "st" && is_object($a_lm)) {
1279  $node = $a_lm->getLMTree()->getNodeData($a_obj_id);
1280  $child_nodes = $a_lm->getLMTree()->getSubTree($node);
1281  if (is_array($child_nodes) && count($child_nodes) > 0) {
1282  foreach ($child_nodes as $c) {
1283  if ($c["type"] == "pg") {
1284  $query = "UPDATE lm_data SET " .
1285  " layout = " . $ilDB->quote($a_layout, "text") .
1286  " WHERE obj_id = " . $ilDB->quote($c["child"], "integer");
1287  $ilDB->manipulate($query);
1288  }
1289  }
1290  }
1291  }
1292  }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
$query
global $ilDB
$DIC
Definition: xapitoken.php:46
+ 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 1560 of file class.ilLMObject.php.

References $db, and $DIC.

Referenced by ilLMEditShortTitlesGUI\save().

1561  {
1562  global $DIC;
1563 
1564  $db = $DIC->database();
1565 
1566  if ($a_lang != "-" && $a_lang != "") {
1567  $trans = new ilLMObjTranslation($a_id, $a_lang);
1568  $trans->setShortTitle($a_short_title);
1569  $trans->save();
1570  } else {
1571  $db->manipulate(
1572  "UPDATE lm_data SET " .
1573  " short_title = " . $db->quote($a_short_title, "text") .
1574  " WHERE obj_id = " . $db->quote($a_id, "integer")
1575  );
1576  }
1577  }
$DIC
Definition: xapitoken.php:46
Translation information on lm object.
+ Here is the caller graph for this function:

Field Documentation

◆ $active

ilLMObject::$active = true

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

Referenced by ilLMPageObject\_getPresentationTitle().

◆ $content_object

ilLMObject::$content_object

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

Referenced by getContentObject().

◆ $data_record

ilLMObject::$data_record

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

◆ $data_records

ilLMObject::$data_records = array()
staticprotected

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

◆ $db

ilLMObject::$db
protected

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

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

◆ $description

ilLMObject::$description

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

Referenced by getDescription().

◆ $id

ilLMObject::$id

◆ $lm_id

◆ $meta_data

ilLMObject::$meta_data

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

◆ $short_title

ilLMObject::$short_title

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

Referenced by getShortTitle().

◆ $title

◆ $type

◆ $user

ilLMObject::$user
protected

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

Referenced by createMetaData().

◆ CHAPTER_TITLE

const ilLMObject::CHAPTER_TITLE = "st_title"

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

Referenced by ilStructureObjectGUI\subchap().

◆ NO_HEADER

const ilLMObject::NO_HEADER = "none"

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

◆ PAGE_TITLE

const ilLMObject::PAGE_TITLE = "pg_title"

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