ILIAS  release_8 Revision v8.24
class.ilObject.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
30{
31 public const TITLE_LENGTH = 255; // title column max length in db
32 public const DESC_LENGTH = 128; // (short) description column max length in db
33 public const LONG_DESC_LENGTH = 4000; // long description column max length in db
34 public const TABLE_OBJECT_DATA = "object_data";
35 protected ilLogger $obj_log;
36
37 protected ?ILIAS $ilias;
39 protected ilDBInterface $db;
40 protected ?ilLogger $log;
42 protected ilTree $tree;
46 protected ilObjUser $user;
47 protected ilLanguage $lng;
48
49 protected int $id;
50 protected bool $referenced;
51 protected bool $call_by_reference;
54 protected bool $add_dots = true;
55 protected ?int $ref_id = null;
56 protected string $type = "";
57 protected string $title = "";
58 protected bool $offline = false;
59 protected string $desc = "";
60 protected string $long_desc = "";
61 protected int $owner = 0;
62 protected string $create_date = "";
63 protected string $last_update = "";
64 protected string $import_id = "";
65 protected bool $register = false; // registering required for object? set to true to implement a subscription interface
66
67 private bool $process_auto_reating = false;
68
69
73 public array $objectList;
74
75
76 // BEGIN WebDAV: WebDAV needs to access the untranslated title of an object
77 public string $untranslatedTitle;
78 // END WebDAV: WebDAV needs to access the untranslated title of an object
79
84 public function __construct(int $id = 0, bool $reference = true)
85 {
86 global $DIC;
87
88 $this->ilias = $DIC["ilias"];
89 $this->obj_definition = $DIC["objDefinition"];
90 $this->db = $DIC["ilDB"];
91 $this->log = $DIC["ilLog"];
92 $this->obj_log = ilLoggerFactory::getLogger("obj");
93 $this->error = $DIC["ilErr"];
94 $this->tree = $DIC["tree"];
95 $this->app_event_handler = $DIC["ilAppEventHandler"];
96
97 $this->referenced = $reference;
98 $this->call_by_reference = $reference;
99
100 if (isset($DIC["lng"])) {
101 $this->lng = $DIC["lng"];
102 }
103
104 if (isset($DIC["ilUser"])) {
105 $this->user = $DIC["ilUser"];
106 }
107
108 if (isset($DIC["rbacadmin"])) {
109 $this->rbac_admin = $DIC["rbacadmin"];
110 }
111
112 if (isset($DIC["rbacreview"])) {
113 $this->rbac_review = $DIC["rbacreview"];
114 }
115
116 if ($id == 0) {
117 $this->referenced = false; // newly created objects are never referenced
118 } // they will get referenced if createReference() is called
119
120 if ($this->referenced) {
121 $this->ref_id = $id;
122 } else {
123 $this->id = $id;
124 }
125 // read object data
126 if ($id != 0) {
127 $this->read();
128 }
129 }
130
134 final public function withReferences(): bool
135 {
136 // both vars could differ. this method should always return true if one of them is true without changing their status
137 return ($this->call_by_reference) ? true : $this->referenced;
138 }
139
144 public function processAutoRating(): void
145 {
146 $this->process_auto_reating = true;
147 }
148
149 public function read(): void
150 {
151 global $DIC;
152 try {
153 $ilUser = $DIC["ilUser"];
154 } catch (InvalidArgumentException $e) {
155 }
156
157 if ($this->referenced) {
158 if (!isset($this->ref_id)) {
159 $message = "ilObject::read(): No ref_id given! (" . $this->type . ")";
160 $this->error->raiseError($message, $this->error->WARNING);
161 }
162
163 // read object data
164 $sql =
165 "SELECT od.obj_id, od.type, od.title, od.description, od.owner, od.create_date," . PHP_EOL
166 . "od.last_update, od.import_id, od.offline, ore.ref_id, ore.obj_id, ore.deleted, ore.deleted_by" . PHP_EOL
167 . "FROM " . self::TABLE_OBJECT_DATA . " od" . PHP_EOL
168 . "JOIN object_reference ore ON od.obj_id = ore.obj_id" . PHP_EOL
169 . "WHERE ore.ref_id = " . $this->db->quote($this->ref_id, "integer") . PHP_EOL
170 ;
171
172 $result = $this->db->query($sql);
173
174 // check number of records
175 if ($this->db->numRows($result) == 0) {
176 $message = sprintf(
177 "ilObject::read(): Object with ref_id %s not found! (%s)",
178 $this->ref_id,
179 $this->type
180 );
181 $this->error->raiseError($message, $this->error->WARNING);
182 }
183 } else {
184 if (!isset($this->id)) {
185 $message = sprintf("ilObject::read(): No obj_id given! (%s)", $this->type);
186 $this->error->raiseError($message, $this->error->WARNING);
187 }
188
189 $sql =
190 "SELECT obj_id, type, title, description, owner, create_date, last_update, import_id, offline" . PHP_EOL
191 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
192 . "WHERE obj_id = " . $this->db->quote($this->id, "integer") . PHP_EOL
193 ;
194 $result = $this->db->query($sql);
195
196 if ($this->db->numRows($result) == 0) {
197 $message = sprintf("ilObject::read(): Object with obj_id: %s (%s) not found!", $this->id, $this->type);
199 }
200 }
201 $obj = $this->db->fetchAssoc($result);
202
203 $this->id = (int) $obj["obj_id"];
204
205 // check type match (the "xxx" type is used for the unit test)
206 if ($this->type != $obj["type"] && $obj["type"] != "xxx") {
207 $message = sprintf(
208 "ilObject::read(): Type mismatch. Object with obj_id: %s was instantiated by type '%s'. DB type is: %s",
209 $this->id,
210 $this->type,
211 $obj["type"]
212 );
213
214 $this->log->write($message);
216 }
217
218 $this->type = (string) $obj["type"];
219 $this->title = (string) $obj["title"];
220 // BEGIN WebDAV: WebDAV needs to access the untranslated title of an object
221 $this->untranslatedTitle = (string) $obj["title"];
222 // END WebDAV: WebDAV needs to access the untranslated title of an object
223
224 $this->desc = (string) $obj["description"];
225 $this->owner = (int) $obj["owner"];
226 $this->create_date = (string) $obj["create_date"];
227 $this->last_update = (string) $obj["last_update"];
228 $this->import_id = (string) $obj["import_id"];
229
230 $this->setOfflineStatus((bool) $obj['offline']);
231
232 if ($this->obj_definition->isRBACObject($this->getType())) {
233 $sql =
234 "SELECT obj_id, description" . PHP_EOL
235 . "FROM object_description" . PHP_EOL
236 . "WHERE obj_id = " . $this->db->quote($this->id, 'integer') . PHP_EOL
237 ;
238
239 $res = $this->db->query($sql);
240
241 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
242 if (($row->description ?? '') !== '') {
243 $this->setDescription($row->description);
244 }
245 }
246 }
247
248 // multilingual support system objects (sys) & categories (db)
249 $translation_type = $this->obj_definition->getTranslationType($this->type);
250
251 if ($translation_type == "sys") {
252 $this->title = $this->lng->txt("obj_" . $this->type);
253 $this->setDescription($this->lng->txt("obj_" . $this->type . "_desc"));
254 } elseif ($translation_type == "db") {
255 $sql =
256 "SELECT title, description" . PHP_EOL
257 . "FROM object_translation" . PHP_EOL
258 . "WHERE obj_id = " . $this->db->quote($this->id, 'integer') . PHP_EOL
259 . "AND lang_code = " . $this->db->quote($ilUser->getCurrentLanguage(), 'text') . PHP_EOL
260 ;
261 $r = $this->db->query($sql);
262 $row = $r->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
263 if ($row) {
264 $this->title = (string) $row->title;
265 $this->setDescription((string) $row->description);
266 }
267 }
268 }
269
270 public function getId(): int
271 {
272 return $this->id;
273 }
274
275 public function setId(int $id): void
276 {
277 $this->id = $id;
278 }
279
280 final public function setRefId(int $ref_id): void
281 {
282 $this->ref_id = $ref_id;
283 $this->referenced = true;
284 }
285
286 final public function getRefId(): int
287 {
288 return $this->ref_id ?? 0;
289 }
290
291 public function getType(): string
292 {
293 return $this->type;
294 }
295
296 final public function setType(string $type): void
297 {
298 $this->type = $type;
299 }
300
306 public function getPresentationTitle(): string
307 {
308 return $this->getTitle();
309 }
310
311 public function getTitle(): string
312 {
313 return $this->title;
314 }
315
320 final public function getUntranslatedTitle(): string
321 {
323 }
324
325 final public function setTitle(string $title): void
326 {
327 $this->title = ilStr::shortenTextExtended($title, $this->max_title ?? self::TITLE_LENGTH, $this->add_dots);
328
329 // WebDAV needs to access the untranslated title of an object
330 $this->untranslatedTitle = $this->title;
331 }
332
333 final public function getDescription(): string
334 {
335 return $this->desc;
336 }
337
338 final public function setDescription(string $desc): void
339 {
340 // Shortened form is storted in object_data. Long form is stored in object_description
341 $this->desc = ilStr::shortenTextExtended($desc, $this->max_desc, $this->add_dots);
343 }
344
348 public function getLongDescription(): string
349 {
350 if (strlen($this->long_desc)) {
351 return $this->long_desc;
352 } elseif (strlen($this->desc)) {
353 return $this->desc;
354 }
355 return "";
356 }
357
358 final public function getImportId(): string
359 {
360 return $this->import_id;
361 }
362
363 final public function setImportId(string $import_id): void
364 {
365 $this->import_id = $import_id;
366 }
367
371 final public static function _lookupObjIdByImportId(string $import_id): int
372 {
373 global $DIC;
374 $db = $DIC->database();
375
376 $sql =
377 "SELECT obj_id" . PHP_EOL
378 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
379 . "WHERE import_id = " . $db->quote($import_id, "text") . PHP_EOL
380 . "ORDER BY create_date DESC" . PHP_EOL
381 ;
382 $result = $db->query($sql);
383
384 if ($db->numRows($result) == 0) {
385 return 0;
386 }
387
388 $row = $db->fetchObject($result);
389
390 return (int) $row->obj_id;
391 }
392
393 public function setOfflineStatus(bool $status): void
394 {
395 $this->offline = $status;
396 }
397
398 public function getOfflineStatus(): bool
399 {
400 return $this->offline;
401 }
402
403 public function supportsOfflineHandling(): bool
404 {
405 return $this->obj_definition->supportsOfflineHandling($this->getType());
406 }
407
408 public static function _lookupImportId(int $obj_id): string
409 {
410 global $DIC;
411
412 $db = $DIC->database();
413
414 $sql =
415 "SELECT import_id" . PHP_EOL
416 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
417 . "WHERE obj_id = " . $db->quote($obj_id, "integer") . PHP_EOL
418 ;
419
420 $res = $db->query($sql);
421 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
422 return (string) $row->import_id;
423 }
424 return '';
425 }
426
427 final public function getOwner(): int
428 {
429 return $this->owner;
430 }
431
435 final public function getOwnerName(): string
436 {
437 return ilObject::_lookupOwnerName($this->getOwner());
438 }
439
443 final public static function _lookupOwnerName(int $owner_id): string
444 {
445 global $DIC;
446 $lng = $DIC->language();
447
448 $owner = null;
449 if ($owner_id != -1) {
450 if (ilObject::_exists($owner_id)) {
451 $owner = new ilObjUser($owner_id);
452 }
453 }
454
455 $own_name = $lng->txt("unknown");
456 if (is_object($owner)) {
457 $own_name = $owner->getFullname();
458 }
459
460 return $own_name;
461 }
462
463 final public function setOwner(int $usr_id): void
464 {
465 $this->owner = $usr_id;
466 }
467
471 final public function getCreateDate(): string
472 {
473 return $this->create_date;
474 }
475
479 final public function getLastUpdateDate(): string
480 {
481 return $this->last_update;
482 }
483
484
488 public function create(): int
489 {
490 global $DIC;
491 $user = $DIC["ilUser"];
492
493 if (!isset($this->type)) {
494 $message = sprintf("%s::create(): No object type given!", get_class($this));
495 $this->error->raiseError($message, $this->error->WARNING);
496 }
497
498 $this->log->write("ilObject::create(), start");
499
500 // determine owner
501 $owner = 0;
502 if ($this->getOwner() > 0) {
503 $owner = $this->getOwner();
504 } elseif (is_object($user)) {
505 $owner = $user->getId();
506 }
507
508 $this->id = $this->db->nextId(self::TABLE_OBJECT_DATA);
509 $values = [
510 "obj_id" => ["integer", $this->getId()],
511 "type" => ["text", $this->getType()],
512 "title" => ["text", $this->getTitle()],
513 "description" => ["text", $this->getDescription()],
514 "owner" => ["integer", $owner],
515 "create_date" => ["date", $this->db->now()],
516 "last_update" => ["date", $this->db->now()],
517 "import_id" => ["text", $this->getImportId()],
518 "offline" => ["integer", $this->supportsOfflineHandling() ? $this->getOfflineStatus() : null]
519 ];
520
521 $this->db->insert(self::TABLE_OBJECT_DATA, $values);
522
523
524 // Save long form of description if is rbac object
525 if ($this->obj_definition->isRBACObject($this->getType())) {
526 $values = [
527 'obj_id' => ['integer',$this->id],
528 'description' => ['clob', $this->getLongDescription()]
529 ];
530 $this->db->insert('object_description', $values);
531 }
532
533 if ($this->obj_definition->isOrgUnitPermissionType($this->type)) {
534 ilOrgUnitGlobalSettings::getInstance()->saveDefaultPositionActivationStatus($this->id);
535 }
536
537 // the line ($this->read();) messes up meta data handling: meta data,
538 // that is not saved at this time, gets lost, so we query for the dates alone
539 //$this->read();
540 $sql =
541 "SELECT last_update, create_date" . PHP_EOL
542 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
543 . "WHERE obj_id = " . $this->db->quote($this->id, "integer") . PHP_EOL
544 ;
545 $obj_set = $this->db->query($sql);
546 $obj_rec = $this->db->fetchAssoc($obj_set);
547 $this->last_update = $obj_rec["last_update"];
548 $this->create_date = $obj_rec["create_date"];
549
550 // set owner for new objects
551 $this->setOwner($owner);
552
553 // write log entry
554 $this->log->write(sprintf(
555 "ilObject::create(), finished, obj_id: %s, type: %s, title: %s",
556 $this->getId(),
557 $this->getType(),
558 $this->getTitle()
559 ));
560
561 $this->app_event_handler->raise(
562 'Services/Object',
563 'create',
564 [
565 'obj_id' => $this->id,
566 'obj_type' => $this->type
567 ]
568 );
569
570 return $this->id;
571 }
572
573 public function update(): bool
574 {
575 $values = [
576 "title" => ["text", $this->getTitle()],
577 "description" => ["text", ilStr::subStr($this->getDescription(), 0, 128)],
578 "last_update" => ["date", $this->db->now()],
579 "import_id" => ["text", $this->getImportId()],
580 "offline" => ["integer", $this->supportsOfflineHandling() ? $this->getOfflineStatus() : null]
581 ];
582
583 $where = [
584 "obj_id" => ["integer", $this->getId()]
585 ];
586
587 $this->db->update(self::TABLE_OBJECT_DATA, $values, $where);
588
589 // the line ($this->read();) messes up meta data handling: metadata,
590 // that is not saved at this time, gets lost, so we query for the dates alone
591 //$this->read();
592 $sql =
593 "SELECT last_update" . PHP_EOL
594 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
595 . "WHERE obj_id = " . $this->db->quote($this->getId(), "integer") . PHP_EOL
596 ;
597 $obj_set = $this->db->query($sql);
598 $obj_rec = $this->db->fetchAssoc($obj_set);
599 $this->last_update = $obj_rec["last_update"];
600
601 if ($this->obj_definition->isRBACObject($this->getType())) {
602 // Update long description
603 $sql =
604 "SELECT obj_id, description" . PHP_EOL
605 . "FROM object_description" . PHP_EOL
606 . "WHERE obj_id = " . $this->db->quote($this->getId(), 'integer') . PHP_EOL
607 ;
608 $res = $this->db->query($sql);
609
610 if ($res->numRows()) {
611 $values = [
612 'description' => ['clob',$this->getLongDescription()]
613 ];
614 $where = [
615 'obj_id' => ['integer',$this->getId()]
616 ];
617 $this->db->update('object_description', $values, $where);
618 } else {
619 $values = [
620 'description' => ['clob',$this->getLongDescription()],
621 'obj_id' => ['integer',$this->getId()]
622 ];
623 $this->db->insert('object_description', $values);
624 }
625 }
626
627 $this->app_event_handler->raise(
628 'Services/Object',
629 'update',
630 [
631 'obj_id' => $this->getId(),
632 'obj_type' => $this->getType(),
633 'ref_id' => $this->getRefId()
634 ]
635 );
636
637 return true;
638 }
639
649 final public function MDUpdateListener(string $element): void
650 {
651 if ($this->beforeMDUpdateListener($element)) {
652 $this->app_event_handler->raise(
653 'Services/Object',
654 'update',
655 array('obj_id' => $this->getId(),
656 'obj_type' => $this->getType(),
657 'ref_id' => $this->getRefId()
658 )
659 );
660
661 // Update Title and description
662 if ($element == 'General') {
663 $md = new ilMD($this->getId(), 0, $this->getType());
664 if (!is_object($md_gen = $md->getGeneral())) {
665 return;
666 }
667 $this->setTitle($md_gen->getTitle());
668
669 foreach ($md_gen->getDescriptionIds() as $id) {
670 $md_des = $md_gen->getDescription($id);
671 $this->setDescription($md_des->getDescription());
672 break;
673 }
674 $this->update();
675 }
676 $this->doMDUpdateListener($element);
677 }
678 }
679
680 protected function doMDUpdateListener(string $a_element): void
681 {
682 }
683
684 protected function beforeMDUpdateListener(string $a_element): bool
685 {
686 return true;
687 }
688
689 final public function createMetaData(): void
690 {
691 if ($this->beforeCreateMetaData()) {
692 global $DIC;
693 $ilUser = $DIC["ilUser"];
694
695 $md_creator = new ilMDCreator($this->getId(), 0, $this->getType());
696 $md_creator->setTitle($this->getTitle());
697 $md_creator->setTitleLanguage($ilUser->getPref('language'));
698 $md_creator->setDescription($this->getLongDescription());
699 $md_creator->setDescriptionLanguage($ilUser->getPref('language'));
700 $md_creator->setKeywordLanguage($ilUser->getPref('language'));
701 // see https://docu.ilias.de/goto_docu_wiki_wpage_4891_1357.html
702 //$md_creator->setLanguage($ilUser->getPref('language'));
703 $md_creator->create();
704 $this->doCreateMetaData();
705 }
706 }
707
708 protected function doCreateMetaData(): void
709 {
710 }
711
712 protected function beforeCreateMetaData(): bool
713 {
714 return true;
715 }
716
717 final public function updateMetaData(): void
718 {
719 if ($this->beforeUpdateMetaData()) {
720 $md = new ilMD($this->getId(), 0, $this->getType());
721 $md_gen = $md->getGeneral();
722 // BEGIN WebDAV: metadata can be missing sometimes.
723 if (!$md_gen instanceof ilMDGeneral) {
724 $this->createMetaData();
725 $md = new ilMD($this->getId(), 0, $this->getType());
726 $md_gen = $md->getGeneral();
727 }
728 // END WebDAV: metadata can be missing sometimes.
729 $md_gen->setTitle($this->getTitle());
730
731 // sets first description (maybe not appropriate)
732 $md_des_ids = $md_gen->getDescriptionIds();
733 if (count($md_des_ids) > 0) {
734 $md_des = $md_gen->getDescription($md_des_ids[0]);
735 $md_des->setDescription($this->getLongDescription());
736 $md_des->update();
737 }
738 $md_gen->update();
739 $this->doUpdateMetaData();
740 }
741 }
742
743 protected function doUpdateMetaData(): void
744 {
745 }
746
747 protected function beforeUpdateMetaData(): bool
748 {
749 return true;
750 }
751
752 final public function deleteMetaData(): void
753 {
754 if ($this->beforeDeleteMetaData()) {
755 $md = new ilMD($this->getId(), 0, $this->getType());
756 $md->deleteAll();
757 $this->doDeleteMetaData();
758 }
759 }
760
761 protected function doDeleteMetaData(): void
762 {
763 }
764
765 protected function beforeDeleteMetaData(): bool
766 {
767 return true;
768 }
769
773 final public function updateOwner(): void
774 {
775 $values = [
776 "owner" => ["integer", $this->getOwner()],
777 "last_update" => ["date", $this->db->now()]
778 ];
779
780 $where = [
781 "obj_id" => ["integer", $this->getId()]
782 ];
783
784 $this->db->update(self::TABLE_OBJECT_DATA, $values, $where);
785
786 // get current values from database so last_update is updated as well
787 $this->read();
788 }
789
790 final public static function _getIdForImportId(string $import_id): int
791 {
792 global $DIC;
793 $db = $DIC->database();
794 $db->setLimit(1, 0);
795
796 $sql =
797 "SELECT obj_id" . PHP_EOL
798 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
799 . "WHERE import_id = " . $db->quote($import_id, "text") . PHP_EOL
800 . "ORDER BY create_date DESC" . PHP_EOL
801 ;
802
803 $result = $db->query($sql);
804
805 if ($row = $db->fetchAssoc($result)) {
806 return (int) $row["obj_id"];
807 }
808
809 return 0;
810 }
811
816 final public static function _getAllReferences(int $id): array
817 {
818 global $DIC;
819 $db = $DIC->database();
820
821 $sql =
822 "SELECT ref_id" . PHP_EOL
823 . "FROM object_reference" . PHP_EOL
824 . "WHERE obj_id = " . $db->quote($id, 'integer') . PHP_EOL
825 ;
826
827 $result = $db->query($sql);
828
829 $ref = array();
830 while ($row = $db->fetchAssoc($result)) {
831 $ref[(int) $row["ref_id"]] = (int) $row["ref_id"];
832 }
833
834 return $ref;
835 }
836
837 public static function _lookupTitle(int $obj_id): string
838 {
839 global $DIC;
840 return (string) $DIC["ilObjDataCache"]->lookupTitle($obj_id);
841 }
842
846 public static function lookupOfflineStatus(int $obj_id): bool
847 {
848 global $DIC;
849 return $DIC['ilObjDataCache']->lookupOfflineStatus($obj_id);
850 }
851
855 final public static function _lookupOwner(int $obj_id): int
856 {
857 global $DIC;
858 return (int) $DIC["ilObjDataCache"]->lookupOwner($obj_id);
859 }
860
864 final public static function _getIdsForTitle(string $title, string $type = '', bool $partial_match = false): array
865 {
866 global $DIC;
867 $db = $DIC->database();
868
869 $where = "title = " . $db->quote($title, "text");
870 if ($partial_match) {
871 $where = $db->like("title", "text", '%' . $title . '%');
872 }
873
874 $sql =
875 "SELECT obj_id" . PHP_EOL
876 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
877 . "WHERE " . $where . PHP_EOL
878 ;
879
880 if ($type != '') {
881 $sql .= " AND type = " . $db->quote($type, "text");
882 }
883
884 $result = $db->query($sql);
885
886 $object_ids = [];
887 while ($row = $db->fetchAssoc($result)) {
888 $object_ids[] = (int) $row['obj_id'];
889 }
890
891 return $object_ids;
892 }
893
894 final public static function _lookupDescription(int $obj_id): string
895 {
896 global $DIC;
897 return (string) $DIC["ilObjDataCache"]->lookupDescription($obj_id);
898 }
899
900 final public static function _lookupLastUpdate(int $obj_id, bool $formatted = false): string
901 {
902 global $DIC;
903
904 $last_update = $DIC["ilObjDataCache"]->lookupLastUpdate($obj_id);
905
906 if ($formatted) {
908 }
909
910 return (string) $last_update;
911 }
912
913 final public static function _getLastUpdateOfObjects(array $obj_ids): string
914 {
915 global $DIC;
916 $db = $DIC->database();
917
918 $sql =
919 "SELECT MAX(last_update) as last_update" . PHP_EOL
920 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
921 . "WHERE " . $db->in("obj_id", $obj_ids, false, "integer") . PHP_EOL
922 ;
923
924 $result = $db->query($sql);
925 $row = $db->fetchAssoc($result);
926
927 return (string) $row["last_update"];
928 }
929
930 final public static function _lookupObjId(int $ref_id): int
931 {
932 global $DIC;
933 return $DIC["ilObjDataCache"]->lookupObjId($ref_id);
934 }
935
936 final public static function _setDeletedDate(int $ref_id, int $deleted_by): void
937 {
938 global $DIC;
939 $db = $DIC->database();
940
941 $values = [
942 "deleted" => ["date", $db->now()],
943 "deleted_by" => ["integer", $deleted_by]
944 ];
945
946 $where = [
947 "ref_id" => ["integer", $ref_id]
948 ];
949
950 $db->update("object_reference", $values, $where);
951 }
952
956 public static function setDeletedDates(array $ref_ids, int $user_id): void
957 {
958 global $DIC;
959 $db = $DIC->database();
960
961 $sql =
962 "UPDATE object_reference" . PHP_EOL
963 . "SET deleted = " . $db->now() . ", " . PHP_EOL
964 . "deleted_by = " . $db->quote($user_id, "integer") . PHP_EOL
965 . "WHERE " . $db->in("ref_id", $ref_ids, false, "integer") . PHP_EOL;
966
967 $db->manipulate($sql);
968 }
969
970 final public static function _resetDeletedDate(int $ref_id): void
971 {
972 global $DIC;
973 $db = $DIC->database();
974
975 $values = [
976 "deleted" => ["timestamp", null],
977 "deleted_by" => ["integer", 0]
978 ];
979
980 $where = [
981 "ref_id" => ["integer", $ref_id]
982 ];
983
984 $db->update("object_reference", $values, $where);
985 }
986
987 final public static function _lookupDeletedDate(int $ref_id): ?string
988 {
989 global $DIC;
990 $db = $DIC->database();
991
992 $sql =
993 "SELECT deleted" . PHP_EOL
994 . "FROM object_reference" . PHP_EOL
995 . "WHERE ref_id = " . $db->quote($ref_id, "integer") . PHP_EOL
996 ;
997 $result = $db->query($sql);
998 $row = $db->fetchAssoc($result);
999
1000 return $row["deleted"];
1001 }
1002
1006 final public static function _writeTitle(int $obj_id, string $title): void
1007 {
1008 global $DIC;
1009 $db = $DIC->database();
1010
1011 $values = [
1012 "title" => ["text", $title],
1013 "last_update" => ["date", $db->now()]
1014 ];
1015
1016 $where = [
1017 "obj_id" => ["integer", $obj_id]
1018 ];
1019
1020 $db->update(self::TABLE_OBJECT_DATA, $values, $where);
1021 }
1022
1026 final public static function _writeDescription(int $obj_id, string $desc): void
1027 {
1028 global $DIC;
1029
1030 $db = $DIC->database();
1031 $obj_definition = $DIC["objDefinition"];
1032
1033 $desc = ilStr::shortenTextExtended($desc, self::DESC_LENGTH, true);
1034
1035 $values = [
1036 "description" => ["text", $desc],
1037 "last_update" => ["date", $db->now()]
1038 ];
1039
1040 $where = [
1041 "obj_id" => ["integer", $obj_id]
1042 ];
1043
1044 $db->update(self::TABLE_OBJECT_DATA, $values, $where);
1045
1046
1048 // Update long description
1049 $sql =
1050 "SELECT obj_id, description" . PHP_EOL
1051 . "FROM object_description" . PHP_EOL
1052 . "WHERE obj_id = " . $db->quote($obj_id, 'integer') . PHP_EOL
1053 ;
1054 $result = $db->query($sql);
1055
1056 if ($result->numRows()) {
1057 $values = [
1058 "description" => ["clob", $desc]
1059 ];
1060 $db->update("object_description", $values, $where);
1061 } else {
1062 $values = [
1063 "description" => ["clob",$desc],
1064 "obj_id" => ["integer",$obj_id]
1065 ];
1066 $db->insert("object_description", $values);
1067 }
1068 }
1069 }
1070
1074 final public static function _writeImportId(int $obj_id, string $import_id): void
1075 {
1076 global $DIC;
1077 $db = $DIC->database();
1078
1079 $values = [
1080 "import_id" => ["text", $import_id],
1081 "last_update" => ["date", $db->now()]
1082 ];
1083
1084 $where = [
1085 "obj_id" => ["integer", $obj_id]
1086 ];
1087
1088 $db->update(self::TABLE_OBJECT_DATA, $values, $where);
1089 }
1090
1091 final public static function _lookupType(int $id, bool $reference = false): string
1092 {
1093 global $DIC;
1094
1095 if ($reference) {
1096 return $DIC["ilObjDataCache"]->lookupType($DIC["ilObjDataCache"]->lookupObjId($id));
1097 }
1098
1099 return $DIC["ilObjDataCache"]->lookupType($id);
1100 }
1101
1102 final public static function _isInTrash(int $ref_id): bool
1103 {
1104 global $DIC;
1105 return $DIC->repositoryTree()->isSaved($ref_id);
1106 }
1107
1111 final public static function _hasUntrashedReference(int $obj_id): bool
1112 {
1113 $ref_ids = ilObject::_getAllReferences($obj_id);
1114 foreach ($ref_ids as $ref_id) {
1116 return true;
1117 }
1118 }
1119
1120 return false;
1121 }
1122
1123 final public static function _lookupObjectId(int $ref_id): int
1124 {
1125 global $DIC;
1126 return $DIC["ilObjDataCache"]->lookupObjId($ref_id);
1127 }
1128
1136 final public static function _getObjectsDataForType(string $type, bool $omit_trash = false): array
1137 {
1138 global $DIC;
1139 $db = $DIC->database();
1140
1141 $sql =
1142 "SELECT obj_id, type, title, description, owner, create_date, last_update, import_id, offline" . PHP_EOL
1143 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
1144 . "WHERE type = " . $db->quote($type, "text") . PHP_EOL
1145 ;
1146 $result = $db->query($sql);
1147
1148 $objects = array();
1149 while ($row = $db->fetchAssoc($result)) {
1150 if ((!$omit_trash) || ilObject::_hasUntrashedReference((int) $row["obj_id"])) {
1151 $objects[$row["title"] . "." . $row["obj_id"]] = [
1152 "id" => $row["obj_id"],
1153 "type" => $row["type"],
1154 "title" => $row["title"],
1155 "description" => $row["description"]
1156 ];
1157 }
1158 }
1159 ksort($objects);
1160 return $objects;
1161 }
1162
1163
1169 public function putInTree(int $parent_ref_id): void
1170 {
1171 $this->tree->insertNode($this->getRefId(), $parent_ref_id);
1172 $this->handleAutoRating();
1173
1174 $log_entry = sprintf(
1175 "ilObject::putInTree(), parent_ref: %s, ref_id: %s, obj_id: %s, type: %s, title: %s",
1176 $parent_ref_id,
1177 $this->getRefId(),
1178 $this->getId(),
1179 $this->getType(),
1180 $this->getTitle()
1181 );
1182
1183 $this->log->write($log_entry);
1184
1185 $this->app_event_handler->raise(
1186 'Services/Object',
1187 'putObjectInTree',
1188 [
1189 'object' => $this,
1190 'obj_type' => $this->getType(),
1191 'obj_id' => $this->getId(),
1192 'parent_ref_id' => $parent_ref_id
1193 ]
1194 );
1195 }
1196
1197 public function setPermissions(int $parent_ref_id): void
1198 {
1199 $this->setParentRolePermissions($parent_ref_id);
1200 $this->initDefaultRoles();
1201 }
1202
1208 public function setParentRolePermissions(int $parent_ref_id): bool
1209 {
1210 $parent_roles = $this->rbac_review->getParentRoleIds($parent_ref_id);
1211 foreach ($parent_roles as $parent_role) {
1212 if ($parent_role['obj_id'] == SYSTEM_ROLE_ID) {
1213 continue;
1214 }
1215 $operations = $this->rbac_review->getOperationsOfRole(
1216 (int) $parent_role['obj_id'],
1217 $this->getType(),
1218 (int) $parent_role['parent']
1219 );
1220 $this->rbac_admin->grantPermission(
1221 (int) $parent_role['obj_id'],
1222 $operations,
1223 $this->getRefId()
1224 );
1225 }
1226 return true;
1227 }
1228
1232 public function createReference(): int
1233 {
1234 if (!isset($this->id)) {
1235 $message = "ilObject::createNewReference(): No obj_id given!";
1236 $this->error->raiseError($message, $this->error->WARNING);
1237 }
1238
1239 $next_id = $this->db->nextId('object_reference');
1240
1241 $values = [
1242 "ref_id" => ["integer", $next_id],
1243 "obj_id" => ["integer", $this->getId()]
1244 ];
1245
1246 $this->db->insert("object_reference", $values);
1247
1248 $this->ref_id = $next_id;
1249 $this->referenced = true;
1250
1251 return $this->ref_id;
1252 }
1253
1254 final public function countReferences(): int
1255 {
1256 if (!isset($this->id)) {
1257 $message = "ilObject::countReferences(): No obj_id given!";
1258 $this->error->raiseError($message, $this->error->WARNING);
1259 }
1260
1261 $sql =
1262 "SELECT COUNT(ref_id) num" . PHP_EOL
1263 . "FROM object_reference" . PHP_EOL
1264 . "WHERE obj_id = " . $this->db->quote($this->id, 'integer') . PHP_EOL
1265 ;
1266
1267 $res = $this->db->query($sql);
1268 $row = $this->db->fetchObject($res);
1269
1270 return (int) $row->num;
1271 }
1272
1281 public function delete(): bool
1282 {
1283 global $DIC;
1284 $rbac_admin = $DIC["rbacadmin"];
1285
1286 $remove = false;
1287
1288 // delete object_data entry
1289 if ((!$this->referenced) || ($this->countReferences() == 1)) {
1290 $type = ilObject::_lookupType($this->getId());
1291 if ($this->type != $type) {
1292 $log_entry = sprintf(
1293 "ilObject::delete(): Type mismatch. Object with obj_id: %s was instantiated by type '%s'. DB type is: %s",
1294 $this->id,
1295 $this->type,
1296 $type
1297 );
1298
1299 $this->log->write($log_entry);
1300 $this->error->raiseError(
1301 sprintf("ilObject::delete(): Type mismatch. (%s/%s)", $this->type, $this->id),
1302 $this->error->WARNING
1303 );
1304 }
1305
1306 $this->app_event_handler->raise('Services/Object', 'beforeDeletion', ['object' => $this]);
1307
1308 $sql =
1309 "DELETE FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
1310 . "WHERE obj_id = " . $this->db->quote($this->getId(), "integer") . PHP_EOL
1311 ;
1312 $this->db->manipulate($sql);
1313
1314 $sql =
1315 "DELETE FROM object_description" . PHP_EOL
1316 . "WHERE obj_id = " . $this->db->quote($this->getId(), "integer") . PHP_EOL
1317 ;
1318 $this->db->manipulate($sql);
1319
1320 $this->log->write(
1321 sprintf(
1322 "ilObject::delete(), deleted object, obj_id: %s, type: %s, title: %s",
1323 $this->getId(),
1324 $this->getType(),
1325 $this->getTitle()
1326 )
1327 );
1328
1329 // keep log of core object data
1331
1332 // remove news
1333 $news_item = new ilNewsItem();
1334 $news_item->deleteNewsOfContext($this->getId(), $this->getType());
1336
1338
1339 // BEGIN WebDAV: Delete WebDAV properties
1340 $sql =
1341 "DELETE FROM dav_property" . PHP_EOL
1342 . "WHERE obj_id = " . $this->db->quote($this->getId(), 'integer') . PHP_EOL
1343 ;
1344 $this->db->manipulate($sql);
1345 // END WebDAV: Delete WebDAV properties
1346
1347 ilECSImportManager::getInstance()->_deleteByObjId($this->getId());
1350
1351 $remove = true;
1352 } else {
1353 $this->log->write(
1354 sprintf(
1355 "ilObject::delete(), object not deleted, number of references: %s, obj_id: %s, type: %s, title: %s",
1356 $this->countReferences(),
1357 $this->getId(),
1358 $this->getType(),
1359 $this->getTitle()
1360 )
1361 );
1362 }
1363
1364 // delete object_reference entry
1365 if ($this->referenced) {
1367
1368 $this->app_event_handler->raise('Services/Object', 'deleteReference', ['ref_id' => $this->getRefId()]);
1369
1370 $sql =
1371 "DELETE FROM object_reference" . PHP_EOL
1372 . "WHERE ref_id = " . $this->db->quote($this->getRefId(), 'integer') . PHP_EOL
1373 ;
1374 $this->db->manipulate($sql);
1375
1376 $this->log->write(
1377 sprintf(
1378 "ilObject::delete(), reference deleted, ref_id: %s, obj_id: %s, type: %s, title: %s",
1379 $this->getRefId(),
1380 $this->getId(),
1381 $this->getType(),
1382 $this->getTitle()
1383 )
1384 );
1385
1386 // DELETE PERMISSION ENTRIES IN RBAC_PA
1387 // DONE: method overwritten in ilObjRole & ilObjUser.
1388 // this call only applies for objects in rbac (not usr,role,rolt)
1389 // TODO: Do this for role templates too
1390 $rbac_admin->revokePermission($this->getRefId(), 0, false);
1391
1392 ilRbacLog::delete($this->getRefId());
1393
1394 // Remove applied didactic template setting
1396 }
1397
1398 // remove conditions
1399 if ($this->referenced) {
1400 $ch = new ilConditionHandler();
1401 $ch->delete($this->getRefId());
1402 unset($ch);
1403 }
1404
1405 return $remove;
1406 }
1407
1415 public function initDefaultRoles(): void
1416 {
1417 }
1418
1419 public function applyDidacticTemplate(int $tpl_id): void
1420 {
1421 ilLoggerFactory::getLogger('obj')->debug('Applying didactic template with id: ' . $tpl_id);
1422 if ($tpl_id) {
1423 foreach (ilDidacticTemplateActionFactory::getActionsByTemplateId($tpl_id) as $action) {
1424 $action->setRefId($this->getRefId());
1425 $action->apply();
1426 }
1427 }
1428
1430 }
1431
1440 public static function _exists(int $id, bool $reference = false, ?string $type = null): bool
1441 {
1442 global $DIC;
1443 $db = $DIC->database();
1444
1445 if ($reference) {
1446 $sql =
1447 "SELECT object_data.obj_id" . PHP_EOL
1448 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
1449 . "LEFT JOIN object_reference ON object_reference.obj_id = object_data.obj_id " . PHP_EOL
1450 . "WHERE object_reference.ref_id= " . $db->quote($id, "integer") . PHP_EOL
1451 ;
1452 } else {
1453 $sql =
1454 "SELECT object_data.obj_id" . PHP_EOL
1455 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
1456 . "WHERE obj_id = " . $db->quote($id, "integer") . PHP_EOL
1457 ;
1458 }
1459
1460 if ($type) {
1461 $sql .= " AND object_data.type = " . $db->quote($type, "text") . PHP_EOL;
1462 }
1463
1464 $result = $db->query($sql);
1465
1466 return (bool) $db->numRows($result);
1467 }
1468
1469 public function getXMLZip(): string
1470 {
1471 return "";
1472 }
1473 public function getHTMLDirectory(): bool
1474 {
1475 return false;
1476 }
1477
1478 final public static function _getObjectsByType(string $obj_type = "", int $owner = null): array
1479 {
1480 global $DIC;
1481 $db = $DIC->database();
1482
1483 $order = " ORDER BY title";
1484
1485 $where = "";
1486 if ($obj_type) {
1487 $where = "WHERE type = " . $db->quote($obj_type, "text");
1488
1489 if (!is_null($owner)) {
1490 $where .= " AND owner = " . $db->quote($owner, "integer");
1491 }
1492 }
1493
1494 $sql =
1495 "SELECT obj_id, type, title, description, owner, create_date, last_update, import_id, offline" . PHP_EOL
1496 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
1497 . $where . PHP_EOL
1498 . $order . PHP_EOL
1499 ;
1500 $result = $db->query($sql);
1501
1502 $arr = [];
1503 if ($db->numRows($result) > 0) {
1504 while ($row = $db->fetchAssoc($result)) {
1505 $row["desc"] = $row["description"];
1506 $arr[$row["obj_id"]] = $row;
1507 }
1508 }
1509
1510 return $arr;
1511 }
1512
1519 final public static function _prepareCloneSelection(
1520 array $ref_ids,
1521 string $new_type,
1522 bool $show_path = true
1523 ): array {
1524 global $DIC;
1525
1526 $db = $DIC->database();
1527 $lng = $DIC->language();
1528 $obj_definition = $DIC["objDefinition"];
1529
1530 $sql =
1531 "SELECT obj_data.title obj_title, path_data.title path_title, child" . PHP_EOL
1532 . "FROM tree " . PHP_EOL
1533 . "JOIN object_reference obj_ref ON child = obj_ref.ref_id " . PHP_EOL
1534 . "JOIN object_data obj_data ON obj_ref.obj_id = obj_data.obj_id " . PHP_EOL
1535 . "JOIN object_reference path_ref ON parent = path_ref.ref_id " . PHP_EOL
1536 . "JOIN object_data path_data ON path_ref.obj_id = path_data.obj_id " . PHP_EOL
1537 . "WHERE " . $db->in("child", $ref_ids, false, "integer") . PHP_EOL
1538 . "ORDER BY obj_data.title" . PHP_EOL
1539 ;
1540 $res = $db->query($sql);
1541
1542 if (!$obj_definition->isPlugin($new_type)) {
1543 $options[0] = $lng->txt('obj_' . $new_type . '_select');
1544 } else {
1545 $options[0] = ilObjectPlugin::lookupTxtById($new_type, "obj_" . $new_type . "_select");
1546 }
1547
1548 while ($row = $db->fetchObject($res)) {
1549 if (strlen($title = $row->obj_title) > 40) {
1550 $title = substr($title, 0, 40) . '...';
1551 }
1552
1553 if ($show_path) {
1554 if (strlen($path = $row->path_title) > 40) {
1555 $path = substr($path, 0, 40) . '...';
1556 }
1557
1558 $title .= ' (' . $lng->txt('path') . ': ' . $path . ')';
1559 }
1560
1561 $options[$row->child] = $title;
1562 }
1563 return $options ?: array();
1564 }
1565
1569 public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree = false): ?ilObject
1570 {
1571 global $DIC;
1572
1573 $ilUser = $DIC["ilUser"];
1574 $rbac_admin = $DIC["rbacadmin"];
1575
1576 $class_name = ('ilObj' . $this->obj_definition->getClassName($this->getType()));
1577
1578 $options = ilCopyWizardOptions::_getInstance($copy_id);
1579
1580 $title = $this->getTitle();
1581 $this->obj_log->debug($title);
1582 $this->obj_log->debug("isTreeCopyDisabled: " . $options->isTreeCopyDisabled());
1583 $this->obj_log->debug("omit_tree: " . $omit_tree);
1584 if (!$options->isTreeCopyDisabled() && !$omit_tree) {
1585 $title_with_suffix = $this->appendCopyInfo($target_id, $copy_id);
1586 $title = mb_strlen($title_with_suffix) < self::TITLE_LENGTH ? $title_with_suffix : $title;
1587 $this->obj_log->debug("title incl. copy info: " . $title);
1588
1589 }
1590
1591 // create instance
1592 $new_obj = new $class_name(0, false);
1593 $new_obj->setOwner($ilUser->getId());
1594 $new_obj->setTitle($title);
1595 $new_obj->setDescription($this->getLongDescription());
1596 $new_obj->setType($this->getType());
1597
1598 // Choose upload mode to avoid creation of additional settings, db entries ...
1599 $new_obj->create(true);
1600
1601 if ($this->supportsOfflineHandling()) {
1602 $new_obj->setOffLineStatus($this->getOfflineStatus());
1603 $new_obj->update();
1604 }
1605
1606 if (!$options->isTreeCopyDisabled() && !$omit_tree) {
1607 ilLoggerFactory::getLogger('obj')->debug('Tree copy is enabled');
1608 $new_obj->createReference();
1609 $new_obj->putInTree($target_id);
1610 $new_obj->setPermissions($target_id);
1611
1612 // when copying from personal workspace we have no current ref id
1613 if ($this->getRefId()) {
1614 // copy local roles
1615 $rbac_admin->copyLocalRoles($this->getRefId(), $new_obj->getRefId());
1616 }
1617 } else {
1618 ilLoggerFactory::getLogger('obj')->debug('Tree copy is disabled');
1619 }
1620
1621 ilAdvancedMDValues::_cloneValues($copy_id, $this->getId(), $new_obj->getId());
1622
1623 // BEGIN WebDAV: Clone WebDAV properties
1624 $sql =
1625 "INSERT INTO dav_property" . PHP_EOL
1626 . "(obj_id, node_id, ns, name, value)" . PHP_EOL
1627 . "SELECT " . $this->db->quote($new_obj->getId(), 'integer') . ", node_id, ns, name, value " . PHP_EOL
1628 . "FROM dav_property" . PHP_EOL
1629 . "WHERE obj_id = " . $this->db->quote($this->getId(), 'integer') . PHP_EOL
1630 ;
1631 $this->db->manipulate($sql);
1632 // END WebDAV: Clone WebDAV properties
1633
1635 $customIconFactory = $DIC['object.customicons.factory'];
1636 $customIcon = $customIconFactory->getByObjId($this->getId(), $this->getType());
1637 $customIcon->copy($new_obj->getId());
1638
1639 $tile_image = $DIC->object()->commonSettings()->tileImage()->getByObjId($this->getId());
1640 $tile_image->copy($new_obj->getId());
1641
1642 $this->app_event_handler->raise(
1643 'Services/Object',
1644 'cloneObject',
1645 [
1646 'object' => $new_obj,
1647 'cloned_from_object' => $this,
1648 ]
1649 );
1650
1651 return $new_obj;
1652 }
1653
1657 final public function appendCopyInfo(int $target_id, int $copy_id): string
1658 {
1659 $cp_options = ilCopyWizardOptions::_getInstance($copy_id);
1660 if (!$cp_options->isRootNode($this->getRefId())) {
1661 return $this->getTitle();
1662 }
1663
1664 $obj_translations = ilObjectTranslation::getInstance($this->getId());
1665
1666 $other_children_of_same_type = $this->tree->getChildsByType($target_id, $this->type);
1667
1668 if ($obj_translations->getLanguages() === []) {
1669 $existing_titles = array_map(
1670 fn (array $child): string => $child['title'],
1671 $other_children_of_same_type
1672 );
1673
1674 return $this->appendNumberOfCopiesToTitle(
1675 $this->lng->txt('copy_of_suffix'),
1676 $this->lng->txt('copy_n_of_suffix'),
1677 $this->getTitle(),
1678 $existing_titles
1679 );
1680 }
1681
1682 return $this->appendCopyInfoToTranslations($obj_translations, $other_children_of_same_type);
1683 }
1684
1686 ilObjectTranslation $obj_translations,
1687 array $other_children_of_same_type
1688 ): string {
1689 $nodes_translations = array_map(
1690 fn (array $child): ilObjectTranslation =>
1691 ilObjectTranslation::getInstance((int) $child['obj_id']),
1692 $other_children_of_same_type
1693 );
1694
1695 $title_translations_per_lang = array_reduce(
1696 $nodes_translations,
1697 $this->getCallbackForTitlesPerLanguageTransformation(),
1698 []
1699 );
1700
1701 $new_languages = [];
1702 $installed_langs = $this->lng->getInstalledLanguages();
1703 foreach ($obj_translations->getLanguages() as $language) {
1704 $lang_code = $language->getLanguageCode();
1705 $suffix_lang = $lang_code;
1706 if (!in_array($suffix_lang, $installed_langs)) {
1707 $suffix_lang = $this->lng->getDefaultLanguage();
1708 }
1709 $language->setTitle(
1710 $this->appendNumberOfCopiesToTitle(
1711 $this->lng->txtlng('common', 'copy_of_suffix', $suffix_lang),
1712 $this->lng->txtlng('common', 'copy_n_of_suffix', $suffix_lang),
1713 $language->getTitle(),
1714 $title_translations_per_lang[$lang_code] ?? []
1715 )
1716 );
1717 $new_languages[$lang_code] = $language;
1718 }
1719 $obj_translations->setLanguages($new_languages);
1720
1721 return $obj_translations->getDefaultTitle();
1722 }
1723
1725 {
1726 return function (array $npl, ?ilObjectTranslation $nt): array {
1727 $langs = $nt->getLanguages();
1728 foreach ($langs as $lang) {
1729 if (!array_key_exists($lang->getLanguageCode(), $npl)) {
1730 $npl[$lang->getLanguageCode()] = [];
1731 }
1732 $npl[$lang->getLanguageCode()][] = $lang->getTitle();
1733 }
1734 return $npl;
1735 };
1736 }
1737
1739 string $copy_suffix,
1740 string $copy_n_suffix,
1741 string $title,
1742 array $other_titles_for_lang
1743 ): string {
1744 $title_without_suffix = $this->buildTitleWithoutCopySuffix($copy_suffix, $copy_n_suffix, $title);
1745 $title_with_suffix = "{$title_without_suffix} {$copy_suffix}";
1746 if ($other_titles_for_lang === []
1747 || $this->isTitleUnique($title_with_suffix, $other_titles_for_lang)) {
1748 return $title_with_suffix;
1749 }
1750
1751 for ($i = 2;true;$i++) {
1752 $title_with_suffix = $title_without_suffix . ' ' . sprintf($copy_n_suffix, $i);
1753 if ($this->isTitleUnique($title_with_suffix, $other_titles_for_lang)) {
1754 return $title_with_suffix;
1755 }
1756 }
1757 }
1758
1759 private function isTitleUnique(string $title, array $nodes): bool
1760 {
1761 foreach ($nodes as $node) {
1762 if (($title === $node)) {
1763 return false;
1764 }
1765 }
1766 return true;
1767 }
1768
1769 private function buildTitleWithoutCopySuffix(string $copy_suffix, string $copy_n_suffix, string $title): string
1770 {
1771 /*
1772 * create a regular expression from the language text copy_n_of_suffix, so that
1773 * we can match it against $filenameWithoutExtension, and retrieve the number of the copy.
1774 * for example, if copy_n_of_suffix is 'Copy (%1s)', this creates the regular
1775 * expression '/ Copy \\‍([0-9]+)\\‍)$/'.
1776 */
1777 $regexp_for_suffix = preg_replace(
1778 '/([\^$.\[\]|()?*+{}])/',
1779 '\\\\${1}',
1780 ' '
1781 . $copy_n_suffix
1782 );
1783 $regexp_for_file_name = '/' . preg_replace('/%1\\\\\$s/', '([0-9]+)', $regexp_for_suffix) . '$/';
1784
1785 if (preg_match($regexp_for_file_name, $title, $matches)) {
1786 return substr($title, 0, -strlen($matches[0]));
1787 }
1788
1789 if (str_ends_with($title, " {$copy_suffix}")) {
1790 return substr(
1791 $title,
1792 0,
1793 -strlen(
1794 " {$copy_suffix}"
1795 )
1796 );
1797 }
1798
1799 return $title;
1800 }
1801
1809 public function cloneDependencies(int $target_id, int $copy_id): bool
1810 {
1811 ilConditionHandler::cloneDependencies($this->getRefId(), $target_id, $copy_id);
1812
1813 $tpl_id = ilDidacticTemplateObjSettings::lookupTemplateId($this->getRefId());
1814 if ($tpl_id) {
1815 $factory = new ilObjectFactory();
1816 $obj = $factory->getInstanceByRefId($target_id, false);
1817 if ($obj instanceof ilObject) {
1818 $obj->applyDidacticTemplate($tpl_id);
1819 }
1820 }
1821 return true;
1822 }
1823
1827 public function cloneMetaData(ilObject $target_obj): bool
1828 {
1829 $md = new ilMD($this->getId(), 0, $this->getType());
1830 $md->cloneMD($target_obj->getId(), 0, $target_obj->getType());
1831 return true;
1832 }
1833
1834 public static function getIconForReference(
1835 int $ref_id,
1836 int $obj_id,
1837 string $size,
1838 string $type = "",
1839 bool $offline = false
1840 ): string {
1841 global $DIC;
1842
1843 $ilSetting = $DIC->settings();
1844 $objDefinition = $DIC["objDefinition"];
1845
1846 if ($obj_id == "" && $type == "") {
1847 return "";
1848 }
1849
1850 if ($type == "") {
1851 $type = ilObject::_lookupType($obj_id);
1852 }
1853
1854 if ($size == "") {
1855 $size = "big";
1856 }
1857
1858 if ($obj_id && $ilSetting->get('custom_icons')) {
1860 $customIconFactory = $DIC['object.customicons.factory'];
1861 $customIcon = $customIconFactory->getPresenterByObjId($obj_id, $type);
1862 if ($customIcon->exists()) {
1863 $filename = $customIcon->getFullPath();
1864 return $filename . '?tmp=' . filemtime($filename);
1865 }
1866 }
1867
1868 if ($obj_id) {
1869 $dtpl_icon_factory = ilDidacticTemplateIconFactory::getInstance();
1870 if ($ref_id) {
1871 $path = $dtpl_icon_factory->getIconPathForReference($ref_id);
1872 } else {
1873 $path = $dtpl_icon_factory->getIconPathForObject($obj_id);
1874 }
1875 if ($path) {
1876 return $path . '?tmp=' . filemtime($path);
1877 }
1878 }
1879
1880 if (!$offline) {
1881 if ($objDefinition->isPluginTypeName($type)) {
1882 if ($objDefinition->getClassName($type) != "") {
1883 $class_name = "il" . $objDefinition->getClassName($type) . 'Plugin';
1884 $location = $objDefinition->getLocation($type);
1885 if (is_file($location . "/class." . $class_name . ".php")) {
1886 return call_user_func(array($class_name, "_getIcon"), $type, $size, $obj_id);
1887 }
1888 }
1889 return ilUtil::getImagePath("icon_cmps.svg");
1890 }
1891
1892 return ilUtil::getImagePath("icon_" . $type . ".svg");
1893 } else {
1894 return "./images/icon_" . $type . ".svg";
1895 }
1896 }
1897
1906 final public static function _getIcon(
1907 int $obj_id = 0,
1908 string $size = "big",
1909 string $type = "",
1910 bool $offline = false
1911 ): string {
1912 return self::getIconForReference(0, $obj_id, $size, $type, $offline);
1913 }
1914
1915 protected function handleAutoRating(): void
1916 {
1917 if ($this->process_auto_reating
1918 && $this->hasAutoRating()
1919 && method_exists($this, "setRating")
1920 ) {
1921 $this->setRating(true);
1922 $this->update();
1923 }
1924 }
1925
1926 protected function hasAutoRating(): bool
1927 {
1928 $ref_id = $this->getRefId();
1930
1931 if (!$ref_id || !in_array($type, array("file", "lm", "wiki"))) {
1932 return false;
1933 }
1934
1935 return $this->selfOrParentWithRatingEnabled();
1936 }
1937
1938 public function selfOrParentWithRatingEnabled(): bool
1939 {
1940 $tree = $this->tree;
1941 $ref_id = $this->getRefId();
1942 $parent_ref_id = $tree->checkForParentType($ref_id, "grp");
1943 if (!$parent_ref_id) {
1944 $parent_ref_id = $tree->checkForParentType($ref_id, "crs");
1945 }
1946 if ($parent_ref_id) {
1947 // get auto rate setting
1948 $parent_obj_id = ilObject::_lookupObjId($parent_ref_id);
1950 $parent_obj_id,
1952 );
1953 }
1954 return false;
1955 }
1956
1960 public static function collectDeletionDependencies(
1961 array &$deps,
1962 int $ref_id,
1963 int $obj_id,
1964 string $type,
1965 int $depth = 0
1966 ): void {
1967 global $DIC;
1968
1969 $objDefinition = $DIC["objDefinition"];
1970 $tree = $DIC->repositoryTree();
1971
1972 if ($depth == 0) {
1973 $deps["dep"] = array();
1974 }
1975
1976 $deps["del_ids"][$obj_id] = $obj_id;
1977
1978 if (!$objDefinition->isPluginTypeName($type)) {
1979 $class_name = "ilObj" . $objDefinition->getClassName($type);
1980 $odeps = call_user_func(array($class_name, "getDeletionDependencies"), $obj_id);
1981 if (is_array($odeps)) {
1982 foreach ($odeps as $id => $message) {
1983 $deps["dep"][$id][$obj_id][] = $message;
1984 }
1985 }
1986
1987 // get deletion dependency of children
1988 foreach ($tree->getChilds($ref_id) as $c) {
1989 ilObject::collectDeletionDependencies($deps, (int) $c["child"], (int) $c["obj_id"], (string) $c["type"], $depth + 1);
1990 }
1991 }
1992
1993 // delete all dependencies to objects that will be deleted, too
1994 if ($depth == 0) {
1995 foreach ($deps["del_ids"] as $obj_id) {
1996 unset($deps["dep"][$obj_id]);
1997 }
1998 $deps = $deps["dep"];
1999 }
2000 }
2001
2005 public static function getDeletionDependencies(int $obj_id): array
2006 {
2007 return [];
2008 }
2009
2010 public static function getLongDescriptions(array $obj_ids): array
2011 {
2012 global $DIC;
2013 $db = $DIC->database();
2014
2015 $sql =
2016 "SELECT obj_id, description" . PHP_EOL
2017 . "FROM object_description" . PHP_EOL
2018 . "WHERE " . $db->in("obj_id", $obj_ids, false, "integer") . PHP_EOL
2019 ;
2020 $result = $db->query($sql);
2021
2022 $all = array();
2023 while ($row = $db->fetchAssoc($result)) {
2024 $all[$row["obj_id"]] = $row["description"];
2025 }
2026 return $all;
2027 }
2028
2029 public static function getAllOwnedRepositoryObjects(int $user_id): array
2030 {
2031 global $DIC;
2032
2033 $db = $DIC->database();
2034 $obj_definition = $DIC["objDefinition"];
2035
2036 // restrict to repository
2037 $types = array_keys($obj_definition->getSubObjectsRecursively("root"));
2038
2039 $sql =
2040 "SELECT od.obj_id, od.type, od.title" . PHP_EOL
2041 . "FROM object_data od" . PHP_EOL
2042 . "JOIN object_reference oref ON(oref.obj_id = od.obj_id)" . PHP_EOL
2043 . "JOIN tree ON (tree.child = oref.ref_id)" . PHP_EOL
2044 ;
2045
2046 if ($user_id) {
2047 $sql .= "WHERE od.owner = " . $db->quote($user_id, "integer") . PHP_EOL;
2048 } else {
2049 $sql .=
2050 "LEFT JOIN usr_data ud ON (ud.usr_id = od.owner)" . PHP_EOL
2051 . "WHERE (od.owner < " . $db->quote(1, "integer") . PHP_EOL
2052 . "OR od.owner IS NULL OR ud.login IS NULL)" . PHP_EOL
2053 . "AND od.owner <> " . $db->quote(-1, "integer") . PHP_EOL
2054 ;
2055 }
2056
2057 $sql .=
2058 "AND " . $db->in("od.type", $types, false, "text") . PHP_EOL
2059 . "AND tree.tree > " . $db->quote(0, "integer") . PHP_EOL
2060 ;
2061
2062 $res = $db->query($sql);
2063
2064 $all = array();
2065 while ($row = $db->fetchAssoc($res)) {
2066 $all[$row["type"]][$row["obj_id"]] = $row["title"];
2067 }
2068
2069 return $all;
2070 }
2071
2075 public static function fixMissingTitles($type, array &$obj_title_map)
2076 {
2077 global $DIC;
2078 $db = $DIC->database();
2079
2080 if (!in_array($type, array("catr", "crsr", "sess", "grpr", "prgr"))) {
2081 return;
2082 }
2083
2084 // any missing titles?
2085 $missing_obj_ids = array();
2086 foreach ($obj_title_map as $obj_id => $title) {
2087 if (!trim($title)) {
2088 $missing_obj_ids[] = $obj_id;
2089 }
2090 }
2091
2092 if (!sizeof($missing_obj_ids)) {
2093 return;
2094 }
2095
2096 switch ($type) {
2097 case "grpr":
2098 case "catr":
2099 case "crsr":
2100 case "prgr":
2101 $sql =
2102 "SELECT oref.obj_id, od.type, od.title" . PHP_EOL
2103 . "FROM object_data od" . PHP_EOL
2104 . "JOIN container_reference oref ON (od.obj_id = oref.target_obj_id)" . PHP_EOL
2105 . "AND " . $db->in("oref.obj_id", $missing_obj_ids, false, "integer") . PHP_EOL
2106 ;
2107 $result = $db->query($sql);
2108
2109 while ($row = $db->fetchAssoc($result)) {
2110 $obj_title_map[$row["obj_id"]] = $row["title"];
2111 }
2112 break;
2113 case "sess":
2114 foreach ($missing_obj_ids as $obj_id) {
2115 $sess = new ilObjSession($obj_id, false);
2116 $obj_title_map[$obj_id] = $sess->getFirstAppointment()->appointmentToString();
2117 }
2118 break;
2119 }
2120 }
2121
2122 public static function _lookupCreationDate(int $obj_id): string
2123 {
2124 global $DIC;
2125 $db = $DIC->database();
2126
2127 $sql =
2128 "SELECT create_date" . PHP_EOL
2129 . "FROM " . self::TABLE_OBJECT_DATA . PHP_EOL
2130 . "WHERE obj_id = " . $db->quote($obj_id, "integer") . PHP_EOL
2131 ;
2132 $result = $db->query($sql);
2133 $rec = $db->fetchAssoc($result);
2134 return $rec["create_date"];
2135 }
2136
2145 public function getPossibleSubObjects(bool $filter = true): array
2146 {
2147 return $this->obj_definition->getSubObjects($this->type, $filter);
2148 }
2149
2150 public static function _getObjectTypeIdByTitle(string $type, \ilDBInterface $ilDB = null): ?int
2151 {
2152 if (!$ilDB) {
2153 global $DIC;
2154 $ilDB = $DIC->database();
2155 }
2156
2157 $sql =
2158 "SELECT obj_id FROM object_data" . PHP_EOL
2159 . "WHERE type = 'typ'" . PHP_EOL
2160 . "AND title = " . $ilDB->quote($type, 'text') . PHP_EOL
2161 ;
2162
2163 $res = $ilDB->query($sql);
2164 if ($ilDB->numRows($res) == 0) {
2165 return null;
2166 }
2167
2168 $row = $ilDB->fetchAssoc($res);
2169 return (int) $row['obj_id'] ?? null;
2170 }
2171} // END class.ilObject
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$filename
Definition: buildRTE.php:78
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
const IL_CAL_DATETIME
error(string $a_errmsg)
return true
static _deleteByObjId(int $a_obj_id)
Delete by objekt id.
static _cloneValues(int $copy_id, int $a_source_id, int $a_target_id, ?string $a_sub_type=null, ?int $a_source_sub_id=null, ?int $a_target_sub_id=null)
Clone Advanced Meta Data.
Global event handler.
static _deleteSettingsOfBlock(int $a_block_id, string $a_block_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static cloneDependencies(int $a_src_ref_id, int $a_target_ref_id, int $a_copy_id)
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
static _getInstance(int $a_copy_id)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
static getActionsByTemplateId(int $a_tpl_id)
Get actions of one template.
static assignTemplate(int $a_ref_id, int $a_obj_id, int $a_tpl_id)
static getInstance()
Get the singleton instance of this ilECSImportManager.
Error Handling & global info handling uses PEAR error class.
static _deleteByObjId(int $a_obj_id)
language handling
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
A news item can be created by different sources.
User class.
static deleteAllEntries(int $ref_id)
Delete all db entries for ref id.
parses the objects.xml it handles the xml-description of all ilias objects
isPlugin(string $obj_name)
get RBAC status by type returns true if object type is an (activated) plugin type
isRBACObject(string $obj_name)
get RBAC status by type returns true if object type is a RBAC object type
getSubObjectsRecursively(string $obj_type, bool $include_source_obj=true, bool $add_admin_objects=false)
Get all sub objects by type.
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 lookupTxtById(string $plugin_id, string $lang_var)
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjectId(int $ref_id)
static _lookupType(int $id, bool $reference=false)
string $desc
setPermissions(int $parent_ref_id)
createReference()
creates reference for object
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
appendCopyInfo(int $target_id, int $copy_id)
Prepend Copy info if object with same name exists in that container.
string $title
const TITLE_LENGTH
bool $add_dots
static _lookupOwnerName(int $owner_id)
Lookup owner name for owner id.
ilRbacReview $rbac_review
cloneMetaData(ilObject $target_obj)
Copy meta data.
static _writeDescription(int $obj_id, string $desc)
write description to db (static)
static _getObjectsByType(string $obj_type="", int $owner=null)
putInTree(int $parent_ref_id)
maybe this method should be in tree object!?
static _getObjectTypeIdByTitle(string $type, \ilDBInterface $ilDB=null)
static _setDeletedDate(int $ref_id, int $deleted_by)
array $objectList
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
string $create_date
static _getAllReferences(int $id)
get all reference ids for object ID
updateOwner()
update owner of object in db
const LONG_DESC_LENGTH
supportsOfflineHandling()
cloneDependencies(int $target_id, int $copy_id)
Clone object dependencies.
ilLanguage $lng
doMDUpdateListener(string $a_element)
static _lookupDeletedDate(int $ref_id)
selfOrParentWithRatingEnabled()
static collectDeletionDependencies(array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
Collect deletion dependencies.
ilAppEventHandler $app_event_handler
static _isInTrash(int $ref_id)
getPossibleSubObjects(bool $filter=true)
get all possible sub objects of this type the object can decide which types of sub objects are possib...
static _lookupObjIdByImportId(string $import_id)
Get (latest) object id for an import id.
beforeDeleteMetaData()
static _writeTitle(int $obj_id, string $title)
write title to db (static)
setId(int $id)
ilTree $tree
static _getIdForImportId(string $import_id)
applyDidacticTemplate(int $tpl_id)
bool $call_by_reference
beforeUpdateMetaData()
static _lookupImportId(int $obj_id)
ilObjectDefinition $obj_definition
string $long_desc
static _getIdsForTitle(string $title, string $type='', bool $partial_match=false)
isTitleUnique(string $title, array $nodes)
getLastUpdateDate()
Get last update date in YYYY-MM-DD HH-MM-SS format.
bool $process_auto_reating
setType(string $type)
ilErrorHandling $error
static _prepareCloneSelection(array $ref_ids, string $new_type, bool $show_path=true)
Prepare copy wizard object selection.
static getDeletionDependencies(int $obj_id)
Get deletion dependencies.
static setDeletedDates(array $ref_ids, int $user_id)
setTitle(string $title)
setImportId(string $import_id)
ilLogger $log
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _getLastUpdateOfObjects(array $obj_ids)
static _lookupLastUpdate(int $obj_id, bool $formatted=false)
getOwnerName()
get full name of object owner
__construct(int $id=0, bool $reference=true)
withReferences()
determines whether objects are referenced or not (got ref ids or not)
ilLogger $obj_log
setOwner(int $usr_id)
getLongDescription()
get object long description (stored in object_description)
string $untranslatedTitle
bool $register
ilRbacAdmin $rbac_admin
string $last_update
static _writeImportId(int $obj_id, string $import_id)
write import id to db (static)
static getAllOwnedRepositoryObjects(int $user_id)
const TABLE_OBJECT_DATA
setOfflineStatus(bool $status)
create()
note: title, description and type should be set when this function is called
ilObjUser $user
static _lookupCreationDate(int $obj_id)
getUntranslatedTitle()
Get untranslated object title WebDAV needs to access the untranslated title of an object.
string $type
getCallbackForTitlesPerLanguageTransformation()
appendCopyInfoToTranslations(ilObjectTranslation $obj_translations, array $other_children_of_same_type)
static _getObjectsDataForType(string $type, bool $omit_trash=false)
get all objects of a certain type
appendNumberOfCopiesToTitle(string $copy_suffix, string $copy_n_suffix, string $title, array $other_titles_for_lang)
beforeMDUpdateListener(string $a_element)
const DESC_LENGTH
static _resetDeletedDate(int $ref_id)
static getLongDescriptions(array $obj_ids)
ILIAS $ilias
static _lookupObjId(int $ref_id)
string $import_id
bool $referenced
MDUpdateListener(string $element)
Metadata update listener.
setParentRolePermissions(int $parent_ref_id)
Initialize the permissions of parent roles (local roles of categories, global roles....
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
beforeCreateMetaData()
ilDBInterface $db
buildTitleWithoutCopySuffix(string $copy_suffix, string $copy_n_suffix, string $title)
getCreateDate()
Get create date in YYYY-MM-DD HH-MM-SS format.
static fixMissingTitles($type, array &$obj_title_map)
Try to fix missing object titles.
setDescription(string $desc)
getPresentationTitle()
get presentation title Normally same as title Overwritten for sessions
setRefId(int $ref_id)
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
Class ilRbacAdmin Core functions for role based access control.
copyLocalRoles(int $a_source_id, int $a_target_id)
Copy local roles This method creates a copy of all local role.
revokePermission(int $a_ref_id, int $a_rol_id=0, bool $a_keep_protected=true)
Revokes permissions of an object of one role.
static delete(int $a_ref_id)
class ilRbacReview Contains Review functions of core Rbac.
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
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...
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
$c
Definition: cli.php:38
const SYSTEM_ROLE_ID
Definition: constants.php:29
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
$target_id
Definition: goto.php:52
$ilUser
Definition: imgupload.php:34
Interface ilDBInterface.
update(string $table_name, array $values, array $where)
@description $where MUST contain existing columns only.
insert(string $table_name, array $values)
fetchObject(ilDBStatement $query_result)
setLimit(int $limit, int $offset=0)
like(string $column, string $type, string $value="?", bool $case_insensitive=true)
Generate a like subquery.
numRows(ilDBStatement $statement)
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)
in(string $field, array $values, bool $negate=false, string $type="")
$ref_id
Definition: ltiauth.php:67
$path
Definition: ltiservices.php:32
$res
Definition: ltiservices.php:69
$factory
Definition: metadata.php:75
$i
Definition: metadata.php:41
Class ChatMainBarProvider \MainMenu\Provider.
header include for all ilias files.
global $ilSetting
Definition: privfeed.php:17
$type
$lang
Definition: xapiexit.php:26
$message
Definition: xapiexit.php:32