ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilLMObject Class Reference

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

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

Public Member Functions

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

Static Public Member Functions

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

Data Fields

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

Static Protected Member Functions

static _lookup (int $a_obj_id, string $a_field)
 

Protected Attributes

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

Static Protected Attributes

static $data_records = array()
 

Detailed Description

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

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

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

Base class for ilStructureObjects and ilPageObjects (see ILIAS DTD)

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

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

Member Function Documentation

◆ _deleteAllObjectData()

static ilLMObject::_deleteAllObjectData ( ilObjLearningModule  $a_cobj)
static

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

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

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

Referenced by ilObjContentObject\getExportDirectory().

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

◆ _exists()

static ilLMObject::_exists ( int  $a_id)
static

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

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

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

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

617  : bool
618  {
619  global $DIC;
620 
621  $ilDB = $DIC->database();
622 
623  if (is_int(strpos($a_id, "_"))) {
625  }
626 
627  $q = "SELECT * FROM lm_data WHERE obj_id = " .
628  $ilDB->quote($a_id, "integer");
629  $obj_set = $ilDB->query($q);
630  if ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
631  return true;
632  } else {
633  return false;
634  }
635  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getAllLMObjectsOfLM()

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

Get all objects of learning module.

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

References $DIC, and $ilDB.

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

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

◆ _getAllObjectsForImportId()

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

Get all items for an import ID.

(only for items notnot in trash)

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

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

Referenced by updateInternalLinks().

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

◆ _getIdForImportId()

static ilLMObject::_getIdForImportId ( string  $a_import_id)
static

get current object id for import id (static)

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

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

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

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

555  : int
556  {
557  global $DIC;
558 
559  $ilDB = $DIC->database();
560  $help_module = $DIC->help()->internal()->domain()->module();
561 
562  $q = "SELECT obj_id FROM lm_data WHERE import_id = " .
563  $ilDB->quote($a_import_id, "text") . " " .
564  " ORDER BY create_date DESC";
565  $obj_set = $ilDB->query($q);
566  while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
567  $lm_id = ilLMObject::_lookupContObjID($obj_rec["obj_id"]);
568 
569  // link only in learning module, that is not trashed
570  $ref_ids = ilObject::_getAllReferences($lm_id); // will be 0 if import of lm is in progress (new import)
571  if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($lm_id) ||
572  $help_module->isHelpLM($lm_id)) {
573  return $obj_rec["obj_id"];
574  }
575  }
576 
577  return 0;
578  }
static _getAllReferences(int $id)
get all reference ids for object ID
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
static _lookupContObjID(int $a_id)
get learning module id for lm object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getNodePresentationTitle()

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

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

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

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

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

◆ _isPagePublic()

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

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

References $DIC, $ilDB, $message, $q, $r, _lookupContObjID(), and ilUtil\yn2tf().

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

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

◆ _lookup()

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

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

References $DIC, and $ilDB.

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

◆ _lookupContObjID()

static ilLMObject::_lookupContObjID ( int  $a_id)
static

get learning module id for lm object

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

References $DIC, and $ilDB.

Referenced by ilObjContentObjectAccess\_checkGoto(), _getIdForImportId(), ilStructureObject\_getPresentationTitle(), ilLMPageObject\_getPresentationTitle(), ilLMPageObjectGUI\_goto(), ilStructureObjectGUI\_goto(), _isPagePublic(), ilObjContentObjectGUI\activatePages(), ilObjMediaObjectAccess\checkAccessGlossaryTerm(), ilLMEditorGUI\checkRequestParameters(), clipboardCopy(), ilLMNavigationStatus\determineStatus(), ilLinksTableGUI\fillRow(), ilLearningModuleImporter\finalProcessing(), ilPageLinker\getLinkXML(), ilLMPageObjectGUI\getLinkXML(), ilLMPresentationLinker\getLinkXML(), ilObjMediaObject\getParentObjectIdForUsage(), ilLearningModuleDataSet\importRecord(), ilGlossaryPresentationGUI\listDefinitions(), ilStartUpGUI\processIndexPHP(), ilLMEditShortTitlesGUI\save(), ilHelpGUI\showHelp(), and updateInternalLinks().

