ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjectListGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4define("IL_LIST_AS_TRIGGER", "trigger");
5define("IL_LIST_FULL", "full");
6require_once('./Services/Repository/classes/class.ilObjectPlugin.php');
7
24{
28 protected $access;
29
33 protected $lng;
34
38 protected $user;
39
43 protected $obj_definition;
44
48 protected $tree;
49
53 protected $settings;
54
58 protected $tpl;
59
60 const DETAILS_MINIMAL = 10;
61 const DETAILS_SEARCH = 20 ;
62 const DETAILS_ALL = 30;
63
68 const CONTEXT_SEARCH = 6;
69
73
74 public $ctrl;
75 public $description_enabled = true;
77 public $properties_enabled = true;
79 public $commands_enabled = true;
80 public $cust_prop = array();
81 public $cust_commands = array();
82 public $info_screen_enabled = false;
83 public $condition_depth = 0;
84 public $std_cmd_only = false;
85 public $sub_item_html = array();
88
89 protected $obj_id;
90 protected $ref_id;
91 protected $type;
92 protected $sub_obj_id;
93 protected $sub_obj_type;
94
95 protected $substitutions = null;
96 protected $substitutions_enabled = false;
97
98 protected $icons_enabled = false;
99 protected $checkboxes_enabled = false;
100 protected $position_enabled = false;
101 protected $progress_enabled = false;
102 protected $item_detail_links_enabled = false;
103 protected $item_detail_links = array();
105
106 protected $search_fragments_enabled = false;
107 protected $search_fragment = '';
108 protected $path_linked = false;
109
110 protected $enabled_relevance = false;
111 protected $relevance = 0;
112
113 protected $expand_enabled = false;
114 protected $is_expanded = true;
115 protected $bold_title = false;
116
117 protected $copy_enabled = true;
118
120
121 protected $reference_ref_id = false;
122 protected $separate_commands = false;
123 protected $search_fragment_enabled = false;
124 protected $additional_information = false;
125 protected $static_link_enabled = false;
126
128 protected $shared = false;
129 protected $restrict_to_goto = false;
130
131 protected $comments_enabled = false;
132 protected $comments_settings_enabled = false;
133 protected $notes_enabled = false;
134 protected $tags_enabled = false;
135
136 protected $rating_enabled = false;
137 protected $rating_categories_enabled = false;
138 protected $rating_text = false;
139 protected $rating_ctrl_path = false;
140
141 protected $timings_enabled = true;
142 protected $force_visible_only = false;
143 protected $prevent_duplicate_commands = array();
144 protected $parent_ref_id;
145 protected $context;
146
147 protected static $cnt_notes = array();
148 protected static $cnt_tags = array();
149 protected static $tags = array();
150 protected static $comments_activation = array();
151 protected static $preload_done = false;
152
153 protected $title_link = '';
154 protected $title_link_disabled = false;
155
156 protected static $js_unique_id = 0;
157
158
159 protected static $tpl_file_name = "tpl.container_list_item.html";
160 protected static $tpl_component = "Services/Container";
161
165 protected $ui;
166
171 public function __construct($a_context = self::CONTEXT_REPOSITORY)
172 {
173 global $DIC;
174 $this->access = $DIC->access();
175 $this->user = $DIC->user();
176 $this->obj_definition = $DIC["objDefinition"];
177 $this->tree = $DIC->repositoryTree();
178 $this->settings = $DIC->settings();
179
180 $this->ui = $DIC->ui();
181 $this->rbacsystem = $DIC->rbac()->system();
182 $this->ctrl = $DIC->ctrl();
183 $this->lng = $DIC->language();
184 $this->mode = IL_LIST_FULL;
185 $this->path_enabled = false;
186 $this->context = $a_context;
187
188 $this->enableComments(false);
189 $this->enableNotes(false);
190 $this->enableTags(false);
191
192 // unique js-ids
193 $this->setParentRefId((int) $_REQUEST["ref_id"]);
194
195 //echo "list";
196 $this->init();
197
198 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
199 $this->ldap_mapping = ilLDAPRoleGroupMapping::_getInstance();
200
201 $this->lng->loadLanguageModule("obj");
202 }
203
204
211 public function setContainerObject($container_obj)
212 {
213 $this->container_obj = $container_obj;
214 }
215
223 public function getContainerObject()
224 {
225 return $this->container_obj;
226 }
227
228
234 public function init()
235 {
236 // Create static links for default command (linked title) or not
237 $this->static_link_enabled = true;
238 $this->delete_enabled = true;
239 $this->cut_enabled = true;
240 $this->subscribe_enabled = true;
241 $this->link_enabled = false;
242 $this->copy_enabled = false;
243 $this->progress_enabled = false;
244 $this->notice_properties_enabled = true;
245 $this->info_screen_enabled = false;
246 $this->type = ""; // "cat", "course", ...
247 $this->gui_class_name = ""; // "ilobjcategorygui", "ilobjcoursegui", ...
248
249 // general commands array, e.g.
250 include_once('./Services/Object/classes/class.ilObjectAccess.php');
251 $this->commands = ilObjectAccess::_getCommands();
252 }
253
254 // Single get set methods
261 public function enableProperties($a_status)
262 {
263 $this->properties_enabled = $a_status;
264
265 return;
266 }
273 public function getPropertiesStatus()
274 {
276 }
283 public function enablePreconditions($a_status)
284 {
285 $this->preconditions_enabled = $a_status;
286
287 return;
288 }
289
291 {
293 }
294
301 public function enableNoticeProperties($a_status)
302 {
303 $this->notice_properties_enabled = $a_status;
304
305 return;
306 }
313 public function getPreconditionsStatus()
314 {
316 }
323 public function enableDescription($a_status)
324 {
325 $this->description_enabled = $a_status;
326
327 return;
328 }
335 public function getDescriptionStatus()
336 {
338 }
339
346 public function getSearchFragmentStatus()
347 {
349 }
350
357 public function enableSearchFragments($a_status)
358 {
359 $this->search_fragment_enabled = $a_status;
360
361 return;
362 }
363
369 public function enableLinkedPath($a_status)
370 {
371 $this->path_linked = $a_status;
372 }
373
378 public function enabledRelevance()
379 {
381 }
382
387 public function enableRelevance($a_status)
388 {
389 $this->enabled_relevance = $a_status;
390 }
391
397 public function setRelevance($a_rel)
398 {
399 $this->relevance = $a_rel;
400 }
401
407 public function getRelevance()
408 {
409 return $this->relevance;
410 }
411
417 public function enableIcon($a_status)
418 {
419 $this->icons_enabled = $a_status;
420 }
421
427 public function getIconStatus()
428 {
430 }
431
437 public function enableCheckbox($a_status)
438 {
439 $this->checkboxes_enabled = $a_status;
440 }
441
447 public function getCheckboxStatus()
448 {
450 }
451
457 public function enableExpand($a_status)
458 {
459 $this->expand_enabled = $a_status;
460 }
461
467 public function getExpandStatus()
468 {
470 }
471
472 public function setExpanded($a_status)
473 {
474 $this->is_expanded = $a_status;
475 }
476
477 public function isExpanded()
478 {
479 return $this->is_expanded;
480 }
487 public function setPositionInputField($a_field_index, $a_position_value)
488 {
489 $this->position_enabled = true;
490 $this->position_field_index = $a_field_index;
491 $this->position_value = $a_position_value;
492 }
493
500 public function enableDelete($a_status)
501 {
502 $this->delete_enabled = $a_status;
503
504 return;
505 }
512 public function getDeleteStatus()
513 {
514 return $this->delete_enabled;
515 }
516
523 public function enableCut($a_status)
524 {
525 $this->cut_enabled = $a_status;
526
527 return;
528 }
534 public function getCutStatus()
535 {
536 return $this->cut_enabled;
537 }
538
545 public function enableCopy($a_status)
546 {
547 $this->copy_enabled = $a_status;
548
549 return;
550 }
556 public function getCopyStatus()
557 {
558 return $this->copy_enabled;
559 }
560
567 public function enableSubscribe($a_status)
568 {
569 $this->subscribe_enabled = $a_status;
570
571 return;
572 }
578 public function getSubscribeStatus()
579 {
580 return $this->subscribe_enabled;
581 }
582
589 public function enableLink($a_status)
590 {
591 $this->link_enabled = $a_status;
592
593 return;
594 }
600 public function getLinkStatus()
601 {
602 return $this->link_enabled;
603 }
604
612 public function enablePath($a_path, $a_start_node = null)
613 {
614 $this->path_enabled = $a_path;
615 $this->path_start_node = (int) $a_start_node;
616 }
617
623 public function getPathStatus()
624 {
625 return $this->path_enabled;
626 }
627
634 public function enableCommands($a_status, $a_std_only = false)
635 {
636 $this->commands_enabled = $a_status;
637 $this->std_cmd_only = $a_std_only;
638 }
644 public function getCommandsStatus()
645 {
647 }
648
655 public function enableInfoScreen($a_info_screen)
656 {
657 $this->info_screen_enabled = $a_info_screen;
658 }
659
665 public function addSubItemHTML($a_html)
666 {
667 $this->sub_item_html[] = $a_html;
668 }
669
675 public function getInfoScreenStatus()
676 {
678 }
679
687 public function enableProgressInfo($a_status)
688 {
689 $this->progress_enabled = $a_status;
690 }
691
699 public function getProgressInfoStatus()
700 {
702 }
703
711 public function enableSubstitutions($a_status)
712 {
713 $this->substitutions_enabled = $a_status;
714 }
715
722 public function getSubstitutionStatus()
723 {
725 }
726
735 public function enableItemDetailLinks($a_status)
736 {
737 $this->item_detail_links_enabled = $a_status;
738 }
739
746 public function getItemDetailLinkStatus()
747 {
749 }
750
758 public function setItemDetailLinks($a_detail_links, $a_intro_txt = '')
759 {
760 $this->item_detail_links = $a_detail_links;
761 $this->item_detail_links_intro = $a_intro_txt;
762 }
763
771 public function insertItemDetailLinks()
772 {
773 if (!count($this->item_detail_links)) {
774 return true;
775 }
776 if (strlen($this->item_detail_links_intro)) {
777 $this->tpl->setCurrentBlock('item_detail_intro');
778 $this->tpl->setVariable('ITEM_DETAIL_INTRO_TXT', $this->item_detail_links_intro);
779 $this->tpl->parseCurrentBlock();
780 }
781
782 foreach ($this->item_detail_links as $info) {
783 $this->tpl->setCurrentBlock('item_detail_link');
784 $this->tpl->setVariable('ITEM_DETAIL_LINK_TARGET', $info['target']);
785 $this->tpl->setVariable('ITEM_DETAIL_LINK_DESC', $info['desc']);
786 $this->tpl->setVariable('ITEM_DETAIL_LINK_HREF', $info['link']);
787 $this->tpl->setVariable('ITEM_DETAIL_LINK_NAME', $info['name']);
788 $this->tpl->parseCurrentBlock();
789 }
790 $this->tpl->setCurrentBlock('item_detail_links');
791 $this->tpl->parseCurrentBlock();
792 }
793
794
795
800 public function setTitle($a_title)
801 {
802 $this->title = $a_title;
803 }
804
810 public function getTitle()
811 {
812 return $this->title;
813 }
814
819 public function setDescription($a_description)
820 {
821 $this->description = $a_description;
822 }
823
829 public function getDescription()
830 {
831 return $this->description;
832 }
833
839 public function setSearchFragment($a_text)
840 {
841 $this->search_fragment = $a_text;
842 }
843
848 public function getSearchFragment()
849 {
851 }
852
858 public function setSeparateCommands($a_val)
859 {
860 $this->separate_commands = $a_val;
861 }
862
868 public function getSeparateCommands()
869 {
871 }
881 public function getCommandId()
882 {
883 return $this->ref_id;
884 }
885
891 public function setAdditionalInformation($a_val)
892 {
893 $this->additional_information = $a_val;
894 }
895
901 public function getAdditionalInformation()
902 {
904 }
905
913 public function setDetailsLevel($a_level)
914 {
915 $this->details_level = $a_level;
916 }
917
922 public function getDetailsLevel()
923 {
925 }
926
932 public function enableRepositoryTransfer($a_value)
933 {
934 $this->repository_transfer_enabled = (bool) $a_value;
935 }
936
942 public function restrictToGoto($a_value)
943 {
944 $this->restrict_to_goto = (bool) $a_value;
945 }
946
952 public function checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
953 {
954 $ilAccess = $this->access;
955
956 // e.g: subitems should not be readable since their parent sesssion is readonly.
957 if ($a_permission != 'visible' and $this->isVisibleOnlyForced()) {
958 return false;
959 }
960
961 $cache_prefix = null;
962 if ($this->context == self::CONTEXT_WORKSPACE || $this->context == self::CONTEXT_WORKSPACE_SHARING) {
963 $cache_prefix = "wsp";
964 if (!$this->ws_access) {
965 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
966 $this->ws_access = new ilWorkspaceAccessHandler();
967 }
968 }
969
970 if (isset($this->access_cache[$a_permission]["-" . $a_cmd][$cache_prefix . $a_ref_id])) {
971 return $this->access_cache[$a_permission]["-" . $a_cmd][$cache_prefix . $a_ref_id];
972 }
973
974 if ($this->context == self::CONTEXT_REPOSITORY) {
975 $access = $ilAccess->checkAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id);
976 if ($ilAccess->getPreventCachingLastResult()) {
977 $this->prevent_access_caching = true;
978 }
979 } else {
980 $access = $this->ws_access->checkAccess($a_permission, $a_cmd, $a_ref_id, $a_type);
981 }
982
983 $this->access_cache[$a_permission]["-" . $a_cmd][$cache_prefix . $a_ref_id] = $access;
984 return $access;
985 }
986
996 public function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
997 {
998 $this->offline_mode = false;
999 if ($this->type == "sahs") {
1000 include_once('Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php');
1001 $this->offline_mode = ilObjSAHSLearningModuleAccess::_lookupUserIsOfflineMode($a_obj_id);
1002 }
1003 $this->access_cache = array();
1004 $this->ref_id = $a_ref_id;
1005 $this->obj_id = $a_obj_id;
1006 $this->setTitle($a_title);
1007 $this->setDescription($a_description);
1008 #$this->description = $a_description;
1009
1010 // checks, whether any admin commands are included in the output
1011 $this->adm_commands_included = false;
1012 $this->prevent_access_caching = false;
1013 }
1014
1015 public function setConditionTarget($a_ref_id, $a_obj_id, $a_target_type)
1016 {
1017 $this->condition_target = array(
1018 'ref_id' => $a_ref_id,
1019 'obj_id' => $a_obj_id,
1020 'target_type' => $a_target_type
1021 );
1022 }
1023
1024 public function resetConditionTarget()
1025 {
1026 $this->condition_target = array();
1027 }
1028
1029 public function disableTitleLink($a_status)
1030 {
1031 $this->title_link_disabled = $a_status;
1032 }
1033 // end-patch lok
1034
1035 public function setDefaultCommandParameters(array $a_params)
1036 {
1037 $this->default_command_params = $a_params;
1038 }
1039
1049 public function createDefaultCommand($command)
1050 {
1051 // begin-patch lok
1052 if ($this->static_link_enabled and !$this->default_command_params) {
1053 include_once('./Services/Link/classes/class.ilLink.php');
1054 if ($link = ilLink::_getStaticLink($this->ref_id, $this->type, false)) {
1055 $command['link'] = $link;
1056 $command['frame'] = '_top';
1057 }
1058 }
1059 if ($this->default_command_params) {
1060 $params = array();
1061 foreach ($this->default_command_params as $name => $value) {
1062 $params[] = $name . '=' . $value;
1063 }
1064 $params = implode('&', $params);
1065
1066 // #12370
1067 if (!stristr($command['link'], '?')) {
1068 $command['link'] .= '?' . $params;
1069 } else {
1070 $command['link'] .= '&' . $params;
1071 }
1072 }
1073 return $command;
1074 }
1075
1088 public function getCommandLink($a_cmd)
1089 {
1090 if ($this->context == self::CONTEXT_REPOSITORY) {
1091 // BEGIN WebDAV Get mount webfolder link.
1092 require_once('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1093 if ($a_cmd == 'mount_webfolder' && ilDAVActivationChecker::_isActive()) {
1094 require_once('Services/WebDAV/classes/class.ilDAVServer.php');
1095 $davServer = ilDAVServer::getInstance();
1096
1097 // XXX: The following is a very dirty, ugly trick.
1098 // To mount URI needs to be put into two attributes:
1099 // href and folder. This hack returns both attributes
1100 // like this: http://...mount_uri..." folder="http://...folder_uri...
1101 return $davServer->getMountURI($this->ref_id) .
1102 '" folder="' . $davServer->getFolderURI($this->ref_id);
1103 }
1104 // END WebDAV Get mount webfolder link.
1105
1106 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
1107 $cmd_link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
1108 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
1109 return $cmd_link;
1110
1111 /* separate method for this line
1112 $cmd_link = $this->ctrl->getLinkTargetByClass($this->gui_class_name,
1113 $a_cmd);
1114 return $cmd_link;
1115 */
1116 } else {
1117 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", "");
1118 $this->ctrl->setParameterByClass($this->gui_class_name, "wsp_id", $this->ref_id);
1119 return $this->ctrl->getLinkTargetByClass($this->gui_class_name, $a_cmd);
1120 }
1121 }
1122
1123
1133 public function getCommandFrame($a_cmd)
1134 {
1135 // BEGIN WebDAV Get mount webfolder link.
1136 require_once('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1137 if ($a_cmd == 'mount_webfolder' && ilDAVActivationChecker::_isActive()) {
1138 return '_blank';
1139 }
1140 // begin-patch fm
1141 if ($a_cmd == 'fileManagerLaunch') {
1142 return '_blank';
1143 }
1144 // end-patch fm
1145 return "";
1146 }
1147
1157 public function getCommandImage($a_cmd)
1158 {
1159 return "";
1160 }
1161
1173 public function getProperties()
1174 {
1175 $lng = $this->lng;
1177
1178 $props = array();
1179 // please list alert properties first
1180 // example (use $lng->txt instead of "Status"/"Offline" strings):
1181 // $props[] = array("alert" => true, "property" => "Status", "value" => "Offline");
1182 // $props[] = array("alert" => false, "property" => ..., "value" => ...);
1183 // ...
1184
1185 // #8280: WebDav is only supported in repository
1186 if ($this->context == self::CONTEXT_REPOSITORY) {
1187 // BEGIN WebDAV Display locking information
1188 require_once('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1190 require_once('Services/WebDAV/classes/class.ilDAVServer.php');
1191
1192 // Show lock info
1193 require_once('Services/WebDAV/classes/class.ilDAVLocks.php');
1194 $davLocks = new ilDAVLocks();
1195 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
1196 $locks =&$davLocks->getLocksOnObjectObj($this->obj_id);
1197 if (count($locks) > 0) {
1198 $lockUser = new ilObjUser($locks[0]['ilias_owner']);
1199
1200 $props[] = array(
1201 "alert" => false,
1202 "property" => $lng->txt("in_use_by"),
1203 "value" => $lockUser->getLogin(),
1204 "link" => "./ilias.php?user=" . $locks[0]['ilias_owner'] . '&cmd=showUserProfile&cmdClass=ilpersonaldesktopgui&cmdNode=1&baseClass=ilPersonalDesktopGUI',
1205 );
1206 }
1207 }
1208 // END WebDAV Display locking information
1209
1210 if ($this->getDetailsLevel() == self::DETAILS_SEARCH) {
1211 return $props;
1212 }
1213
1214 // BEGIN WebDAV Display warning for invisible Unix files and files with special characters
1215 if (preg_match('/^(\\.|\\.\\.)$/', $this->title)) {
1216 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1217 "value" => $lng->txt("filename_special_filename"),
1218 'propertyNameVisible' => false);
1219 } elseif (preg_match('/^\\./', $this->title)) {
1220 $props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"),
1221 "value" => $lng->txt("filename_hidden_unix_file"),
1222 'propertyNameVisible' => false);
1223 } elseif (preg_match('/~$/', $this->title)) {
1224 $props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"),
1225 "value" => $lng->txt("filename_hidden_backup_file"),
1226 'propertyNameVisible' => false);
1227 } elseif (preg_match('/[\\/]/', $this->title)) {
1228 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1229 "value" => $lng->txt("filename_special_characters"),
1230 'propertyNameVisible' => false);
1231 } elseif (preg_match('/[\\\\\\/:*?"<>|]/', $this->title)) {
1232 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1233 "value" => $lng->txt("filename_windows_special_characters"),
1234 'propertyNameVisible' => false);
1235 } elseif (preg_match('/\\.$/', $this->title)) {
1236 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1237 "value" => $lng->txt("filename_windows_empty_extension"),
1238 'propertyNameVisible' => false);
1239 } elseif (preg_match('/^(\\.|\\.\\.)$/', $this->title)) {
1240 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1241 "value" => $lng->txt("filename_special_filename"),
1242 'propertyNameVisible' => false);
1243 } elseif (preg_match('/#/', $this->title)) {
1244 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1245 "value" => $lng->txt("filename_windows_webdav_issue"),
1246 'propertyNameVisible' => false);
1247 }
1248 }
1249 // END WebDAV Display warning for invisible files and files with special characters
1250 }
1251
1252 return $props;
1253 }
1254
1258 public function addCustomProperty(
1259 $a_property = "",
1260 $a_value = "",
1261 $a_alert = false,
1262 $a_newline = false
1263 ) {
1264 $this->cust_prop[] = array("property" => $a_property, "value" => $a_value,
1265 "alert" => $a_alert, "newline" => $a_newline);
1266 }
1267
1271 public function getCustomProperties($a_prop)
1272 {
1273 if (is_array($this->cust_prop)) {
1274 foreach ($this->cust_prop as $prop) {
1275 $a_prop[] = $prop;
1276 }
1277 }
1278 return $a_prop;
1279 }
1280
1285 public function getAlertProperties()
1286 {
1287 $alert = array();
1288 foreach ((array) $this->getProperties() as $prop) {
1289 if ($prop['alert'] == true) {
1290 $alert[] = $prop;
1291 }
1292 }
1293 return $alert;
1294 }
1295
1299 public function getNoticeProperties()
1300 {
1301 $this->notice_prop = array();
1302 if ($infos = $this->ldap_mapping->getInfoStrings($this->obj_id, true)) {
1303 foreach ($infos as $info) {
1304 $this->notice_prop[] = array('value' => $info);
1305 }
1306 }
1307 return $this->notice_prop ? $this->notice_prop : array();
1308 }
1312 public function addCustomCommand($a_link, $a_lang_var, $a_frame = "", $onclick = "")
1313 {
1314 $this->cust_commands[] =
1315 array("link" => $a_link, "lang_var" => $a_lang_var,
1316 "frame" => $a_frame, "onclick" => $onclick);
1317 }
1318
1323 public function forceVisibleOnly($a_stat)
1324 {
1325 $this->force_visible_only = $a_stat;
1326 }
1327
1332 public function isVisibleOnlyForced()
1333 {
1335 }
1336
1360 public function getCommands()
1361 {
1362 $ilAccess = $this->access;
1364
1365 $ref_commands = array();
1366 foreach ($this->commands as $command) {
1367 $permission = $command["permission"];
1368 $cmd = $command["cmd"];
1369 $lang_var = $command["lang_var"];
1370 $txt = "";
1371 $info_object = null;
1372
1373 if (isset($command["txt"])) {
1374 $txt = $command["txt"];
1375 }
1376
1377 // BEGIN WebDAV: Suppress commands that don't make sense for anonymous users.
1378 // Suppress commands that don't make sense for anonymous users
1379 if ($ilUser->getId() == ANONYMOUS_USER_ID &&
1380 $command['enable_anonymous'] == 'false') {
1381 continue;
1382 }
1383 // END WebDAV: Suppress commands that don't make sense for anonymous users.
1384
1385 // all access checking should be made within $ilAccess and
1386 // the checkAccess of the ilObj...Access classes
1387 //$access = $ilAccess->checkAccess($permission, $cmd, $this->ref_id, $this->type);
1388 $access = $this->checkCommandAccess($permission, $cmd, $this->ref_id, $this->type);
1389
1390 if ($access) {
1391 $cmd_link = $this->getCommandLink($command["cmd"]);
1392 $cmd_frame = $this->getCommandFrame($command["cmd"]);
1393 $cmd_image = $this->getCommandImage($command["cmd"]);
1394 $access_granted = true;
1395 } else {
1396 $access_granted = false;
1397 $info_object = $ilAccess->getInfo();
1398 }
1399
1400 if (!isset($command["default"])) {
1401 $command["default"] = "";
1402 }
1403 $ref_commands[] = array(
1404 "permission" => $permission,
1405 "cmd" => $cmd,
1406 "link" => $cmd_link,
1407 "frame" => $cmd_frame,
1408 "lang_var" => $lang_var,
1409 "txt" => $txt,
1410 "granted" => $access_granted,
1411 "access_info" => $info_object,
1412 "img" => $cmd_image,
1413 "default" => $command["default"]
1414 );
1415 }
1416
1417 return $ref_commands;
1418 }
1419
1420 // BEGIN WebDAV: Visualize object state in its icon.
1428 public function getIconImageType()
1429 {
1430 if ($this->type == "sahs" && $this->offline_mode) {
1431 return $this->type . "_offline";
1432 }
1433 return $this->type;
1434 }
1435 // END WebDAV: Visualize object state in its icon.
1436
1444 public function insertTitle()
1445 {
1446 if ($this->restrict_to_goto) {
1447 $this->default_command = array("frame" => "",
1448 "link" => $this->buildGotoLink());
1449 }
1450 // begin-patch lok
1451 if (
1452 !$this->default_command ||
1453 (!$this->getCommandsStatus() && !$this->restrict_to_goto) ||
1454 $this->title_link_disabled
1455 ) {
1456 // end-patch lok
1457 $this->tpl->setCurrentBlock("item_title");
1458 $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
1459 $this->tpl->parseCurrentBlock();
1460 } else {
1461 $this->default_command['link'] = $this->modifyTitleLink($this->default_command['link']);
1462
1463 $this->default_command["link"] =
1464 $this->modifySAHSlaunch($this->default_command["link"], $this->default_command["frame"]);
1465
1466 if ($this->default_command["frame"] != "") {
1467 $this->tpl->setCurrentBlock("title_linked_frame");
1468 $this->tpl->setVariable("TARGET_TITLE_LINKED", $this->default_command["frame"]);
1469 $this->tpl->parseCurrentBlock();
1470 }
1471
1472 // workaround for repository frameset
1473 #var_dump("<pre>",$this->default_command['link'],"</pre>");
1474 $this->default_command["link"] =
1475 $this->appendRepositoryFrameParameter($this->default_command["link"]);
1476
1477 #var_dump("<pre>",$this->default_command['link'],"</pre>");
1478
1479
1480 // the default command is linked with the title
1481 $this->tpl->setCurrentBlock("item_title_linked");
1482 $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
1483 $this->tpl->setVariable("HREF_TITLE_LINKED", $this->default_command["link"]);
1484
1485 // has preview?
1486 include_once("./Services/Preview/classes/class.ilPreview.php");
1487 if (ilPreview::hasPreview($this->obj_id, $this->type)) {
1488 include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
1489
1490 // get context for access checks later on
1491 $access_handler = null;
1492 switch ($this->context) {
1496 include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php");
1497 $access_handler = new ilWorkspaceAccessHandler();
1498 break;
1499
1500 default:
1501 $ilAccess = $this->access;
1503 $access_handler = $ilAccess;
1504 break;
1505 }
1506
1507 $preview = new ilPreviewGUI($this->ref_id, $context, $this->obj_id, $access_handler);
1508 $preview_status = ilPreview::lookupRenderStatus($this->obj_id);
1509 $preview_status_class = "";
1510 $preview_text_topic = "preview_show";
1511 if ($preview_status == ilPreview::RENDER_STATUS_NONE) {
1512 $preview_status_class = "ilPreviewStatusNone";
1513 $preview_text_topic = "preview_none";
1514 }
1515 $this->tpl->setCurrentBlock("item_title_linked");
1516 $this->tpl->setVariable("PREVIEW_STATUS_CLASS", $preview_status_class);
1517 $this->tpl->setVariable("SRC_PREVIEW_ICON", ilUtil::getImagePath("preview.png", "Services/Preview"));
1518 $this->tpl->setVariable("TXT_PREVIEW", $this->lng->txt($preview_text_topic));
1519 $this->tpl->setVariable("SCRIPT_PREVIEW_CLICK", $preview->getJSCall($this->getUniqueItemId(true)));
1520 $this->tpl->parseCurrentBlock();
1521 }
1522
1523 $this->tpl->parseCurrentBlock();
1524 }
1525
1526 if ($this->bold_title == true) {
1527 $this->tpl->touchBlock('bold_title_start');
1528 $this->tpl->touchBlock('bold_title_end');
1529 }
1530 }
1531
1532 protected function buildGotoLink()
1533 {
1534 switch ($this->context) {
1536 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
1537 return ilWorkspaceAccessHandler::getGotoLink($this->ref_id, $this->obj_id);
1538
1539 default:
1540 // not implemented yet
1541 break;
1542 }
1543 }
1544
1551 public function insertSubstitutions()
1552 {
1553 $fields_shown = false;
1554 foreach ($this->substitutions->getParsedSubstitutions($this->ref_id, $this->obj_id) as $data) {
1555 if ($data['bold']) {
1556 $data['name'] = '<strong>' . $data['name'] . '</strong>';
1557 $data['value'] = '<strong>' . $data['value'] . '</strong>';
1558 }
1559 $this->tpl->touchBlock("std_prop");
1560 $this->tpl->setCurrentBlock('item_property');
1561 if ($data['show_field']) {
1562 $this->tpl->setVariable('TXT_PROP', $data['name']);
1563 }
1564 $this->tpl->setVariable('VAL_PROP', $data['value']);
1565 $this->tpl->parseCurrentBlock();
1566
1567 if ($data['newline']) {
1568 $this->tpl->touchBlock('newline_prop');
1569 }
1570 $fields_shown = false;
1571 }
1572 if ($fields_shown) {
1573 $this->tpl->touchBlock('newline_prop');
1574 }
1575 }
1576
1577
1585 public function insertDescription()
1586 {
1587 if ($this->getSubstitutionStatus()) {
1588 $this->insertSubstitutions();
1589 if (!$this->substitutions->isDescriptionEnabled()) {
1590 return true;
1591 }
1592 }
1593
1594 // see bug #16519
1595 $d = $this->getDescription();
1596 $d = strip_tags($d, "<b>");
1597 $this->tpl->setCurrentBlock("item_description");
1598 $this->tpl->setVariable("TXT_DESC", $d);
1599 $this->tpl->parseCurrentBlock();
1600 }
1601
1606 public function insertSearchFragment()
1607 {
1608 if (strlen($this->getSearchFragment())) {
1609 $this->tpl->setCurrentBlock('search_fragment');
1610 $this->tpl->setVariable('TXT_SEARCH_FRAGMENT', $this->getSearchFragment() . ' ...');
1611 $this->tpl->parseCurrentBlock();
1612 }
1613 }
1614
1620 public function insertRelevance()
1621 {
1622 if (!$this->enabledRelevance() or !(int) $this->getRelevance()) {
1623 return false;
1624 }
1625
1626 include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
1628 $pbar->setCurrent($this->getRelevance());
1629
1630 $this->tpl->setCurrentBlock('relevance');
1631 $this->tpl->setVariable('REL_PBAR', $pbar->render());
1632 $this->tpl->parseCurrentBlock();
1633 }
1634
1640 public function setMode($a_mode)
1641 {
1642 $this->mode = $a_mode;
1643 }
1644
1650 public function getMode()
1651 {
1652 return $this->mode;
1653 }
1654
1658 public function setConditionDepth($a_depth)
1659 {
1660 $this->condition_depth = $a_depth;
1661 }
1662
1670 public function isMode($a_mode)
1671 {
1672 if ($a_mode == $this->mode) {
1673 return true;
1674 } else {
1675 return false;
1676 }
1677 }
1678
1684 public function insertProperties()
1685 {
1686 $ilAccess = $this->access;
1687 $lng = $this->lng;
1689
1690 $props = $this->getProperties();
1691 $props = $this->getCustomProperties($props);
1692
1693 if ($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING) {
1694 // add learning progress custom property
1695 include_once "Services/Tracking/classes/class.ilLPStatus.php";
1696 $lp = ilLPStatus::getListGUIStatus($this->obj_id);
1697 if ($lp) {
1698 $props[] = array("alert" => false,
1699 "property" => $lng->txt("learning_progress"),
1700 "value" => $lp,
1701 "newline" => true);
1702 }
1703
1704 // add no item access note in public section
1705 // for items that are visible but not readable
1706 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
1707 if (!$ilAccess->checkAccess("read", "", $this->ref_id, $this->type, $this->obj_id)) {
1708 $props[] = array("alert" => true,
1709 "value" => $lng->txt("no_access_item_public"),
1710 "newline" => true);
1711 }
1712 }
1713 }
1714
1715 // reference objects have translated ids, revert to originals
1716 $note_ref_id = $this->ref_id;
1717 $note_obj_id = $this->obj_id;
1718 if ($this->reference_ref_id) {
1719 $note_ref_id = $this->reference_ref_id;
1720 $note_obj_id = $this->reference_obj_id;
1721 }
1722
1723 $redraw_js = "il.Object.redrawListItem(" . $note_ref_id . ");";
1724
1725 // add common properties (comments, notes, tags)
1726 require_once 'Services/Notes/classes/class.ilNote.php';
1727 if ((self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] > 0 ||
1728 self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] > 0 ||
1729 self::$cnt_tags[$note_obj_id] > 0 ||
1730 is_array(self::$tags[$note_obj_id])) &&
1731 ($ilUser->getId() != ANONYMOUS_USER_ID)) {
1732 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
1733 include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
1734
1735 $nl = true;
1736 if ($this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, false, false)
1737 && self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] > 0) {
1738 $props[] = array("alert" => false,
1739 "property" => $lng->txt("notes_comments"),
1740 "value" => "<a href='#' onclick=\"return " .
1741 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js) . "\">" .
1742 self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] . "</a>",
1743 "newline" => $nl);
1744 $nl = false;
1745 }
1746
1747 if ($this->notes_enabled && self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] > 0) {
1748 $props[] = array("alert" => false,
1749 "property" => $lng->txt("notes"),
1750 "value" => "<a href='#' onclick=\"return " .
1751 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js) . "\">" .
1752 self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] . "</a>",
1753 "newline" => $nl);
1754 $nl = false;
1755 }
1756 if ($this->tags_enabled &&
1757 (self::$cnt_tags[$note_obj_id] > 0 ||
1758 is_array(self::$tags[$note_obj_id]))) {
1759 $tags_set = new ilSetting("tags");
1760 if ($tags_set->get("enable")) {
1761 $tags_url = ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js);
1762
1763 // list object tags
1764 if (is_array(self::$tags[$note_obj_id])) {
1765 $tags_tmp = array();
1766 foreach (self::$tags[$note_obj_id] as $tag => $is_tag_owner) {
1767 if ($is_tag_owner) {
1768 $tags_tmp[] = "<a class=\"ilTag ilTagRelHigh\" href='#' onclick=\"return " .
1769 $tags_url . "\">" . $tag . "</a>";
1770 } else {
1771 $tags_tmp[] = "<span class=\"ilTag ilTagRelMiddle\">" . $tag . "</span>";
1772 }
1773 }
1774 $tags_value = implode(" ", $tags_tmp);
1775 $nl = true;
1776 $prop_text = "";
1777 }
1778 // tags counter
1779 else {
1780 $tags_value = "<a href='#' onclick=\"return " . $tags_url . "\">" .
1781 self::$cnt_tags[$note_obj_id] . "</a>";
1782 $prop_text = $lng->txt("tagging_tags");
1783 }
1784 $props[] = array("alert" => false,
1785 "property" => $prop_text,
1786 "value" => $tags_value,
1787 "newline" => $nl);
1788 $nl = false;
1789 }
1790 }
1791 }
1792
1793 $cnt = 1;
1794 if (is_array($props) && count($props) > 0) {
1795 foreach ($props as $prop) {
1796 // BEGIN WebDAV: Display a separator between properties.
1797 if ($cnt > 1) {
1798 $this->tpl->touchBlock("separator_prop");
1799 }
1800 // END WebDAV: Display a separator between properties.
1801
1802 if ($prop["alert"] == true) {
1803 $this->tpl->touchBlock("alert_prop");
1804 } else {
1805 $this->tpl->touchBlock("std_prop");
1806 }
1807 if ($prop["newline"] == true && $cnt > 1) {
1808 $this->tpl->touchBlock("newline_prop");
1809 }
1810 //BEGIN WebDAV: Support hidden property names.
1811 if (isset($prop["property"]) && $prop['propertyNameVisible'] !== false && $prop["property"] != "") {
1812 //END WebDAV: Support hidden property names.
1813 $this->tpl->setCurrentBlock("prop_name");
1814 $this->tpl->setVariable("TXT_PROP", $prop["property"]);
1815 $this->tpl->parseCurrentBlock();
1816 }
1817 $this->tpl->setCurrentBlock("item_property");
1818 //BEGIN WebDAV: Support links in property values.
1819 if ($prop['link']) {
1820 $this->tpl->setVariable("LINK_PROP", $prop['link']);
1821 $this->tpl->setVariable("LINK_VAL_PROP", $prop["value"]);
1822 } else {
1823 $this->tpl->setVariable("VAL_PROP", $prop["value"]);
1824 }
1825 //END WebDAV: Support links in property values.
1826 $this->tpl->parseCurrentBlock();
1827
1828 $cnt++;
1829 }
1830 $this->tpl->setCurrentBlock("item_properties");
1831 $this->tpl->parseCurrentBlock();
1832 }
1833 }
1834
1835 public function insertNoticeProperties()
1836 {
1837 $this->getNoticeProperties();
1838 foreach ($this->notice_prop as $property) {
1839 $this->tpl->setCurrentBlock('notice_item');
1840 $this->tpl->setVariable('NOTICE_ITEM_VALUE', $property['value']);
1841 $this->tpl->parseCurrentBlock();
1842 }
1843 $this->tpl->setCurrentBlock('notice_property');
1844 $this->tpl->parseCurrentBlock();
1845 }
1846
1847 protected function parseConditions($toggle_id, $conditions, $obligatory = true)
1848 {
1849 $lng = $this->lng;
1850 $objDefinition = $this->obj_definition;
1852
1853 $num_required = ilConditionHandler::calculateRequiredTriggers($this->ref_id, $this->obj_id);
1854 $num_optional_required =
1855 $num_required - count($conditions) + count(ilConditionHandler::getOptionalConditionsOfTarget($this->ref_id, $this->obj_id));
1856
1857 // Check if all conditions are fullfilled
1858 $visible_conditions = array();
1859 $passed_optional = 0;
1860 foreach ($conditions as $condition) {
1861 if ($obligatory and !$condition['obligatory']) {
1862 continue;
1863 }
1864 if (!$obligatory and $condition['obligatory']) {
1865 continue;
1866 }
1867
1868 if ($tree->isDeleted($condition['trigger_ref_id'])) {
1869 continue;
1870 }
1871
1872 include_once 'Services/Container/classes/class.ilMemberViewSettings.php';
1873 $ok = ilConditionHandler::_checkCondition($condition['id']) and
1874 !ilMemberViewSettings::getInstance()->isActive();
1875
1876 if (!$ok) {
1877 $visible_conditions[] = $condition['id'];
1878 }
1879
1880 if (!$obligatory and $ok) {
1881 ++$passed_optional;
1882 // optional passed
1883 if ($passed_optional >= $num_optional_required) {
1884 return true;
1885 }
1886 }
1887 }
1888
1889 foreach ($conditions as $condition) {
1890 if (!in_array($condition['id'], $visible_conditions)) {
1891 continue;
1892 }
1893
1894 include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
1895 $cond_txt = ilConditionHandlerGUI::translateOperator($condition['trigger_obj_id'], $condition['operator']) . ' ' . $condition['value'];
1896
1897 // display trigger item
1898 $class = $objDefinition->getClassName($condition["trigger_type"]);
1899 $location = $objDefinition->getLocation($condition["trigger_type"]);
1900 if ($class == "" && $location == "") {
1901 continue;
1902 }
1903 $missing_cond_exist = true;
1904
1905 $full_class = "ilObj" . $class . "ListGUI";
1906 include_once($location . "/class." . $full_class . ".php");
1907 $item_list_gui = new $full_class($this);
1908 $item_list_gui->setMode(IL_LIST_AS_TRIGGER);
1909 $item_list_gui->enablePath(false);
1910 $item_list_gui->enableIcon(true);
1911 $item_list_gui->setConditionDepth($this->condition_depth + 1);
1912 $item_list_gui->setParentRefId($this->getUniqueItemId()); // yes we can
1913 $item_list_gui->addCustomProperty($this->lng->txt("precondition_required_itemlist"), $cond_txt, false, true);
1914
1915 $item_list_gui->enableCommands($this->commands_enabled, $this->std_cmd_only);
1916 $item_list_gui->enableProperties($this->properties_enabled);
1917
1918 $trigger_html = $item_list_gui->getListItemHTML(
1919 $condition['trigger_ref_id'],
1920 $condition['trigger_obj_id'],
1921 ilObject::_lookupTitle($condition["trigger_obj_id"]),
1922 ""
1923 );
1924 $this->tpl->setCurrentBlock("precondition");
1925 if ($trigger_html == "") {
1926 $trigger_html = $this->lng->txt("precondition_not_accessible");
1927 }
1928 $this->tpl->setVariable("TXT_CONDITION", trim($cond_txt));
1929 $this->tpl->setVariable("TRIGGER_ITEM", $trigger_html);
1930 $this->tpl->parseCurrentBlock();
1931 }
1932
1933 if ($missing_cond_exist and $obligatory) {
1934 $this->tpl->setCurrentBlock("preconditions");
1935 $this->tpl->setVariable("CONDITION_TOGGLE_ID", "_obl_" . $toggle_id);
1936 $this->tpl->setVariable("TXT_PRECONDITIONS", $lng->txt("preconditions_obligatory_hint"));
1937 $this->tpl->parseCurrentBlock();
1938 } elseif ($missing_cond_exist and !$obligatory) {
1939 $this->tpl->setCurrentBlock("preconditions");
1940 $this->tpl->setVariable("CONDITION_TOGGLE_ID", "_opt_" . $toggle_id);
1941 $this->tpl->setVariable("TXT_PRECONDITIONS", sprintf($lng->txt("preconditions_optional_hint"), $num_optional_required));
1942 $this->tpl->parseCurrentBlock();
1943 }
1944
1945 return !$missing_cond_exist;
1946 }
1947
1951 public function insertPreconditions()
1952 {
1953 include_once("./Services/AccessControl/classes/class.ilConditionHandler.php");
1954
1955 // do not show multi level conditions (messes up layout)
1956 if ($this->condition_depth > 0) {
1957 return;
1958 }
1959
1960 if ($this->condition_target) {
1962 $this->condition_target['ref_id'],
1963 $this->condition_target['obj_id'],
1964 $this->condition_target['target_type']
1965 );
1966 } else {
1967 $conditions = ilConditionHandler::_getConditionsOfTarget($this->ref_id, $this->obj_id);
1968 }
1969
1970 if (sizeof($conditions)) {
1971 for ($i = 0; $i < count($conditions); $i++) {
1972 $conditions[$i]['title'] = ilObject::_lookupTitle($conditions[$i]['trigger_obj_id']);
1973 }
1974 $conditions = ilUtil::sortArray($conditions, 'title', 'DESC');
1975
1977
1978 // Show obligatory and optional preconditions seperated
1979 $all_done_obl = $this->parseConditions(self::$js_unique_id, $conditions, true);
1980 $all_done_opt = $this->parseConditions(self::$js_unique_id, $conditions, false);
1981
1982 if (!$all_done_obl || !$all_done_opt) {
1983 $this->tpl->setCurrentBlock("preconditions_toggle");
1984 $this->tpl->setVariable("PRECONDITION_TOGGLE_INTRO", $this->lng->txt("precondition_toggle"));
1985 $this->tpl->setVariable("PRECONDITION_TOGGLE_TRIGGER", $this->lng->txt("show"));
1986 $this->tpl->setVariable("PRECONDITION_TOGGLE_ID", self::$js_unique_id);
1987 $this->tpl->setVariable("TXT_PRECONDITION_SHOW", $this->lng->txt("show"));
1988 $this->tpl->setVariable("TXT_PRECONDITION_HIDE", $this->lng->txt("hide"));
1989 $this->tpl->parseCurrentBlock();
1990 }
1991 }
1992 }
1993
2002 public function insertCommand($a_href, $a_text, $a_frame = "", $a_img = "", $a_cmd = "", $a_onclick = "")
2003 {
2004 // #11099
2005 $chksum = md5($a_href . $a_text);
2006 if ($a_href == "#" ||
2007 !in_array($chksum, $this->prevent_duplicate_commands)) {
2008 if ($a_href != "#") {
2009 $this->prevent_duplicate_commands[] = $chksum;
2010 }
2011
2012 $prevent_background_click = false;
2013 if ($a_cmd == 'mount_webfolder') {
2014 $prevent_background_click = true;
2015 }
2016
2017 if ($a_cmd == "downloadFolder") {
2018 include_once "Services/BackgroundTask/classes/class.ilFolderDownloadBackgroundTaskHandler.php";
2021 $a_href = "#";
2022 }
2023 }
2024
2025 $this->current_selection_list->addItem(
2026 $a_text,
2027 "",
2028 $a_href,
2029 $a_img,
2030 $a_text,
2031 $a_frame,
2032 "",
2033 $prevent_background_click,
2034 $a_onclick
2035 );
2036 }
2037 }
2038
2046 public function insertDeleteCommand()
2047 {
2048 if ($this->std_cmd_only) {
2049 return;
2050 }
2051
2052 if (is_object($this->getContainerObject()) and
2054 if ($this->checkCommandAccess('delete', '', $this->ref_id, $this->type)) {
2055 $this->ctrl->setParameter($this->getContainerObject(), 'item_ref_id', $this->getCommandId());
2056 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "delete");
2057 $this->insertCommand($cmd_link, $this->lng->txt("delete"));
2058 $this->adm_commands_included = true;
2059 return true;
2060 }
2061 return false;
2062 }
2063
2064 if ($this->checkCommandAccess('delete', '', $this->ref_id, $this->type)) {
2065 $this->ctrl->setParameter(
2066 $this->container_obj,
2067 "ref_id",
2068 $this->container_obj->object->getRefId()
2069 );
2070 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2071 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "delete");
2072 $this->insertCommand(
2073 $cmd_link,
2074 $this->lng->txt("delete"),
2075 "",
2076 ""
2077 );
2078 $this->adm_commands_included = true;
2079 }
2080 }
2081
2089 public function insertLinkCommand()
2090 {
2091 $objDefinition = $this->obj_definition;
2092
2093 if ($this->std_cmd_only) {
2094 return;
2095 }
2096
2097 // #17307
2098 if (!$this->checkCommandAccess('delete', '', $this->ref_id, $this->type) or
2099 !$objDefinition->allowLink($this->type)) {
2100 return false;
2101 }
2102
2103 // BEGIN PATCH Lucene search
2104
2105 if (is_object($this->getContainerObject()) and
2107 $this->ctrl->setParameter($this->getContainerObject(), 'item_ref_id', $this->getCommandId());
2108 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "link");
2109 $this->insertCommand($cmd_link, $this->lng->txt("link"));
2110 $this->adm_commands_included = true;
2111 return true;
2112 }
2113 // END PATCH Lucene Search
2114
2115 // if the permission is changed here, it has
2116 // also to be changed in ilContainerGUI, admin command check
2117 $this->ctrl->setParameter(
2118 $this->container_obj,
2119 "ref_id",
2120 $this->container_obj->object->getRefId()
2121 );
2122 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2123 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "link");
2124 $this->insertCommand(
2125 $cmd_link,
2126 $this->lng->txt("link"),
2127 "",
2128 ""
2129 );
2130 $this->adm_commands_included = true;
2131 return true;
2132 }
2133
2140 public function insertCutCommand($a_to_repository = false)
2141 {
2142 if ($this->std_cmd_only) {
2143 return;
2144 }
2145 // BEGIN PATCH Lucene search
2146 if (is_object($this->getContainerObject()) and
2148 if ($this->checkCommandAccess('delete', '', $this->ref_id, $this->type)) {
2149 $this->ctrl->setParameter($this->getContainerObject(), 'item_ref_id', $this->getCommandId());
2150 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "cut");
2151 $this->insertCommand($cmd_link, $this->lng->txt("move"));
2152 $this->adm_commands_included = true;
2153 return true;
2154 }
2155 return false;
2156 }
2157 // END PATCH Lucene Search
2158
2159 // if the permission is changed here, it has
2160 // also to be changed in ilContainerContentGUI, determineAdminCommands
2161 if ($this->checkCommandAccess('delete', '', $this->ref_id, $this->type) &&
2162 $this->container_obj->object) {
2163 $this->ctrl->setParameter(
2164 $this->container_obj,
2165 "ref_id",
2166 $this->container_obj->object->getRefId()
2167 );
2168 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2169
2170 if (!$a_to_repository) {
2171 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "cut");
2172 $this->insertCommand(
2173 $cmd_link,
2174 $this->lng->txt("move"),
2175 "",
2176 ""
2177 );
2178 } else {
2179 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "cut_for_repository");
2180 $this->insertCommand(
2181 $cmd_link,
2182 $this->lng->txt("wsp_move_to_repository"),
2183 "",
2184 ""
2185 );
2186 }
2187
2188 $this->adm_commands_included = true;
2189 }
2190 }
2191
2197 public function insertCopyCommand($a_to_repository = false)
2198 {
2199 $objDefinition = $this->obj_definition;
2200
2201 if ($this->std_cmd_only) {
2202 return;
2203 }
2204
2205 if ($this->checkCommandAccess('copy', 'copy', $this->ref_id, $this->type) &&
2206 $objDefinition->allowCopy($this->type)) {
2207 if ($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING) {
2208 $this->ctrl->setParameterByClass('ilobjectcopygui', 'source_id', $this->getCommandId());
2209 $cmd_copy = $this->ctrl->getLinkTargetByClass('ilobjectcopygui', 'initTargetSelection');
2210 $this->insertCommand($cmd_copy, $this->lng->txt('copy'));
2211 } else {
2212 $this->ctrl->setParameter(
2213 $this->container_obj,
2214 "ref_id",
2215 $this->container_obj->object->getRefId()
2216 );
2217 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2218
2219 if (!$a_to_repository) {
2220 $cmd_copy = $this->ctrl->getLinkTarget($this->container_obj, 'copy');
2221 $this->insertCommand($cmd_copy, $this->lng->txt('copy'));
2222 } else {
2223 $cmd_copy = $this->ctrl->getLinkTarget($this->container_obj, 'copy_to_repository');
2224 $this->insertCommand($cmd_copy, $this->lng->txt('wsp_copy_to_repository'));
2225 }
2226 }
2227
2228 $this->adm_commands_included = true;
2229 }
2230 return;
2231 }
2232
2233
2237 public function insertPasteCommand()
2238 {
2239 $objDefinition = $this->obj_definition;
2240
2241 if ($this->std_cmd_only) {
2242 return;
2243 }
2244
2245 if (!$objDefinition->isContainer(ilObject::_lookupType($this->obj_id))) {
2246 return false;
2247 }
2248
2249 if (is_object($this->getContainerObject()) and
2251 isset($_SESSION['clipboard'])) {
2252 $this->ctrl->setParameter($this->getContainerObject(), 'item_ref_id', $this->getCommandId());
2253 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "paste");
2254 $this->insertCommand($cmd_link, $this->lng->txt("paste"));
2255 $this->adm_commands_included = true;
2256 return true;
2257 }
2258 return false;
2259 }
2260
2268 public function insertSubscribeCommand()
2269 {
2272
2273 if ($this->std_cmd_only) {
2274 return;
2275 }
2276
2277 if ((int) $ilSetting->get('disable_my_offers')) {
2278 return;
2279 }
2280
2282
2283 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
2284 // #17467 - add ref_id to link (in repository only!)
2285 if (is_object($this->container_obj) &&
2286 !($this->container_obj instanceof ilAdministrationCommandHandling) &&
2287 is_object($this->container_obj->object)) {
2288 $this->ctrl->setParameter($this->container_obj, "ref_id", $this->container_obj->object->getRefId());
2289 }
2290
2291 if (!$ilUser->isDesktopItem($this->getCommandId(), $type)) {
2292 // Pass type and object ID to ilAccess to improve performance
2293 if ($this->checkCommandAccess("read", "", $this->ref_id, $this->type, $this->obj_id)) {
2294 if ($this->getContainerObject() instanceof ilDesktopItemHandling) {
2295 $this->ctrl->setParameter($this->container_obj, "type", $type);
2296 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2297 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "addToDesk");
2298 $this->insertCommand(
2299 $cmd_link,
2300 $this->lng->txt("to_desktop"),
2301 "",
2302 ""
2303 );
2304 }
2305 }
2306 } else {
2307 if ($this->getContainerObject() instanceof ilDesktopItemHandling) {
2308 $this->ctrl->setParameter($this->container_obj, "type", $type);
2309 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2310 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "removeFromDesk");
2311 $this->insertCommand(
2312 $cmd_link,
2313 $this->lng->txt("unsubscribe"),
2314 "",
2315 ""
2316 );
2317 }
2318 }
2319 }
2320 }
2321
2325 public function insertInfoScreenCommand()
2326 {
2327 if ($this->std_cmd_only) {
2328 return;
2329 }
2330 $cmd_link = $this->getCommandLink("infoScreen");
2331 $cmd_frame = $this->getCommandFrame("infoScreen");
2332 $this->insertCommand(
2333 $cmd_link,
2334 $this->lng->txt("info_short"),
2335 $cmd_frame,
2336 ilUtil::getImagePath("icon_info.svg")
2337 );
2338 }
2339
2346 public function insertCommonSocialCommands($a_header_actions = false)
2347 {
2348 $lng = $this->lng;
2350
2351 if ($this->std_cmd_only ||
2352 ($ilUser->getId() == ANONYMOUS_USER_ID)) {
2353 return;
2354 }
2355 $lng->loadLanguageModule("notes");
2356 $lng->loadLanguageModule("tagging");
2357 $cmd_frame = $this->getCommandFrame("infoScreen");
2358 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
2359
2360 // reference objects have translated ids, revert to originals
2361 $note_ref_id = $this->ref_id;
2362 if ($this->reference_ref_id) {
2363 $note_ref_id = $this->reference_ref_id;
2364 }
2365
2366 $js_updater = $a_header_actions
2367 ? "il.Object.redrawActionHeader();"
2368 : "il.Object.redrawListItem(" . $note_ref_id . ")";
2369
2370 $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, $a_header_actions, true);
2371 if ($comments_enabled) {
2372 $this->insertCommand(
2373 "#",
2374 $this->lng->txt("notes_comments"),
2375 $cmd_frame,
2376 "",
2377 "",
2378 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $js_updater)
2379 );
2380 }
2381
2382 if ($this->notes_enabled) {
2383 $this->insertCommand(
2384 "#",
2385 $this->lng->txt("notes"),
2386 $cmd_frame,
2387 "",
2388 "",
2389 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $js_updater)
2390 );
2391 }
2392
2393 if ($this->tags_enabled) {
2394 include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
2395 //$this->insertCommand($cmd_tag_link, $this->lng->txt("tagging_set_tag"), $cmd_frame);
2396 $this->insertCommand(
2397 "#",
2398 $this->lng->txt("tagging_set_tag"),
2399 $cmd_frame,
2400 "",
2401 "",
2402 ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $js_updater)
2403 );
2404 }
2405 }
2406
2412 public function insertTimingsCommand()
2413 {
2414 if ($this->std_cmd_only || !$this->container_obj->object) {
2415 return;
2416 }
2417
2418 $parent_ref_id = $this->container_obj->object->getRefId();
2419 $parent_type = $this->container_obj->object->getType();
2420
2421 // #18737
2422 if ($this->reference_ref_id) {
2423 $this->ctrl->setParameterByClass('ilobjectactivationgui', 'ref_id', $this->reference_ref_id);
2424 }
2425
2426 if ($this->checkCommandAccess('write', '', $parent_ref_id, $parent_type) ||
2427 $this->checkCommandAccess('write', '', $this->ref_id, $this->type)) {
2428 $this->ctrl->setParameterByClass(
2429 'ilobjectactivationgui',
2430 'cadh',
2431 $this->ajax_hash
2432 );
2433 $this->ctrl->setParameterByClass(
2434 'ilobjectactivationgui',
2435 'parent_id',
2437 );
2438 $cmd_lnk = $this->ctrl->getLinkTargetByClass(
2439 array($this->gui_class_name, 'ilcommonactiondispatchergui', 'ilobjectactivationgui'),
2440 'edit'
2441 );
2442
2443 $this->insertCommand($cmd_lnk, $this->lng->txt('obj_activation_list_gui'));
2444 }
2445
2446 if ($this->reference_ref_id) {
2447 $this->ctrl->setParameterByClass('ilobjectactivationgui', 'ref_id', $this->ref_id);
2448 }
2449 }
2450
2458 public function insertCommands(
2459 $a_use_asynch = false,
2460 $a_get_asynch_commands = false,
2461 $a_asynch_url = "",
2462 $a_header_actions = false
2463 ) {
2464 $lng = $this->lng;
2466
2467 if (!$this->getCommandsStatus()) {
2468 return;
2469 }
2470
2471 include_once("Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2472 $this->current_selection_list = new ilAdvancedSelectionListGUI();
2473 $this->current_selection_list->setAsynch($a_use_asynch && !$a_get_asynch_commands);
2474 $this->current_selection_list->setAsynchUrl($a_asynch_url);
2475 if ($a_header_actions) {
2476 $this->current_selection_list->setListTitle("<span class='hidden-xs'>" . $lng->txt("actions") . "</span>");
2477 } else {
2478 $this->current_selection_list->setListTitle("");
2479 }
2480 $this->current_selection_list->setId("act_" . $this->getUniqueItemId(false));
2481 $this->current_selection_list->setSelectionHeaderClass("small");
2482 $this->current_selection_list->setItemLinkClass("xsmall");
2483 $this->current_selection_list->setLinksMode("il_ContainerItemCommand2");
2484 $this->current_selection_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
2485 $this->current_selection_list->setUseImages(false);
2486 $this->current_selection_list->setAdditionalToggleElement($this->getUniqueItemId(true), "ilContainerListItemOuterHighlight");
2487
2488 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", $this->ref_id);
2489
2490 // only standard command?
2491 $only_default = false;
2492 if ($a_use_asynch && !$a_get_asynch_commands) {
2493 $only_default = true;
2494 }
2495
2496 $this->default_command = false;
2497 $this->prevent_duplicate_commands = array();
2498
2499 // we only allow the following commands inside the header actions
2500 $valid_header_commands = array("mount_webfolder");
2501
2502 $commands = $this->getCommands($this->ref_id, $this->obj_id);
2503 foreach ($commands as $command) {
2504 if ($a_header_actions && !in_array($command["cmd"], $valid_header_commands)) {
2505 continue;
2506 }
2507
2508 if ($command["granted"] == true) {
2509 if (!$command["default"] === true) {
2510 if (!$this->std_cmd_only && !$only_default) {
2511 // workaround for repository frameset
2512 $command["link"] =
2513 $this->appendRepositoryFrameParameter($command["link"]);
2514
2515 $cmd_link = $command["link"];
2516 $txt = ($command["lang_var"] == "")
2517 ? $command["txt"]
2518 : $this->lng->txt($command["lang_var"]);
2519 $this->insertCommand(
2520 $cmd_link,
2521 $txt,
2522 $command["frame"],
2523 $command["img"],
2524 $command["cmd"]
2525 );
2526 }
2527 } else {
2528 $this->default_command = $this->createDefaultCommand($command);
2529 //$this->default_command = $command;
2530 }
2531 } elseif ($command["default"] === true) {
2532 $items =&$command["access_info"];
2533 foreach ($items as $item) {
2534 if (defined('IL_NO_LICENSE') && $item["type"] == IL_NO_LICENSE) {
2535 $this->addCustomProperty($this->lng->txt("license"), $item["text"], true);
2536 $this->enableProperties(true);
2537 break;
2538 }
2539 }
2540 }
2541 }
2542
2543 if (!$only_default) {
2544 // custom commands
2545 if (is_array($this->cust_commands)) {
2546 foreach ($this->cust_commands as $command) {
2547 $this->insertCommand(
2548 $command["link"],
2549 $this->lng->txt($command["lang_var"]),
2550 $command["frame"],
2551 "",
2552 $command["cmd"],
2553 $command["onclick"]
2554 );
2555 }
2556 }
2557
2558 // info screen commmand
2559 if ($this->getInfoScreenStatus()) {
2560 $this->insertInfoScreenCommand();
2561 }
2562
2563 if (!$this->isMode(IL_LIST_AS_TRIGGER)) {
2564 // edit timings
2565 if ($this->timings_enabled) {
2566 $this->insertTimingsCommand();
2567 }
2568
2569 // delete
2570 if ($this->delete_enabled) {
2571 $this->insertDeleteCommand();
2572 }
2573
2574 // link
2575 if ($this->link_enabled) {
2576 $this->insertLinkCommand();
2577 }
2578
2579 // cut
2580 if ($this->cut_enabled) {
2581 $this->insertCutCommand();
2582 }
2583
2584 // copy
2585 if ($this->copy_enabled) {
2586 $this->insertCopyCommand();
2587 }
2588
2589 // cut/copy from workspace to repository
2590 if ($this->repository_transfer_enabled) {
2591 $this->insertCutCommand(true);
2592 $this->insertCopyCommand(true);
2593 }
2594
2595 // subscribe
2596 if ($this->subscribe_enabled) {
2597 $this->insertSubscribeCommand();
2598 }
2599
2600 // multi download
2601 if ($this->multi_download_enabled && $a_header_actions) {
2603 }
2604
2605 // BEGIN PATCH Lucene search
2606 if ($this->cut_enabled or $this->link_enabled) {
2607 $this->insertPasteCommand();
2608 }
2609 // END PATCH Lucene Search
2610 }
2611 }
2612
2613 // common social commands (comment, notes, tags)
2614 if (!$only_default && !$this->isMode(IL_LIST_AS_TRIGGER)) {
2615 $this->insertCommonSocialCommands($a_header_actions);
2616 }
2617
2618 if (!$a_header_actions) {
2619 $this->ctrl->clearParametersByClass($this->gui_class_name);
2620 }
2621
2622 // fix bug #12417
2623 // there is one case, where no action menu should be displayed:
2624 // public area, category, no info tab
2625 // todo: make this faster and remove type specific implementation if possible
2626 if ($a_use_asynch && !$a_get_asynch_commands && !$a_header_actions) {
2627 if ($ilUser->getId() == ANONYMOUS_USER_ID && $this->type == "cat") {
2628 include_once("./Services/Container/classes/class.ilContainer.php");
2629 include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
2631 $this->obj_id,
2633 true
2634 )) {
2635 return;
2636 }
2637 }
2638 }
2639
2640 if ($a_use_asynch && $a_get_asynch_commands) {
2641 return $this->current_selection_list->getHTML(true);
2642 }
2643
2644 return $this->current_selection_list->getHTML();
2645 }
2646
2652 public function enableComments($a_value, $a_enable_comments_settings = true)
2653 {
2655
2656 // global switch
2657 if ($ilSetting->get("disable_comments")) {
2658 $a_value = false;
2659 }
2660
2661 $this->comments_enabled = (bool) $a_value;
2662 $this->comments_settings_enabled = (bool) $a_enable_comments_settings;
2663 }
2664
2670 public function enableNotes($a_value)
2671 {
2673
2674 // global switch
2675 if ($ilSetting->get("disable_notes")) {
2676 $a_value = false;
2677 }
2678
2679 $this->notes_enabled = (bool) $a_value;
2680 }
2681
2687 public function enableTags($a_value)
2688 {
2689 $tags_set = new ilSetting("tags");
2690 if (!$tags_set->get("enable")) {
2691 $a_value = false;
2692 }
2693 $this->tags_enabled = (bool) $a_value;
2694 }
2695
2704 public function enableRating($a_value, $a_text = null, $a_categories = false, array $a_ctrl_path = null)
2705 {
2706 $this->rating_enabled = (bool) $a_value;
2707
2708 if ($this->rating_enabled) {
2709 $this->rating_categories_enabled = (bool) $a_categories;
2710 $this->rating_text = $a_text;
2711 $this->rating_ctrl_path = $a_ctrl_path;
2712 }
2713 }
2714
2720 public function enableMultiDownload($a_value)
2721 {
2722 $folder_set = new ilSetting("fold");
2723 if (!$folder_set->get("enable_multi_download")) {
2724 $a_value = false;
2725 }
2726 $this->multi_download_enabled = (bool) $a_value;
2727 }
2728
2730 {
2731 $objDefinition = $this->obj_definition;
2732
2733 if ($this->std_cmd_only) {
2734 return;
2735 }
2736
2737 if (!$objDefinition->isContainer(ilObject::_lookupType($this->obj_id))) {
2738 return false;
2739 }
2740
2741 if (is_object($this->getContainerObject()) &&
2742 $this->getContainerObject() instanceof ilContainerGUI) {
2743 $this->ctrl->setParameter($this->getContainerObject(), "type", "");
2744 $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", "");
2745 $this->ctrl->setParameter($this->getContainerObject(), "active_node", "");
2746 // bugfix mantis 24559
2747 // undoing an erroneous change inside mantis 23516 by adding "Download Multiple Objects"-functionality for non-admins
2748 // as they don't have the possibility to use the multi-download-capability of the manage-tab
2749 $user_id = $this->user->getId();
2750 $hasAdminAccess = $this->access->checkAccessOfUser($user_id, "crs_admin", $this->ctrl->getCmd(), $_GET['ref_id']);
2751 // to still prevent duplicate download functions for admins the following if-else statement keeps the redirection for admins
2752 // while letting other course members access the original multi-download functionality
2753 if ($hasAdminAccess) {
2754 $cmd = $_GET["cmd"] == "enableAdministrationPanel" ? "render" : "enableAdministrationPanel";
2755 } else {
2756 $cmd = $_GET["cmd"] == "enableMultiDownload" ? "render" : "enableMultiDownload";
2757 }
2758 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), $cmd);
2759 $this->insertCommand($cmd_link, $this->lng->txt("download_multiple_objects"));
2760 return true;
2761 }
2762
2763 return false;
2764 }
2765
2766 public function enableDownloadCheckbox($a_ref_id, $a_value)
2767 {
2768 $ilAccess = $this->access;
2769
2770 // TODO: delegate to list object class!
2771 if (!$this->getContainerObject()->isActiveAdministrationPanel() || $_SESSION["clipboard"]) {
2772 if (in_array($this->type, array("file", "fold")) &&
2773 $ilAccess->checkAccess("read", "", $a_ref_id, $this->type)) {
2774 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_ENABLED;
2775 } else {
2776 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_DISABLED;
2777 }
2778 } else {
2779 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_NONE;
2780 }
2781 }
2782
2784 {
2786 }
2787
2791 public static function prepareJsLinks($a_redraw_url, $a_notes_url, $a_tags_url, $a_tpl = null)
2792 {
2793 global $DIC;
2794
2795 $tpl = $DIC["tpl"];
2796
2797 if (is_null($a_tpl)) {
2798 $a_tpl = $tpl;
2799 }
2800
2801 if ($a_notes_url) {
2802 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
2803 ilNoteGUI::initJavascript($a_notes_url, IL_NOTE_PRIVATE, $a_tpl);
2804 }
2805
2806 if ($a_tags_url) {
2807 include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
2808 ilTaggingGUI::initJavascript($a_tags_url, $a_tpl);
2809 }
2810
2811 if ($a_redraw_url) {
2812 $a_tpl->addOnLoadCode("il.Object.setRedrawAHUrl('" .
2813 $a_redraw_url . "');");
2814 }
2815 }
2816
2823 public function setHeaderSubObject($a_type, $a_id)
2824 {
2825 $this->sub_obj_type = $a_type;
2826 $this->sub_obj_id = (int) $a_id;
2827 }
2828
2838 public function addHeaderIcon($a_id, $a_img, $a_tooltip = null, $a_onclick = null, $a_status_text = null, $a_href = null)
2839 {
2840 $this->header_icons[$a_id] = array("img" => $a_img,
2841 "tooltip" => $a_tooltip,
2842 "onclick" => $a_onclick,
2843 "status_text" => $a_status_text,
2844 "href" => $a_href);
2845 }
2846
2852 public function addHeaderIconHTML($a_id, $a_html)
2853 {
2854 $this->header_icons[$a_id] = $a_html;
2855 }
2856
2862 public function addHeaderGlyph($a_id, $a_glyph, $a_onclick = null)
2863 {
2864 $this->header_icons[$a_id] = array("glyph" => $a_glyph, "onclick" => $a_onclick);
2865 }
2866
2867 public function setAjaxHash($a_hash)
2868 {
2869 $this->ajax_hash = $a_hash;
2870 }
2871
2877 public function getHeaderAction(ilTemplate $a_main_tpl = null)
2878 {
2879 global $DIC;
2880
2882 $lng = $this->lng;
2883
2884 if ($a_main_tpl == null) {
2885 $main_tpl = $DIC["tpl"];
2886 } else {
2887 $main_tpl = $a_main_tpl;
2888 }
2889
2890 $htpl = new ilTemplate("tpl.header_action.html", true, true, "Services/Repository");
2891
2892 $redraw_js = "il.Object.redrawActionHeader();";
2893
2894 // tags
2895 if ($this->tags_enabled) {
2896 include_once("./Services/Tagging/classes/class.ilTagging.php");
2898 $this->obj_id,
2899 ilObject::_lookupType($this->obj_id),
2900 0,
2901 "",
2902 $ilUser->getId()
2903 );
2904 if (count($tags) > 0) {
2905 include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
2906 $lng->loadLanguageModule("tagging");
2907 /*$this->addHeaderIcon("tags",
2908 ilUtil::getImagePath("icon_tag.svg"),
2909 $lng->txt("tagging_tags").": ".count($tags),
2910 ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js),
2911 count($tags));*/
2912
2913 $f = $this->ui->factory();
2914 $this->addHeaderGlyph(
2915 "tags",
2916 $f->glyph()->tag("#")
2917 ->withCounter($f->counter()->status((int) count($tags))),
2918 ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js)
2919 );
2920 }
2921 }
2922
2923 // notes and comments
2924 $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, true, false);
2925 if ($this->notes_enabled || $comments_enabled) {
2926 include_once("./Services/Notes/classes/class.ilNote.php");
2927 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
2928 $cnt = ilNote::_countNotesAndComments($this->obj_id, $this->sub_obj_id);
2929
2930 if ($this->notes_enabled && $cnt[$this->obj_id][IL_NOTE_PRIVATE] > 0) {
2931 /*$this->addHeaderIcon("notes",
2932 ilUtil::getImagePath("note_unlabeled.svg"),
2933 $lng->txt("private_notes").": ".$cnt[$this->obj_id][IL_NOTE_PRIVATE],
2934 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js),
2935 $cnt[$this->obj_id][IL_NOTE_PRIVATE]
2936 );*/
2937
2938 $f = $this->ui->factory();
2939 $this->addHeaderGlyph(
2940 "notes",
2941 $f->glyph()->note("#")
2942 ->withCounter($f->counter()->status((int) $cnt[$this->obj_id][IL_NOTE_PRIVATE])),
2943 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js)
2944 );
2945 }
2946
2947 if ($comments_enabled && $cnt[$this->obj_id][IL_NOTE_PUBLIC] > 0) {
2948 $lng->loadLanguageModule("notes");
2949
2950 /*$this->addHeaderIcon("comments",
2951 ilUtil::getImagePath("comment_unlabeled.svg"),
2952 $lng->txt("notes_public_comments").": ".$cnt[$this->obj_id][IL_NOTE_PUBLIC],
2953 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js),
2954 $cnt[$this->obj_id][IL_NOTE_PUBLIC]);*/
2955
2956 $f = $this->ui->factory();
2957 $this->addHeaderGlyph(
2958 "comments",
2959 $f->glyph()->comment("#")
2960 ->withCounter($f->counter()->status((int) $cnt[$this->obj_id][IL_NOTE_PUBLIC])),
2961 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js)
2962 );
2963 }
2964 }
2965
2966 // rating
2967 if ($this->rating_enabled) {
2968 include_once("./Services/Rating/classes/class.ilRatingGUI.php");
2969 $rating_gui = new ilRatingGUI();
2970 $rating_gui->enableCategories($this->rating_categories_enabled);
2971 // never rate sub objects from header action!
2972 $rating_gui->setObject($this->obj_id, $this->type);
2973 if ($this->rating_text) {
2974 $rating_gui->setYourRatingText($this->rating_text);
2975 }
2976
2977 $this->ctrl->setParameterByClass("ilRatingGUI", "cadh", $this->ajax_hash);
2978 $this->ctrl->setParameterByClass("ilRatingGUI", "rnsb", true);
2979 if ($this->rating_ctrl_path) {
2980 $rating_gui->setCtrlPath($this->rating_ctrl_path);
2981 $ajax_url = $this->ctrl->getLinkTargetByClass($this->rating_ctrl_path, "saveRating", "", true, false);
2982 } else {
2983 // ???
2984 $ajax_url = $this->ctrl->getLinkTargetByClass("ilRatingGUI", "saveRating", "", true, false);
2985 }
2986 $main_tpl->addOnLoadCode("il.Object.setRatingUrl('" . $ajax_url . "');");
2987 $this->addHeaderIconHTML(
2988 "rating",
2989 $rating_gui->getHtml(
2990 true,
2991 $this->checkCommandAccess("read", "", $this->ref_id, $this->type),
2992 "il.Object.saveRating(%rating%);"
2993 )
2994 );
2995 }
2996
2997 if ($this->header_icons) {
2998 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
2999
3000 $chunks = array();
3001 foreach ($this->header_icons as $id => $attr) {
3002 $id = "headp_" . $id;
3003
3004 if (is_array($attr)) {
3005 if ($attr["glyph"]) {
3006 if ($attr["onclick"]) {
3007 $htpl->setCurrentBlock("prop_glyph_oc");
3008 $htpl->setVariable("GLYPH_ONCLICK", $attr["onclick"]);
3009 $htpl->parseCurrentBlock();
3010 }
3011 $renderer = $this->ui->renderer();
3012 $html = $renderer->render($attr["glyph"]);
3013 $htpl->setCurrentBlock("prop_glyph");
3014 $htpl->setVariable("GLYPH", $html);
3015 $htpl->parseCurrentBlock();
3016 } else {
3017 if ($attr["onclick"]) {
3018 $htpl->setCurrentBlock("onclick");
3019 $htpl->setVariable("PROP_ONCLICK", $attr["onclick"]);
3020 $htpl->parseCurrentBlock();
3021 }
3022
3023 if ($attr["status_text"]) {
3024 $htpl->setCurrentBlock("status");
3025 $htpl->setVariable("PROP_TXT", $attr["status_text"]);
3026 $htpl->parseCurrentBlock();
3027 }
3028
3029
3030 $htpl->setCurrentBlock("prop");
3031 if ($attr["href"] || $attr["onclick"]) {
3032 $htpl->setVariable("TAG", "a");
3033 } else {
3034 $htpl->setVariable("TAG", "span");
3035 }
3036 $htpl->setVariable("PROP_ID", $id);
3037 $htpl->setVariable("IMG", ilUtil::img($attr["img"]));
3038 if ($attr["href"] != "") {
3039 $htpl->setVariable("PROP_HREF", ' href="' . $attr["href"] . '" ');
3040 }
3041 $htpl->parseCurrentBlock();
3042
3043 if ($attr["tooltip"]) {
3044 ilTooltipGUI::addTooltip($id, $attr["tooltip"]);
3045 }
3046 }
3047 } else {
3048 $chunks[] = $attr;
3049 }
3050 }
3051
3052 if (sizeof($chunks)) {
3053 $htpl->setVariable(
3054 "PROP_CHUNKS",
3055 implode("&nbsp;&nbsp;&nbsp;", $chunks) . "&nbsp;&nbsp;&nbsp;"
3056 );
3057 }
3058 }
3059
3060 $htpl->setVariable(
3061 "ACTION_DROP_DOWN",
3062 $this->insertCommands(false, false, "", true)
3063 );
3064
3065 return $htpl->get();
3066 }
3067
3068
3073 public function appendRepositoryFrameParameter($a_link)
3074 {
3075 // we should get rid of this nonsense with 4.4 (alex)
3076 if ((strtolower($_GET["baseClass"]) != "ilrepositorygui") &&
3077 is_int(strpos($a_link, "baseClass=ilRepositoryGUI"))) {
3078 if ($this->type != "frm") {
3079 $a_link =
3080 ilUtil::appendUrlParameterString($a_link, "rep_frame=1");
3081 }
3082 }
3083
3084 return $a_link;
3085 }
3086
3087 protected function modifyTitleLink($a_default_link)
3088 {
3089 if ($this->default_command_params) {
3090 $params = array();
3091 foreach ($this->default_command_params as $name => $value) {
3092 $params[] = $name . '=' . $value;
3093 }
3094 $params = implode('&', $params);
3095
3096
3097 // #12370
3098 if (!stristr($a_default_link, '?')) {
3099 $a_default_link = ($a_default_link . '?' . $params);
3100 } else {
3101 $a_default_link = ($a_default_link . '&' . $params);
3102 }
3103 }
3104 return $a_default_link;
3105 }
3106
3110 public function modifySAHSlaunch($a_link, $wtarget)
3111 {
3112 global $DIC;
3113
3114 if (strstr($a_link, 'ilSAHSPresentationGUI') && !$this->offline_mode) {
3115 include_once 'Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
3116 $sahs_obj = new ilObjSAHSLearningModule($this->ref_id);
3117 $om = $sahs_obj->getOpenMode();
3118 $width = $sahs_obj->getWidth();
3119 $height = $sahs_obj->getHeight();
3120 if (($om == 5 || $om == 1) && $width > 0 && $height > 0) {
3121 $om++;
3122 }
3123 if ($om != 0 && !$DIC['ilBrowser']->isMobile()) {
3124 $this->default_command["frame"]="";
3125 $a_link = "javascript:void(0); onclick=startSAHS('" . $a_link . "','" . $wtarget . "'," . $om . "," . $width . "," . $height . ");";
3126 }
3127 }
3128 return $a_link;
3129 }
3130
3134 public function insertPath()
3135 {
3136 $lng = $this->lng;
3137
3138 if ($this->getPathStatus() != false) {
3139 include_once 'Services/Tree/classes/class.ilPathGUI.php';
3140 $path_gui = new ilPathGUI();
3141 $path_gui->enableTextOnly(!$this->path_linked);
3142 $path_gui->setUseImages(false);
3143
3144 $start_node = $this->path_start_node
3145 ? $this->path_start_node
3146 : ROOT_FOLDER_ID;
3147
3148 $this->tpl->setCurrentBlock("path_item");
3149 $this->tpl->setVariable('PATH_ITEM', $path_gui->getPath($start_node, $this->ref_id));
3150 $this->tpl->parseCurrentBlock();
3151
3152 $this->tpl->setCurrentBlock("path");
3153 $this->tpl->setVariable("TXT_LOCATION", $lng->txt("locator"));
3154 $this->tpl->parseCurrentBlock();
3155 return true;
3156 }
3157 }
3158
3165 public function insertProgressInfo()
3166 {
3167 return true;
3168 }
3169
3170
3175 {
3176 $lng = $this->lng;
3177 $objDefinition = $this->obj_definition;
3178
3179 $cnt = 0;
3180 if ($this->getCheckboxStatus()) {
3181 $this->tpl->setCurrentBlock("check");
3182 $this->tpl->setVariable("VAL_ID", $this->getCommandId());
3183 $this->tpl->parseCurrentBlock();
3184 $cnt += 1;
3185 } elseif ($this->getDownloadCheckboxState() != self::DOWNLOAD_CHECKBOX_NONE) {
3186 $this->tpl->setCurrentBlock("check_download");
3187 if ($this->getDownloadCheckboxState() == self::DOWNLOAD_CHECKBOX_ENABLED) {
3188 $this->tpl->setVariable("VAL_ID", $this->getCommandId());
3189 } else {
3190 $this->tpl->setVariable("VAL_VISIBILITY", "visibility: hidden;\" disabled=\"disabled");
3191 }
3192 $this->tpl->parseCurrentBlock();
3193 $cnt += 1;
3194 } elseif ($this->getExpandStatus()) {
3195 $this->tpl->setCurrentBlock('expand');
3196
3197 if ($this->isExpanded()) {
3198 $this->ctrl->setParameter($this->container_obj, 'expand', -1 * $this->obj_id);
3199 // "view" added, see #19922
3200 $this->tpl->setVariable('EXP_HREF', $this->ctrl->getLinkTarget($this->container_obj, 'view', $this->getUniqueItemId(true)));
3201 $this->ctrl->clearParameters($this->container_obj);
3202 $this->tpl->setVariable('EXP_IMG', ilUtil::getImagePath('tree_exp.svg'));
3203 $this->tpl->setVariable('EXP_ALT', $this->lng->txt('collapse'));
3204 } else {
3205 $this->ctrl->setParameter($this->container_obj, 'expand', $this->obj_id);
3206 // "view" added, see #19922
3207 $this->tpl->setVariable('EXP_HREF', $this->ctrl->getLinkTarget($this->container_obj, 'view', $this->getUniqueItemId(true)));
3208 $this->ctrl->clearParameters($this->container_obj);
3209 $this->tpl->setVariable('EXP_IMG', ilUtil::getImagePath('tree_col.svg'));
3210 $this->tpl->setVariable('EXP_ALT', $this->lng->txt('expand'));
3211 }
3212
3213 $this->tpl->parseCurrentBlock();
3214 $cnt += 1;
3215 }
3216
3217 if ($this->getIconStatus()) {
3218 if ($cnt == 1) {
3219 $this->tpl->touchBlock("i_1"); // indent
3220 }
3221
3222 // icon link
3223 if ($this->title_link_disabled || !$this->default_command || (!$this->getCommandsStatus() && !$this->restrict_to_goto)) {
3224 } else {
3225 $this->tpl->setCurrentBlock("icon_link_s");
3226
3227 if ($this->default_command["frame"] != "") {
3228 $this->tpl->setVariable("ICON_TAR", "target='" . $this->default_command["frame"] . "'");
3229 }
3230
3231 $this->tpl->setVariable(
3232 "ICON_HREF",
3233 $this->default_command["link"]
3234 );
3235 $this->tpl->parseCurrentBlock();
3236 $this->tpl->touchBlock("icon_link_e");
3237 }
3238
3239 $this->tpl->setCurrentBlock("icon");
3240 if (!$objDefinition->isPlugin($this->getIconImageType())) {
3241 $this->tpl->setVariable("ALT_ICON", $lng->txt("icon") . " " . $lng->txt("obj_" . $this->getIconImageType()));
3242 } else {
3243 include_once("Services/Component/classes/class.ilPlugin.php");
3244 $this->tpl->setVariable("ALT_ICON", $lng->txt("icon") . " " .
3245 ilObjectPlugin::lookupTxtById($this->getIconImageType(), "obj_" . $this->getIconImageType()));
3246 }
3247
3248 $this->tpl->setVariable(
3249 "SRC_ICON",
3250 ilObject::_getIcon($this->obj_id, "small", $this->getIconImageType())
3251 );
3252 $this->tpl->parseCurrentBlock();
3253 $cnt += 1;
3254 }
3255
3256 $this->tpl->touchBlock("d_" . $cnt); // indent main div
3257 }
3258
3262 public function insertSubItems()
3263 {
3264 foreach ($this->sub_item_html as $sub_html) {
3265 $this->tpl->setCurrentBlock("subitem");
3266 $this->tpl->setVariable("SUBITEM", $sub_html);
3267 $this->tpl->parseCurrentBlock();
3268 }
3269 }
3270
3274 public function insertPositionField()
3275 {
3276 if ($this->position_enabled) {
3277 $this->tpl->setCurrentBlock("position");
3278 $this->tpl->setVariable("POS_ID", $this->position_field_index);
3279 $this->tpl->setVariable("POS_VAL", $this->position_value);
3280 $this->tpl->parseCurrentBlock();
3281 }
3282 }
3283
3288 public function adminCommandsIncluded()
3289 {
3290 return $this->adm_commands_included;
3291 }
3292
3296 public function storeAccessCache()
3297 {
3299 if ($this->acache->getLastAccessStatus() == "miss" &&
3300 !$this->prevent_access_caching) {
3301 $this->acache->storeEntry(
3302 $ilUser->getId() . ":" . $this->ref_id,
3303 serialize($this->access_cache),
3304 $this->ref_id
3305 );
3306 }
3307 }
3308
3323 public function getListItemHTML(
3324 $a_ref_id,
3325 $a_obj_id,
3326 $a_title,
3327 $a_description,
3328 $a_use_asynch = false,
3329 $a_get_asynch_commands = false,
3330 $a_asynch_url = ""
3331 ) {
3333
3334 // this variable stores wheter any admin commands
3335 // are included in the output
3336 $this->adm_commands_included = false;
3337
3338 // only for permformance exploration
3339 $type = ilObject::_lookupType($a_obj_id);
3340
3341 // initialization
3342 $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
3343
3344 // prepare ajax calls
3345 include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
3346 if ($this->context == self::CONTEXT_REPOSITORY) {
3348 } else {
3350 }
3351 $this->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash($node_type, $a_ref_id, $type, $a_obj_id));
3352
3353 if ($a_use_asynch && $a_get_asynch_commands) {
3354 return $this->insertCommands(true, true);
3355 }
3356
3357 if ($this->rating_enabled) {
3358 if (ilRating::hasRatingInListGUI($this->obj_id, $this->type)) {
3359 $may_rate = $this->checkCommandAccess("read", "", $this->ref_id, $this->type);
3360
3361 $rating = new ilRatingGUI();
3362 $rating->setObject($this->obj_id, $this->type);
3363 /* $this->addCustomProperty(
3364 $this->lng->txt("rating_average_rating"),
3365 $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id),
3366 false,
3367 true
3368 );*/
3369 $this->addCustomProperty(
3370 "",
3371 $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id),
3372 false,
3373 true
3374 );
3375 }
3376 }
3377
3378 // read from cache
3379 include_once("Services/Object/classes/class.ilListItemAccessCache.php");
3380 $this->acache = new ilListItemAccessCache();
3381 $cres = $this->acache->getEntry($ilUser->getId() . ":" . $a_ref_id);
3382 if ($this->acache->getLastAccessStatus() == "hit") {
3383 $this->access_cache = unserialize($cres);
3384 } else {
3385 // write to cache
3386 $this->storeAccessCache();
3387 }
3388
3389 // visible check
3390 if (!$this->checkCommandAccess("visible", "", $a_ref_id, "", $a_obj_id)) {
3391 $this->resetCustomData();
3392 return "";
3393 }
3394
3395 // BEGIN WEBDAV
3396 if ($type=='file' and ilObjFileAccess::_isFileHidden($a_title)) {
3397 $this->resetCustomData();
3398 return "";
3399 }
3400 // END WEBDAV
3401
3402
3403 $this->tpl = new ilTemplate(
3404 static::$tpl_file_name,
3405 true,
3406 true,
3407 static::$tpl_component,
3408 "DEFAULT",
3409 false,
3410 true
3411 );
3412
3413 if ($this->getCommandsStatus()) {
3414 if (!$this->getSeparateCommands()) {
3415 $this->tpl->setVariable(
3416 "COMMAND_SELECTION_LIST",
3417 $this->insertCommands($a_use_asynch, $a_get_asynch_commands, $a_asynch_url)
3418 );
3419 }
3420 }
3421
3422 if ($this->getProgressInfoStatus()) {
3423 $this->insertProgressInfo();
3424 }
3425
3426 // insert title and describtion
3427 $this->insertTitle();
3428 if (!$this->isMode(IL_LIST_AS_TRIGGER)) {
3429 if ($this->getDescriptionStatus()) {
3430 $this->insertDescription();
3431 }
3432 }
3433
3434 if ($this->getSearchFragmentStatus()) {
3435 $this->insertSearchFragment();
3436 }
3437 if ($this->enabledRelevance()) {
3438 $this->insertRelevance();
3439 }
3440
3441 // properties
3442 if ($this->getPropertiesStatus()) {
3443 $this->insertProperties();
3444 }
3445
3446 // notice properties
3447 if ($this->getNoticePropertiesStatus()) {
3448 $this->insertNoticeProperties();
3449 }
3450
3451 // preconditions
3452 if ($this->getPreconditionsStatus()) {
3453 $this->insertPreconditions();
3454 }
3455
3456 // path
3457 $this->insertPath();
3458
3459 if ($this->getItemDetailLinkStatus()) {
3460 $this->insertItemDetailLinks();
3461 }
3462
3463 // icons and checkboxes
3464 $this->insertIconsAndCheckboxes();
3465
3466 // input field for position
3467 $this->insertPositionField();
3468
3469 // subitems
3470 $this->insertSubItems();
3471
3472 // file upload
3473 if ($this->isFileUploadAllowed()) {
3474 $this->insertFileUpload();
3475 }
3476
3477 $this->resetCustomData();
3478
3479 $this->tpl->setVariable("DIV_CLASS", 'ilContainerListItemOuter');
3480 $this->tpl->setVariable("DIV_ID", 'id = "' . $this->getUniqueItemId(true) . '"');
3481 $this->tpl->setVariable("ADDITIONAL", $this->getAdditionalInformation());
3482
3483 if (is_object($this->getContainerObject())) {
3484 // #11554 - make sure that internal ids are reset
3485 $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", "");
3486 }
3487
3488 return $this->tpl->get();
3489 }
3490
3494 protected function resetCustomData()
3495 {
3496 // #15747
3497 $this->cust_prop = array();
3498 $this->cust_commands = array();
3499 $this->sub_item_html = array();
3500 $this->position_enabled = false;
3501 }
3502
3508 public function setParentRefId($a_ref_id)
3509 {
3510 $this->parent_ref_id = $a_ref_id;
3511 }
3512
3519 protected function getUniqueItemId($a_as_div = false)
3520 {
3521 // use correct id for references
3522 $id_ref = ($this->reference_ref_id > 0)
3523 ? $this->reference_ref_id
3524 : $this->ref_id;
3525
3526 // add unique identifier for preconditions (objects can appear twice in same container)
3527 if ($this->condition_depth) {
3528 $id_ref .= "_pc" . $this->condition_depth;
3529 }
3530
3531 // unique
3532 $id_ref .= "_pref_" . $this->parent_ref_id;
3533
3534 if (!$a_as_div) {
3535 return $id_ref;
3536 } else {
3537 // action menu [yellow] toggle
3538 return "lg_div_" . $id_ref;
3539 }
3540 }
3541
3545 public function getCommandsHTML()
3546 {
3547 return $this->insertCommands();
3548 }
3549
3553 public function isSideBlock()
3554 {
3555 return false;
3556 }
3557
3563 public function setBoldTitle($a_bold_title)
3564 {
3565 $this->bold_title = $a_bold_title;
3566 }
3567
3573 public function isTitleBold()
3574 {
3575 return $this->bold_title;
3576 }
3577
3584 public static function preloadCommonProperties($a_obj_ids, $a_context)
3585 {
3586 global $DIC;
3587
3588 $lng = $DIC->language();
3589 $ilSetting = $DIC->settings();
3590 $ilUser = $DIC->user();
3591
3592 if ($a_context == self::CONTEXT_REPOSITORY) {
3593 $active_notes = !$ilSetting->get("disable_notes");
3594 $active_comments = !$ilSetting->get("disable_comments");
3595
3596 if ($active_notes || $active_comments) {
3597 include_once("./Services/Notes/classes/class.ilNote.php");
3598 }
3599
3600 if ($active_comments) {
3601 // needed for action
3602 self::$comments_activation = ilNote::getRepObjActivation($a_obj_ids);
3603 }
3604
3605 // properties are optional
3606 if ($ilSetting->get('comments_tagging_in_lists')) {
3607 if ($active_notes || $active_comments) {
3608 self::$cnt_notes = ilNote::_countNotesAndCommentsMultiple($a_obj_ids, true);
3609
3610 $lng->loadLanguageModule("notes");
3611 }
3612
3613 $tags_set = new ilSetting("tags");
3614 if ($tags_set->get("enable")) {
3615 $all_users = $tags_set->get("enable_all_users");
3616
3617 include_once("./Services/Tagging/classes/class.ilTagging.php");
3618 if (!$ilSetting->get('comments_tagging_in_lists_tags')) {
3619 self::$cnt_tags = ilTagging::_countTags($a_obj_ids, $all_users);
3620 } else {
3621 $tag_user_id = null;
3622 if (!$all_users) {
3623 $tag_user_id = $ilUser->getId();
3624 }
3625 self::$tags = ilTagging::_getListTagsForObjects($a_obj_ids, $tag_user_id);
3626 }
3627
3628 $lng->loadLanguageModule("tagging");
3629 }
3630 }
3631
3632 $lng->loadLanguageModule("rating");
3633 }
3634
3635 self::$preload_done = true;
3636 }
3637
3648 protected function isCommentsActivated($a_type, $a_ref_id, $a_obj_id, $a_header_actions, $a_check_write_access = true)
3649 {
3650 if ($this->comments_enabled) {
3651 if (!$this->comments_settings_enabled) {
3652 return true;
3653 }
3654 if ($a_check_write_access && $this->checkCommandAccess('write', '', $a_ref_id, $a_type)) {
3655 return true;
3656 }
3657 // fallback to single object check if no preloaded data
3658 // only the repository does preloadCommonProperties() yet
3659 if (!$a_header_actions && self::$preload_done) {
3660 if (self::$comments_activation[$a_obj_id][$a_type]) {
3661 return true;
3662 }
3663 } else {
3664 include_once("./Services/Notes/classes/class.ilNote.php");
3665 if (ilNote::commentsActivated($a_obj_id, 0, $a_type)) {
3666 return true;
3667 }
3668 }
3669 }
3670 return false;
3671 }
3672
3680 public function enableTimings($a_status)
3681 {
3682 $this->timings_enabled = (bool) $a_status;
3683 }
3684
3690 public function isFileUploadAllowed()
3691 {
3692 // check if file upload allowed
3693 include_once("./Services/FileUpload/classes/class.ilFileUploadUtil.php");
3694 return ilFileUploadUtil::isUploadAllowed($this->ref_id, $this->type);
3695 }
3696
3700 public function insertFileUpload()
3701 {
3702 include_once("./Services/FileUpload/classes/class.ilFileUploadGUI.php");
3704
3705 $upload = new ilFileUploadGUI($this->getUniqueItemId(true), $this->ref_id);
3706
3707 $this->tpl->setCurrentBlock("fileupload");
3708 $this->tpl->setVariable("FILE_UPLOAD", $upload->getHTML());
3709 $this->tpl->parseCurrentBlock();
3710 }
3711}
sprintf('%.4f', $callTime)
user()
Definition: user.php:4
$location
Definition: buildRTE.php:44
$_GET["client_id"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:5
const IL_LIST_AS_TRIGGER
const IL_LIST_FULL
User interface class for advanced drop-down selection lists.
static buildAjaxHash($a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null)
Build ajax hash.
static translateOperator($a_obj_id, $a_operator)
Translate operator.
static getOptionalConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_obj_type='')
Get optional conditions.
static _checkCondition($a_id, $a_usr_id=0)
checks wether a single condition is fulfilled every trigger object type must implement a static metho...
static calculateRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_target_obj_type='', $a_force_update=false)
calculate number of obligatory items
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
Class ilContainerGUI.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static getInstance()
Get singelton instance.
static initFileUpload()
Initializes the file upload and loads the needed javascripts and styles.
static isUploadAllowed($a_ref_id, $a_type="")
Determines whether files can be uploaded to the object with the specified reference id.
static isActive()
Is folder background download active?
static getObjectListAction($a_ref_id)
Get object list action.
static _getInstance()
Get singleton instance of this class.
static getListGUIStatus($a_obj_id, $a_image_only=false)
Caches (check) access information on list items.
static getInstance()
Get instance.
static getListCommentsJSCall($a_hash, $a_update_code=null)
Get list comments js call.
static initJavascript($a_ajax_url, $a_type=IL_NOTE_PRIVATE, ilTemplate $a_main_tpl=null)
Init javascript.
static getListNotesJSCall($a_hash, $a_update_code=null)
Get list notes js call.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
static _countNotesAndComments($a_rep_obj_id, $a_sub_obj_id=null)
Get all notes related to a specific object.
static _countNotesAndCommentsMultiple($a_rep_obj_ids, $a_no_sub_objs=false)
Get all notes related to multiple objcts.
static getRepObjActivation($a_rep_obj_ids)
Get activation for repository objects.
static _isFileHidden($a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user.
static _lookupUserIsOfflineMode($a_obj_id)
Checks offlineMode and returns false if.
Class ilObjSCORMLearningModule.
static _getCommands()
get commands
Class ilObjectListGUI.
getProperties()
Get item properties.
enableDescription($a_status)
En/disable description.
getAdditionalInformation()
Get additional information.
enabledRelevance()
enabled relevance
getContainerObject()
get container object
setHeaderSubObject($a_type, $a_id)
Set sub object identifier.
getTitle()
getTitle overwritten in class.ilObjLinkResourceList.php
isTitleBold()
@access public
setBoldTitle($a_bold_title)
@access public @params boolean $a_bold_title set the item title bold
addHeaderIconHTML($a_id, $a_html)
getMode()
get output mode
setSearchFragment($a_text)
set search fragment
setMode($a_mode)
set output mode
setConditionTarget($a_ref_id, $a_obj_id, $a_target_type)
getAlertProperties()
get all alert properties
enableLinkedPath($a_status)
Enable linked path.
storeAccessCache()
Store access cache.
modifyTitleLink($a_default_link)
adminCommandsIncluded()
returns whether any admin commands (link, delete, cut) are included in the output
insertTitle()
insert item title
setDetailsLevel($a_level)
Details level Currently used in Search which shows only limited properties of forums Currently used f...
enableDownloadCheckbox($a_ref_id, $a_value)
enableCommands($a_status, $a_std_only=false)
En/disable commands.
setDefaultCommandParameters(array $a_params)
getCommandLink($a_cmd)
Get command link url.
enableRepositoryTransfer($a_value)
Enable copy/move to repository (from personal workspace)
getCommands()
get all current commands for a specific ref id (in the permission context of the current user)
insertRelevance()
insert relevance
insertSubstitutions()
Insert substitutions.
enableProperties($a_status)
En/disable properties.
getIconImageType()
Returns the icon image type.
setSeparateCommands($a_val)
Set separate commands.
insertFileUpload()
Inserts a file upload component.
static prepareJsLinks($a_redraw_url, $a_notes_url, $a_tags_url, $a_tpl=null)
Insert js/ajax links into template.
insertPreconditions()
insert all missing preconditions
isCommentsActivated($a_type, $a_ref_id, $a_obj_id, $a_header_actions, $a_check_write_access=true)
Check comments status against comments settings and context.
enableRelevance($a_status)
enable relevance
parseConditions($toggle_id, $conditions, $obligatory=true)
addCustomCommand($a_link, $a_lang_var, $a_frame="", $onclick="")
add a custom command
isMode($a_mode)
check current output mode
insertPasteCommand()
Insert paste command.
enableLink($a_status)
En/disable link.
getSearchFragmentStatus()
Show hide search result fragments.
enableSubstitutions($a_status)
Enable substitutions.
isSideBlock()
Returns whether current item is a block in a side column or not.
isVisibleOnlyForced()
Force unreadable.
enableCheckbox($a_status)
En/Dis-able checkboxes.
getCommandsHTML()
Get commands HTML (must be called after get list item html)
setConditionDepth($a_depth)
set depth for precondition output (stops at level 5)
__construct($a_context=self::CONTEXT_REPOSITORY)
constructor
getItemDetailLinkStatus()
get item detail link status
resetCustomData()
reset properties and commands
forceVisibleOnly($a_stat)
Force visible access only.
addSubItemHTML($a_html)
Add HTML for subitem (used for sessions)
getCommandFrame($a_cmd)
Get command target frame.
getNoticeProperties()
get notice properties
enableNotes($a_value)
Toogle notes action status.
insertTimingsCommand()
insert edit timings command
insertInfoScreenCommand()
insert info screen command
enableNoticeProperties($a_status)
En/disable notices.
getUniqueItemId($a_as_div=false)
Get unique item identifier (for js-actions)
getCommandImage($a_cmd)
Get command icon image.
setParentRefId($a_ref_id)
Set current parent ref id to enable unique js-ids (sessions, etc.)
enableIcon($a_status)
En/Dis-able icons.
getSearchFragment()
get search fragment
insertSearchFragment()
Insert highlighted search fragment.
insertCutCommand($a_to_repository=false)
insert cut command
createDefaultCommand($command)
Get default command link Overwritten for e.g categories,courses => they return a goto link If search ...
enableSearchFragments($a_status)
En/disable description.
enableCopy($a_status)
En/disable copy.
enableTimings($a_status)
enable timings link
addHeaderIcon($a_id, $a_img, $a_tooltip=null, $a_onclick=null, $a_status_text=null, $a_href=null)
addHeaderGlyph($a_id, $a_glyph, $a_onclick=null)
insertItemDetailLinks()
insert item detail links
static preloadCommonProperties($a_obj_ids, $a_context)
Preload common properties.
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item (is called by getItemHTML())
enablePreconditions($a_status)
En/disable preconditions.
enableTags($a_value)
Toogle tags action status.
getDescription()
getDescription overwritten in class.ilObjLinkResourceList.php
setPositionInputField($a_field_index, $a_position_value)
Set position input field.
getSubstitutionStatus()
Get substitution status.
enableCut($a_status)
En/disable cut.
setRelevance($a_rel)
set relevance
getHeaderAction(ilTemplate $a_main_tpl=null)
Get header action.
enableMultiDownload($a_value)
Toggles whether multiple objects can be downloaded at once or not.
enableExpand($a_status)
En/Dis-able expand/collapse link.
insertProgressInfo()
insert progress info
insertDescription()
insert item description
setDescription($a_description)
enableProgressInfo($a_status)
enable progress info
insertPositionField()
Insert field for positioning.
insertSubscribeCommand()
insert subscribe command
enableSubscribe($a_status)
En/disable subscribe.
appendRepositoryFrameParameter($a_link)
workaround: all links into the repository (from outside) must tell repository to setup the frameset
getCheckboxStatus()
Are checkboxes enabled?
insertLinkCommand()
insert link command
isFileUploadAllowed()
Gets a value indicating whether file uploads to this object are allowed or not.
insertCommonSocialCommands($a_header_actions=false)
Insert common social commands (comments, notes, tagging)
setContainerObject($container_obj)
set the container object (e.g categorygui) Used for link, delete ... commands
enableRating($a_value, $a_text=null, $a_categories=false, array $a_ctrl_path=null)
Toogle rating action status.
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
enableItemDetailLinks($a_status)
enable item detail links E.g Direct links to chapters or pages
modifySAHSlaunch($a_link, $wtarget)
workaround: SAHS in new javavasript-created window or iframe
insertCopyCommand($a_to_repository=false)
Insert copy command.
addCustomProperty( $a_property="", $a_value="", $a_alert=false, $a_newline=false)
add custom property
getCustomProperties($a_prop)
get custom properties
insertSubItems()
Insert subitems.
enableComments($a_value, $a_enable_comments_settings=true)
Toogle comments action status.
getCommandId()
get command id Normally the ref id.
enableInfoScreen($a_info_screen)
En/disable path.
getProgressInfoStatus()
get progress info status
insertIconsAndCheckboxes()
Insert icons and checkboxes.
enablePath($a_path, $a_start_node=null)
En/disable path.
setAdditionalInformation($a_val)
Set additional information.
setItemDetailLinks($a_detail_links, $a_intro_txt='')
set items detail links
getListItemHTML( $a_ref_id, $a_obj_id, $a_title, $a_description, $a_use_asynch=false, $a_get_asynch_commands=false, $a_asynch_url="")
Get all item information (title, commands, description) in HTML.
restrictToGoto($a_value)
Restrict all actions/links to goto.
getDetailsLevel()
Get current details level.
getIconStatus()
Are icons enabled?
getSeparateCommands()
Get separate commands.
insertDeleteCommand()
insert cut command
insertCommands( $a_use_asynch=false, $a_get_asynch_commands=false, $a_asynch_url="", $a_header_actions=false)
insert all commands into html code
getExpandStatus()
Is expand/collapse enabled.
insertProperties()
insert properties
getRelevance()
get relevance
enableDelete($a_status)
En/disable delete.
insertCommand($a_href, $a_text, $a_frame="", $a_img="", $a_cmd="", $a_onclick="")
insert command button
static lookupTxtById($plugin_id, $lang_var)
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _lookupType($a_id, $a_reference=false)
lookup object type
Creates a path for a start and endnode.
static hasPreview($a_obj_id, $a_type="")
Determines whether the object with the specified reference id has a preview.
const RENDER_STATUS_NONE
static lookupRenderStatus($a_obj_id)
Gets the render status for the object with the specified id.
static getInstance()
Factory.
Class ilRatingGUI.
static hasRatingInListGUI($a_obj_id, $a_obj_type)
ILIAS Setting Class.
static initJavascript($a_ajax_url, ilTemplate $a_main_tpl=null)
Init javascript.
static getListTagsJSCall($a_hash, $a_update_code=null)
Get tagging js call.
static getTagsForUserAndObject( $a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_user_id)
Get tags for a user and an object.
static _getListTagsForObjects(array $a_obj_ids, $a_user_id=null)
Get tags for given object ids.
static _countTags($a_obj_ids, $a_all_users=false)
Count all tags for repository objects.
special template class to simplify handling of ITX/PEAR
static addTooltip( $a_el_id, $a_text, $a_container="", $a_my="bottom center", $a_at="top center", $a_use_htmlspecialchars=true)
Adds a tooltip to an HTML element.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Access handler for personal workspace.
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
$tags
Definition: croninfo.php:19
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296
$i
Definition: disco.tpl.php:19
$txt
Definition: error.php:11
$html
Definition: example_001.php:87
if(!array_key_exists('StateId', $_REQUEST)) $id
Interface for GUI classes (PDGUI, LuceneSearchGUI...) that have to handle administration commands (cu...
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
if($format !==null) $name
Definition: metadata.php:146
$info
Definition: index.php:5
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
global $ilSetting
Definition: privfeed.php:17
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
$preview
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:92
$params
Definition: disable.php:11