ILIAS  release_8 Revision v8.24
class.ilObjectListGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29
42{
43 public const IL_LIST_AS_TRIGGER = "trigger";
44 public const IL_LIST_FULL = "full";
45
46 public const DETAILS_MINIMAL = 10;
47 public const DETAILS_SEARCH = 20 ;
48 public const DETAILS_ALL = 30;
49
50 public const CONTEXT_REPOSITORY = 1;
51 public const CONTEXT_WORKSPACE = 2;
52 public const CONTEXT_WORKSPACE_SHARING = 4;
53 public const CONTEXT_PERSONAL_DESKTOP = 5;
54 public const CONTEXT_SEARCH = 6;
55
56 public const DOWNLOAD_CHECKBOX_NONE = 0;
57 public const DOWNLOAD_CHECKBOX_ENABLED = 1;
59
60 protected static array $cnt_notes = [];
61 protected static array $cnt_tags = [];
62 protected static array $tags = [];
63 protected static array $comments_activation = [];
64 protected static bool $preload_done = false;
65 protected static int $js_unique_id = 0;
66 protected static string $tpl_file_name = "tpl.container_list_item.html";
67 protected static string $tpl_component = "Services/Container";
68 private \ILIAS\Notes\Service $notes_service;
69 protected bool $force_rate_parent = false;
70
71 protected array $access_cache;
73 protected ilObjUser $user;
75 protected ilTree $tree;
77 protected UIServices $ui;
80 protected ilLanguage $lng;
81 protected string $mode;
82 protected bool $path_enabled;
83 protected int $context;
87
88 protected bool $static_link_enabled = false;
89 protected bool $delete_enabled = false;
90 protected bool $cut_enabled = false;
91 protected bool $subscribe_enabled = false;
92 protected bool $link_enabled = false;
93 protected bool $copy_enabled = true;
94 protected bool $progress_enabled = false;
95 protected bool $notice_properties_enabled = true;
96 protected bool $info_screen_enabled = false;
97 protected string $type;
98 protected string $gui_class_name = "";
99 protected array $commands = [];
100
103 protected int $requested_ref_id;
104 protected string $requested_cmd;
105 protected string $requested_base_class;
107
108
109 protected bool $description_enabled = true;
110 protected bool $preconditions_enabled = true;
111 protected bool $properties_enabled = true;
112 protected bool $commands_enabled = true;
113 protected array $cust_prop = [];
115 protected array $cust_commands = [];
117 protected array $cust_modals = [];
118 protected int $condition_depth = 0;
119 protected bool $std_cmd_only = false;
120 protected array $sub_item_html = [];
121 protected bool $multi_download_enabled = false;
123 protected int $obj_id;
124 protected int $ref_id;
125 protected int $sub_obj_id;
126 protected ?string $sub_obj_type;
128 protected bool $substitutions_enabled = false;
129 protected bool $icons_enabled = false;
130 protected bool $checkboxes_enabled = false;
131 protected bool $position_enabled = false;
132 protected bool $item_detail_links_enabled = false;
133 protected array $item_detail_links = [];
134 protected string $item_detail_links_intro = '';
135 protected bool $search_fragments_enabled = false;
136 protected string $search_fragment = '';
137 protected bool $path_linked = false;
138 protected bool $enabled_relevance = false;
139 protected int $relevance = 0;
140 protected bool $expand_enabled = false;
141 protected bool $is_expanded = true;
142 protected bool $bold_title = false;
144 protected int $reference_ref_id = 0;
145 protected ?int $reference_obj_id = null;
146 protected bool $separate_commands = false;
147 protected bool $search_fragment_enabled = false;
148 protected ?string $additional_information = "";
149 protected bool $repository_transfer_enabled = false;
150 protected bool $shared = false;
151 protected bool $restrict_to_goto = false;
152 protected bool $comments_enabled = false;
153 protected bool $comments_settings_enabled = false;
154 protected bool $notes_enabled = false;
155 protected bool $tags_enabled = false;
156 protected bool $rating_enabled = false;
157 protected bool $rating_categories_enabled = false;
158 protected ?string $rating_text = null;
159 protected ?array $rating_ctrl_path = null;
160 protected bool $timings_enabled = true;
161 protected bool $force_visible_only = false;
162 protected array $prevent_duplicate_commands = [];
163 protected int $parent_ref_id;
164 protected string $title_link = '';
165 protected bool $title_link_disabled = false;
166 protected bool $lp_cmd_enabled = false;
168 protected ?ilPathGUI $path_gui = null;
169 protected array $default_command_params = [];
170 protected array $header_icons = [];
171 protected ?object $container_obj = null;
172 protected ilTemplate $tpl;
173 protected string $position_value;
174 protected int $path_start_node;
175 protected array $default_command = [];
178 protected array $condition_target;
179 protected array $notice_prop = [];
180 protected string $ajax_hash;
182 protected string $position_field_index = "";
183 protected string $title = "";
184 protected string $description = "";
186
187 public function __construct(int $context = self::CONTEXT_REPOSITORY)
188 {
190 global $DIC;
191
192 $this->access = $DIC->access();
193 $this->user = $DIC->user();
194 $this->obj_definition = $DIC["objDefinition"];
195 $this->tree = $DIC->repositoryTree();
196 $this->settings = $DIC->settings();
197 $this->ui = $DIC->ui();
198 $this->rbacsystem = $DIC->rbac()->system();
199 $this->ctrl = $DIC->ctrl();
200 $this->lng = $DIC->language();
201 $this->mode = self::IL_LIST_FULL;
202 $this->path_enabled = false;
203 $this->context = $context;
204 $this->object_service = $DIC->object();
205 $this->request_wrapper = $DIC->http()->wrapper()->query();
206 $this->refinery = $DIC->refinery();
207
208 $this->enableComments(false);
209 $this->enableNotes(false);
210 $this->enableTags(false);
211
212 // unique js-ids
213 $this->setParentRefId((int) ($_REQUEST["ref_id"] ?? 0));
214
215 $this->init();
216
217 $this->ldap_mapping = ilLDAPRoleGroupMapping::_getInstance();
218 $this->fav_manager = new ilFavouritesManager();
219
220 $this->lng->loadLanguageModule("obj");
221 $this->lng->loadLanguageModule("rep");
222 $params = $DIC->http()->request()->getQueryParams();
223 $this->requested_ref_id = (int) ($params["ref_id"] ?? null);
224 $this->requested_cmd = (string) ($params["cmd"] ?? null);
225 $this->requested_base_class = (string) ($params["baseClass"] ?? null);
226 $this->clipboard = $DIC
227 ->repository()
228 ->internal()
229 ->domain()
230 ->clipboard();
231 $this->notes_service = $DIC->notes();
232 }
233
234 public function setContainerObject(object $container_obj): void
235 {
236 $this->container_obj = $container_obj;
237 }
238
239 public function getContainerObject(): ?object
240 {
242 }
243
244
250 public function init(): void
251 {
252 // Create static links for default command (linked title) or not
253 $this->static_link_enabled = true;
254 $this->delete_enabled = true;
255 $this->cut_enabled = true;
256 $this->subscribe_enabled = true;
257 $this->link_enabled = false;
258 $this->copy_enabled = false;
259 $this->progress_enabled = false;
260 $this->notice_properties_enabled = true;
261 $this->info_screen_enabled = false;
262 $this->type = ""; // "cat", "course", ...
263 $this->gui_class_name = ""; // "ilobjcategorygui", "ilobjcoursegui", ...
264
265 // general commands array, e.g.
266 $this->commands = ilObjectAccess::_getCommands();
267 }
268
269 public function enableProperties(bool $status): void
270 {
271 $this->properties_enabled = $status;
272 }
273
274 public function getPropertiesStatus(): bool
275 {
277 }
278
279 public function enablePreconditions(bool $status): void
280 {
281 $this->preconditions_enabled = $status;
282 }
283
284 public function getPreconditionsStatus(): bool
285 {
287 }
288
289 public function enableNoticeProperties(bool $status): void
290 {
291 $this->notice_properties_enabled = $status;
292 }
293
294 public function getNoticePropertiesStatus(): bool
295 {
297 }
298
299 public function enableDescription(bool $status): void
300 {
301 $this->description_enabled = $status;
302 }
303
304 public function getDescriptionStatus(): bool
305 {
307 }
308
309 public function enableSearchFragments(bool $status): void
310 {
311 $this->search_fragment_enabled = $status;
312 }
313
314 public function getSearchFragmentStatus(): bool
315 {
317 }
318
319 public function enableLinkedPath(bool $status): void
320 {
321 $this->path_linked = $status;
322 }
323
324 public function enableRelevance(bool $status): void
325 {
326 $this->enabled_relevance = $status;
327 }
328
329 public function enabledRelevance(): bool
330 {
332 }
333
334 public function setRelevance(int $rel): void
335 {
336 $this->relevance = $rel;
337 }
338
339 public function getRelevance(): int
340 {
341 return $this->relevance;
342 }
343
344 public function enableIcon(bool $status): void
345 {
346 $this->icons_enabled = $status;
347 }
348
349 public function getIconStatus(): bool
350 {
352 }
353
354 public function enableCheckbox(bool $status): void
355 {
356 $this->checkboxes_enabled = $status;
357 }
358
359 public function getCheckboxStatus(): bool
360 {
362 }
363
364 public function enableExpand(bool $status): void
365 {
366 $this->expand_enabled = $status;
367 }
368
369 public function getExpandStatus(): bool
370 {
372 }
373
374 public function setExpanded(bool $status): void
375 {
376 $this->is_expanded = $status;
377 }
378
379 public function isExpanded(): bool
380 {
381 return $this->is_expanded;
382 }
387 public function setPositionInputField(string $field_index, string $position_value): void
388 {
389 $this->position_enabled = true;
390 $this->position_field_index = $field_index;
391 $this->position_value = $position_value;
392 }
393
394 public function enableDelete(bool $status): void
395 {
396 $this->delete_enabled = $status;
397 }
398
399 public function getDeleteStatus(): bool
400 {
402 }
403
404 public function enableCut(bool $status): void
405 {
406 $this->cut_enabled = $status;
407 }
408
409 public function getCutStatus(): bool
410 {
411 return $this->cut_enabled;
412 }
413
414 public function enableCopy(bool $status): void
415 {
416 $this->copy_enabled = $status;
417 }
418
419 public function getCopyStatus(): bool
420 {
421 return $this->copy_enabled;
422 }
423
424 public function enableSubscribe(bool $status): void
425 {
426 $this->subscribe_enabled = $status;
427 }
428
429 public function getSubscribeStatus(): bool
430 {
432 }
433
434 public function enableLink(bool $status): void
435 {
436 $this->link_enabled = $status;
437 }
438
439 public function getLinkStatus(): bool
440 {
441 return $this->link_enabled;
442 }
443
444 public function enablePath(bool $path, int $start_node = 0, \ilPathGUI $path_gui = null): void
445 {
446 $this->path_enabled = $path;
447 $this->path_start_node = $start_node;
448 $this->path_gui = $path_gui;
449 }
450
451 public function getPathStatus(): bool
452 {
453 return $this->path_enabled;
454 }
455
456 public function enableCommands(bool $status, bool $std_only = false): void
457 {
458 $this->commands_enabled = $status;
459 $this->std_cmd_only = $std_only;
460 }
461
462 public function getCommandsStatus(): bool
463 {
465 }
466
467 public function enableInfoScreen(bool $info_screen): void
468 {
469 $this->info_screen_enabled = $info_screen;
470 }
471
472 public function getInfoScreenStatus(): bool
473 {
475 }
476
477 protected function enableLearningProgress(bool $enabled): void
478 {
479 $this->lp_cmd_enabled = $enabled;
480 }
481
487 public function addSubItemHTML(string $html): void
488 {
489 $this->sub_item_html[] = $html;
490 }
491
492 public function enableProgressInfo(bool $status): void
493 {
494 $this->progress_enabled = $status;
495 }
496
497 public function getProgressInfoStatus(): bool
498 {
500 }
501
502 public function enableSubstitutions(bool $status): void
503 {
504 $this->substitutions_enabled = $status;
505 }
506
507 public function getSubstitutionStatus(): bool
508 {
510 }
511
516 public function enableItemDetailLinks(bool $status): void
517 {
518 $this->item_detail_links_enabled = $status;
519 }
520
524 public function getItemDetailLinkStatus(): bool
525 {
527 }
528
534 public function setItemDetailLinks(array $detail_links, string $intro_txt = ''): void
535 {
536 $this->item_detail_links = $detail_links;
537 $this->item_detail_links_intro = $intro_txt;
538 }
539
540 public function insertItemDetailLinks(): void
541 {
542 if (!count($this->item_detail_links)) {
543 return;
544 }
545 if (strlen($this->item_detail_links_intro)) {
546 $this->tpl->setCurrentBlock('item_detail_intro');
547 $this->tpl->setVariable('ITEM_DETAIL_INTRO_TXT', $this->item_detail_links_intro);
548 $this->tpl->parseCurrentBlock();
549 }
550
551 foreach ($this->item_detail_links as $info) {
552 $this->tpl->setCurrentBlock('item_detail_link');
553 $this->tpl->setVariable('ITEM_DETAIL_LINK_TARGET', $info['target']);
554 $this->tpl->setVariable('ITEM_DETAIL_LINK_DESC', $info['desc']);
555 $this->tpl->setVariable('ITEM_DETAIL_LINK_HREF', $info['link']);
556 $this->tpl->setVariable('ITEM_DETAIL_LINK_NAME', $info['name']);
557 $this->tpl->parseCurrentBlock();
558 }
559 $this->tpl->setCurrentBlock('item_detail_links');
560 $this->tpl->parseCurrentBlock();
561 }
562 public function setTitle(string $title): void
563 {
564 $this->title = strip_tags(
565 $title,
567 );
568 }
569
573 public function getTitle(): string
574 {
575 return $this->title;
576 }
577
578 public function setDescription(string $description): void
579 {
580 $this->description = strip_tags(
583 );
584 }
585
589 public function getDescription(): string
590 {
591 return $this->description;
592 }
593
597 public function setSearchFragment(string $text): void
598 {
599 $this->search_fragment = $text;
600 }
601
602 public function getSearchFragment(): string
603 {
605 }
606
607 public function setSeparateCommands(bool $val): void
608 {
609 $this->separate_commands = $val;
610 }
611
612 public function getSeparateCommands(): bool
613 {
615 }
616
622 public function getCommandId(): int
623 {
624 return $this->ref_id;
625 }
626
627 public function setAdditionalInformation(?string $val): void
628 {
629 $this->additional_information = $val;
630 }
631
632 public function getAdditionalInformation(): ?string
633 {
635 }
636
642 public function setDetailsLevel(int $level): void
643 {
644 $this->details_level = $level;
645 }
646
647 public function getDetailsLevel(): int
648 {
650 }
651
655 public function enableRepositoryTransfer(bool $value): void
656 {
657 $this->repository_transfer_enabled = $value;
658 }
659
663 public function restrictToGoto(bool $value): void
664 {
665 $this->restrict_to_goto = $value;
666 }
667
668 public function getDefaultCommand(): array
669 {
671 }
672
673 public function checkCommandAccess(
674 string $permission,
675 string $cmd,
676 int $ref_id,
677 string $type,
678 ?int $obj_id = null
679 ): bool {
680 // e.g: sub items should not be readable since their parent session is readonly.
681 if ($permission != 'visible' and $this->isVisibleOnlyForced()) {
682 return false;
683 }
684
685 $cache_prefix = null;
686 if ($this->context == self::CONTEXT_WORKSPACE || $this->context == self::CONTEXT_WORKSPACE_SHARING) {
687 $cache_prefix = "wsp";
688 if (!isset($this->ws_access)) {
689 $this->ws_access = new ilWorkspaceAccessHandler();
690 }
691 }
692
693 if (isset($this->access_cache[$permission]["-" . $cmd][$cache_prefix . $ref_id])) {
694 return $this->access_cache[$permission]["-" . $cmd][$cache_prefix . $ref_id];
695 }
696
697 if ($this->context == self::CONTEXT_REPOSITORY || $this->context == self::CONTEXT_SEARCH) {
698 $access = $this->access->checkAccess($permission, $cmd, $ref_id, $type, (int) $obj_id);
699 if ($this->access->getPreventCachingLastResult()) {
700 $this->prevent_access_caching = true;
701 }
702 } else {
703 $access = $this->ws_access->checkAccess($permission, $cmd, $ref_id, $type);
704 }
705
706 $this->access_cache[$permission]["-" . $cmd][$cache_prefix . $ref_id] = $access;
707 return $access;
708 }
709
713 public function initItem(
714 int $ref_id,
715 int $obj_id,
716 string $type,
717 string $title = "",
718 string $description = ""
719 ): void {
720 $this->access_cache = array();
721 $this->ref_id = $ref_id;
722 $this->obj_id = $obj_id;
723 $this->setTitle($title);
724 $this->setDescription($description);
725
726 // checks, whether any admin commands are included in the output
727 $this->adm_commands_included = false;
728 $this->prevent_access_caching = false;
729
730 // prepare ajax calls
731 if ($this->context == self::CONTEXT_REPOSITORY) {
733 } else {
735 }
736 $this->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash($node_type, $ref_id, $type, $obj_id));
737 }
738
739 public function setConditionTarget(int $ref_id, int $obj_id, string $target_type): void
740 {
741 $this->condition_target = [
742 'ref_id' => $ref_id,
743 'obj_id' => $obj_id,
744 'target_type' => $target_type
745 ];
746 }
747
748 public function resetConditionTarget(): void
749 {
750 $this->condition_target = [];
751 }
752
753 public function disableTitleLink(bool $status): void
754 {
755 $this->title_link_disabled = $status;
756 }
757
758 public function setDefaultCommandParameters(array $params): void
759 {
760 $this->default_command_params = $params;
761 }
762
768 public function createDefaultCommand(array $command): array
769 {
770 if ($this->static_link_enabled and !$this->default_command_params) {
771 if ($link = ilLink::_getStaticLink($this->ref_id, $this->type, false)) {
772 $command['link'] = $link;
773 $command['frame'] = '_top';
774 }
775 }
776 if ($this->default_command_params) {
777 $params = array();
778 foreach ($this->default_command_params as $name => $value) {
779 $params[] = $name . '=' . $value;
780 }
781 $params = implode('&', $params);
782
783 if (!stristr($command['link'], '?')) {
784 $command['link'] .= '?' . $params;
785 } else {
786 $command['link'] .= '&' . $params;
787 }
788 }
789 return $command;
790 }
791
800 public function getCommandLink(string $cmd): string
801 {
802 if ($this->context == self::CONTEXT_REPOSITORY || $this->context == self::CONTEXT_SEARCH) {
803 // BEGIN WebDAV Get mount webfolder link.
804 if ($cmd == 'mount_webfolder' && ilDAVActivationChecker::_isActive()) {
805 global $DIC;
806 $uri_builder = new ilWebDAVUriBuilder($DIC->http()->request());
807 return $uri_builder->getUriToMountInstructionModalByRef($this->ref_id);
808 }
809 // END WebDAV Get mount webfolder link.
810
811 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
812 $cmd_link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", $cmd);
813 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->requested_ref_id);
814 return $cmd_link;
815 }
816
817 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", "");
818 $this->ctrl->setParameterByClass($this->gui_class_name, "wsp_id", $this->ref_id);
819 return $this->ctrl->getLinkTargetByClass($this->gui_class_name, $cmd);
820 }
821
830 public function getCommandFrame(string $cmd): string
831 {
832 return "";
833 }
834
843 public function getCommandImage(string $cmd): string
844 {
845 return "";
846 }
847
859 public function getProperties(): array
860 {
861 $props = [];
862 // please list alert properties first
863 // example (use $this->lng->txt instead of "Status"/"Offline" strings):
864 // $props[] = array("alert" => true, "property" => "Status", "value" => "Offline");
865 // $props[] = array("alert" => false, "property" => ..., "value" => ...);
866 // ...
867
868 // #8280: WebDav is only supported in repository
869 if ($this->context == self::CONTEXT_REPOSITORY) {
870 // add centralized offline status
871 if (ilObject::lookupOfflineStatus($this->obj_id)) {
872 $props[] =
873 [
874 'alert' => true,
875 'property' => $this->lng->txt("status"),
876 'value' => $this->lng->txt("offline")
877 ];
878 }
879
880 // BEGIN WebDAV Display locking information
882 // Show lock info
883 $webdav_dic = new ilWebDAVDIC();
884 $webdav_dic->initWithoutDIC();
885 $webdav_lock_backend = $webdav_dic->locksbackend();
886 if ($this->user->getId() !== ANONYMOUS_USER_ID) {
887 if ($lock = $webdav_lock_backend->getLocksOnObjectId($this->obj_id)) {
888 $lock_user = new ilObjUser($lock->getIliasOwner());
889
890 $props[] = [
891 "alert" => false,
892 "property" => $this->lng->txt("in_use_by"),
893 "value" => $lock_user->getLogin(),
894 "link" =>
895 "./ilias.php?user=" .
896 $lock_user->getId() .
897 '&cmd=showUserProfile&cmdClass=ildashboardgui&baseClass=ilDashboardGUI'
898 ];
899 }
900 }
901 }
902 // END WebDAV Display warning for invisible files and files with special characters
903 }
904
905 return $props;
906 }
907
908 public function addCustomProperty(
909 string $property = "",
910 string $value = "",
911 bool $alert = false,
912 bool $newline = false
913 ): void {
914 $this->cust_prop[] = [
915 "property" => $property,
916 "value" => $value,
917 "alert" => $alert,
918 "newline" => $newline
919 ];
920 }
921
922 public function getCustomProperties(array $prop): array
923 {
924 if (is_array($this->cust_prop)) {
925 foreach ($this->cust_prop as $property) {
926 $prop[] = $property;
927 }
928 }
929 return $prop;
930 }
931
932 public function getAlertProperties(): array
933 {
934 $alert = [];
935 foreach ($this->getProperties() as $prop) {
936 if (isset($prop['alert']) && $prop['alert'] == true) {
937 $alert[] = $prop;
938 }
939 }
940 return $alert;
941 }
942
943 public function getNoticeProperties(): array
944 {
945 $this->notice_prop = [];
946 if ($infos = $this->ldap_mapping->getInfoStrings($this->obj_id, true)) {
947 foreach ($infos as $info) {
948 $this->notice_prop[] = ['value' => $info];
949 }
950 }
951 return $this->notice_prop;
952 }
953
954 public function addCustomCommand(string $link, string $lang_var, string $frame = "", string $onclick = ""): void
955 {
956 $this->cust_commands[] = [
957 "link" => $link,
958 "lang_var" => $lang_var,
959 "frame" => $frame,
960 "onclick" => $onclick
961 ];
962 }
963
964 public function addCustomCommandButton(
965 Button $button,
966 ?Modal $triggeredModal = null
967 ): void {
968 $this->cust_commands[] = $button;
969 if ($triggeredModal !== null) {
970 $this->cust_modals[] = $triggeredModal;
971 }
972 }
973
974 public function forceVisibleOnly(bool $stat): void
975 {
976 $this->force_visible_only = $stat;
977 }
978
979 public function isVisibleOnlyForced(): bool
980 {
981 return $this->force_visible_only;
982 }
983
1007 public function getCommands(): array
1008 {
1009 $ref_commands = [];
1010 foreach ($this->commands as $command) {
1011 $permission = $command["permission"];
1012 $cmd = $command["cmd"];
1013 $lang_var = $command["lang_var"] ?? "";
1014 $txt = "";
1015 $info_object = null;
1016 $cmd_link = '';
1017 $cmd_frame = '';
1018 $cmd_image = '';
1019 $access_granted = false;
1020
1021 if (isset($command["txt"])) {
1022 $txt = $command["txt"];
1023 }
1024
1025 // Suppress commands that don't make sense for anonymous users
1026 if (
1027 $this->user->getId() == ANONYMOUS_USER_ID &&
1028 (isset($command['enable_anonymous']) && $command['enable_anonymous'] == 'false')
1029 ) {
1030 continue;
1031 }
1032
1033 // all access checking should be made within $this->access and
1034 // the checkAccess of the ilObj...Access classes
1035 // $access = $this->access->checkAccess($permission, $cmd, $this->ref_id, $this->type);
1036 $access = $this->checkCommandAccess($permission, $cmd, $this->ref_id, $this->type);
1037
1038 if ($access) {
1039 $access_granted = true;
1040 $cmd_link = $this->getCommandLink($command["cmd"]);
1041 $cmd_frame = $this->getCommandFrame($command["cmd"]);
1042 $cmd_image = $this->getCommandImage($command["cmd"]);
1043 } else {
1044 $info_object = $this->access->getInfo();
1045 }
1046
1047 if (!isset($command["default"])) {
1048 $command["default"] = "";
1049 }
1050 $ref_commands[] = [
1051 "permission" => $permission,
1052 "cmd" => $cmd,
1053 "link" => $cmd_link,
1054 "frame" => $cmd_frame,
1055 "lang_var" => $lang_var,
1056 "txt" => $txt,
1057 "granted" => $access_granted,
1058 "access_info" => $info_object,
1059 "img" => $cmd_image,
1060 "default" => $command["default"]
1061 ];
1062 }
1063
1064 return $ref_commands;
1065 }
1066
1074 public function getIconImageType(): string
1075 {
1076 return $this->type;
1077 }
1078
1079 public function insertTitle(): void
1080 {
1081 if ($this->restrict_to_goto) {
1082 $this->default_command = [
1083 "frame" => "",
1084 "link" => $this->buildGotoLink()
1085 ];
1086 }
1087 // begin-patch lok
1088 if (
1089 !$this->default_command ||
1090 (!$this->getCommandsStatus() && !$this->restrict_to_goto) ||
1091 $this->title_link_disabled
1092 ) {
1093 // end-patch lok
1094 $this->tpl->setCurrentBlock("item_title");
1095 $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
1096 } else {
1097 $this->default_command['link'] = $this->modifyTitleLink($this->default_command['link']);
1098
1099 $modifySAHS = $this->modifySAHSlaunch($this->default_command["link"], $this->default_command["frame"]);
1100 $this->default_command["link"] = $modifySAHS[0];
1101 $this->default_command["frame"] = $modifySAHS[1];
1102
1103 if ($this->default_command["frame"] != "") {
1104 $this->tpl->setCurrentBlock("title_linked_frame");
1105 $this->tpl->setVariable("TARGET_TITLE_LINKED", $this->default_command["frame"]);
1106 $this->tpl->parseCurrentBlock();
1107 }
1108
1109 // workaround for repository frameset
1110 $this->default_command["link"] = $this->appendRepositoryFrameParameter($this->default_command["link"]);
1111
1112 // the default command is linked with the title
1113 $this->tpl->setCurrentBlock("item_title_linked");
1114 $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
1115 $this->tpl->setVariable("HREF_TITLE_LINKED", $this->default_command["link"]);
1116
1117 // has preview?
1118 if (ilPreview::hasPreview($this->obj_id, $this->type)) {
1119
1120 // get context for access checks later on
1121 switch ($this->context) {
1122 case self::CONTEXT_WORKSPACE:
1123 case self::CONTEXT_WORKSPACE_SHARING:
1125 $access_handler = new ilWorkspaceAccessHandler();
1126 break;
1127
1128 default:
1129 $ilAccess = $this->access;
1131 $access_handler = $ilAccess;
1132 break;
1133 }
1134
1135 $preview = new ilPreviewGUI($this->ref_id, $context, $this->obj_id, $access_handler);
1136 $preview_status = ilPreview::lookupRenderStatus($this->obj_id);
1137 $preview_status_class = "";
1138 $preview_text_topic = "preview_show";
1139 if ($preview_status == ilPreview::RENDER_STATUS_NONE) {
1140 $preview_status_class = "ilPreviewStatusNone";
1141 $preview_text_topic = "preview_none";
1142 }
1143 $this->tpl->setCurrentBlock("item_title_linked");
1144 $this->tpl->setVariable("PREVIEW_STATUS_CLASS", $preview_status_class);
1145 $this->tpl->setVariable("SRC_PREVIEW_ICON", ilUtil::getImagePath("preview.png"));
1146 $this->tpl->setVariable("ALT_PREVIEW_ICON", $this->lng->txt($preview_text_topic));
1147 $this->tpl->setVariable("TXT_PREVIEW", $this->lng->txt($preview_text_topic));
1148 $this->tpl->setVariable("SCRIPT_PREVIEW_CLICK", $preview->getJSCall($this->getUniqueItemId(true)));
1149 $this->tpl->parseCurrentBlock();
1150 }
1151 }
1152 $this->tpl->parseCurrentBlock();
1153
1154 if ($this->bold_title == true) {
1155 $this->tpl->touchBlock('bold_title_start');
1156 $this->tpl->touchBlock('bold_title_end');
1157 }
1158 }
1159
1160 protected function buildGotoLink(): ?string
1161 {
1162 switch ($this->context) {
1163 case self::CONTEXT_WORKSPACE_SHARING:
1164 return ilWorkspaceAccessHandler::getGotoLink($this->ref_id, $this->obj_id);
1165
1166 default:
1167 // not implemented yet
1168 break;
1169 }
1170 return null;
1171 }
1172
1173 public function insertSubstitutions(): void
1174 {
1175 $fields_shown = false;
1176 foreach ($this->substitutions->getParsedSubstitutions($this->ref_id, $this->obj_id) as $data) {
1177 if ($data['bold']) {
1178 $data['name'] = '<strong>' . $data['name'] . '</strong>';
1179 $data['value'] = '<strong>' . $data['value'] . '</strong>';
1180 }
1181 $this->tpl->touchBlock("std_prop");
1182 $this->tpl->setCurrentBlock('item_property');
1183 if ($data['show_field']) {
1184 $this->tpl->setVariable('TXT_PROP', $data['name']);
1185 }
1186 $this->tpl->setVariable('VAL_PROP', $data['value']);
1187 $this->tpl->parseCurrentBlock();
1188
1189 if ($data['newline']) {
1190 $this->tpl->touchBlock('newline_prop');
1191 }
1192 $fields_shown = false;
1193 }
1194 }
1195
1196 public function insertDescription(): void
1197 {
1198 if ($this->getSubstitutionStatus()) {
1199 $this->insertSubstitutions();
1200 if (!$this->substitutions->isDescriptionEnabled()) {
1201 return;
1202 }
1203 }
1204
1205 // see bug #16519
1206 $d = $this->getDescription();
1207 // even b tag produced bugs, see #32304
1208 $d = strip_tags($d);
1209 $this->tpl->setCurrentBlock("item_description");
1210 $this->tpl->setVariable("TXT_DESC", $d);
1211 $this->tpl->parseCurrentBlock();
1212 }
1213
1217 public function insertSearchFragment(): void
1218 {
1219 if (strlen($this->getSearchFragment())) {
1220 $this->tpl->setCurrentBlock('search_fragment');
1221 $this->tpl->setVariable('TXT_SEARCH_FRAGMENT', $this->getSearchFragment() . ' ...');
1222 $this->tpl->parseCurrentBlock();
1223 }
1224 }
1225
1226 public function insertRelevance(): void
1227 {
1228 if (!$this->enabledRelevance() or !$this->getRelevance()) {
1229 return;
1230 }
1231
1233 $pbar->setCurrent($this->getRelevance());
1234
1235 $this->tpl->setCurrentBlock('relevance');
1236 $this->tpl->setVariable('REL_PBAR', $pbar->render());
1237 $this->tpl->parseCurrentBlock();
1238 }
1239
1245 public function setMode(string $mode): void
1246 {
1247 $this->mode = $mode;
1248 }
1249
1255 public function getMode(): string
1256 {
1257 return $this->mode;
1258 }
1259
1263 public function setConditionDepth(int $depth): void
1264 {
1265 $this->condition_depth = $depth;
1266 }
1267
1274 public function isMode(string $mode): bool
1275 {
1276 return $mode === $this->mode;
1277 }
1278
1279 public function determineProperties(): array
1280 {
1281 $props = $this->getProperties();
1282 $props = $this->getCustomProperties($props);
1283
1284 if ($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING) {
1285 // add learning progress custom property
1286 $lp = ilLPStatus::getListGUIStatus($this->obj_id);
1287 if ($lp) {
1288 $props[] = [
1289 "alert" => false,
1290 "property" => $this->lng->txt("learning_progress"),
1291 "value" => $lp,
1292 "newline" => true
1293 ];
1294 }
1295
1296 // add no item access note in public section
1297 // for items that are visible but not readable
1298 if ($this->user->getId() === ANONYMOUS_USER_ID) {
1299 if (!$this->access->checkAccess("read", "", $this->ref_id, $this->type, $this->obj_id)) {
1300 $props[] = [
1301 "alert" => true,
1302 "value" => $this->lng->txt("no_access_item_public"),
1303 "newline" => true
1304 ];
1305 }
1306 }
1307 }
1308
1309 // reference objects have translated ids, revert to originals
1310 $note_ref_id = $this->ref_id;
1311 $note_obj_id = $this->obj_id;
1312 if ($this->reference_ref_id) {
1313 $note_ref_id = $this->reference_ref_id;
1314 $note_obj_id = $this->reference_obj_id;
1315 }
1316 $redraw_js = "il.Object.redrawListItem(" . $note_ref_id . ");";
1317
1318 // add common properties (comments, notes, tags)
1319 if (
1320 (
1321 (
1322 isset(self::$cnt_notes[$note_obj_id][Note::PRIVATE]) &&
1323 self::$cnt_notes[$note_obj_id][Note::PRIVATE] > 0
1324 ) || (
1325 isset(self::$cnt_notes[$note_obj_id][Note::PUBLIC]) &&
1326 self::$cnt_notes[$note_obj_id][Note::PUBLIC] > 0
1327 ) || (
1328 isset(self::$cnt_tags[$note_obj_id]) && self::$cnt_tags[$note_obj_id] > 0
1329 ) || (
1330 isset(self::$tags[$note_obj_id]) && is_array(self::$tags[$note_obj_id])
1331 )
1332 ) && ($this->user->getId() !== ANONYMOUS_USER_ID)
1333 ) {
1334 $nl = true;
1335 $cnt_comments = self::$cnt_notes[$note_obj_id][Note::PUBLIC] ?? 0;
1336 if ($this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, false, false)
1337 && $cnt_comments > 0) {
1338 $props[] = [
1339 "alert" => false,
1340 "property" => $this->lng->txt("notes_comments"),
1341 "value" =>
1342 "<a href='#' onclick=\"return " .
1343 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js) . "\">" .
1344 self::$cnt_notes[$note_obj_id][Note::PUBLIC] . "</a>",
1345 "newline" => $nl
1346 ];
1347 $nl = false;
1348 }
1349
1350 $cnt_notes = self::$cnt_notes[$note_obj_id][Note::PRIVATE] ?? 0;
1351 if ($this->notes_enabled && $cnt_notes > 0) {
1352 $props[] = [
1353 "alert" => false,
1354 "property" => $this->lng->txt("notes"),
1355 "value" =>
1356 "<a href='#' onclick=\"return " .
1357 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js) . "\">" .
1358 self::$cnt_notes[$note_obj_id][Note::PRIVATE] . "</a>",
1359 "newline" => $nl
1360 ];
1361 $nl = false;
1362 }
1363
1364 $cnt_tags = self::$cnt_tags[$note_obj_id] ?? 0;
1365 if ($this->tags_enabled && ($cnt_tags > 0 || isset(self::$tags[$note_obj_id]))) {
1366 $tags_set = new ilSetting("tags");
1367 if ($tags_set->get("enable")) {
1368 $tags_url = ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js);
1369
1370 // list object tags
1371 if (isset(self::$tags[$note_obj_id])) {
1372 $tags_tmp = array();
1373 foreach (self::$tags[$note_obj_id] as $tag => $is_tag_owner) {
1374 if ($is_tag_owner) {
1375 $tags_tmp[] = "<a class=\"ilTag ilTagRelHigh\" href='#' onclick=\"return " .
1376 $tags_url . "\">" . $tag . "</a>";
1377 } else {
1378 $tags_tmp[] = "<span class=\"ilTag ilTagRelMiddle\">" . $tag . "</span>";
1379 }
1380 }
1381 $tags_value = implode(" ", $tags_tmp);
1382 $nl = true;
1383 $prop_text = "";
1384 } // tags counter
1385 else {
1386 $tags_value = "<a href='#' onclick=\"return " . $tags_url . "\">" .
1387 self::$cnt_tags[$note_obj_id] . "</a>";
1388 $prop_text = $this->lng->txt("tagging_tags");
1389 }
1390 $props[] = [
1391 "alert" => false,
1392 "property" => $prop_text,
1393 "value" => $tags_value,
1394 "newline" => $nl
1395 ];
1396 }
1397 }
1398 }
1399
1400 if (!isset($props)) {
1401 return [];
1402 }
1403
1404 return $props;
1405 }
1406
1407 public function insertProperties(): void
1408 {
1409 $props = $this->determineProperties();
1410 $cnt = 1;
1411 if (is_array($props) && count($props) > 0) {
1412 foreach ($props as $prop) {
1413 if ($cnt > 1) {
1414 $this->tpl->touchBlock("separator_prop");
1415 }
1416
1417 if (isset($prop["alert"]) && $prop["alert"] == true) {
1418 $this->tpl->touchBlock("alert_prop");
1419 } else {
1420 $this->tpl->touchBlock("std_prop");
1421 }
1422
1423 if (isset($prop["newline"]) && $prop["newline"] == true && $cnt > 1) {
1424 $this->tpl->touchBlock("newline_prop");
1425 }
1426
1427 //BEGIN WebDAV: Support hidden property names.
1428 if (
1429 isset($prop["property"]) &&
1430 (($prop['propertyNameVisible'] ?? null) !== false) &&
1431 $prop["property"] != ""
1432 ) {
1433 //END WebDAV: Support hidden property names.
1434 $this->tpl->setCurrentBlock("prop_name");
1435 $this->tpl->setVariable("TXT_PROP", $prop["property"]);
1436 $this->tpl->parseCurrentBlock();
1437 }
1438
1439 $this->tpl->setCurrentBlock("item_property");
1440 //BEGIN WebDAV: Support links in property values.
1441 if (isset($prop['link']) && $prop['link']) {
1442 $this->tpl->setVariable("LINK_PROP", $prop['link']);
1443 $this->tpl->setVariable("LINK_VAL_PROP", $prop["value"]);
1444 } else {
1445 $this->tpl->setVariable("VAL_PROP", $prop["value"]);
1446 }
1447 //END WebDAV: Support links in property values.
1448 $this->tpl->parseCurrentBlock();
1449
1450 $cnt++;
1451 }
1452 $this->tpl->setCurrentBlock("item_properties");
1453 $this->tpl->parseCurrentBlock();
1454 }
1455 }
1456
1457 public function insertNoticeProperties(): void
1458 {
1459 $this->getNoticeProperties();
1460 foreach ($this->notice_prop as $property) {
1461 $this->tpl->setCurrentBlock('notice_item');
1462 $this->tpl->setVariable('NOTICE_ITEM_VALUE', $property['value']);
1463 $this->tpl->parseCurrentBlock();
1464 }
1465 $this->tpl->setCurrentBlock('notice_property');
1466 $this->tpl->parseCurrentBlock();
1467 }
1468
1469 protected function parseConditions(int $toggle_id, array $conditions, bool $obligatory = true): bool
1470 {
1471 $num_required = ilConditionHandler::calculateEffectiveRequiredTriggers($this->ref_id, $this->obj_id);
1472 $num_optional_required =
1473 $num_required -
1474 count($conditions) +
1475 count(ilConditionHandler::getEffectiveOptionalConditionsOfTarget($this->ref_id, $this->obj_id))
1476 ;
1477
1478 // Check if all conditions are fulfilled
1479 $visible_conditions = [];
1480 $passed_optional = 0;
1481 foreach ($conditions as $condition) {
1482 if ($obligatory && !$condition['obligatory']) {
1483 continue;
1484 }
1485 if (!$obligatory && $condition['obligatory']) {
1486 continue;
1487 }
1488
1489 if ($this->tree->isDeleted($condition['trigger_ref_id'])) {
1490 continue;
1491 }
1492
1494
1495 if (!$ok) {
1496 $visible_conditions[] = $condition['id'];
1497 }
1498
1499 if (!$obligatory && $ok) {
1500 ++$passed_optional;
1501 // optional passed
1502 if ($passed_optional >= $num_optional_required) {
1503 return true;
1504 }
1505 }
1506 }
1507
1508 $missing_cond_exist = false;
1509 foreach ($conditions as $condition) {
1510 if (!in_array($condition['id'], $visible_conditions)) {
1511 continue;
1512 }
1513
1514 $operator = ilConditionHandlerGUI::translateOperator($condition['trigger_obj_id'], $condition['operator']);
1515 $cond_txt = $operator . ' ' . $condition['value'];
1516
1517 // display trigger item
1518 $class = $this->obj_definition->getClassName($condition["trigger_type"]);
1519 $location = $this->obj_definition->getLocation($condition["trigger_type"]);
1520 if ($class == "" && $location == "") {
1521 continue;
1522 }
1523 $missing_cond_exist = true;
1524
1525 $full_class = "ilObj" . $class . "ListGUI";
1526 $item_list_gui = new $full_class($this->context);
1527 $item_list_gui->setMode(self::IL_LIST_AS_TRIGGER);
1528 $item_list_gui->enablePath(false);
1529 $item_list_gui->enableIcon(true);
1530 $item_list_gui->setConditionDepth($this->condition_depth + 1);
1531 $item_list_gui->setParentRefId($this->ref_id);
1532 $item_list_gui->addCustomProperty($this->lng->txt("precondition_required_itemlist"), $cond_txt, false, true);
1533 $item_list_gui->enableCommands($this->commands_enabled, $this->std_cmd_only);
1534 $item_list_gui->enableProperties($this->properties_enabled);
1535
1536 $trigger_html = $item_list_gui->getListItemHTML(
1537 $condition['trigger_ref_id'],
1538 $condition['trigger_obj_id'],
1539 ilObject::_lookupTitle($condition["trigger_obj_id"]),
1540 ""
1541 );
1542 $this->tpl->setCurrentBlock("precondition");
1543 if ($trigger_html == "") {
1544 $trigger_html = $this->lng->txt("precondition_not_accessible");
1545 }
1546 $this->tpl->setVariable("TXT_CONDITION", trim($cond_txt));
1547 $this->tpl->setVariable("TRIGGER_ITEM", $trigger_html);
1548 $this->tpl->parseCurrentBlock();
1549 }
1550
1551 if ($missing_cond_exist && $obligatory) {
1552 $this->tpl->setCurrentBlock("preconditions");
1553 $this->tpl->setVariable("CONDITION_TOGGLE_ID", "_obl_" . $toggle_id);
1554 $this->tpl->setVariable("TXT_PRECONDITIONS", $this->lng->txt("preconditions_obligatory_hint"));
1555 $this->tpl->parseCurrentBlock();
1556 } elseif ($missing_cond_exist && !$obligatory) {
1557 $this->tpl->setCurrentBlock("preconditions");
1558 $this->tpl->setVariable("CONDITION_TOGGLE_ID", "_opt_" . $toggle_id);
1559 $this->tpl->setVariable(
1560 "TXT_PRECONDITIONS",
1561 sprintf(
1562 $this->lng->txt("preconditions_optional_hint"),
1563 $num_optional_required - $passed_optional
1564 )
1565 );
1566 $this->tpl->parseCurrentBlock();
1567 }
1568
1569 return !$missing_cond_exist;
1570 }
1571
1575 public function insertPreconditions(): void
1576 {
1577 // do not show multi level conditions (messes up layout)
1578 if ($this->condition_depth > 0) {
1579 return;
1580 }
1581
1582 if ($this->context == self::CONTEXT_WORKSPACE) {
1583 return;
1584 }
1585
1586 if (isset($this->condition_target) && is_array($this->condition_target)
1587 && count($this->condition_target) > 0) {
1588 $conditions = ilConditionHandler::_getEffectiveConditionsOfTarget(
1589 (int) $this->condition_target['ref_id'],
1590 (int) $this->condition_target['obj_id'],
1591 $this->condition_target['target_type'] ?? ""
1592 );
1593 } else {
1594 $conditions = ilConditionHandler::_getEffectiveConditionsOfTarget($this->ref_id, $this->obj_id);
1595 }
1596
1597 if (sizeof($conditions)) {
1598 for ($i = 0; $i < count($conditions); $i++) {
1599 $conditions[$i]['title'] = ilObject::_lookupTitle($conditions[$i]['trigger_obj_id']);
1600 }
1601 $conditions = ilArrayUtil::sortArray($conditions, 'title', 'DESC');
1602
1603 ++self::$js_unique_id;
1604 // Show obligatory and optional preconditions seperated
1605 $all_done_obl = $this->parseConditions(self::$js_unique_id, $conditions);
1606 $all_done_opt = $this->parseConditions(self::$js_unique_id, $conditions, false);
1607
1608 if (!$all_done_obl || !$all_done_opt) {
1609 $this->tpl->setCurrentBlock("preconditions_toggle");
1610 $this->tpl->setVariable("PRECONDITION_TOGGLE_INTRO", $this->lng->txt("precondition_toggle"));
1611 $this->tpl->setVariable("PRECONDITION_TOGGLE_TRIGGER", $this->lng->txt("show"));
1612 $this->tpl->setVariable("PRECONDITION_TOGGLE_ID", self::$js_unique_id);
1613 $this->tpl->setVariable("TXT_PRECONDITION_SHOW", $this->lng->txt("show"));
1614 $this->tpl->setVariable("TXT_PRECONDITION_HIDE", $this->lng->txt("hide"));
1615 $this->tpl->parseCurrentBlock();
1616 }
1617 }
1618 }
1619
1623 public function insertCommand(
1624 string $href,
1625 string $text,
1626 string $frame = "",
1627 string $img = "",
1628 string $cmd = "",
1629 string $onclick = ""
1630 ): void {
1631 // #11099
1632 $checksum = md5($href . $text);
1633 if ($href == "#" || !in_array($checksum, $this->prevent_duplicate_commands)) {
1634 if ($href != "#") {
1635 $this->prevent_duplicate_commands[] = $checksum;
1636 }
1637
1638 $prevent_background_click = false;
1639 if ($cmd == 'mount_webfolder') {
1640 $onclick = "triggerWebDAVModal('$href')";
1641 $href = "#";
1643 }
1644
1645 $this->current_selection_list->addItem(
1646 $text,
1647 "",
1648 $href,
1649 $img,
1650 $text,
1651 $frame,
1652 "",
1653 $prevent_background_click,
1654 $onclick
1655 );
1656 }
1657 }
1658
1659 public function insertDeleteCommand(): void
1660 {
1661 if ($this->std_cmd_only) {
1662 return;
1663 }
1664
1665 if (is_object($this->getContainerObject()) and
1666 $this->getContainerObject() instanceof ilAdministrationCommandHandling) {
1667 if ($this->checkCommandAccess('delete', '', $this->ref_id, $this->type)) {
1668 $this->ctrl->setParameter($this->getContainerObject(), 'item_ref_id', $this->getCommandId());
1669 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "delete");
1670 $this->insertCommand($cmd_link, $this->lng->txt("delete"));
1671 $this->adm_commands_included = true;
1672 }
1673 return;
1674 }
1675
1676 if ($this->checkCommandAccess('delete', '', $this->ref_id, $this->type)) {
1677 $this->ctrl->setParameter(
1678 $this->container_obj,
1679 "ref_id",
1680 $this->container_obj->getObject()->getRefId()
1681 );
1682 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
1683 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "delete");
1684 $this->insertCommand($cmd_link, $this->lng->txt("delete"));
1685 $this->adm_commands_included = true;
1686 }
1687 }
1688
1689 public function insertLinkCommand(): void
1690 {
1691 $objDefinition = $this->obj_definition;
1692
1693 if ($this->std_cmd_only) {
1694 return;
1695 }
1696
1697 // #17307
1698 if (
1699 !$this->checkCommandAccess('delete', '', $this->ref_id, $this->type) ||
1700 !$objDefinition->allowLink($this->type)
1701 ) {
1702 return;
1703 }
1704
1705 // BEGIN PATCH Lucene search
1706 if ($this->getContainerObject() instanceof ilAdministrationCommandHandling) {
1707 $this->ctrl->setParameter($this->getContainerObject(), 'item_ref_id', $this->getCommandId());
1708 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "link");
1709 $this->insertCommand($cmd_link, $this->lng->txt("link"));
1710 $this->adm_commands_included = true;
1711 return;
1712 }
1713 // END PATCH Lucene Search
1714
1715 // if the permission is changed here, it has
1716 // also to be changed in ilContainerGUI, admin command check
1717 $this->ctrl->setParameter(
1718 $this->container_obj,
1719 "ref_id",
1720 $this->container_obj->getObject()->getRefId()
1721 );
1722 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
1723 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "link");
1724 $this->insertCommand($cmd_link, $this->lng->txt("link"));
1725 $this->adm_commands_included = true;
1726 }
1727
1728 public function insertCutCommand(bool $to_repository = false): void
1729 {
1730 if ($this->std_cmd_only) {
1731 return;
1732 }
1733 // BEGIN PATCH Lucene search
1734 if (
1735 $this->getContainerObject() instanceof ilAdministrationCommandHandling
1736 ) {
1737 if ($this->checkCommandAccess('delete', '', $this->ref_id, $this->type)) {
1738 $this->ctrl->setParameter($this->getContainerObject(), 'item_ref_id', $this->getCommandId());
1739 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "cut");
1740 $this->insertCommand($cmd_link, $this->lng->txt("move"));
1741 $this->adm_commands_included = true;
1742 }
1743 return;
1744 }
1745 // END PATCH Lucene Search
1746
1747 // if the permission is changed here, it has
1748 // also to be changed in ilContainerContentGUI, determineAdminCommands
1749 if ($this->checkCommandAccess('delete', '', $this->ref_id, $this->type) && $this->container_obj->getObject()) {
1750 $this->ctrl->setParameter(
1751 $this->container_obj,
1752 "ref_id",
1753 $this->container_obj->getObject()->getRefId()
1754 );
1755 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
1756
1757 if (!$to_repository) {
1758 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "cut");
1759 $this->insertCommand($cmd_link, $this->lng->txt("move"));
1760 } else {
1761 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "cut_for_repository");
1762 $this->insertCommand($cmd_link, $this->lng->txt("wsp_move_to_repository"));
1763 }
1764
1765 $this->adm_commands_included = true;
1766 }
1767 }
1768
1769 public function insertCopyCommand(bool $to_repository = false): void
1770 {
1771 if ($this->std_cmd_only) {
1772 return;
1773 }
1774
1775 if ($this->checkCommandAccess('copy', 'copy', $this->ref_id, $this->type) &&
1776 $this->obj_definition->allowCopy($this->type)) {
1777 if ($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING) {
1778 $this->ctrl->setParameterByClass('ilobjectcopygui', 'source_id', $this->getCommandId());
1779 $cmd_copy = $this->ctrl->getLinkTargetByClass('ilobjectcopygui', 'initTargetSelection');
1780 $this->insertCommand($cmd_copy, $this->lng->txt('copy'));
1781 } else {
1782 $this->ctrl->setParameter(
1783 $this->container_obj,
1784 "ref_id",
1785 $this->container_obj->getObject()->getRefId()
1786 );
1787 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
1788
1789 if (!$to_repository) {
1790 $cmd_copy = $this->ctrl->getLinkTarget($this->container_obj, 'copy');
1791 $this->insertCommand($cmd_copy, $this->lng->txt('copy'));
1792 } else {
1793 $cmd_copy = $this->ctrl->getLinkTarget($this->container_obj, 'copy_to_repository');
1794 $this->insertCommand($cmd_copy, $this->lng->txt('wsp_copy_to_repository'));
1795 }
1796 }
1797
1798 $this->adm_commands_included = true;
1799 }
1800 }
1801
1802 public function insertPasteCommand(): void
1803 {
1804 if ($this->std_cmd_only) {
1805 return;
1806 }
1807
1808 if (!$this->obj_definition->isContainer(ilObject::_lookupType($this->obj_id))) {
1809 return;
1810 }
1811
1812 if (
1813 $this->getContainerObject() instanceof ilAdministrationCommandHandling &&
1814 $this->clipboard->hasEntries()
1815 ) {
1816 $this->ctrl->setParameter($this->getContainerObject(), 'item_ref_id', $this->getCommandId());
1817 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "paste");
1818 $this->insertCommand($cmd_link, $this->lng->txt("paste"));
1819 $this->adm_commands_included = true;
1820 }
1821 }
1822
1823 public function insertSubscribeCommand(): void
1824 {
1825 if ($this->std_cmd_only) {
1826 return;
1827 }
1828
1829 // note: the setting disable_my_offers is used for
1830 // presenting the favourites in the main section of the dashboard
1831 // see also bug #32014
1832 if (!(bool) $this->settings->get('rep_favourites', "0")) {
1833 return;
1834 }
1835
1836 $type = ilObject::_lookupType(ilObject::_lookupObjId($this->getCommandId()));
1837
1838 if ($this->user->getId() != ANONYMOUS_USER_ID) {
1839 // #17467 - add ref_id to link (in repository only!)
1840 if (
1841 is_object($this->container_obj) &&
1842 !($this->container_obj instanceof ilAdministrationCommandHandling) &&
1843 method_exists($this->container_obj, "getObject") &&
1844 is_object($this->container_obj->getObject())
1845 ) {
1846 $this->ctrl->setParameter($this->container_obj, "ref_id", $this->container_obj->getObject()->getRefId());
1847 }
1848
1849 if (!$this->fav_manager->ifIsFavourite($this->user->getId(), $this->getCommandId())) {
1850 // Pass type and object ID to ilAccess to improve performance
1851 if ($this->checkCommandAccess("read", "", $this->ref_id, $this->type, $this->obj_id)) {
1852 if ($this->getContainerObject() instanceof ilDesktopItemHandling) {
1853 $this->ctrl->setParameter($this->container_obj, "type", $type);
1854 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
1855 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "addToDesk");
1856 $this->insertCommand($cmd_link, $this->lng->txt("rep_add_to_favourites"));
1857 }
1858 }
1859 } else {
1860 if ($this->getContainerObject() instanceof ilDesktopItemHandling) {
1861 $this->ctrl->setParameter($this->container_obj, "type", $type);
1862 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
1863 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "removeFromDesk");
1864 $this->insertCommand($cmd_link, $this->lng->txt("rep_remove_from_favourites"));
1865 }
1866 }
1867 }
1868 }
1869
1870 public function insertInfoScreenCommand(): void
1871 {
1872 if ($this->std_cmd_only) {
1873 return;
1874 }
1875 $this->insertCommand(
1876 $this->getCommandLink("infoScreen"),
1877 $this->lng->txt("info_short"),
1878 $this->getCommandFrame("infoScreen"),
1879 ilUtil::getImagePath("icon_info.svg")
1880 );
1881 }
1882
1886 public function insertCommonSocialCommands(bool $header_actions = false): void
1887 {
1888 if ($this->std_cmd_only || ($this->user->getId() == ANONYMOUS_USER_ID)) {
1889 return;
1890 }
1891
1892 $this->lng->loadLanguageModule("notes");
1893 $this->lng->loadLanguageModule("tagging");
1894 $cmd_frame = $this->getCommandFrame("infoScreen");
1895
1896 // reference objects have translated ids, revert to originals
1897 $note_ref_id = $this->ref_id;
1898 if ($this->reference_ref_id) {
1899 $note_ref_id = $this->reference_ref_id;
1900 }
1901
1902 $js_updater = $header_actions
1903 ? "il.Object.redrawActionHeader();"
1904 : "il.Object.redrawListItem(" . $note_ref_id . ")";
1905
1906 $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, $header_actions);
1907 if ($comments_enabled) {
1908 $this->insertCommand(
1909 "#",
1910 $this->lng->txt("notes_comments"),
1911 $cmd_frame,
1912 "",
1913 "",
1914 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $js_updater)
1915 );
1916 }
1917
1918 if ($this->notes_enabled) {
1919 $this->insertCommand(
1920 "#",
1921 $this->lng->txt("notes"),
1922 $cmd_frame,
1923 "",
1924 "",
1925 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $js_updater)
1926 );
1927 }
1928
1929 if ($this->tags_enabled) {
1930 $this->insertCommand(
1931 "#",
1932 $this->lng->txt("tagging_set_tag"),
1933 $cmd_frame,
1934 "",
1935 "",
1936 ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $js_updater)
1937 );
1938 }
1939 }
1940
1941 public function insertTimingsCommand(): void
1942 {
1943 if (
1944 $this->std_cmd_only || is_null($this->container_obj) ||
1945 !method_exists($this->container_obj, "getObject") ||
1946 !is_object($this->container_obj->getObject())
1947 ) {
1948 return;
1949 }
1950
1951 $parent_ref_id = $this->container_obj->getObject()->getRefId();
1952 $parent_type = $this->container_obj->getObject()->getType();
1953
1954 // #18737
1955 if ($this->reference_ref_id) {
1956 $this->ctrl->setParameterByClass('ilobjectactivationgui', 'ref_id', $this->reference_ref_id);
1957 }
1958
1959 if (
1960 $this->checkCommandAccess('write', '', $parent_ref_id, $parent_type) ||
1961 $this->checkCommandAccess('write', '', $this->ref_id, $this->type)
1962 ) {
1963 $this->ctrl->setParameterByClass(
1964 'ilobjectactivationgui',
1965 'cadh',
1966 $this->ajax_hash
1967 );
1968 $this->ctrl->setParameterByClass(
1969 'ilobjectactivationgui',
1970 'parent_id',
1971 $parent_ref_id
1972 );
1973 $cmd_lnk = $this->ctrl->getLinkTargetByClass(
1974 array($this->gui_class_name, 'ilcommonactiondispatchergui', 'ilobjectactivationgui'),
1975 'edit'
1976 );
1977
1978 $this->insertCommand($cmd_lnk, $this->lng->txt('obj_activation_list_gui'));
1979 }
1980
1981 if ($this->reference_ref_id) {
1982 $this->ctrl->setParameterByClass('ilobjectactivationgui', 'ref_id', $this->ref_id);
1983 }
1984 }
1985
1989 public function insertCommands(
1990 bool $use_async = false,
1991 bool $get_async_commands = false,
1992 string $async_url = "",
1993 bool $header_actions = false
1994 ): string {
1995 if (!$this->getCommandsStatus()) {
1996 return "";
1997 }
1998
1999 $this->current_selection_list = new ilAdvancedSelectionListGUI();
2000 $this->current_selection_list->setAriaListTitle(
2001 sprintf(
2002 $this->lng->txt('actions_for'),
2003 htmlspecialchars(addslashes($this->getTitle()))
2004 )
2005 );
2006 $this->current_selection_list->setAsynch($use_async && !$get_async_commands);
2007 $this->current_selection_list->setAsynchUrl($async_url);
2008 if ($header_actions) {
2009 $this->current_selection_list->setListTitle(
2010 "<span class='hidden-xs'>" .
2011 $this->lng->txt("actions") .
2012 "</span>"
2013 );
2014 } else {
2015 $this->current_selection_list->setListTitle("");
2016 }
2017 $this->current_selection_list->setId("act_" . $this->getUniqueItemId());
2018 $this->current_selection_list->setSelectionHeaderClass("");
2019 $this->current_selection_list->setItemLinkClass("");
2020 $this->current_selection_list->setLinksMode("il_ContainerItemCommand2");
2021 $this->current_selection_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
2022 $this->current_selection_list->setUseImages(false);
2023 $this->current_selection_list->setAdditionalToggleElement(
2024 $this->getUniqueItemId(true),
2025 "ilContainerListItemOuterHighlight"
2026 );
2027
2028 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", $this->ref_id);
2029
2030 // only standard command?
2031 $only_default = false;
2032 if ($use_async && !$get_async_commands) {
2033 $only_default = true;
2034 }
2035
2036 $this->default_command = [];
2037 $this->prevent_duplicate_commands = [];
2038
2039 // we only allow the following commands inside the header actions
2040 $valid_header_commands = array("mount_webfolder");
2041
2042 $commands = $this->getCommands();
2043 foreach ($commands as $command) {
2044 if ($header_actions && !in_array($command["cmd"], $valid_header_commands)) {
2045 continue;
2046 }
2047
2048 if ($command["granted"] == true) {
2049 if (!$command["default"] === true) {
2050 if (!$this->std_cmd_only && !$only_default) {
2051 // workaround for repository frameset
2052 $command["link"] =
2053 $this->appendRepositoryFrameParameter($command["link"]);
2054
2055 $cmd_link = $command["link"];
2056 $txt = ($command["lang_var"] == "")
2057 ? $command["txt"]
2058 : $this->lng->txt($command["lang_var"]);
2059 $this->insertCommand(
2060 $cmd_link,
2061 $txt,
2062 $command["frame"],
2063 $command["img"],
2064 $command["cmd"]
2065 );
2066 }
2067 } else {
2068 $this->default_command = $this->createDefaultCommand($command);
2069 }
2070 }
2071 }
2072
2073 if (!$only_default) {
2074 // custom commands
2075 if (is_array($this->cust_commands)) {
2076 foreach ($this->cust_commands as $command) {
2077 if ($command instanceof Button) {
2078 $this->current_selection_list->addComponent($command);
2079 continue;
2080 }
2081
2082 $this->insertCommand(
2083 $command["link"],
2084 $this->lng->txt($command["lang_var"]),
2085 $command["frame"],
2086 "",
2087 $command["cmd"] ?? "",
2088 $command["onclick"]
2089 );
2090 }
2091 }
2092
2093 // info screen command
2094 if ($this->getInfoScreenStatus()) {
2095 $this->insertInfoScreenCommand();
2096 }
2097
2098 $this->insertLPCommand();
2099
2100 if (!$this->isMode(self::IL_LIST_AS_TRIGGER)) {
2101 // edit timings
2102 if ($this->timings_enabled) {
2103 $this->insertTimingsCommand();
2104 }
2105
2106 // delete
2107 if ($this->delete_enabled) {
2108 $this->insertDeleteCommand();
2109 }
2110
2111 // link
2112 if ($this->link_enabled) {
2113 $this->insertLinkCommand();
2114 }
2115
2116 // cut
2117 if ($this->cut_enabled) {
2118 $this->insertCutCommand();
2119 }
2120
2121 // copy
2122 if ($this->copy_enabled) {
2123 $this->insertCopyCommand();
2124 }
2125
2126 // cut/copy from workspace to repository
2127 if ($this->repository_transfer_enabled) {
2128 $this->insertCutCommand(true);
2129 $this->insertCopyCommand(true);
2130 }
2131
2132 // subscribe
2133 if ($this->subscribe_enabled) {
2134 $this->insertSubscribeCommand();
2135 }
2136
2137 // multi download
2138 if ($this->multi_download_enabled && $header_actions) {
2139 $this->insertMultiDownloadCommand();
2140 }
2141
2142 // BEGIN PATCH Lucene search
2143 if ($this->cut_enabled or $this->link_enabled) {
2144 $this->insertPasteCommand();
2145 }
2146 // END PATCH Lucene Search
2147 }
2148 }
2149
2150 // common social commands (comment, notes, tags)
2151 if (!$only_default && !$this->isMode(self::IL_LIST_AS_TRIGGER)) {
2152 $this->insertCommonSocialCommands($header_actions);
2153 }
2154
2155 if (!$header_actions) {
2156 $this->ctrl->clearParametersByClass($this->gui_class_name);
2157 }
2158
2159 // fix bug #12417
2160 // there is one case, where no action menu should be displayed:
2161 // public area, category, no info tab
2162 // todo: make this faster and remove type specific implementation if possible
2163 if ($use_async && !$get_async_commands && !$header_actions) {
2164 if ($this->user->getId() === ANONYMOUS_USER_ID && $this->checkInfoPageOnAsynchronousRendering()) {
2165 if (
2167 ) {
2168 return "";
2169 }
2170 }
2171 }
2172
2173 if ($use_async && $get_async_commands) {
2174 return $this->current_selection_list->getHTML(true);
2175 }
2176
2177 return $this->current_selection_list->getHTML();
2178 }
2179
2180 public function enableComments(bool $value, bool $enable_comments_settings = true): void
2181 {
2182 if ($this->settings->get("disable_comments")) {
2183 $value = false;
2184 }
2185
2186 $this->comments_enabled = $value;
2187 $this->comments_settings_enabled = $enable_comments_settings;
2188 }
2189
2190 public function enableNotes(bool $value): void
2191 {
2192 if ($this->settings->get("disable_notes")) {
2193 $value = false;
2194 }
2195
2196 $this->notes_enabled = $value;
2197 }
2198
2199 public function enableTags(bool $value): void
2200 {
2201 $tags_set = new ilSetting("tags");
2202 if (!$tags_set->get("enable")) {
2203 $value = false;
2204 }
2205 $this->tags_enabled = $value;
2206 }
2207
2208 public function enableRating(
2209 bool $value,
2210 string $text = null,
2211 bool $categories = false,
2212 array $ctrl_path = null,
2213 bool $force_rate_parent = false
2214 ): void {
2215 $this->rating_enabled = $value;
2216
2217 if ($this->rating_enabled) {
2218 $this->rating_categories_enabled = $categories;
2219 $this->rating_text = $text;
2220 $this->rating_ctrl_path = $ctrl_path;
2221 $this->force_rate_parent = $force_rate_parent;
2222 }
2223 }
2224
2230 public function enableMultiDownload(bool $value): void
2231 {
2232 $folder_set = new ilSetting("fold");
2233 if (!$folder_set->get("enable_multi_download")) {
2234 $value = false;
2235 }
2236 $this->multi_download_enabled = $value;
2237 }
2238
2239 public function insertMultiDownloadCommand(): void
2240 {
2241 if ($this->std_cmd_only) {
2242 return;
2243 }
2244
2245 if (!$this->obj_definition->isContainer(ilObject::_lookupType($this->obj_id))) {
2246 return;
2247 }
2248
2249 if ($this->getContainerObject() instanceof ilContainerGUI) {
2250 $this->ctrl->setParameter($this->getContainerObject(), "type", "");
2251 $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", "");
2252 $this->ctrl->setParameter($this->getContainerObject(), "active_node", "");
2253 // bugfix mantis 24559
2254 // undoing an erroneous change inside mantis 23516 by
2255 // adding "Download Multiple Objects"-functionality for non-admins
2256 // as they don't have the possibility to use the multi-download-capability of the manage-tab
2257 $user_id = $this->user->getId();
2258 $hasAdminAccess = $this->access->checkAccessOfUser($user_id, "crs_admin", $this->ctrl->getCmd(), $this->requested_ref_id);
2259 // to still prevent duplicate download functions for admins
2260 // the following if-else statement keeps the redirection for admins
2261 // while letting other course members access the original multi-download functionality
2262 if ($hasAdminAccess) {
2263 $cmd = ($this->requested_cmd == "enableAdministrationPanel")
2264 ? "render"
2265 : "enableAdministrationPanel";
2266 } else {
2267 $cmd = ($this->requested_cmd == "enableMultiDownload")
2268 ? "render"
2269 : "enableMultiDownload";
2270 }
2271 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), $cmd);
2272 $this->insertCommand($cmd_link, $this->lng->txt("download_multiple_objects"));
2273 }
2274 }
2275
2276 public function enableDownloadCheckbox(int $ref_id): void
2277 {
2278 // TODO: delegate to list object class!
2279 if (!$this->getContainerObject()->isActiveAdministrationPanel() || $this->clipboard->hasEntries()) {
2280 if (
2281 in_array($this->type, ["file", "fold"]) &&
2282 $this->access->checkAccess("read", "", $ref_id, $this->type)
2283 ) {
2284 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_ENABLED;
2285 } else {
2286 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_DISABLED;
2287 }
2288 } else {
2289 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_NONE;
2290 }
2291 }
2292
2294 {
2295 return $this->download_checkbox_state;
2296 }
2297
2301 public static function prepareJsLinks(
2302 string $redraw_url,
2303 string $notes_url,
2304 string $tags_url,
2306 ): void {
2307 global $DIC;
2308
2309 if (is_null($tpl)) {
2310 $tpl = $DIC["tpl"];
2311 }
2312
2313 //if ($notes_url) {
2314 $DIC->notes()->gui()->initJavascript($notes_url);
2315 //}
2316
2317 if ($tags_url) {
2319 }
2320
2321 if ($redraw_url) {
2322 $tpl->addOnLoadCode("il.Object.setRedrawAHUrl('" . $redraw_url . "');");
2323 }
2324 }
2325
2326 public function setHeaderSubObject(?string $type, ?int $id): void
2327 {
2328 $this->sub_obj_type = $type;
2329 $this->sub_obj_id = (int) $id;
2330 }
2331
2332 public function addHeaderIcon(
2333 string $id,
2334 string $img,
2335 string $tooltip = null,
2336 string $onclick = null,
2337 string $status_text = null,
2338 string $href = null
2339 ): void {
2340 $this->header_icons[$id] = [
2341 "img" => $img,
2342 "tooltip" => $tooltip,
2343 "onclick" => $onclick,
2344 "status_text" => $status_text,
2345 "href" => $href
2346 ];
2347 }
2348
2349 public function addHeaderIconHTML(string $id, string $html): void
2350 {
2351 $this->header_icons[$id] = $html;
2352 }
2353
2354 public function addHeaderGlyph(string $id, ILIAS\UI\Component\Symbol\Glyph\Glyph $glyph, $onclick = null): void
2355 {
2356 $this->header_icons[$id] = ["glyph" => $glyph, "onclick" => $onclick];
2357 }
2358
2359 public function setAjaxHash(string $hash): void
2360 {
2361 $this->ajax_hash = $hash;
2362 }
2363
2364 public function getHeaderAction(ilGlobalTemplateInterface $main_tpl = null): string
2365 {
2366 if ($main_tpl == null) {
2367 global $DIC;
2368 $main_tpl = $DIC["tpl"];
2369 }
2370
2371 $htpl = new ilTemplate("tpl.header_action.html", true, true, "Services/Repository");
2372
2373 $redraw_js = "il.Object.redrawActionHeader();";
2374
2375 // tags
2376 if ($this->tags_enabled) {
2378 $this->obj_id,
2379 ilObject::_lookupType($this->obj_id),
2380 0,
2381 "",
2382 $this->user->getId()
2383 );
2384 if (count($tags) > 0) {
2385 $this->lng->loadLanguageModule("tagging");
2386
2387 $f = $this->ui->factory();
2388 $this->addHeaderGlyph(
2389 "tags",
2390 $f->symbol()->glyph()->tag("#")
2391 ->withCounter($f->counter()->status(count($tags))),
2392 ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js)
2393 );
2394 }
2395 }
2396
2397 // notes and comments
2398 $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, true, false);
2399 if ($this->notes_enabled || $comments_enabled) {
2400 $type = ($this->sub_obj_type == "") ? $this->type : $this->sub_obj_type;
2401 $context = $this->notes_service->data()->context($this->obj_id, $this->sub_obj_id, $type);
2402 $cnt[$this->obj_id][Note::PUBLIC] = $this->notes_service->domain()->getNrOfCommentsForContext($context);
2403 $cnt[$this->obj_id][Note::PRIVATE] = $this->notes_service->domain()->getNrOfNotesForContext($context);
2404 if (
2405 $this->notes_enabled &&
2406 isset($cnt[$this->obj_id][Note::PRIVATE]) &&
2407 $cnt[$this->obj_id][Note::PRIVATE] > 0
2408 ) {
2409 $f = $this->ui->factory();
2410 $this->addHeaderGlyph(
2411 "notes",
2412 $f->symbol()->glyph()->note("#")
2413 ->withCounter($f->counter()->status((int) $cnt[$this->obj_id][Note::PRIVATE])),
2414 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js)
2415 );
2416 }
2417
2418 if (
2419 $comments_enabled &&
2420 isset($cnt[$this->obj_id][Note::PUBLIC]) &&
2421 $cnt[$this->obj_id][Note::PUBLIC] > 0
2422 ) {
2423 $this->lng->loadLanguageModule("notes");
2424 $f = $this->ui->factory();
2425 $this->addHeaderGlyph(
2426 "comments",
2427 $f->symbol()->glyph()->comment("#")
2428 ->withCounter($f->counter()->status((int) $cnt[$this->obj_id][Note::PUBLIC])),
2429 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js)
2430 );
2431 }
2432 }
2433
2434 // rating
2435 if ($this->rating_enabled) {
2436 $rating_gui = new ilRatingGUI();
2437 $rating_gui->enableCategories($this->rating_categories_enabled);
2438 // never rate sub objects from header action!
2439 $rating_gui->setObject($this->obj_id, $this->type);
2440 if ($this->rating_text) {
2441 $rating_gui->setYourRatingText($this->rating_text);
2442 }
2443
2444 $ajax_hash = $this->force_rate_parent
2446 : $this->ajax_hash;
2447 $this->ctrl->setParameterByClass("ilRatingGUI", "cadh", $ajax_hash);
2448 $this->ctrl->setParameterByClass("ilRatingGUI", "rnsb", true);
2449 if ($this->rating_ctrl_path) {
2450 $rating_gui->setCtrlPath($this->rating_ctrl_path);
2451 $ajax_url = $this->ctrl->getLinkTargetByClass($this->rating_ctrl_path, "saveRating", "", true);
2452 } else {
2453 $ajax_url = $this->ctrl->getLinkTargetByClass("ilRatingGUI", "saveRating", "", true);
2454 }
2455 $main_tpl->addOnLoadCode("il.Object.setRatingUrl('" . $ajax_url . "');");
2456 $this->addHeaderIconHTML(
2457 "rating",
2458 $rating_gui->getHTML(
2459 true,
2460 $this->checkCommandAccess("read", "", $this->ref_id, $this->type),
2461 "il.Object.saveRating(%rating%);"
2462 )
2463 );
2464 }
2465
2466 if ($this->header_icons) {
2467 $chunks = [];
2468 foreach ($this->header_icons as $id => $attr) {
2469 $id = "headp_" . $id;
2470
2471 if (is_array($attr)) {
2472 if (isset($attr["glyph"]) && $attr["glyph"]) {
2473 if ($attr["onclick"]) {
2474 $htpl->setCurrentBlock("prop_glyph_oc");
2475 $htpl->setVariable("GLYPH_ONCLICK", $attr["onclick"]);
2476 $htpl->parseCurrentBlock();
2477 }
2478 $renderer = $this->ui->renderer();
2479 $html = $renderer->render($attr["glyph"]);
2480 $htpl->setCurrentBlock("prop_glyph");
2481 $htpl->setVariable("GLYPH", $html);
2482 $htpl->parseCurrentBlock();
2483 } else {
2484 if ($attr["onclick"]) {
2485 $htpl->setCurrentBlock("onclick");
2486 $htpl->setVariable("PROP_ONCLICK", $attr["onclick"]);
2487 $htpl->parseCurrentBlock();
2488 }
2489
2490 if ($attr["status_text"]) {
2491 $htpl->setCurrentBlock("status");
2492 $htpl->setVariable("PROP_TXT", $attr["status_text"]);
2493 $htpl->parseCurrentBlock();
2494 }
2495
2496
2497 $htpl->setCurrentBlock("prop");
2498 if ($attr["href"] || $attr["onclick"]) {
2499 $htpl->setVariable("TAG", "a");
2500 } else {
2501 $htpl->setVariable("TAG", "span");
2502 }
2503 $htpl->setVariable("PROP_ID", $id);
2504 $htpl->setVariable("IMG", ilUtil::img($attr["img"], $attr["tooltip"]));
2505 if ($attr["href"] != "") {
2506 $htpl->setVariable("PROP_HREF", ' href="' . $attr["href"] . '" ');
2507 }
2508 $htpl->parseCurrentBlock();
2509
2510 if ($attr["tooltip"]) {
2511 ilTooltipGUI::addTooltip($id, $attr["tooltip"]);
2512 }
2513 }
2514 } else {
2515 $chunks[] = $attr;
2516 }
2517 }
2518
2519 if (sizeof($chunks)) {
2520 $htpl->setVariable(
2521 "PROP_CHUNKS",
2522 implode("&nbsp;&nbsp;&nbsp;", $chunks) . "&nbsp;&nbsp;&nbsp;"
2523 );
2524 }
2525 }
2526
2527 $this->setTitle(ilObject::_lookupTitle($this->obj_id));
2528 $htpl->setVariable(
2529 "ACTION_DROP_DOWN",
2530 $this->insertCommands(false, false, "", true)
2531 );
2532
2533 if ($this->cust_modals !== []) {
2534 $htpl->setVariable('TRIGGERED_MODALS', $this->ui->renderer()->render($this->cust_modals));
2535 }
2536
2537 return $htpl->get();
2538 }
2539
2540
2545 public function appendRepositoryFrameParameter(string $link): string
2546 {
2547 // we should get rid of this nonsense with 4.4 (alex)
2548 $base_class = $this->request_wrapper->retrieve("baseClass", $this->refinery->kindlyTo()->string());
2549 if (
2550 (strtolower($base_class) != "ilrepositorygui") &&
2551 is_int(strpos($link, "baseClass=ilRepositoryGUI"))
2552 ) {
2553 if ($this->type != "frm") {
2554 $link = ilUtil::appendUrlParameterString($link, "rep_frame=1");
2555 }
2556 }
2557
2558 return $link;
2559 }
2560
2561 protected function modifyTitleLink(string $default_link): string
2562 {
2563 if ($this->default_command_params) {
2564 $params = array();
2565 foreach ($this->default_command_params as $name => $value) {
2566 $params[] = $name . '=' . $value;
2567 }
2568 $params = implode('&', $params);
2569
2570
2571 // #12370
2572 if (!stristr($default_link, '?')) {
2573 $default_link = ($default_link . '?' . $params);
2574 } else {
2575 $default_link = ($default_link . '&' . $params);
2576 }
2577 }
2578 return $default_link;
2579 }
2580
2584 public function modifySAHSlaunch(string $link, string $wtarget): array
2585 {
2586 global $DIC;
2587
2588 if (strstr($link, ilSAHSPresentationGUI::class)) {
2589 $sahs_obj = new ilObjSAHSLearningModule($this->ref_id);
2590 $om = $sahs_obj->getOpenMode();
2591 $width = $sahs_obj->getWidth();
2592 $height = $sahs_obj->getHeight();
2593 if (($om == 5 || $om == 1) && $width > 0 && $height > 0) {
2594 $om++;
2595 }
2596 if ($om != 0 && !$DIC->http()->agent()->isMobile()) {
2597 $this->default_command["frame"] = "";
2598 $link =
2599 "javascript:void(0); onclick=startSAHS('" .
2600 $link .
2601 "','" .
2602 $wtarget .
2603 "'," .
2604 $om .
2605 "," .
2606 $width .
2607 "," .
2608 $height .
2609 ");"
2610 ;
2611 } else {
2612 $wtarget = "ilContObj" . $this->ref_id; //workaround for new tab
2613 }
2614 }
2615 return [$link, $wtarget];
2616 }
2617
2618 public function insertPath(): void
2619 {
2620 if ($this->getPathStatus() != false) {
2621 if (!$this->path_gui instanceof \ilPathGUI) {
2622 $path_gui = new \ilPathGUI();
2623 } else {
2624 $path_gui = $this->path_gui;
2625 }
2626
2627 $path_gui->enableTextOnly(!$this->path_linked);
2628 $path_gui->setUseImages(false);
2629
2630 $start_node = ROOT_FOLDER_ID;
2631 if ($this->path_start_node) {
2632 $start_node = $this->path_start_node;
2633 }
2634
2635 $this->tpl->setCurrentBlock("path_item");
2636 $this->tpl->setVariable('PATH_ITEM', $path_gui->getPath($start_node, $this->ref_id));
2637 $this->tpl->parseCurrentBlock();
2638
2639 $this->tpl->setCurrentBlock("path");
2640 $this->tpl->setVariable("TXT_LOCATION", $this->lng->txt("locator"));
2641 $this->tpl->parseCurrentBlock();
2642 }
2643 }
2644
2645 public function insertProgressInfo(): void
2646 {
2647 }
2648
2649 public function insertIconsAndCheckboxes(): void
2650 {
2651 $cnt = 0;
2652 if ($this->getCheckboxStatus()) {
2653 $this->tpl->setCurrentBlock("check");
2654 $this->tpl->setVariable("VAL_ID", $this->getCommandId());
2655 $this->tpl->setVariable("CHECK_TITLE", $this->lng->txt("select") . " " . $this->getTitle());
2656 $this->tpl->parseCurrentBlock();
2657 $cnt += 1;
2658 } elseif ($this->getDownloadCheckboxState() != self::DOWNLOAD_CHECKBOX_NONE) {
2659 $this->tpl->setCurrentBlock("check_download");
2660 $this->tpl->setVariable("CHECK_DOWNLOAD_TITLE", $this->lng->txt("download") . " " . $this->getTitle());
2661 if ($this->getDownloadCheckboxState() == self::DOWNLOAD_CHECKBOX_ENABLED) {
2662 $this->tpl->setVariable("VAL_ID", $this->getCommandId());
2663 } else {
2664 $this->tpl->setVariable("VAL_VISIBILITY", "visibility: hidden;\" disabled=\"disabled");
2665 }
2666 $this->tpl->parseCurrentBlock();
2667 $cnt += 1;
2668 } elseif ($this->getExpandStatus()) {
2669 $this->tpl->setCurrentBlock('expand');
2670
2671 if ($this->isExpanded()) {
2672 $this->ctrl->setParameter($this->container_obj, 'expand', -1 * $this->obj_id);
2673 // "view" added, see #19922
2674 $this->tpl->setVariable('EXP_HREF', $this->ctrl->getLinkTarget($this->container_obj, 'view', $this->getUniqueItemId(true)));
2675 $this->ctrl->clearParameters($this->container_obj);
2676 $this->tpl->setVariable('EXP_IMG', ilUtil::getImagePath('tree_exp.svg'));
2677 $this->tpl->setVariable('EXP_ALT', $this->lng->txt('collapse'));
2678 } else {
2679 $this->ctrl->setParameter($this->container_obj, 'expand', $this->obj_id);
2680 // "view" added, see #19922
2681 $this->tpl->setVariable('EXP_HREF', $this->ctrl->getLinkTarget($this->container_obj, 'view', $this->getUniqueItemId(true)));
2682 $this->ctrl->clearParameters($this->container_obj);
2683 $this->tpl->setVariable('EXP_IMG', ilUtil::getImagePath('tree_col.svg'));
2684 $this->tpl->setVariable('EXP_ALT', $this->lng->txt('expand'));
2685 }
2686
2687 $this->tpl->parseCurrentBlock();
2688 $cnt += 1;
2689 }
2690
2691 if ($this->getIconStatus()) {
2692 if ($cnt == 1) {
2693 $this->tpl->touchBlock("i_1");
2694 }
2695
2696 $this->tpl->setCurrentBlock("icon");
2697 if (!$this->obj_definition->isPlugin($this->getIconImageType())) {
2698 $this->tpl->setVariable("ALT_ICON", $this->lng->txt("obj_" . $this->getIconImageType()));
2699 } else {
2700 $this->tpl->setVariable(
2701 "ALT_ICON",
2702 ilObjectPlugin::lookupTxtById($this->getIconImageType(), "obj_" . $this->getIconImageType())
2703 );
2704 }
2705
2706 $this->tpl->setVariable(
2707 "SRC_ICON",
2708 $this->getTypeIcon()
2709 );
2710 $this->tpl->parseCurrentBlock();
2711 $cnt += 1;
2712 }
2713
2714 $this->tpl->touchBlock("d_" . $cnt);
2715 }
2716
2720 public function getTypeIcon(): string
2721 {
2722 return ilObject::getIconForReference(
2723 $this->ref_id,
2724 $this->obj_id,
2725 'small',
2726 $this->getIconImageType()
2727 );
2728 }
2729
2730 public function insertSubItems(): void
2731 {
2732 foreach ($this->sub_item_html as $sub_html) {
2733 $this->tpl->setCurrentBlock("subitem");
2734 $this->tpl->setVariable("SUBITEM", $sub_html);
2735 $this->tpl->parseCurrentBlock();
2736 }
2737 }
2738
2739 public function insertPositionField(): void
2740 {
2741 if ($this->position_enabled) {
2742 $this->tpl->setCurrentBlock("position");
2743 $this->tpl->setVariable("POS_ID", $this->position_field_index);
2744 $this->tpl->setVariable("POS_VAL", $this->position_value);
2745 $this->tpl->parseCurrentBlock();
2746 }
2747 }
2748
2753 public function adminCommandsIncluded(): bool
2754 {
2755 return $this->adm_commands_included;
2756 }
2757
2758 public function storeAccessCache(): void
2759 {
2760 if ($this->acache->getLastAccessStatus() == "miss" && !$this->prevent_access_caching) {
2761 $this->acache->storeEntry(
2762 $this->user->getId() . ":" . $this->ref_id,
2763 serialize($this->access_cache),
2764 $this->ref_id
2765 );
2766 }
2767 }
2768
2772 public function getListItemHTML(
2773 int $ref_id,
2774 int $obj_id,
2775 string $title,
2776 string $description,
2777 bool $use_async = false,
2778 bool $get_async_commands = false,
2779 string $async_url = ""
2780 ): string {
2781 // this variable stores whether any admin commands
2782 // are included in the output
2783 $this->adm_commands_included = false;
2784
2785 // only for performance exploration
2786 $type = ilObject::_lookupType($obj_id);
2787
2788 $this->initItem($ref_id, $obj_id, $type, $title, $description);
2789
2790 if ($use_async && $get_async_commands) {
2791 return $this->insertCommands(true, true);
2792 }
2793
2794 if ($this->rating_enabled) {
2795 if (ilRating::hasRatingInListGUI($this->obj_id, $this->type)) {
2796 $may_rate = $this->checkCommandAccess("read", "", $this->ref_id, $this->type);
2797 $rating = new ilRatingGUI();
2798 $rating->setObject($this->obj_id, $this->type);
2799 $this->addCustomProperty(
2800 "",
2801 $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id),
2802 false,
2803 true
2804 );
2805 }
2806 }
2807
2808 // read from cache
2809 $this->acache = new ilListItemAccessCache();
2810 $cres = $this->acache->getEntry($this->user->getId() . ":" . $ref_id);
2811 if ($this->acache->getLastAccessStatus() == "hit") {
2812 $this->access_cache = unserialize($cres);
2813 } else {
2814 // write to cache
2815 $this->storeAccessCache();
2816 }
2817
2818 // visible check
2819 if (!$this->checkCommandAccess("visible", "", $ref_id, "", $obj_id)) {
2820 $this->resetCustomData();
2821 return "";
2822 }
2823
2824 // BEGIN WEBDAV
2825 if ($type == 'file' and ilObjFileAccess::_isFileHidden($title)) {
2826 $this->resetCustomData();
2827 return "";
2828 }
2829 // END WEBDAV
2830
2831 $this->tpl = new ilTemplate(
2832 static::$tpl_file_name,
2833 true,
2834 true,
2835 static::$tpl_component,
2836 "DEFAULT",
2837 false,
2838 true
2839 );
2840
2841 if ($this->getCommandsStatus()) {
2842 if (!$this->getSeparateCommands()) {
2843 $this->tpl->setVariable(
2844 "COMMAND_SELECTION_LIST",
2845 $this->insertCommands($use_async, $get_async_commands, $async_url)
2846 );
2847 }
2848 }
2849
2850 if ($this->getProgressInfoStatus()) {
2851 $this->insertProgressInfo();
2852 }
2853
2854 // insert title and describtion
2855 $this->insertTitle();
2856 if (!$this->isMode(self::IL_LIST_AS_TRIGGER)) {
2857 if ($this->getDescriptionStatus()) {
2858 $this->insertDescription();
2859 }
2860 }
2861
2862 if ($this->getSearchFragmentStatus()) {
2863 $this->insertSearchFragment();
2864 }
2865 if ($this->enabledRelevance()) {
2866 $this->insertRelevance();
2867 }
2868
2869 // properties
2870 if ($this->getPropertiesStatus()) {
2871 $this->insertProperties();
2872 }
2873
2874 // notice properties
2875 if ($this->getNoticePropertiesStatus()) {
2876 $this->insertNoticeProperties();
2877 }
2878
2879 // preconditions
2880 if ($this->getPreconditionsStatus()) {
2881 $this->insertPreconditions();
2882 }
2883
2884 // path
2885 $this->insertPath();
2886
2887 if ($this->getItemDetailLinkStatus()) {
2888 $this->insertItemDetailLinks();
2889 }
2890
2891 // icons and checkboxes
2892 $this->insertIconsAndCheckboxes();
2893
2894 // input field for position
2895 $this->insertPositionField();
2896
2897 // subitems
2898 $this->insertSubItems();
2899
2900 $this->resetCustomData();
2901
2902 $this->tpl->setVariable("DIV_CLASS", 'ilContainerListItemOuter');
2903 $this->tpl->setVariable(
2904 "DIV_ID",
2905 'data-list-item-id="' . $this->getUniqueItemId(true) . '" id = "' . $this->getUniqueItemId(true) . '"'
2906 );
2907 $this->tpl->setVariable("ADDITIONAL", $this->getAdditionalInformation());
2908
2909 if (is_object($this->getContainerObject())) {
2910 // #11554 - make sure that internal ids are reset
2911 $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", "");
2912 }
2913
2914 // if file upload is enabled the content is wrapped by a UI dropzone.
2915 $content = $this->tpl->get();
2916 $file_upload_dropzone = new ilObjFileUploadDropzone($this->ref_id, $content);
2917 if ($this->context === self::CONTEXT_REPOSITORY
2918 && ($this->requested_cmd === "view" || $this->requested_cmd === "" || $this->requested_cmd === "render")
2919 && $file_upload_dropzone->isUploadAllowed($this->type)
2920 && !(new ViewSessionRepository())->isAdminView()
2921 ) {
2922 return $file_upload_dropzone->getDropzoneHtml();
2923 }
2924
2925 return $content;
2926 }
2927
2931 protected function resetCustomData(): void
2932 {
2933 // #15747
2934 $this->cust_prop = [];
2935 $this->cust_commands = [];
2936 $this->cust_modals = [];
2937 $this->sub_item_html = [];
2938 $this->position_enabled = false;
2939 }
2940
2944 public function setParentRefId(int $ref_id): void
2945 {
2946 $this->parent_ref_id = $ref_id;
2947 }
2948
2955 public function getUniqueItemId(bool $as_div = false): string
2956 {
2957 // use correct id for references
2958 $id_ref = $this->ref_id;
2959 if ($this->reference_ref_id > 0) {
2960 $id_ref = $this->reference_ref_id;
2961 }
2962
2963 // add unique identifier for preconditions (objects can appear twice in same container)
2964 if ($this->condition_depth) {
2965 $id_ref .= "_pc" . $this->condition_depth;
2966 }
2967
2968 // unique
2969 $id_ref .= "_pref_" . $this->parent_ref_id;
2970
2971 if (!$as_div) {
2972 return $id_ref;
2973 } else {
2974 // action menu [yellow] toggle
2975 return "lg_div_" . $id_ref;
2976 }
2977 }
2978
2982 public function getCommandsHTML(): string
2983 {
2984 return $this->insertCommands();
2985 }
2986
2990 public function isSideBlock(): bool
2991 {
2992 return false;
2993 }
2994
2995 public function setBoldTitle(bool $bold_title): void
2996 {
2997 $this->bold_title = $bold_title;
2998 }
2999
3000 public function isTitleBold(): bool
3001 {
3002 return $this->bold_title;
3003 }
3004
3005 public static function preloadCommonProperties(array $obj_ids, int $context): void
3006 {
3007 global $DIC;
3008 $lng = $DIC->language();
3009 $ilSetting = $DIC->settings();
3010 $ilUser = $DIC->user();
3011 $notes_manager = $DIC->notes()->internal()->domain()->notes();
3012
3013 if ($context == self::CONTEXT_REPOSITORY) {
3014 $active_notes = !$ilSetting->get("disable_notes");
3015 $active_comments = !$ilSetting->get("disable_comments");
3016
3017 if ($active_comments) {
3018 // needed for action
3019 self::$comments_activation = $DIC->notes()
3020 ->internal()
3021 ->domain()
3022 ->notes()->commentsActiveMultiple($obj_ids);
3023 }
3024
3025 // properties are optional
3026 if ($ilSetting->get('comments_tagging_in_lists')) {
3027 if ($active_notes || $active_comments) {
3028
3029 // @todo: should be refactored, see comment in notes db repo
3030 self::$cnt_notes = $notes_manager->countNotesAndCommentsMultipleObjects(
3031 $obj_ids,
3032 true
3033 );
3034
3035 $lng->loadLanguageModule("notes");
3036 }
3037
3038 $tags_set = new ilSetting("tags");
3039 if ($tags_set->get("enable")) {
3040 $all_users = (bool) $tags_set->get("enable_all_users");
3041
3042 if (!$ilSetting->get('comments_tagging_in_lists_tags')) {
3043 self::$cnt_tags = ilTagging::_countTags($obj_ids, $all_users);
3044 } else {
3045 $tag_user_id = null;
3046 if (!$all_users) {
3047 $tag_user_id = $ilUser->getId();
3048 }
3049 self::$tags = ilTagging::_getListTagsForObjects($obj_ids, $tag_user_id);
3050 }
3051
3052 $lng->loadLanguageModule("tagging");
3053 }
3054 }
3055
3056 $lng->loadLanguageModule("rating");
3057 }
3058
3059 self::$preload_done = true;
3060 }
3061
3065 protected function isCommentsActivated(
3066 string $type,
3067 int $ref_id,
3068 int $obj_id,
3069 bool $header_actions,
3070 bool $check_write_access = true
3071 ): bool {
3072 if ($this->comments_enabled) {
3073 if (!$this->comments_settings_enabled) {
3074 return true;
3075 }
3076 if ($check_write_access && $this->checkCommandAccess('write', '', $ref_id, $type)) {
3077 return true;
3078 }
3079 // fallback to single object check if no preloaded data
3080 // only the repository does preloadCommonProperties() yet
3081 if (!$header_actions && self::$preload_done) {
3082 if (isset(self::$comments_activation[$obj_id]) &&
3083 self::$comments_activation[$obj_id]) {
3084 return true;
3085 }
3086 } elseif ($this->notes_service->domain()->commentsActive($obj_id)) {
3087 return true;
3088 }
3089 }
3090 return false;
3091 }
3092
3096 public function enableTimings(bool $status): void
3097 {
3098 $this->timings_enabled = $status;
3099 }
3100
3104 public function getAsListItem(
3105 int $ref_id,
3106 int $obj_id,
3107 string $type,
3108 string $title,
3109 string $description
3110 ): ?Item {
3111 $ui = $this->ui;
3112
3113 // even b tag produced bugs, see #32304
3114 $description = strip_tags($description);
3115
3116 $this->initItem(
3117 $ref_id,
3118 $obj_id,
3119 $type,
3120 $title,
3121 $description
3122 );
3123
3124 $this->enableCommands(true);
3125
3126 // actions
3127 $this->insertCommands();
3128 $actions = [];
3129 foreach ($this->current_selection_list->getItems() as $action_item) {
3130 $action = $ui->factory()
3131 ->button()
3132 ->shy($action_item['title'], $action_item['link']);
3133
3134 // Dirty hack to remain the "onclick" action of action items
3135 if ($action_item['onclick'] != null && $action_item['onclick'] != '') {
3136 $action = $action->withAdditionalOnLoadCode(function ($id) use ($action_item): string {
3137 return "$('#$id').click(function(){" . $action_item['onclick'] . ";});";
3138 });
3139 }
3140
3141 $actions[] = $action;
3142 }
3143
3144 $dropdown = $ui->factory()
3145 ->dropdown()
3146 ->standard($actions)
3147 ->withAriaLabel(sprintf(
3148 $this->lng->txt('actions_for'),
3149 htmlspecialchars(addslashes($title))
3150 ));
3151
3152 $def_command = $this->getDefaultCommand();
3153
3154 $icon = $this->ui->factory()
3155 ->symbol()
3156 ->icon()
3157 ->custom(ilObject::_getIcon($obj_id), $this->lng->txt("icon") . " " . $this->lng->txt('obj_' . $type))
3158 ->withSize('medium');
3159
3160
3161 if ($def_command['link'] ?? false) {
3162 $modifySAHS = $this->modifySAHSlaunch($def_command['link'], $def_command['frame']);
3163 $def_command['link'] = $modifySAHS[0];
3164 $def_command['frame'] = $modifySAHS[1];
3165 $new_viewport = !in_array($def_command['frame'], ['', '_top', '_self', '_parent'], true);
3166 $link = $this->ui->factory()
3167 ->link()
3168 ->standard($this->getTitle(), $def_command['link'])
3169 ->withOpenInNewViewport($new_viewport);
3170 $list_item = $ui->factory()->item()->standard($link);
3171 } else {
3172 $list_item = $ui->factory()->item()->standard($this->getTitle());
3173 }
3174
3175 if ($description != "") {
3176 $list_item = $list_item->withDescription($description);
3177 }
3178 $list_item = $list_item->withActions($dropdown)->withLeadIcon($icon);
3179
3180
3181 $l = [];
3182 $this->enableComments(true);
3183 $this->enableNotes(true);
3184 $this->enableTags(true);
3185 $this->enableRating(true);
3186
3187 foreach ($this->determineProperties() as $p) {
3188 //if ($p['property'] !== $this->lng->txt('learning_progress')) {
3189 $l[(string) $p['property']] = (string) $p['value'];
3190 //}
3191 }
3192 if (count($l) > 0) {
3193 $list_item = $list_item->withProperties($l);
3194 }
3195
3196 // @todo: learning progress
3197 /*
3198 $lp = ilLPStatus::getListGUIStatus($item['obj_id'], false);
3199 if (is_array($lp) && array_key_exists('status', $lp)) {
3200 $percentage = (int)ilLPStatus::_lookupPercentage($item['obj_id'], $this->user->getId());
3201 if ($lp['status'] == ilLPStatus::LP_STATUS_COMPLETED_NUM) {
3202 $percentage = 100;
3203 }
3204
3205 $card = $card->withProgress(
3206 $this->uiFactory
3207 ->chart()
3208 ->progressMeter()
3209 ->mini(100, $percentage)
3210 );
3211 }*/
3212
3213 return $list_item;
3214 }
3215
3219 public function getAsCard(
3220 int $ref_id,
3221 int $obj_id,
3222 string $type,
3223 string $title,
3224 string $description
3225 ): ?RepositoryObject {
3226 $ui = $this->ui;
3227
3228 $title = htmlspecialchars(addslashes($title));
3229 // even b tag produced bugs, see #32304
3230 $description = strip_tags($description);
3231
3232 $this->initItem(
3233 $ref_id,
3234 $obj_id,
3235 $type,
3236 $title,
3237 $description
3238 );
3239
3240 $user = $this->user;
3241 $access = $this->access;
3242
3243 $this->enableCommands(true);
3244
3245 $sections = [];
3246
3247 // description, @todo: move to new ks element
3248 if ($description != "") {
3249 $sections[] = $ui->factory()->legacy("<div class='il-multi-line-cap-3'>" . $description . "</div>");
3250 }
3251
3252 $this->insertCommands();
3253 $actions = [];
3254
3255 foreach ($this->current_selection_list->getItems() as $item) {
3256 if (!isset($item["onclick"]) || $item["onclick"] == "") {
3257 $actions[] =
3258 $ui->factory()->button()->shy($item["title"], $item["link"]);
3259 } else {
3260 $actions[] =
3261 $ui->factory()->button()->shy($item["title"], "")->withAdditionalOnLoadCode(function ($id) use ($item): string {
3262 return
3263 "$('#$id').click(function(e) { " . $item["onclick"] . "});";
3264 });
3265 }
3266 }
3267
3268 $def_command = $this->getDefaultCommand();
3269
3270 $dropdown = $ui->factory()->dropdown()->standard($actions)
3271 ->withAriaLabel(sprintf(
3272 $this->lng->txt('actions_for'),
3273 $title
3274 ));
3275
3276 $path = $this->getTileImagePath();
3277
3278 // workaround for #26205
3279 // we should get rid of _top links completely and gifure our how
3280 // to manage scorm links better
3281 $def_cmd_frame = ($def_command["frame"] ?? "");
3282 if ($def_cmd_frame === "_top") {
3283 $def_cmd_frame = "";
3284 }
3285 $def_cmd_link = ($def_command["link"] ?? "");
3286
3287 // workaround for scorm
3288 $scorm_modifications = $this->modifySAHSlaunch($def_cmd_link, $def_cmd_frame);
3289 $modified_link = $scorm_modifications[0];
3290 if ($modified_link === $def_cmd_link) {
3291 $def_cmd_frame = $scorm_modifications[1];
3292 }
3293
3294 $image = $this->ui->factory()
3295 ->image()
3296 ->responsive($path, '');
3297 if ($def_cmd_link != '') { // #24256
3298 if ($def_cmd_frame != "" && ($modified_link == $def_cmd_link)) {
3299 $image = $image->withAdditionalOnLoadCode(function ($id) use (
3300 $def_command,
3301 $def_cmd_frame,
3302 $def_cmd_link
3303 ): string {
3304 return
3305 "$('#$id').click(function(e) { window.open('" . str_replace(
3306 "&amp;",
3307 "&",
3308 $def_cmd_link
3309 ) . "', '" . $def_cmd_frame . "');});";
3310 });
3311
3312 $button =
3313 $ui->factory()->button()->shy($title, "")->withAdditionalOnLoadCode(function ($id) use (
3314 $def_command,
3315 $def_cmd_frame,
3316 $def_cmd_link
3317 ): string {
3318 return
3319 "$('#$id').click(function(e) { window.open('" . str_replace(
3320 "&amp;",
3321 "&",
3322 $def_cmd_link
3323 ) . "', '" . $def_cmd_frame . "');});";
3324 });
3325 $title = $ui->renderer()->render($button);
3326 } else {
3327 $image = $image->withAction($modified_link);
3328 }
3329 }
3330
3331 if ($type == 'sess') {
3332 if ($title != "") {
3333 $title = ": " . $title;
3334 }
3335 $app_info = ilSessionAppointment::_lookupAppointment($obj_id);
3337 $app_info['start'],
3338 $app_info['end'],
3339 (bool) $app_info['fullday']
3340 ) . $title;
3341 }
3342
3343 $icon = $this->ui
3344 ->factory()
3345 ->symbol()
3346 ->icon()
3347 ->standard($type, $this->lng->txt('obj_' . $type))
3348 ;
3349
3350
3351
3352 if ($this->obj_definition->isActivePluginType($type)) {
3353 $class_name = 'il' . $this->obj_definition->getClassName($type) . 'Plugin';
3354 if ($class_name !== 'ilPlugin'
3355 && method_exists($class_name, '_getIcon')) {
3357 $icon = $this->ui
3358 ->factory()
3359 ->symbol()
3360 ->icon()
3361 ->custom(call_user_func([$class_name, '_getIcon'], $type, 'small', $obj_id), $pl->txt('obj_' . $type));
3362 }
3363 }
3364
3365 // card title action
3366 $card_title_action = "";
3367 if ($def_cmd_link != "" && ($def_cmd_frame == "" || $modified_link != $def_cmd_link)) { // #24256
3368 $card_title_action = $modified_link;
3369 } elseif ($def_cmd_link == "" &&
3370 $this->getInfoScreenStatus() &&
3371 $access->checkAccessOfUser(
3372 $user->getId(),
3373 "visible",
3374 "",
3375 $ref_id
3376 )) {
3377 $card_title_action = ilLink::_getLink($ref_id);
3378 if ($image->getAction() == "") {
3379 $image = $image->withAction($card_title_action);
3380 }
3381 }
3382
3383 $card = $ui->factory()->card()->repositoryObject(
3384 $title . '<span data-list-item-id="' . $this->getUniqueItemId(true) . '"></span>',
3385 $image
3386 )->withObjectIcon(
3387 $icon
3388 )->withActions(
3389 $dropdown
3390 );
3391
3392 if ($card_title_action != "") {
3393 $card = $card->withTitleAction($card_title_action);
3394 }
3395
3396 $l = [];
3397 foreach ($this->determineProperties() as $p) {
3398 if (isset($p['alert']) && $p['alert'] == true
3399 && isset($p['property']) && $p['property'] !== $this->lng->txt('learning_progress')) {
3400 $l[(string) $p['property']] = (string) $p['value'];
3401 }
3402 }
3403 if (count($l) > 0) {
3404 $prop_list = $ui->factory()->listing()->descriptive($l);
3405 $sections[] = $prop_list;
3406 }
3407 if (count($sections) > 0) {
3408 $card = $card->withSections($sections);
3409 }
3410
3411 $lp = ilLPStatus::getListGUIStatus($obj_id, false);
3412 if (is_array($lp) && array_key_exists('status', $lp)) {
3413 $percentage = (int) ilLPStatus::_lookupPercentage($obj_id, $this->user->getId());
3414 if ($lp['status'] == ilLPStatus::LP_STATUS_COMPLETED_NUM) {
3415 $percentage = 100;
3416 }
3417
3418 $card = $card->withProgress(
3419 $ui->factory()
3420 ->chart()
3421 ->progressMeter()
3422 ->mini(100, $percentage)
3423 );
3424 }
3425
3426 return $card;
3427 }
3428
3430 {
3431 return false;
3432 }
3433
3434 protected function getTileImagePath(): string
3435 {
3436 $img = $this->object_service->commonSettings()->tileImage()->getByObjId($this->obj_id);
3437 if ($img->exists()) {
3438 $path = $img->getFullPath();
3439 } else {
3440 $path = ilUtil::getImagePath('cont_tile/cont_tile_default_' . $this->type . '.svg');
3441 if (!is_file($path)) {
3442 $path = ilUtil::getImagePath('cont_tile/cont_tile_default.svg');
3443 }
3444 }
3445 return $path;
3446 }
3447
3451 public function insertLPCommand(): void
3452 {
3453 if ($this->std_cmd_only || !$this->lp_cmd_enabled) {
3454 return;
3455 }
3456 $relevant = ilLPStatus::hasListGUIStatus($this->obj_id);
3457 if ($relevant) {
3458 $cmd_link = $this->getCommandLink("learningProgress");
3459 $this->insertCommand(
3460 $cmd_link,
3461 $this->lng->txt("learning_progress")
3462 );
3463 }
3464 }
3465}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
Provides fluid interface to RBAC services.
Definition: UIServices.php:24
renderer()
Get a renderer for UI components.
Definition: UIServices.php:43
factory()
Get the factory that crafts UI components.
Definition: UIServices.php:35
Builds data types.
Definition: Factory.php:21
Manages items in repository clipboard.
return true
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.
static translateOperator(int $a_obj_id, string $a_operator)
static calculateEffectiveRequiredTriggers(int $a_target_ref_id, int $a_target_obj_id, string $a_target_obj_type='')
static _checkCondition(array $condition, int $a_usr_id=0)
checks wether a single condition is fulfilled every trigger object type must implement a static metho...
static getEffectiveOptionalConditionsOfTarget(int $a_target_ref_id, int $a_target_obj_id, string $a_obj_type='')
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstance()
Get singleton instance of this class.
const LP_STATUS_COMPLETED_NUM
static _lookupPercentage(int $a_obj_id, int $a_user_id)
Lookup percentage.
static getListGUIStatus(int $a_obj_id, bool $a_image_only=true)
static hasListGUIStatus(int $a_obj_id)
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getListNotesJSCall(string $a_hash, string $a_update_code=null)
Get list notes js call.
static getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
static _isFileHidden(string $a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user.
Class ilObjSCORMLearningModule.
User class.
static _getCommands()
get commands
parses the objects.xml it handles the xml-description of all ilias objects
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
getProperties()
Get item properties.
enableTimings(bool $status)
enable timings link
ilObjectDefinition $obj_definition
getAsListItem(int $ref_id, int $obj_id, string $type, string $title, string $description)
Get list item ui object.
getTitle()
getTitle overwritten in class.ilObjLinkResourceList.php
enableItemDetailLinks(bool $status)
enable item detail links E.g Direct links to chapters or pages
isCommentsActivated(string $type, int $ref_id, int $obj_id, bool $header_actions, bool $check_write_access=true)
Check comments status against comments settings and context.
getMode()
get output mode
setDefaultCommandParameters(array $params)
addHeaderGlyph(string $id, ILIAS\UI\Component\Symbol\Glyph\Glyph $glyph, $onclick=null)
ILIAS Notes Service $notes_service
getCustomProperties(array $prop)
enableDownloadCheckbox(int $ref_id)
enableLearningProgress(bool $enabled)
enableDelete(bool $status)
ilCtrlInterface $ctrl
checkCommandAccess(string $permission, string $cmd, int $ref_id, string $type, ?int $obj_id=null)
adminCommandsIncluded()
returns whether any admin commands (link, delete, cut) are included in the output
ilAdvancedMDSubstitution $substitutions
enableDescription(bool $status)
ilWorkspaceAccessHandler $ws_access
ILIAS Refinery Factory $refinery
addCustomCommand(string $link, string $lang_var, string $frame="", string $onclick="")
enableProgressInfo(bool $status)
insertLPCommand()
insert learning progress command
getCommands()
get all current commands for a specific ref id (in the permission context of the current user)
enableMultiDownload(bool $value)
Toggles whether multiple objects can be downloaded at once or not.
enablePreconditions(bool $status)
getIconImageType()
Returns the icon image type.
insertPreconditions()
insert all missing preconditions
addHeaderIconHTML(string $id, string $html)
addHeaderIcon(string $id, string $img, string $tooltip=null, string $onclick=null, string $status_text=null, string $href=null)
modifyTitleLink(string $default_link)
isMode(string $mode)
check current output mode
ilAccessHandler $access
modifySAHSlaunch(string $link, string $wtarget)
workaround: SAHS in new javavasript-created window or iframe
appendRepositoryFrameParameter(string $link)
workaround: all links into the repository (from outside) must tell repository to set up the frameset
setDetailsLevel(int $level)
Details level Currently used in Search which shows only limited properties of forums Currently used f...
getAsCard(int $ref_id, int $obj_id, string $type, string $title, string $description)
Get card object.
ilListItemAccessCache $acache
insertCopyCommand(bool $to_repository=false)
setHeaderSubObject(?string $type, ?int $id)
isSideBlock()
Returns whether current item is a block in a side column or not.
getCommandFrame(string $cmd)
Get command target frame.
setConditionTarget(int $ref_id, int $obj_id, string $target_type)
initItem(int $ref_id, int $obj_id, string $type, string $title="", string $description="")
initialize new item (is called by getItemHTML())
setAdditionalInformation(?string $val)
enableRepositoryTransfer(bool $value)
Enable copy/move to repository (from personal workspace)
addSubItemHTML(string $html)
Add HTML for sub item (used for sessions)
createDefaultCommand(array $command)
Get default command link Overwritten for e.g categories,courses => they return a goto link If search ...
ilLDAPRoleGroupMapping $ldap_mapping
getCommandsHTML()
Get commands HTML (must be called after get list item html)
restrictToGoto(bool $value)
Restrict all actions/links to goto.
setContainerObject(object $container_obj)
getItemDetailLinkStatus()
get item detail link status
resetCustomData()
reset properties and commands
insertCommands(bool $use_async=false, bool $get_async_commands=false, string $async_url="", bool $header_actions=false)
insert all commands into html code
setBoldTitle(bool $bold_title)
ilFavouritesManager $fav_manager
disableTitleLink(bool $status)
ClipboardManager $clipboard
setPositionInputField(string $field_index, string $position_value)
enableComments(bool $value, bool $enable_comments_settings=true)
enableInfoScreen(bool $info_screen)
getTypeIcon()
Get object type specific type icon.
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
getCommandImage(string $cmd)
Get command icon image.
enableSearchFragments(bool $status)
setItemDetailLinks(array $detail_links, string $intro_txt='')
set items detail links
setParentRefId(int $ref_id)
Set current parent ref id to enable unique js-ids (sessions, etc.)
enablePath(bool $path, int $start_node=0, \ilPathGUI $path_gui=null)
static preloadCommonProperties(array $obj_ids, int $context)
insertSearchFragment()
Insert highlighted search fragment.
setDescription(string $description)
addCustomCommandButton(Button $button, ?Modal $triggeredModal=null)
enableLinkedPath(bool $status)
static string $tpl_file_name
enableRating(bool $value, string $text=null, bool $categories=false, array $ctrl_path=null, bool $force_rate_parent=false)
enableCommands(bool $status, bool $std_only=false)
insertCommonSocialCommands(bool $header_actions=false)
Insert common social commands (comments, notes, tagging)
ilAdvancedSelectionListGUI $current_selection_list
static string $tpl_component
enableRelevance(bool $status)
insertCutCommand(bool $to_repository=false)
getDescription()
getDescription overwritten in class.ilObjLinkResourceList.php
setSearchFragment(string $text)
getHeaderAction(ilGlobalTemplateInterface $main_tpl=null)
ilObjectService $object_service
setConditionDepth(int $depth)
set depth for precondition output (stops at level 5)
addCustomProperty(string $property="", string $value="", bool $alert=false, bool $newline=false)
setMode(string $mode)
set output mode
getListItemHTML(int $ref_id, int $obj_id, string $title, string $description, bool $use_async=false, bool $get_async_commands=false, string $async_url="")
Get all item information (title, commands, description) in HTML.
enableCheckbox(bool $status)
enableNoticeProperties(bool $status)
parseConditions(int $toggle_id, array $conditions, bool $obligatory=true)
static array $comments_activation
insertCommand(string $href, string $text, string $frame="", string $img="", string $cmd="", string $onclick="")
insert command button
enableSubstitutions(bool $status)
getCommandId()
get command id Normally the ref id.
getCommandLink(string $cmd)
Get command link url.
enableProperties(bool $status)
getUniqueItemId(bool $as_div=false)
Get unique item identifier (for js-actions)
enableExpand(bool $status)
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
enableSubscribe(bool $status)
static getPluginObjectByType(string $type)
Return either a repoObject plugin or a orgunit extension plugin or null if the type is not a plugin.
static lookupTxtById(string $plugin_id, string $lang_var)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static lookupOfflineStatus(int $obj_id)
Lookup offline status using objectDataCache.
Creates a path for a start and endnode.
getPath(int $a_startnode, int $a_endnode)
get path
setUseImages(bool $a_status)
enableTextOnly(bool $a_status)
render path as text only
static lookupRenderStatus(int $a_obj_id)
Gets the render status for the object with the specified id.
static hasPreview(int $a_obj_id, string $a_type="")
Determines whether the object with the specified reference id has a preview.
const RENDER_STATUS_NONE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static hasRatingInListGUI(int $a_obj_id, string $a_obj_type)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
static _lookupAppointment(int $a_obj_id)
static _appointmentToString(int $start, int $end, bool $fulltime)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getListTagsJSCall(string $a_hash, string $a_update_code=null)
static initJavascript(string $a_ajax_url, ilGlobalTemplateInterface $a_main_tpl=null)
static getTagsForUserAndObject(int $a_obj_id, string $a_obj_type, int $a_sub_obj_id, string $a_sub_obj_type, int $a_user_id)
static _getListTagsForObjects(array $a_obj_ids, int $a_user_id=null)
Get tags for given object ids.
static _countTags(array $a_obj_ids, bool $a_all_users=false)
Count all tags for repository objects.
special template class to simplify handling of ITX/PEAR
static addTooltip(string $a_el_id, string $a_text, string $a_container="", string $a_my="bottom center", string $a_at="top center", bool $a_use_htmlspecialchars=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getGotoLink(int $a_node_id, int $a_obj_id, string $a_additional="")
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 ANONYMOUS_USER_ID
Definition: constants.php:27
const ROOT_FOLDER_ID
Definition: constants.php:32
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
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']
$txt
Definition: error.php:13
global $DIC
Definition: feed.php:28
$target_type
Definition: goto.php:51
$preview
Definition: imgupload.php:81
$img
Definition: imgupload.php:83
$ilUser
Definition: imgupload.php:34
Interface RequestWrapper.
This describes commonalities between standard and primary buttons.
Definition: Button.php:32
Common interface to all items.
Definition: Item.php:32
This describes commonalities between the different modals.
Definition: Modal.php:35
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...
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$ref_id
Definition: ltiauth.php:67
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
$path
Definition: ltiservices.php:32
if($format !==null) $name
Definition: metadata.php:247
$i
Definition: metadata.php:41
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
bool $enabled
Whether the system instance is enabled to accept connection requests.
Definition: System.php:123
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.
global $ilSetting
Definition: privfeed.php:17
$type
$lng
catch(InvalidArgumentException $e) if(!ilDAVActivationChecker::_isActive()) $webdav_dic
Definition: webdav.php:55
$context
Definition: webdav.php:29