691  : int
692  {
693  global $DIC;
694 
695  $ilDB = $DIC->database();
696 
697  if (isset(self::$data_records[$a_id])) {
698  return self::$data_records[$a_id]["lm_id"];
699  }
700 
701  $query = "SELECT lm_id FROM lm_data WHERE obj_id = " .
702  $ilDB->quote($a_id, "integer");
703  $obj_set = $ilDB->query($query);
704  $obj_rec = $ilDB->fetchAssoc($obj_set);
705 
706  return (int) ($obj_rec["lm_id"] ?? 0);
707  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ _lookupNID()

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

lookup named identifier (ILIAS_NID)

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

References $id.

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

◆ _lookupShortTitle()

static ilLMObject::_lookupShortTitle ( int  $a_obj_id)
static

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

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

265  : string
266  {
267  return self::_lookup($a_obj_id, "short_title");
268  }
+ Here is the caller graph for this function:

◆ _lookupTitle()

◆ _lookupType()

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

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

References $DIC, and $ilDB.

Referenced by ilStructureObjectGUI\activatePages(), clipboardCopy(), ilLMNavigationStatus\determineStatus(), ilLMContentRendererGUI\determineStatus(), ILIAS\COPage\Link\LinkManager\getDefaultLMTypeLookuper(), ilLMTOCExplorerGUIFactory\getExplorer(), ilObjLearningModuleSubItemListGUI\getHTML(), ilLMTOCExplorerGUI\getRootNode(), ilLMNavigationStatus\getSuccessorPageId(), ilObjContentObjectGUI\saveExportIds(), ilLMPresentationGUI\showPrintView(), uniqueTypesCheck(), updateInternalLinks(), ilCourseObjectivesGUI\updateMaterialAssignment(), and writeLayout().

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

◆ _writeImportId()

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

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

References $DIC, $ilDB, and $q.

Referenced by ilQuestionPageParser\handlerEndTag().

378  : void
379  {
380  global $DIC;
381 
382  $ilDB = $DIC->database();
383 
384  $q = "UPDATE lm_data " .
385  "SET " .
386  "import_id = " . $ilDB->quote($a_import_id, "text") . "," .
387  "last_update = " . $ilDB->now() . " " .
388  "WHERE obj_id = " . $ilDB->quote($a_id, "integer");
389 
390  $ilDB->manipulate($q);
391  }
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
+ Here is the caller graph for this function:

◆ _writePublicAccessStatus()

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

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

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

References $DIC, $ilDB, $ilErr, $message, $q, and $r.

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

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

◆ _writeTitle()

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

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

References $DIC, and $ilDB.

Referenced by MDUpdateListener(), and saveTitles().

295  : void
296  {
297  global $DIC;
298 
299  $ilDB = $DIC->database();
300 
301  $query = "UPDATE lm_data SET " .
302  " title = " . $ilDB->quote($a_title, "text") .
303  " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
304  $ilDB->manipulate($query);
305  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ clipboardCopy()

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

Copy a set of chapters/pages into the clipboard.

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

References $DIC, _lookupContObjID(), _lookupType(), ilMD\cloneMD(), ilObject\getId(), ilObjectFactory\getInstanceByObjId(), getTree(), ILIAS\Repository\int(), ilTree\POS_LAST_NODE, putInTree(), and ilStr\subStr().

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

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

◆ clipboardCut()

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

Copy a set of chapters/pages into the clipboard.

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

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

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

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

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

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

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

◆ createMetaData()

ilLMObject::createMetaData ( )

create meta data entry

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

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

Referenced by create().

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

◆ delete()

ilLMObject::delete ( bool  $a_delete_meta_data = true)

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

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

537  : void
538  {
539  $ilDB = $this->db;
540 
541  $query = "DELETE FROM lm_data WHERE obj_id = " .
542  $ilDB->quote($this->getId(), "integer");
543  $ilDB->manipulate($query);
544 
545  $this->deleteMetaData();
546  }
ilDBInterface $db
deleteMetaData()
delete meta data entry
+ Here is the call graph for this function:

◆ deleteMetaData()

ilLMObject::deleteMetaData ( )

delete meta data entry

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

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

Referenced by delete().

166  : void
167  {
168  // Delete meta data
169  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
170  $md->deleteAll();
171  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ existsExportID()

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

Does export ID exist in lm?

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

References ilMDIdentifier\existsIdInRbacObject().

Referenced by ilLMPageObject\copy().

1348  : bool {
1349  return ilMDIdentifier::existsIdInRbacObject($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1350  }
static existsIdInRbacObject(int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContentObject()

ilLMObject::getContentObject ( )

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

References $content_object.

Referenced by ilStructureObject\exportXMLStructureObjects(), and putInTree().

344  {
345  return $this->content_object;
346  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjLearningModule $content_object
+ Here is the caller graph for this function:

◆ getDescription()

ilLMObject::getDescription ( )

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

References $description.

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

313  : string
314  {
315  return $this->description;
316  }
string $description
+ Here is the caller graph for this function:

◆ getDuplicateExportIDs()

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

Get duplicate export IDs (count export ID usages)

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

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

Referenced by ilExportIDTableGUI\__construct().

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

◆ getExportId()

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

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

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

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

1325  : string {
1326  // look for export id
1328  $a_lm_id,
1329  $a_lmobj_id,
1330  $a_type
1331  );
1332 
1333  foreach ($entries as $e) {
1334  if ($e["catalog"] == "ILIAS_NID") {
1335  return $e["entry"];
1336  }
1337  }
1338  return "";
1339  }
static _getEntriesForObj(int $a_rbac_id, int $a_obj_id, string $a_obj_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getExportIDInfo()

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

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

References $data, and ilMDIdentifier\readIdData().

1375  : array {
1376  $data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1377  return $data;
1378  }
static readIdData(int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)
+ Here is the call graph for this function:

◆ getId()

◆ getImportId()

ilLMObject::getImportId ( )

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

References $import_id.

Referenced by create().

358  : string
359  {
360  return $this->import_id;
361  }
+ Here is the caller graph for this function:

◆ getLayout()

ilLMObject::getLayout ( )

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

References $layout.

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

373  : string
374  {
375  return $this->layout;
376  }
+ Here is the caller graph for this function:

◆ getLMId()

◆ getObjectList()

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

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

References $DIC, and $ilDB.

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

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

◆ getPagesOfChapter()

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

Get pages of chapter.

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

Referenced by ilHelpGUI\showHelp().

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

◆ getShortTitle()

ilLMObject::getShortTitle ( )

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

References $short_title.

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

237  : string
238  {
239  return $this->short_title;
240  }
string $short_title
+ Here is the caller graph for this function:

◆ getShortTitles()

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

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

References $DIC, ilDBInterface\fetchAssoc(), ilDBInterface\query(), and ilDBInterface\quote().

Referenced by ilLMEditShortTitlesTableGUI\__construct().

1420  : array {
1421  global $DIC;
1422 
1423  $db = $DIC->database();
1424 
1425  $title_data = array();
1426  if ($a_lang == "-") {
1427  $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 = " .
1428  $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1429  } else {
1430  $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 " .
1431  " LEFT JOIN lm_tree t ON (d.obj_id = t.child) " .
1432  " LEFT JOIN lm_data_transl tr ON (tr.id = d.obj_id AND tr.lang=" . $db->quote($a_lang, "text") . ") WHERE d.lm_id = " .
1433  $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1434  }
1435  while ($rec = $db->fetchAssoc($set)) {
1436  $title_data[] = $rec;
1437  }
1438  return $title_data;
1439  }
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
global $DIC
Definition: feed.php:28
ilDBInterface $db
query(string $query)
Run a (read-only) Query on the database.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilLMObject::getTitle ( )

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

References $title.

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

227  : string
228  {
229  return $this->title;
230  }
+ Here is the caller graph for this function:

◆ getTree()

static ilLMObject::getTree ( int  $a_cont_obj_id)
static

Get learning module tree.

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

Referenced by clipboardCopy(), and clipboardCut().

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

◆ getType()

ilLMObject::getType ( )

◆ lookupLayout()

static ilLMObject::lookupLayout ( int  $a_obj_id)
static

Lookup type.

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

References $DIC, and $ilDB.

Referenced by ilLMPagesTableGUI\fillRow().

1211  : string
1212  {
1213  global $DIC;
1214 
1215  $ilDB = $DIC->database();
1216 
1217  $query = "SELECT layout FROM lm_data WHERE obj_id = " .
1218  $ilDB->quote($a_obj_id, "integer");
1219  $obj_set = $ilDB->query($query);
1220  $obj_rec = $ilDB->fetchAssoc($obj_set);
1221 
1222  return $obj_rec["layout"];
1223  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ MDUpdateListener()

ilLMObject::MDUpdateListener ( string  $a_element)

Meta data update listener Important note: Do never call create() or update() method of ilObject here.

It would result in an endless loop: update object -> update meta -> update object -> ... Use static _writeTitle() ... methods instead.

Parameters
string$a_elementmd element

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

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

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

◆ preloadDataByLM()

static ilLMObject::preloadDataByLM ( int  $a_lm_id)
static

Preload data records by lm.

Returns
int number of preloaded records

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

References $DIC, and $ilDB.

Referenced by ilLMExplorerGUI\__construct().

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

◆ putInTree()

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

put this object into content object tree

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

References $DIC, getContentObject(), getId(), ilTree\getRootId(), getType(), and ilTree\POS_FIRST_NODE.

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

716  : void {
717  global $DIC;
718 
719  $ilLog = $DIC["ilLog"];
720 
721  $tree = new ilLMTree($a_obj->getContentObject()->getId());
722 
723  // determine parent
724  $parent_id = ($a_parent_id != 0)
725  ? $a_parent_id
726  : $tree->getRootId();
727 
728  // determine target
729  if ($a_target_node_id != 0) {
730  $target = $a_target_node_id;
731  } else {
732  // determine last child that serves as predecessor
733  if ($a_obj->getType() == "st") {
734  $s_types = array("st", "pg");
735  $childs = $tree->getChildsByTypeFilter($parent_id, $s_types);
736  } else {
737  $s_types = "pg";
738  $childs = $tree->getChildsByType($parent_id, $s_types);
739  }
740 
741  if (count($childs) == 0) {
742  $target = ilTree::POS_FIRST_NODE;
743  } else {
744  $target = $childs[count($childs) - 1]["obj_id"];
745  }
746  }
747 
748  if ($tree->isInTree($parent_id) && !$tree->isInTree($a_obj->getId())) {
749  $ilLog->write("LMObject::putInTree: insertNode, ID: " . $a_obj->getId() .
750  "Parent ID: " . $parent_id . ", Target: " . $target);
751 
752  $tree->insertNode($a_obj->getId(), $parent_id, $target);
753  }
754  }
global $DIC
Definition: feed.php:28
const POS_FIRST_NODE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilLMObject::read ( )

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

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

Referenced by __construct().

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

◆ saveExportId()

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

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

References Vendor\Package\$e, ILIAS\LTI\ToolProvider\$updated, and ilMDIdentifier\_getEntriesForObj().

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

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

◆ saveTitles()

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

Save titles for lm objects.

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

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

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

961  : void {
962  if ($a_lang == "") {
963  $a_lang = "-";
964  }
965  if (is_array($a_titles)) {
966  foreach ($a_titles as $id => $title) {
967  // see #20375
969  if ($a_lang == "-") {
970  $lmobj = ilLMObjectFactory::getInstance($a_lm, $id, false);
971  if (is_object($lmobj)) {
972  // Update Title and description
973  $md = new ilMD($a_lm->getId(), $id, $lmobj->getType());
974  $md_gen = $md->getGeneral();
975  if (is_object($md_gen)) { // see bug #0015843
976  $md_gen->setTitle($title);
977  $md_gen->update();
978  $md->update();
979  }
981  }
982  } else {
983  $lmobjtrans = new ilLMObjTranslation($id, $a_lang);
984  $lmobjtrans->setTitle($title);
985  $lmobjtrans->save();
986  }
987  }
988  }
989  }
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
static _writeTitle(int $a_obj_id, string $a_title)
static removeProhibitedCharacters(string $a_text)
Remove prohibited characters see #19159.
getGeneral()
Definition: class.ilMD.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContentObject()

ilLMObject::setContentObject ( ilObjLearningModule  $a_content_obj)

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

Referenced by __construct().

338  : void
339  {
340  $this->content_object = $a_content_obj;
341  }
+ Here is the caller graph for this function:

◆ setDataRecord()

ilLMObject::setDataRecord ( array  $a_record)

this method should only be called by class ilLMObjectFactory

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

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

◆ setDescription()

ilLMObject::setDescription ( string  $a_description)

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

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

◆ setId()

ilLMObject::setId ( int  $a_id)

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

Referenced by create().

348  : void
349  {
350  $this->id = $a_id;
351  }
+ Here is the caller graph for this function:

◆ setImportId()

ilLMObject::setImportId ( string  $a_id)

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

Referenced by read().

363  : void
364  {
365  $this->import_id = $a_id;
366  }
+ Here is the caller graph for this function:

◆ setLayout()

ilLMObject::setLayout ( string  $a_val)

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

Referenced by read().

368  : void
369  {
370  $this->layout = $a_val;
371  }
+ Here is the caller graph for this function:

◆ setLMId()

ilLMObject::setLMId ( int  $a_lm_id)

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

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

328  : void
329  {
330  $this->lm_id = $a_lm_id;
331  }
+ Here is the caller graph for this function:

◆ setShortTitle()

ilLMObject::setShortTitle ( string  $a_title)

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

Referenced by read().

232  : void
233  {
234  $this->short_title = $a_title;
235  }
+ Here is the caller graph for this function:

◆ setTitle()

ilLMObject::setTitle ( string  $a_title)

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

Referenced by read().

222  : void
223  {
224  $this->title = $a_title;
225  }
+ Here is the caller graph for this function:

◆ setType()

ilLMObject::setType ( string  $a_type)

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

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

318  : void
319  {
320  $this->type = $a_type;
321  }
+ Here is the caller graph for this function:

◆ uniqueTypesCheck()

static ilLMObject::uniqueTypesCheck ( array  $a_items)
static

Check for unique types (all pages or all chapters)

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

References $type, and _lookupType().

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

1157  : bool
1158  {
1159  $types = array();
1160  if (is_array($a_items)) {
1161  foreach ($a_items as $item) {
1162  $type = ilLMObject::_lookupType($item);
1163  $types[$type] = $type;
1164  }
1165  }
1166 
1167  if (count($types) > 1) {
1168  return false;
1169  }
1170  return true;
1171  }
static _lookupType(int $a_obj_id, int $a_lm_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilLMObject::update ( )

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

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

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

◆ updateInternalLinks()

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

Update internal links, after multiple pages have been copied.

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

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

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

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

◆ updateMetaData()

ilLMObject::updateMetaData ( )

update meta data entry

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

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

Referenced by update().

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

◆ writeLayout()

static ilLMObject::writeLayout ( int  $a_obj_id,
string  $a_layout,
?ilObjLearningModule  $a_lm = null 
)
static

Write layout setting.

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

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

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

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

◆ writeShortTitle()

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

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

References $DIC, ilDBInterface\manipulate(), and ilDBInterface\quote().

Referenced by ilLMEditShortTitlesGUI\save().

1445  : void {
1446  global $DIC;
1447 
1448  $db = $DIC->database();
1449 
1450  if ($a_lang != "-" && $a_lang != "") {
1451  $trans = new ilLMObjTranslation($a_id, $a_lang);
1452  $trans->setShortTitle($a_short_title);
1453  $trans->save();
1454  } else {
1455  $db->manipulate(
1456  "UPDATE lm_data SET " .
1457  " short_title = " . $db->quote($a_short_title, "text") .
1458  " WHERE obj_id = " . $db->quote($a_id, "integer")
1459  );
1460  }
1461  }
quote($value, string $type)
global $DIC
Definition: feed.php:28
ilDBInterface $db
manipulate(string $query)
Run a (write) Query on the database.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $active

bool ilLMObject::$active = true

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

Referenced by ilLMPageObject\_getPresentationTitle().

◆ $content_object

ilObjLearningModule ilLMObject::$content_object

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

Referenced by getContentObject().

◆ $data_record

array ilLMObject::$data_record

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

◆ $data_records

ilLMObject::$data_records = array()
staticprotected

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

◆ $db

ilDBInterface ilLMObject::$db
protected

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

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

◆ $description

string ilLMObject::$description = ""

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

Referenced by getDescription().

◆ $id

int ilLMObject::$id = 0

◆ $import_id

string ilLMObject::$import_id = ""
protected

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

Referenced by getImportId().

◆ $layout

string ilLMObject::$layout = ""
protected

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

Referenced by getLayout().

◆ $lm_id

int ilLMObject::$lm_id = 0

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

Referenced by getLMId().

◆ $short_title

string ilLMObject::$short_title = ""

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

Referenced by getShortTitle().

◆ $title

◆ $type

string ilLMObject::$type = ""

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

Referenced by getType(), and uniqueTypesCheck().

◆ $user

ilObjUser ilLMObject::$user
protected

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

Referenced by createMetaData().

◆ CHAPTER_TITLE

◆ NO_HEADER

const ilLMObject::NO_HEADER = "none"

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

◆ PAGE_TITLE


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