ILIAS  release_8 Revision v8.24
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 {
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 {
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 {
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 {
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 {
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
561 $q = "SELECT obj_id FROM lm_data WHERE import_id = " .
562 $ilDB->quote($a_import_id, "text") . " " .
563 " ORDER BY create_date DESC";
564 $obj_set = $ilDB->query($q);
565 while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
566 $lm_id = ilLMObject::_lookupContObjID($obj_rec["obj_id"]);
567
568 // link only in learning module, that is not trashed
569 $ref_ids = ilObject::_getAllReferences($lm_id); // will be 0 if import of lm is in progress (new import)
570 if (count($ref_ids) == 0 || ilObject::_hasUntrashedReference($lm_id) ||
572 return $obj_rec["obj_id"];
573 }
574 }
575
576 return 0;
577 }
578
584 public static function _getAllObjectsForImportId(
585 string $a_import_id,
586 int $a_in_lm = 0
587 ): array {
588 global $DIC;
589
590 $ilDB = $DIC->database();
591
592 $where = ($a_in_lm > 0)
593 ? " AND lm_id = " . $ilDB->quote($a_in_lm, "integer") . " "
594 : "";
595
596 $q = "SELECT * FROM lm_data WHERE import_id = " .
597 $ilDB->quote($a_import_id, "text") . " " .
598 $where .
599 " ORDER BY create_date DESC";
600 $obj_set = $ilDB->query($q);
601
602 $items = array();
603 while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
604 // check, whether lm is not trashed
605 if (ilObject::_hasUntrashedReference($obj_rec["lm_id"])) {
606 $items[] = $obj_rec;
607 }
608 }
609
610 return $items;
611 }
612
616 public static function _exists(int $a_id): bool
617 {
618 global $DIC;
619
620 $ilDB = $DIC->database();
621
622 if (is_int(strpos($a_id, "_"))) {
624 }
625
626 $q = "SELECT * FROM lm_data WHERE obj_id = " .
627 $ilDB->quote($a_id, "integer");
628 $obj_set = $ilDB->query($q);
629 if ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
630 return true;
631 } else {
632 return false;
633 }
634 }
635
636 public static function getObjectList(
637 int $lm_id,
638 string $type = ""
639 ): array {
640 global $DIC;
641
642 $ilDB = $DIC->database();
643
644 $type_str = ($type != "")
645 ? "AND type = " . $ilDB->quote($type, "text") . " "
646 : "";
647
648 $query = "SELECT * FROM lm_data " .
649 "WHERE lm_id= " . $ilDB->quote($lm_id, "integer") . " " .
650 $type_str . " " .
651 "ORDER BY title";
652 $obj_set = $ilDB->query($query);
653 $obj_list = array();
654 while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
655 $obj_list[] = array("obj_id" => $obj_rec["obj_id"],
656 "title" => $obj_rec["title"],
657 "import_id" => $obj_rec["import_id"],
658 "type" => $obj_rec["type"]);
659 }
660 return $obj_list;
661 }
662
663
667 public static function _deleteAllObjectData(
668 ilObjLearningModule $a_cobj
669 ): void {
670 global $DIC;
671
672 $ilDB = $DIC->database();
673
674 $query = "SELECT * FROM lm_data " .
675 "WHERE lm_id= " . $ilDB->quote($a_cobj->getId(), "integer");
676 $obj_set = $ilDB->query($query);
677
678 while ($obj_rec = $ilDB->fetchAssoc($obj_set)) {
679 $lm_obj = ilLMObjectFactory::getInstance($a_cobj, $obj_rec["obj_id"], false);
680
681 if (is_object($lm_obj)) {
682 $lm_obj->delete(true);
683 }
684 }
685 }
686
690 public static function _lookupContObjID(int $a_id): int
691 {
692 global $DIC;
693
694 $ilDB = $DIC->database();
695
696 if (isset(self::$data_records[$a_id])) {
697 return self::$data_records[$a_id]["lm_id"];
698 }
699
700 $query = "SELECT lm_id FROM lm_data WHERE obj_id = " .
701 $ilDB->quote($a_id, "integer");
702 $obj_set = $ilDB->query($query);
703 $obj_rec = $ilDB->fetchAssoc($obj_set);
704
705 return (int) ($obj_rec["lm_id"] ?? 0);
706 }
707
711 public static function putInTree(
712 ilLMObject $a_obj,
713 int $a_parent_id = 0,
714 int $a_target_node_id = 0
715 ): void {
716 global $DIC;
717
718 $ilLog = $DIC["ilLog"];
719
720 $tree = new ilLMTree($a_obj->getContentObject()->getId());
721
722 // determine parent
723 $parent_id = ($a_parent_id != 0)
724 ? $a_parent_id
725 : $tree->getRootId();
726
727 // determine target
728 if ($a_target_node_id != 0) {
729 $target = $a_target_node_id;
730 } else {
731 // determine last child that serves as predecessor
732 if ($a_obj->getType() == "st") {
733 $s_types = array("st", "pg");
734 $childs = $tree->getChildsByTypeFilter($parent_id, $s_types);
735 } else {
736 $s_types = "pg";
737 $childs = $tree->getChildsByType($parent_id, $s_types);
738 }
739
740 if (count($childs) == 0) {
741 $target = ilTree::POS_FIRST_NODE;
742 } else {
743 $target = $childs[count($childs) - 1]["obj_id"];
744 }
745 }
746
747 if ($tree->isInTree($parent_id) && !$tree->isInTree($a_obj->getId())) {
748 $ilLog->write("LMObject::putInTree: insertNode, ID: " . $a_obj->getId() .
749 "Parent ID: " . $parent_id . ", Target: " . $target);
750
751 $tree->insertNode($a_obj->getId(), $parent_id, $target);
752 }
753 }
754
758 public static function getTree(
759 int $a_cont_obj_id
760 ): ilLMTree {
761 $tree = new ilLMTree($a_cont_obj_id);
762 $tree->readRootId();
763
764 return $tree;
765 }
766
770 public static function clipboardCut(
771 int $a_cont_obj_id,
772 array $a_ids
773 ): void {
774 $tree = ilLMObject::getTree($a_cont_obj_id);
775 $cut_ids = [];
776
777 if (!is_array($a_ids)) {
778 return;
779 } else {
780 // get all "top" ids, i.e. remove ids, that have a selected parent
781 foreach ($a_ids as $id) {
782 $path = $tree->getPathId($id);
783 $take = true;
784 foreach ($path as $path_id) {
785 if ($path_id != $id && in_array($path_id, $a_ids)) {
786 $take = false;
787 }
788 }
789 if ($take) {
790 $cut_ids[] = $id;
791 }
792 }
793 }
794
795 ilLMObject::clipboardCopy($a_cont_obj_id, $cut_ids);
796
797 // remove the objects from the tree
798 // note: we are getting chapters which are *not* in the tree
799 // we do not delete any pages/chapters here
800 foreach ($cut_ids as $id) {
801 $curnode = $tree->getNodeData($id);
802 if ($tree->isInTree($id)) {
803 $tree->deleteTree($curnode);
804 }
805 }
806 }
807
811 public static function clipboardCopy(
812 int $a_cont_obj_id,
813 array $a_ids
814 ): void {
815 global $DIC;
816
817 $ilUser = $DIC->user();
818
819 $tree = ilLMObject::getTree($a_cont_obj_id);
820
821 $ilUser->clipboardDeleteObjectsOfType("pg");
822 $ilUser->clipboardDeleteObjectsOfType("st");
823
824 // put them into the clipboard
825 $time = date("Y-m-d H:i:s", time());
826 $order = 0;
827 foreach ($a_ids as $id) {
828 $curnode = array();
829 if ($tree->isInTree($id)) {
830 $curnode = $tree->getNodeData($id);
831 $subnodes = $tree->getSubTree($curnode);
832 foreach ($subnodes as $subnode) {
833 if ($subnode["child"] != $id) {
834 $ilUser->addObjectToClipboard(
835 $subnode["child"],
836 $subnode["type"],
837 ilStr::subStr($subnode["title"], 0, 70),
838 $subnode["parent"],
839 $time,
840 $subnode["lft"]
841 );
842 }
843 }
844 }
845 $order = (($curnode["lft"] ?? 0) > 0)
846 ? $curnode["lft"]
847 : (int) ($order + 1);
848 $ilUser->addObjectToClipboard(
849 $id,
850 self::_lookupType($id),
851 ilStr::subStr(self::_lookupTitle($id), 0, 70),
852 0,
853 $time,
854 $order
855 );
856 }
857 }
858
862 public static function pasteTree(
863 ilObjLearningModule $a_target_lm,
864 int $a_item_id,
865 int $a_parent_id,
866 int $a_target,
867 string $a_insert_time,
868 array &$a_copied_nodes,
869 bool $a_as_copy = false,
870 ?ilObjLearningModule $a_source_lm = null
871 ): int {
872 global $DIC;
873
874 $item = null;
875 $ilUser = $DIC->user();
876 $ilLog = $DIC["ilLog"];
877
878 $item_lm_id = ilLMObject::_lookupContObjID($a_item_id);
879 $item_type = ilLMObject::_lookupType($a_item_id);
881 $lm_obj = ilObjectFactory::getInstanceByObjId($item_lm_id);
882 if ($item_type == "st") {
883 $item = new ilStructureObject($lm_obj, $a_item_id);
884 } elseif ($item_type == "pg") {
885 $item = new ilLMPageObject($lm_obj, $a_item_id);
886 }
887
888 $ilLog->write("Getting from clipboard type " . $item_type . ", " .
889 "Item ID: " . $a_item_id . ", of original LM: " . $item_lm_id);
890
891 if ($item_lm_id != $a_target_lm->getId() && !$a_as_copy) {
892 // @todo: check whether st is NOT in tree
893
894 // "move" metadata to new lm
895 $md = new ilMD($item_lm_id, $item->getId(), $item->getType());
896 $new_md = $md->cloneMD($a_target_lm->getId(), $item->getId(), $item->getType());
897
898 // update lm object
899 $item->setLMId($a_target_lm->getId());
900 $item->setContentObject($a_target_lm);
901 $item->update();
902
903 // delete old meta data set
904 $md->deleteAll();
905
906 if ($item_type == "pg") {
907 $page = $item->getPageObject();
908 $page->buildDom();
909 $page->setParentId($a_target_lm->getId());
910 $page->update();
911 }
912 }
913
914 if ($a_as_copy) {
915 $target_item = $item->copy($a_target_lm);
916 $a_copied_nodes[$item->getId()] = $target_item->getId();
917 } else {
918 $target_item = $item;
919 }
920
921 $ilLog->write("Putting into tree type " . $target_item->getType() .
922 "Item ID: " . $target_item->getId() . ", Parent: " . $a_parent_id . ", " .
923 "Target: " . $a_target . ", Item LM:" . $target_item->getContentObject()->getId());
924
925 ilLMObject::putInTree($target_item, $a_parent_id, $a_target);
926
927 if ($a_source_lm == null) {
928 $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
929 } else {
930 $childs = $a_source_lm->lm_tree->getChilds($item->getId());
931 foreach ($childs as $k => $child) {
932 $childs[$k]["id"] = $child["child"];
933 }
934 }
935
936 foreach ($childs as $child) {
937 ilLMObject::pasteTree(
938 $a_target_lm,
939 $child["id"],
940 $target_item->getId(),
942 $a_insert_time,
943 $a_copied_nodes,
944 $a_as_copy,
945 $a_source_lm
946 );
947 }
948
949 return $target_item->getId();
950 // @todo: write history (see pastePage)
951 }
952
956 public static function saveTitles(
958 array $a_titles,
959 string $a_lang = "-"
960 ): void {
961 if ($a_lang == "") {
962 $a_lang = "-";
963 }
964 if (is_array($a_titles)) {
965 foreach ($a_titles as $id => $title) {
966 // see #20375
968 if ($a_lang == "-") {
969 $lmobj = ilLMObjectFactory::getInstance($a_lm, $id, false);
970 if (is_object($lmobj)) {
971 // Update Title and description
972 $md = new ilMD($a_lm->getId(), $id, $lmobj->getType());
973 $md_gen = $md->getGeneral();
974 if (is_object($md_gen)) { // see bug #0015843
975 $md_gen->setTitle($title);
976 $md_gen->update();
977 $md->update();
978 }
980 }
981 } else {
982 $lmobjtrans = new ilLMObjTranslation($id, $a_lang);
983 $lmobjtrans->setTitle($title);
984 $lmobjtrans->save();
985 }
986 }
987 }
988 }
989
993 public static function updateInternalLinks(
994 array $a_copied_nodes,
995 string $a_parent_type = "lm"
996 ): void {
997 $all_fixes = array();
998 foreach ($a_copied_nodes as $original_id => $copied_id) {
999 $copied_type = ilLMObject::_lookupType($copied_id);
1000 $copy_lm = ilLMObject::_lookupContObjID($copied_id);
1001
1002 if ($copied_type == "pg") {
1003 foreach (ilPageObject::lookupTranslations($a_parent_type, $copied_id) as $l) {
1004 //
1005 // 1. Outgoing links from the copied page.
1006 //
1007 //$targets = ilInternalLink::_getTargetsOfSource($a_parent_type.":pg", $copied_id);
1008 $tpg = new ilLMPage($copied_id, 0, $l);
1009 $tpg->buildDom();
1010 $il = $tpg->getInternalLinks();
1011 $targets = array();
1012 foreach ($il as $l2) {
1013 $targets[] = array("type" => ilInternalLink::_extractTypeOfTarget($l2["Target"]),
1014 "id" => (int) ilInternalLink::_extractObjIdOfTarget($l2["Target"]),
1015 "inst" => (int) ilInternalLink::_extractInstOfTarget($l2["Target"]));
1016 }
1017 $fix = array();
1018 foreach ($targets as $target) {
1019 if (($target["inst"] == 0 || $target["inst"] = IL_INST_ID) &&
1020 ($target["type"] == "pg" || $target["type"] == "st")) {
1021 // first check, whether target is also within the copied set
1022 if (($a_copied_nodes[$target["id"]] ?? 0) > 0) {
1023 $fix[$target["id"]] = $a_copied_nodes[$target["id"]];
1024 } else {
1025 // now check, if a copy if the target is already in the same lm
1026
1027 // only if target is not already in the same lm!
1028 $trg_lm = ilLMObject::_lookupContObjID($target["id"]);
1029 if ($trg_lm != $copy_lm) {
1030 $lm_data = ilLMObject::_getAllObjectsForImportId("il__" . $target["type"] . "_" . $target["id"]);
1031 $found = false;
1032
1033 foreach ($lm_data as $item) {
1034 if (!$found && ($item["lm_id"] == $copy_lm)) {
1035 $fix[$target["id"]] = $item["obj_id"];
1036 $found = true;
1037 }
1038 }
1039 }
1040 }
1041 }
1042 }
1043
1044 // outgoing links to be fixed
1045 if (count($fix) > 0) {
1046 //echo "<br>--".$copied_id;
1047 //var_dump($fix);
1048 $t = ilObject::_lookupType($copy_lm);
1049 if (isset($all_fixes[$t . ":" . $copied_id])) {
1050 $all_fixes[$t . ":" . $copied_id] += $fix;
1051 } else {
1052 $all_fixes[$t . ":" . $copied_id] = $fix;
1053 }
1054 }
1055 }
1056 }
1057
1058 if ($copied_type == "pg" ||
1059 $copied_type == "st") {
1060
1061 //
1062 // 2. Incoming links to the original pages
1063 //
1064 // A->B A2 (A+B currently copied)
1065 // A->C B2
1066 // B->A
1067 // C->A C2->A (C already copied)
1068 $original_lm = ilLMObject::_lookupContObjID($original_id);
1069 $original_type = ilObject::_lookupType($original_lm);
1070
1071 if ($original_lm != $copy_lm) {
1072
1073 // This gets sources that link to A+B (so we have C here)
1074 // (this also does already the trick when instance map areas are given in C)
1075 // int_link, where target_type, target_id, target_inst -> ok
1077 $copied_type,
1078 $original_id,
1079 0
1080 );
1081
1082 // mobs linking to $original_id
1083 // map_area, where link_type, target -> ok
1084 $mobs = ilMapArea::_getMobsForTarget("int", "il__" . $copied_type .
1085 "_" . $original_id);
1086
1087 // pages using these mobs
1088 foreach ($mobs as $mob) {
1089 // mob_usage, where id -> ok
1090 // mep_item, where foreign_id, type -> ok
1091 // mep_tree, where child -> already existed
1092 // il_news_item, where mob_id -> ok
1093 // map_area, where link_type, target -> aready existed
1094 // media_item, where id -> already existed
1095 // personal_clipboard, where item_id, type -> ok
1096 $usages = ilObjMediaObject::lookupUsages($mob);
1097 foreach ($usages as $usage) {
1098 if ($usage["type"] == "lm:pg" | $usage["type"] == "lm:st") {
1099 $sources[] = $usage;
1100 }
1101 }
1102 }
1103 $fix = array();
1104 foreach ($sources as $source) {
1105 $stype = explode(":", $source["type"]);
1106 $source_type = $stype[1] ?? "";
1107
1108 if ($source_type == "pg" || $source_type == "st") {
1109 // first of all: source must be in original lm
1110 $src_lm = ilLMObject::_lookupContObjID($source["id"]);
1111
1112 if ($src_lm == $original_lm) {
1113 // check, if a copy if the source is already in the same lm
1114 // now we look for the latest copy of C in LM2
1116 "il__" . $source_type . "_" . $source["id"],
1117 $copy_lm
1118 );
1119 $found = false;
1120 foreach ($lm_data as $item) {
1121 if (!$found) {
1122 $fix[$item["obj_id"]][$original_id] = $copied_id;
1123 $found = true;
1124 }
1125 }
1126 }
1127 }
1128 }
1129 // outgoing links to be fixed
1130 if (count($fix) > 0) {
1131 foreach ($fix as $page_id => $fix_array) {
1132 $t = ilObject::_lookupType($copy_lm);
1133 if (isset($all_fixes[$t . ":" . $page_id])) {
1134 $all_fixes[$t . ":" . $page_id] += $fix_array;
1135 } else {
1136 $all_fixes[$t . ":" . $page_id] = $fix_array;
1137 }
1138 }
1139 }
1140 }
1141 }
1142 }
1143
1144 foreach ($all_fixes as $pg => $fixes) {
1145 $pg = explode(":", $pg);
1146 foreach (ilPageObject::lookupTranslations($pg[0], $pg[1]) as $l) {
1147 $page = ilPageObjectFactory::getInstance($pg[0], $pg[1], 0, $l);
1148 if ($page->moveIntLinks($fixes)) {
1149 $page->update(true, true);
1150 }
1151 }
1152 }
1153 }
1154
1158 public static function uniqueTypesCheck(array $a_items): bool
1159 {
1160 $types = array();
1161 if (is_array($a_items)) {
1162 foreach ($a_items as $item) {
1164 $types[$type] = $type;
1165 }
1166 }
1167
1168 if (count($types) > 1) {
1169 return false;
1170 }
1171 return true;
1172 }
1173
1177 public static function writeLayout(
1178 int $a_obj_id,
1179 string $a_layout,
1180 ?ilObjLearningModule $a_lm = null
1181 ): void {
1182 global $DIC;
1183
1184 $ilDB = $DIC->database();
1185
1186 $t = ilLMObject::_lookupType($a_obj_id);
1187
1188 if ($t == "pg") {
1189 $query = "UPDATE lm_data SET " .
1190 " layout = " . $ilDB->quote($a_layout, "text") .
1191 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
1192 $ilDB->manipulate($query);
1193 } elseif ($t == "st" && is_object($a_lm)) {
1194 $node = $a_lm->getLMTree()->getNodeData($a_obj_id);
1195 $child_nodes = $a_lm->getLMTree()->getSubTree($node);
1196 if (is_array($child_nodes) && count($child_nodes) > 0) {
1197 foreach ($child_nodes as $c) {
1198 if ($c["type"] == "pg") {
1199 $query = "UPDATE lm_data SET " .
1200 " layout = " . $ilDB->quote($a_layout, "text") .
1201 " WHERE obj_id = " . $ilDB->quote($c["child"], "integer");
1202 $ilDB->manipulate($query);
1203 }
1204 }
1205 }
1206 }
1207 }
1208
1212 public static function lookupLayout(int $a_obj_id): string
1213 {
1214 global $DIC;
1215
1216 $ilDB = $DIC->database();
1217
1218 $query = "SELECT layout FROM lm_data WHERE obj_id = " .
1219 $ilDB->quote($a_obj_id, "integer");
1220 $obj_set = $ilDB->query($query);
1221 $obj_rec = $ilDB->fetchAssoc($obj_set);
1222
1223 return $obj_rec["layout"];
1224 }
1225
1229 public static function getPagesOfChapter(
1230 int $a_lm_id,
1231 int $a_chap_id
1232 ): array {
1233 // update structure entries: if at least one page of a chapter is public set chapter to public too
1234 $lm_tree = new ilTree($a_lm_id);
1235 $lm_tree->setTableNames('lm_tree', 'lm_data');
1236 $lm_tree->setTreeTablePK("lm_id");
1237 $lm_tree->readRootId();
1238
1239 $childs = $lm_tree->getChildsByType($a_chap_id, "pg");
1240
1241 return $childs;
1242 }
1243
1247 public static function _getAllLMObjectsOfLM(
1248 int $a_lm_id,
1249 string $a_type = ""
1250 ): array {
1251 global $DIC;
1252
1253 $ilDB = $DIC->database();
1254
1255 $and = ($a_type != "")
1256 ? " AND type = " . $ilDB->quote($a_type, "text")
1257 : "";
1258
1259 $set = $ilDB->query("SELECT obj_id FROM lm_data " .
1260 " WHERE lm_id = " . $ilDB->quote($a_lm_id, "integer") . $and);
1261 $obj_ids = array();
1262 while ($rec = $ilDB->fetchAssoc($set)) {
1263 $obj_ids[] = $rec["obj_id"];
1264 }
1265
1266 return $obj_ids;
1267 }
1268
1269
1273
1274 public static function saveExportId(
1275 int $a_lm_id,
1276 int $a_lmobj_id,
1277 string $a_exp_id,
1278 string $a_type = "pg"
1279 ): void {
1280 $entries = ilMDIdentifier::_getEntriesForObj(
1281 $a_lm_id,
1282 $a_lmobj_id,
1283 $a_type
1284 );
1285 if (trim($a_exp_id) == "") {
1286 // delete export ids, if existing
1287
1288 foreach ($entries as $id => $e) {
1289 if ($e["catalog"] == "ILIAS_NID") {
1290 $identifier = new ilMDIdentifier();
1291 $identifier->setMetaId($id);
1292 $identifier->delete();
1293 }
1294 }
1295 } else {
1296 // update existing entry
1297
1298 $updated = false;
1299 foreach ($entries as $id => $e) {
1300 if ($e["catalog"] == "ILIAS_NID") {
1301 $identifier = new ilMDIdentifier();
1302 $identifier->setMetaId($id);
1303 $identifier->read();
1304 $identifier->setEntry($a_exp_id);
1305 $identifier->update();
1306 $updated = true;
1307 }
1308 }
1309
1310 // nothing updated? create a new one
1311 if (!$updated) {
1312 $md = new ilMD($a_lm_id, $a_lmobj_id, $a_type);
1313 $md_gen = $md->getGeneral();
1314 $identifier = $md_gen->addIdentifier();
1315 $identifier->setEntry($a_exp_id);
1316 $identifier->setCatalog("ILIAS_NID");
1317 $identifier->save();
1318 }
1319 }
1320 }
1321
1322 public static function getExportId(
1323 int $a_lm_id,
1324 int $a_lmobj_id,
1325 string $a_type = "pg"
1326 ): string {
1327 // look for export id
1328 $entries = ilMDIdentifier::_getEntriesForObj(
1329 $a_lm_id,
1330 $a_lmobj_id,
1331 $a_type
1332 );
1333
1334 foreach ($entries as $e) {
1335 if ($e["catalog"] == "ILIAS_NID") {
1336 return $e["entry"];
1337 }
1338 }
1339 return "";
1340 }
1341
1345 public function existsExportID(
1346 int $a_lm_id,
1347 int $a_exp_id,
1348 string $a_type = "pg"
1349 ): bool {
1350 return ilMDIdentifier::existsIdInRbacObject($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1351 }
1352
1356 public static function getDuplicateExportIDs(
1357 int $a_lm_id,
1358 string $a_type = "pg"
1359 ): array {
1360 $entries = ilMDIdentifier::_getEntriesForRbacObj($a_lm_id, $a_type);
1361 $res = array();
1362 foreach ($entries as $e) {
1363 if ($e["catalog"] == "ILIAS_NID") {
1364 if (ilLMObject::_exists($e["obj_id"])) {
1365 $res[trim($e["entry"])] = ($res[trim($e["entry"])] ?? 0) + 1;
1366 }
1367 }
1368 }
1369 return $res;
1370 }
1371
1372 public function getExportIDInfo(
1373 int $a_lm_id,
1374 int $a_exp_id,
1375 string $a_type = "pg"
1376 ): array {
1377 $data = ilMDIdentifier::readIdData($a_lm_id, $a_type, "ILIAS_NID", $a_exp_id);
1378 return $data;
1379 }
1380
1381 // Get effective title
1382 public static function _getNodePresentationTitle(
1383 array $a_node,
1384 string $a_mode = self::PAGE_TITLE,
1385 bool $a_include_numbers = false,
1386 bool $a_time_scheduled_activation = false,
1387 bool $a_force_content = false,
1388 int $a_lm_id = 0,
1389 string $a_lang = "-"
1390 ): string {
1391 if ($a_lang == "") {
1392 $a_lang = "-";
1393 }
1394
1395 if ($a_node["type"] == "st") {
1397 $a_node["child"],
1398 self::CHAPTER_TITLE,
1399 $a_include_numbers,
1400 $a_time_scheduled_activation,
1401 $a_force_content,
1402 $a_lm_id,
1403 $a_lang
1404 );
1405 } else {
1407 $a_node["child"],
1408 $a_mode,
1409 $a_include_numbers,
1410 $a_time_scheduled_activation,
1411 $a_force_content,
1412 $a_lm_id,
1413 $a_lang
1414 );
1415 }
1416 }
1417
1418 public static function getShortTitles(
1419 int $a_lm_id,
1420 string $a_lang = "-"
1421 ): array {
1422 global $DIC;
1423
1424 $db = $DIC->database();
1425
1426 $title_data = array();
1427 if ($a_lang == "-") {
1428 $set = $db->query("SELECT t.child, d.obj_id, d.title, d.short_title FROM lm_data d LEFT JOIN lm_tree t ON (d.obj_id = t.child) WHERE d.lm_id = " .
1429 $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1430 } else {
1431 $set = $db->query("SELECT t.child, d.obj_id, tr.title, tr.short_title, d.title default_title, d.short_title default_short_title FROM lm_data d " .
1432 " LEFT JOIN lm_tree t ON (d.obj_id = t.child) " .
1433 " LEFT JOIN lm_data_transl tr ON (tr.id = d.obj_id AND tr.lang=" . $db->quote($a_lang, "text") . ") WHERE d.lm_id = " .
1434 $db->quote($a_lm_id, "integer") . " ORDER BY t.lft, d.title");
1435 }
1436 while ($rec = $db->fetchAssoc($set)) {
1437 $title_data[] = $rec;
1438 }
1439 return $title_data;
1440 }
1441
1442 public static function writeShortTitle(
1443 int $a_id,
1444 string $a_short_title,
1445 string $a_lang = "-"
1446 ): void {
1447 global $DIC;
1448
1449 $db = $DIC->database();
1450
1451 if ($a_lang != "-" && $a_lang != "") {
1452 $trans = new ilLMObjTranslation($a_id, $a_lang);
1453 $trans->setShortTitle($a_short_title);
1454 $trans->save();
1455 } else {
1456 $db->manipulate(
1457 "UPDATE lm_data SET " .
1458 " short_title = " . $db->quote($a_short_title, "text") .
1459 " WHERE obj_id = " . $db->quote($a_id, "integer")
1460 );
1461 }
1462 }
1463}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static removeProhibitedCharacters(string $a_text)
Remove prohibited characters see #19159.
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContentObject(ilObjLearningModule $a_content_obj)
existsExportID(int $a_lm_id, int $a_exp_id, string $a_type="pg")
Does export ID exist in lm?
static writeLayout(int $a_obj_id, string $a_layout, ?ilObjLearningModule $a_lm=null)
Write layout setting.
setShortTitle(string $a_title)
static _getAllObjectsForImportId(string $a_import_id, int $a_in_lm=0)
Get all items for an import ID.
ilObjLearningModule $content_object
static writeShortTitle(int $a_id, string $a_short_title, string $a_lang="-")
setId(int $a_id)
static getPagesOfChapter(int $a_lm_id, int $a_chap_id)
Get pages of chapter.
static _exists(int $a_id)
checks wether a lm content object with specified id exists or not
ilObjUser $user
setImportId(string $a_id)
ilDBInterface $db
static clipboardCut(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 saveExportId(int $a_lm_id, int $a_lmobj_id, string $a_exp_id, string $a_type="pg")
string $description
static _getAllLMObjectsOfLM(int $a_lm_id, string $a_type="")
Get all objects of learning module.
static _lookupShortTitle(int $a_obj_id)
MDUpdateListener(string $a_element)
Meta data update listener Important note: Do never call create() or update() method of ilObject here.
static saveTitles(ilObjLearningModule $a_lm, array $a_titles, string $a_lang="-")
Save titles for lm objects.
static preloadDataByLM(int $a_lm_id)
Preload data records by lm.
static getShortTitles(int $a_lm_id, string $a_lang="-")
static _writeImportId(int $a_id, string $a_import_id)
__construct(ilObjLearningModule $a_content_obj, int $a_id=0)
static _writeTitle(int $a_obj_id, string $a_title)
static _lookupContObjID(int $a_id)
get learning module id for lm object
static _lookupTitle(int $a_obj_id)
setDescription(string $a_description)
static getObjectList(int $lm_id, string $type="")
static getTree(int $a_cont_obj_id)
Get learning module tree.
static $data_records
static _isPagePublic(int $a_node_id, bool $a_check_public_mode=false)
static clipboardCopy(int $a_cont_obj_id, array $a_ids)
Copy a set of chapters/pages into the clipboard.
static _writePublicAccessStatus(array $a_pages, int $a_cont_obj_id)
update public access flags in lm_data for all pages of a content object
deleteMetaData()
delete meta data entry
static updateInternalLinks(array $a_copied_nodes, string $a_parent_type="lm")
Update internal links, after multiple pages have been copied.
static lookupLayout(int $a_obj_id)
Lookup type.
string $short_title
createMetaData()
create meta data entry
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="-")
getExportIDInfo(int $a_lm_id, int $a_exp_id, string $a_type="pg")
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
setLayout(string $a_val)
static _getIdForImportId(string $a_import_id)
get current object id for import id (static)
static _lookup(int $a_obj_id, string $a_field)
static uniqueTypesCheck(array $a_items)
Check for unique types (all pages or all chapters)
static getExportId(int $a_lm_id, int $a_lmobj_id, string $a_type="pg")
static _lookupNID(int $a_lm_id, int $a_lm_obj_id, string $a_type)
lookup named identifier (ILIAS_NID)
setType(string $a_type)
setTitle(string $a_title)
static _lookupType(int $a_obj_id, int $a_lm_id=0)
updateMetaData()
update meta data entry
static _deleteAllObjectData(ilObjLearningModule $a_cobj)
delete all objects of content object (digi book / learning module)
setLMId(int $a_lm_id)
static getDuplicateExportIDs(int $a_lm_id, string $a_type="pg")
Get duplicate export IDs (count export ID usages)
create(bool $a_upload=false)
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't have to be page title, it may be chapter title + page title or chapter tit...
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 _refreshStatus(int $a_obj_id, ?array $a_users=null)
static _getMobsForTarget(string $a_type, string $a_target)
Get areas for a certain target.
static isHelpLM(int $a_lm_id)
Check if LM is a help LM.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupUsages(int $a_id, bool $a_include_history=true)
Lookup usages of media object.
User class.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static getInstance(int $obj_id)
static _lookupType(int $id, bool $reference=false)
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static _getAllReferences(int $id)
get all reference ids for object ID
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.
static subStr(string $a_str, int $a_start, ?int $a_length=null)
Definition: class.ilStr.php:24
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const POS_LAST_NODE
setTableNames(string $a_table_tree, string $a_table_obj_data, string $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...
const POS_FIRST_NODE
static yn2tf(string $a_yn)
$c
Definition: cli.php:38
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
const IL_INST_ID
Definition: constants.php:40
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
global $DIC
Definition: feed.php:28
$mobs
Definition: imgupload.php:70
$ilUser
Definition: imgupload.php:34
Interface ilDBInterface.
quote($value, string $type)
manipulate(string $query)
Run a (write) Query on the database.
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)
$path
Definition: ltiservices.php:32
$res
Definition: ltiservices.php:69
$source
Definition: metadata.php:93
int $updated
Timestamp for when the object was last updated.
Definition: System.php:158
$query
$type
$ilErr
Definition: raiseError.php:17
$message
Definition: xapiexit.php:32