ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilLMObject.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  public const CHAPTER_TITLE = "st_title";
29  public const PAGE_TITLE = "pg_title";
30  public const NO_HEADER = "none";
31  protected string $layout = "";
32  protected string $import_id = "";
33 
34  protected ilObjUser $user;
35  public int $lm_id = 0;
36  public string $type = "";
37  public int $id = 0;
38  public ?array $data_record; // assoc array of lm_data record
40  public string $title = "";
41  public string $short_title = "";
42  public string $description = "";
43  public bool $active = true;
44  protected static $data_records = array();
45  protected ilDBInterface $db;
46 
47  public function __construct(
48  ilObjLearningModule $a_content_obj,
49  int $a_id = 0
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  }
63 
73  public function MDUpdateListener(string $a_element): 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  }
104 
105 
109  public static function _lookupNID(int $a_lm_id, int $a_lm_obj_id, string $a_type): ?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  }
124 
125 
129  public function createMetaData(): 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  }
142 
146  public function updateMetaData(): 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  }
161 
162 
166  public function deleteMetaData(): void
167  {
168  // Delete meta data
169  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
170  $md->deleteAll();
171  }
172 
173 
174 
178  public function setDataRecord(array $a_record): void
179  {
180  $this->data_record = $a_record;
181  }
182 
183  public function read(): 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  }
200 
201 
206  public static function preloadDataByLM(int $a_lm_id): 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  }
221 
222  public function setTitle(string $a_title): void
223  {
224  $this->title = $a_title;
225  }
226 
227  public function getTitle(): string
228  {
229  return $this->title;
230  }
231 
232  public function setShortTitle(string $a_title): void
233  {
234  $this->short_title = $a_title;
235  }
236 
237  public function getShortTitle(): string
238  {
239  return $this->short_title;
240  }
241 
242  protected static function _lookup(int $a_obj_id, string $a_field): 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  }
259 
260  public static function _lookupTitle(int $a_obj_id): string
261  {
262  return self::_lookup($a_obj_id, "title");
263  }
264 
265  public static function _lookupShortTitle(int $a_obj_id): string
266  {
267  return self::_lookup($a_obj_id, "short_title");
268  }
269 
270  public static function _lookupType(int $a_obj_id, int $a_lm_id = 0): 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  }
293 
294 
295  public static function _writeTitle(int $a_obj_id, string $a_title): 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  }
306 
307 
308  public function setDescription(string $a_description): void
309  {
310  $this->description = $a_description;
311  }
312 
313  public function getDescription(): string
314  {
315  return $this->description;
316  }
317 
318  public function setType(string $a_type): void
319  {
320  $this->type = $a_type;
321  }
322 
323  public function getType(): string
324  {
325  return $this->type;
326  }
327 
328  public function setLMId(int $a_lm_id): void
329  {
330  $this->lm_id = $a_lm_id;
331  }
332 
333  public function getLMId(): int
334  {
335  return $this->lm_id;
336  }
337 
338  public function setContentObject(ilObjLearningModule $a_content_obj): void
339  {
340  $this->content_object = $a_content_obj;
341  }
342 
344  {
345  return $this->content_object;
346  }
347 
348  public function setId(int $a_id): void
349  {
350  $this->id = $a_id;
351  }
352 
353  public function getId(): int
354  {
355  return $this->id;
356  }
357 
358  public function getImportId(): string
359  {
360  return $this->import_id;
361  }
362 
363  public function setImportId(string $a_id): void
364  {
365  $this->import_id = $a_id;
366  }
367 
368  public function setLayout(string $a_val): void
369  {
370  $this->layout = $a_val;
371  }
372 
373  public function getLayout(): string
374  {
375  return $this->layout;
376  }
377 
378  public static function _writeImportId(int $a_id, string $a_import_id): 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  }
392 
393  public function create(bool $a_upload = false): 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  }
423 
424  public function update(): 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  }
439 
440 
444  public static function _writePublicAccessStatus(
445  array $a_pages,
446  int $a_cont_obj_id
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  }
500 
501  public static function _isPagePublic(
502  int $a_node_id,
503  bool $a_check_public_mode = false
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  }
536 
537  public function delete(bool $a_delete_meta_data = true): 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  }
547 
555  public static function _getIdForImportId(string $a_import_id): 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  }
579 
585  public static function _getAllObjectsForImportId(
586  string $a_import_id,
587  int $a_in_lm = 0
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  }
613 
617  public static function _exists(int $a_id): 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  }
636 
637  public static function getObjectList(
638  int $lm_id,
639  string $type = ""
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  }
663 
664 
668  public static function _deleteAllObjectData(
669  ilObjLearningModule $a_cobj
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  }
687 
691  public static function _lookupContObjID(int $a_id): 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  }
708 
712  public static function putInTree(
713  ilLMObject $a_obj,
714  int $a_parent_id = 0,
715  int $a_target_node_id = 0
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  }
755 
759  public static function getTree(
760  int $a_cont_obj_id
761  ): ilLMTree {
762  $tree = new ilLMTree($a_cont_obj_id);
763  $tree->readRootId();
764 
765  return $tree;
766  }
767 
771  public static function clipboardCut(
772  int $a_cont_obj_id,
773  array $a_ids
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  }
808 
812  public static function clipboardCopy(
813  int $a_cont_obj_id,
814  array $a_ids
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  }
859 
863  public static function pasteTree(
864  ilObjLearningModule $a_target_lm,
865  int $a_item_id,
866  int $a_parent_id,
867  int $a_target,
868  string $a_insert_time,
869  array &$a_copied_nodes,
870  bool $a_as_copy = false,
871  ?ilObjLearningModule $a_source_lm = null
872  ): int {
873  global $DIC;
874 
875  $item = null;
876  $ilUser = $DIC->user();
877  $ilLog = $DIC["ilLog"];
878 
879  $item_lm_id = ilLMObject::_lookupContObjID($a_item_id);
880  $item_type = ilLMObject::_lookupType($a_item_id);
882  $lm_obj = ilObjectFactory::getInstanceByObjId($item_lm_id);
883  if ($item_type == "st") {
884  $item = new ilStructureObject($lm_obj, $a_item_id);
885  } elseif ($item_type == "pg") {
886  $item = new ilLMPageObject($lm_obj, $a_item_id);
887  }
888 
889  $ilLog->write("Getting from clipboard type " . $item_type . ", " .
890  "Item ID: " . $a_item_id . ", of original LM: " . $item_lm_id);
891 
892  if ($item_lm_id != $a_target_lm->getId() && !$a_as_copy) {
893  // @todo: check whether st is NOT in tree
894 
895  // "move" metadata to new lm
896  $md = new ilMD($item_lm_id, $item->getId(), $item->getType());
897  $new_md = $md->cloneMD($a_target_lm->getId(), $item->getId(), $item->getType());
898 
899  // update lm object
900  $item->setLMId($a_target_lm->getId());
901  $item->setContentObject($a_target_lm);
902  $item->update();
903 
904  // delete old meta data set
905  $md->deleteAll();
906 
907  if ($item_type == "pg") {
908  $page = $item->getPageObject();
909  $page->buildDom();
910  $page->setParentId($a_target_lm->getId());
911  $page->update();
912  }
913  }
914 
915  if ($a_as_copy) {
916  $target_item = $item->copy($a_target_lm);
917  $a_copied_nodes[$item->getId()] = $target_item->getId();
918  } else {
919  $target_item = $item;
920  }
921 
922  $ilLog->write("Putting into tree type " . $target_item->getType() .
923  "Item ID: " . $target_item->getId() . ", Parent: " . $a_parent_id . ", " .
924  "Target: " . $a_target . ", Item LM:" . $target_item->getContentObject()->getId());
925 
926  ilLMObject::putInTree($target_item, $a_parent_id, $a_target);
927 
928  if ($a_source_lm == null) {
929  $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
930  } else {
931  $childs = $a_source_lm->lm_tree->getChilds($item->getId());
932  foreach ($childs as $k => $child) {
933  $childs[$k]["id"] = $child["child"];
934  }
935  }
936 
937  foreach ($childs as $child) {
938  ilLMObject::pasteTree(
939  $a_target_lm,
940  $child["id"],
941  $target_item->getId(),
943  $a_insert_time,
944  $a_copied_nodes,
945  $a_as_copy,
946  $a_source_lm
947  );
948  }
949 
950  return $target_item->getId();
951  // @todo: write history (see pastePage)
952  }
953 
957  public static function saveTitles(
958  ilObjLearningModule $a_lm,
959  array $a_titles,
960  string $a_lang = "-"
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  }
980  ilLMObject::_writeTitle($id, $title);
981  }
982  } else {
983  $lmobjtrans = new ilLMObjTranslation($id, $a_lang);
984  $lmobjtrans->setTitle($title);
985  $lmobjtrans->save();
986  }
987  }
988  }
989  }
990 
994  public static function updateInternalLinks(
995  array $a_copied_nodes,
996  string $a_parent_type = "lm"
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  }
1153 
1157  public static function uniqueTypesCheck(array $a_items): 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  }
1172 
1176  public static function writeLayout(
1177  int $a_obj_id,
1178  string $a_layout,
1179  ?ilObjLearningModule $a_lm = null
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  }
1207 
1211  public static function lookupLayout(int $a_obj_id): 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  }
1224 
1228  public static function getPagesOfChapter(
1229  int $a_lm_id,
1230  int $a_chap_id
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  }
1242 
1246  public static function _getAllLMObjectsOfLM(
1247  int $a_lm_id,
1248  string $a_type = ""
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  }
1267 
1268 
1272 
1273  public static function saveExportId(
1274  int $a_lm_id,
1275  int $a_lmobj_id,
1276  string $a_exp_id,
1277  string $a_type = "pg"
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  }
1320 
1321  public static function getExportId(
1322  int $a_lm_id,
1323  int $a_lmobj_id,
1324  string $a_type = "pg"
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  }
1340 
1344  public function existsExportID(
1345  int $a_lm_id,
1346  int $a_exp_id,
1347  string $a_type = "pg"
1348  ): bool {
1349  return ilMDIdentifier::existsIdInRbacObject($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1350  }
1351 
1355  public static function getDuplicateExportIDs(
1356  int $a_lm_id,
1357  string $a_type = "pg"
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  }
1370 
1371  public function getExportIDInfo(
1372  int $a_lm_id,
1373  int $a_exp_id,
1374  string $a_type = "pg"
1375  ): array {
1376  $data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1377  return $data;
1378  }
1379 
1380  // Get effective title
1381  public static function _getNodePresentationTitle(
1382  array $a_node,
1383  string $a_mode = self::PAGE_TITLE,
1384  bool $a_include_numbers = false,
1385  bool $a_time_scheduled_activation = false,
1386  bool $a_force_content = false,
1387  int $a_lm_id = 0,
1388  string $a_lang = "-"
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  }
1416 
1417  public static function getShortTitles(
1418  int $a_lm_id,
1419  string $a_lang = "-"
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  }
1440 
1441  public static function writeShortTitle(
1442  int $a_id,
1443  string $a_short_title,
1444  string $a_lang = "-"
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  }
1462 }
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
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)
$res
Definition: ltiservices.php:69
static _isPagePublic(int $a_node_id, bool $a_check_public_mode=false)
static _getMobsForTarget(string $a_type, string $a_target)
Get areas for a certain target.
setDescription(string $a_description)
getExportIDInfo(int $a_lm_id, int $a_exp_id, string $a_type="pg")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupNID(int $a_lm_id, int $a_lm_obj_id, string $a_type)
lookup named identifier (ILIAS_NID)
static readIdData(int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)
static $data_records
static _writePublicAccessStatus(array $a_pages, int $a_cont_obj_id)
update public access flags in lm_data for all pages of a content object
const IL_INST_ID
Definition: constants.php:40
static getExportId(int $a_lm_id, int $a_lmobj_id, string $a_type="pg")
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.
static _getAllObjectsForImportId(string $a_import_id, int $a_in_lm=0)
Get all items for an import ID.
static saveTitles(ilObjLearningModule $a_lm, array $a_titles, string $a_lang="-")
Save titles for lm objects.
fetchAssoc(ilDBStatement $statement)
static lookupUsages(int $a_id, bool $a_include_history=true)
Lookup usages of media object.
static _getAllReferences(int $id)
get all reference ids for object ID
static _deleteAllObjectData(ilObjLearningModule $a_cobj)
delete all objects of content object (digi book / learning module)
string $description
static uniqueTypesCheck(array $a_items)
Check for unique types (all pages or all chapters)
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
MDUpdateListener(string $a_element)
Meta data update listener Important note: Do never call create() or update() method of ilObject here...
setType(string $a_type)
create(bool $a_upload=false)
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static _lookupShortTitle(int $a_obj_id)
static getObjectList(int $lm_id, string $type="")
quote($value, string $type)
static preloadDataByLM(int $a_lm_id)
Preload data records by lm.
static clipboardCut(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Definition: class.ilStr.php:24
static existsIdInRbacObject(int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)
static getTree(int $a_cont_obj_id)
Get learning module tree.
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.
string $short_title
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
$ilErr
Definition: raiseError.php:17
$path
Definition: ltiservices.php:32
static writeShortTitle(int $a_id, string $a_short_title, string $a_lang="-")
static _lookupTitle(int $a_obj_id)
global $DIC
Definition: feed.php:28
__construct(ilObjLearningModule $a_content_obj, int $a_id=0)
const POS_FIRST_NODE
int $updated
Timestamp for when the object was last updated.
Definition: System.php:158
setId(int $a_id)
setLayout(string $a_val)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static writeLayout(int $a_obj_id, string $a_layout, ?ilObjLearningModule $a_lm=null)
Write layout setting.
static _getEntriesForObj(int $a_rbac_id, int $a_obj_id, string $a_obj_type)
static _getIdForImportId(string $a_import_id)
get current object id for import id (static)
static getPagesOfChapter(int $a_lm_id, int $a_chap_id)
Get pages of chapter.
setLMId(int $a_lm_id)
ilObjUser $user
static _refreshStatus(int $a_obj_id, ?array $a_users=null)
ilDBInterface $db
query(string $query)
Run a (read-only) Query on the database.
setTitle(string $a_title)
updateMetaData()
update meta data entry
setImportId(string $a_id)
static _getAllLMObjectsOfLM(int $a_lm_id, string $a_type="")
Get all objects of learning module.
existsExportID(int $a_lm_id, int $a_exp_id, string $a_type="pg")
Does export ID exist in lm?
static _writeImportId(int $a_id, string $a_import_id)
static _writeTitle(int $a_obj_id, string $a_title)
setShortTitle(string $a_title)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
const POS_LAST_NODE
static _exists(int $a_id)
checks wether a lm content object with specified id exists or not
static saveExportId(int $a_lm_id, int $a_lmobj_id, string $a_exp_id, string $a_type="pg")
static getShortTitles(int $a_lm_id, string $a_lang="-")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createMetaData()
create meta data entry
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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&#39;t have to be page title, it may be chapter title + page title or chapter tit...
static removeProhibitedCharacters(string $a_text)
Remove prohibited characters see #19159.
getGeneral()
Definition: class.ilMD.php:34
static getDuplicateExportIDs(int $a_lm_id, string $a_type="pg")
Get duplicate export IDs (count export ID usages)
static _lookupType(int $a_obj_id, int $a_lm_id=0)
$q
Definition: shib_logout.php:21
static _lookupContObjID(int $a_id)
get learning module id for lm object
deleteMetaData()
delete meta data entry
static yn2tf(string $a_yn)
$message
Definition: xapiexit.php:32
ilObjLearningModule $content_object
static _getEntriesForRbacObj(int $a_rbac_id, string $a_obj_type="")
static lookupLayout(int $a_obj_id)
Lookup type.
manipulate(string $query)
Run a (write) Query on the database.
static _lookupType(int $id, bool $reference=false)
setContentObject(ilObjLearningModule $a_content_obj)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $obj_id)
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.
cloneMD(int $a_rbac_id, int $a_obj_id, string $a_obj_type)
Definition: class.ilMD.php:288
static _lookup(int $a_obj_id, string $a_field)
$r
static clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
setDataRecord(array $a_record)
this method should only be called by class ilLMObjectFactory
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="-")