ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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{
25 const DETAILS_MINIMAL = 10;
26 const DETAILS_SEARCH = 20 ;
27 const DETAILS_ALL = 30;
28
33 const CONTEXT_SEARCH = 6;
34
38
39 var $ctrl;
45 var $cust_prop = array();
46 var $cust_commands = array();
49 var $std_cmd_only = false;
50 var $sub_item_html = array();
53
54 protected $obj_id;
55 protected $ref_id;
56 protected $type;
57 protected $sub_obj_id;
58 protected $sub_obj_type;
59
60 protected $substitutions = null;
61 protected $substitutions_enabled = false;
62
63 protected $icons_enabled = false;
64 protected $checkboxes_enabled = false;
65 protected $position_enabled = false;
66 protected $progress_enabled = false;
67 protected $item_detail_links_enabled = false;
68 protected $item_detail_links = array();
70
71 protected $search_fragments_enabled = false;
72 protected $search_fragment = '';
73 protected $path_linked = false;
74
75 protected $enabled_relevance = false;
76 protected $relevance = 0;
77
78 protected $expand_enabled = false;
79 protected $is_expanded = true;
80 protected $bold_title = false;
81
82 protected $copy_enabled = true;
83
85
86 protected $reference_ref_id = false;
87 protected $separate_commands = false;
88 protected $search_fragment_enabled = false;
89 protected $additional_information = false;
90 protected $static_link_enabled = false;
91
93 protected $shared = false;
94 protected $restrict_to_goto = false;
95
96 protected $comments_enabled = false;
97 protected $comments_settings_enabled = false;
98 protected $notes_enabled = false;
99 protected $tags_enabled = false;
100
101 protected $rating_enabled = false;
102 protected $rating_categories_enabled = false;
103 protected $rating_text = false;
104 protected $rating_ctrl_path = false;
105
106 protected $timings_enabled = true;
107 protected $force_visible_only = false;
108 protected $prevent_duplicate_commands = array();
109 protected $parent_ref_id;
110 protected $context;
111
112 static protected $cnt_notes = array();
113 static protected $cnt_tags = array();
114 static protected $tags = array();
115 static protected $comments_activation = array();
116 static protected $preload_done = false;
117
118 protected $title_link = '';
119 protected $title_link_disabled = false;
120
121 static protected $js_unique_id = 0;
122
123
124 static protected $tpl_file_name = "tpl.container_list_item.html";
125 static protected $tpl_component = "Services/Container";
126
130 protected $ui;
131
136 function __construct($a_context = self::CONTEXT_REPOSITORY)
137 {
138 global $ilias, $DIC;
139
140 $this->ui = $DIC->ui();
141 $this->rbacsystem = $DIC->rbac()->system();
142 $this->ilias = $ilias;
143 $this->ctrl = $DIC->ctrl();
144 $this->lng = $DIC->language();
145 $this->mode = IL_LIST_FULL;
146 $this->path_enabled = false;
147 $this->context = $a_context;
148
149 $this->enableComments(false);
150 $this->enableNotes(false);
151 $this->enableTags(false);
152
153 // unique js-ids
154 $this->setParentRefId((int) $_REQUEST["ref_id"]);
155
156//echo "list";
157 $this->init();
158
159 include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
160 $this->ldap_mapping = ilLDAPRoleGroupMapping::_getInstance();
161
162 $this->lng->loadLanguageModule("obj");
163 }
164
165
172 function setContainerObject($container_obj)
173 {
174 $this->container_obj = $container_obj;
175 }
176
184 public function getContainerObject()
185 {
186 return $this->container_obj;
187 }
188
189
195 function init()
196 {
197 // Create static links for default command (linked title) or not
198 $this->static_link_enabled = true;
199 $this->delete_enabled = true;
200 $this->cut_enabled = true;
201 $this->subscribe_enabled = true;
202 $this->link_enabled = false;
203 $this->copy_enabled = false;
204 $this->progress_enabled = false;
205 $this->notice_properties_enabled = true;
206 $this->info_screen_enabled = false;
207 $this->type = ""; // "cat", "course", ...
208 $this->gui_class_name = ""; // "ilobjcategorygui", "ilobjcoursegui", ...
209
210 // general commands array, e.g.
211 include_once('./Services/Object/classes/class.ilObjectAccess.php');
212 $this->commands = ilObjectAccess::_getCommands();
213 }
214
215 // Single get set methods
222 function enableProperties($a_status)
223 {
224 $this->properties_enabled = $a_status;
225
226 return;
227 }
235 {
237 }
244 function enablePreconditions($a_status)
245 {
246 $this->preconditions_enabled = $a_status;
247
248 return;
249 }
250
252 {
254 }
255
262 function enableNoticeProperties($a_status)
263 {
264 $this->notice_properties_enabled = $a_status;
265
266 return;
267 }
275 {
277 }
284 function enableDescription($a_status)
285 {
286 $this->description_enabled = $a_status;
287
288 return;
289 }
297 {
299 }
300
308 {
310 }
311
318 function enableSearchFragments($a_status)
319 {
320 $this->search_fragment_enabled = $a_status;
321
322 return;
323 }
324
330 public function enableLinkedPath($a_status)
331 {
332 $this->path_linked = $a_status;
333 }
334
339 public function enabledRelevance()
340 {
342 }
343
348 public function enableRelevance($a_status)
349 {
350 $this->enabled_relevance = $a_status;
351 }
352
358 public function setRelevance($a_rel)
359 {
360 $this->relevance = $a_rel;
361 }
362
368 public function getRelevance()
369 {
370 return $this->relevance;
371 }
372
378 function enableIcon($a_status)
379 {
380 $this->icons_enabled = $a_status;
381 }
382
388 function getIconStatus()
389 {
391 }
392
398 function enableCheckbox($a_status)
399 {
400 $this->checkboxes_enabled = $a_status;
401 }
402
409 {
411 }
412
418 function enableExpand($a_status)
419 {
420 $this->expand_enabled = $a_status;
421 }
422
429 {
431 }
432
433 function setExpanded($a_status)
434 {
435 $this->is_expanded = $a_status;
436 }
437
438 function isExpanded()
439 {
440 return $this->is_expanded;
441 }
448 function setPositionInputField($a_field_index, $a_position_value)
449 {
450 $this->position_enabled = true;
451 $this->position_field_index = $a_field_index;
452 $this->position_value = $a_position_value;
453 }
454
461 function enableDelete($a_status)
462 {
463 $this->delete_enabled = $a_status;
464
465 return;
466 }
474 {
475 return $this->delete_enabled;
476 }
477
484 function enableCut($a_status)
485 {
486 $this->cut_enabled = $a_status;
487
488 return;
489 }
495 function getCutStatus()
496 {
497 return $this->cut_enabled;
498 }
499
506 function enableCopy($a_status)
507 {
508 $this->copy_enabled = $a_status;
509
510 return;
511 }
517 function getCopyStatus()
518 {
519 return $this->copy_enabled;
520 }
521
528 function enableSubscribe($a_status)
529 {
530 $this->subscribe_enabled = $a_status;
531
532 return;
533 }
540 {
541 return $this->subscribe_enabled;
542 }
543
550 function enableLink($a_status)
551 {
552 $this->link_enabled = $a_status;
553
554 return;
555 }
561 function getLinkStatus()
562 {
563 return $this->link_enabled;
564 }
565
573 function enablePath($a_path, $a_start_node = null)
574 {
575 $this->path_enabled = $a_path;
576 $this->path_start_node = (int)$a_start_node;
577 }
578
584 function getPathStatus()
585 {
586 return $this->path_enabled;
587 }
588
595 function enableCommands($a_status, $a_std_only = false)
596 {
597 $this->commands_enabled = $a_status;
598 $this->std_cmd_only = $a_std_only;
599 }
606 {
608 }
609
616 function enableInfoScreen($a_info_screen)
617 {
618 $this->info_screen_enabled = $a_info_screen;
619 }
620
626 function addSubItemHTML($a_html)
627 {
628 $this->sub_item_html[] = $a_html;
629 }
630
637 {
639 }
640
648 public function enableProgressInfo($a_status)
649 {
650 $this->progress_enabled = $a_status;
651 }
652
660 public function getProgressInfoStatus()
661 {
663 }
664
672 public function enableSubstitutions($a_status)
673 {
674 $this->substitutions_enabled = $a_status;
675 }
676
683 public function getSubstitutionStatus()
684 {
686 }
687
696 public function enableItemDetailLinks($a_status)
697 {
698 $this->item_detail_links_enabled = $a_status;
699 }
700
707 public function getItemDetailLinkStatus()
708 {
710 }
711
719 public function setItemDetailLinks($a_detail_links,$a_intro_txt = '')
720 {
721 $this->item_detail_links = $a_detail_links;
722 $this->item_detail_links_intro = $a_intro_txt;
723 }
724
732 public function insertItemDetailLinks()
733 {
734 if(!count($this->item_detail_links))
735 {
736 return true;
737 }
738 if(strlen($this->item_detail_links_intro))
739 {
740 $this->tpl->setCurrentBlock('item_detail_intro');
741 $this->tpl->setVariable('ITEM_DETAIL_INTRO_TXT',$this->item_detail_links_intro);
742 $this->tpl->parseCurrentBlock();
743 }
744
745 foreach($this->item_detail_links as $info)
746 {
747 $this->tpl->setCurrentBlock('item_detail_link');
748 $this->tpl->setVariable('ITEM_DETAIL_LINK_TARGET',$info['target']);
749 $this->tpl->setVariable('ITEM_DETAIL_LINK_DESC',$info['desc']);
750 $this->tpl->setVariable('ITEM_DETAIL_LINK_HREF',$info['link']);
751 $this->tpl->setVariable('ITEM_DETAIL_LINK_NAME',$info['name']);
752 $this->tpl->parseCurrentBlock();
753 }
754 $this->tpl->setCurrentBlock('item_detail_links');
755 $this->tpl->parseCurrentBlock();
756 }
757
758
759
764 function setTitle($a_title)
765 {
766 $this->title = $a_title;
767 }
768
774 function getTitle()
775 {
776 return $this->title;
777 }
778
783 function setDescription($a_description)
784 {
785 $this->description = $a_description;
786 }
787
793 function getDescription()
794 {
795 return $this->description;
796 }
797
803 public function setSearchFragment($a_text)
804 {
805 $this->search_fragment = $a_text;
806 }
807
812 public function getSearchFragment()
813 {
815 }
816
822 function setSeparateCommands($a_val)
823 {
824 $this->separate_commands = $a_val;
825 }
826
833 {
835 }
845 public function getCommandId()
846 {
847 return $this->ref_id;
848 }
849
856 {
857 $this->additional_information = $a_val;
858 }
859
866 {
868 }
869
877 public function setDetailsLevel($a_level)
878 {
879 $this->details_level = $a_level;
880 }
881
886 public function getDetailsLevel()
887 {
889 }
890
896 public function enableRepositoryTransfer($a_value)
897 {
898 $this->repository_transfer_enabled = (bool)$a_value;
899 }
900
906 public function restrictToGoto($a_value)
907 {
908 $this->restrict_to_goto = (bool)$a_value;
909 }
910
916 public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id="")
917 {
918 global $ilAccess;
919
920 // e.g: subitems should not be readable since their parent sesssion is readonly.
921 if($a_permission != 'visible' and $this->isVisibleOnlyForced())
922 {
923 return false;
924 }
925
926 $cache_prefix = null;
927 if($this->context == self::CONTEXT_WORKSPACE || $this->context == self::CONTEXT_WORKSPACE_SHARING)
928 {
929 $cache_prefix = "wsp";
930 if(!$this->ws_access)
931 {
932 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
933 $this->ws_access = new ilWorkspaceAccessHandler();
934 }
935 }
936
937 if (isset($this->access_cache[$a_permission]["-".$a_cmd][$cache_prefix.$a_ref_id]))
938 {
939 return $this->access_cache[$a_permission]["-".$a_cmd][$cache_prefix.$a_ref_id];
940 }
941
942 if($this->context == self::CONTEXT_REPOSITORY)
943 {
944 $access = $ilAccess->checkAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id);
945 if ($ilAccess->getPreventCachingLastResult())
946 {
947 $this->prevent_access_caching = true;
948 }
949 }
950 else
951 {
952 $access = $this->ws_access->checkAccess($a_permission,$a_cmd,$a_ref_id,$a_type);
953 }
954
955 $this->access_cache[$a_permission]["-".$a_cmd][$cache_prefix.$a_ref_id] = $access;
956 return $access;
957 }
958
968 function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
969 {
970 $this->offline_mode = false;
971 if ($this->type == "sahs") {
972 include_once('Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php');
973 $this->offline_mode = ilObjSAHSLearningModuleAccess::_lookupUserIsOfflineMode($a_obj_id);
974 }
975 $this->access_cache = array();
976 $this->ref_id = $a_ref_id;
977 $this->obj_id = $a_obj_id;
978 $this->setTitle($a_title);
979 $this->setDescription($a_description);
980 #$this->description = $a_description;
981
982 // checks, whether any admin commands are included in the output
983 $this->adm_commands_included = false;
984 $this->prevent_access_caching = false;
985
986 }
987
988 public function setConditionTarget($a_ref_id, $a_obj_id, $a_target_type)
989 {
990 $this->condition_target = array(
991 'ref_id' => $a_ref_id,
992 'obj_id' => $a_obj_id,
993 'target_type' => $a_target_type
994 );
995 }
996
997 public function resetConditionTarget()
998 {
999 $this->condition_target = array();
1000 }
1001
1002 public function disableTitleLink($a_status)
1003 {
1004 $this->title_link_disabled = $a_status;
1005 }
1006 // end-patch lok
1007
1008 public function setDefaultCommandParameters(array $a_params)
1009 {
1010 $this->default_command_params = $a_params;
1011 }
1012
1022 public function createDefaultCommand($command)
1023 {
1024 // begin-patch lok
1025 if($this->static_link_enabled and !$this->default_command_params)
1026 {
1027 include_once('./Services/Link/classes/class.ilLink.php');
1028 if($link = ilLink::_getStaticLink($this->ref_id,$this->type,false))
1029 {
1030 $command['link'] = $link;
1031 $command['frame'] = '_top';
1032 }
1033 }
1034 if($this->default_command_params)
1035 {
1036 $params = array();
1037 foreach($this->default_command_params as $name => $value)
1038 {
1039 $params[] = $name.'='.$value;
1040 }
1041 $params = implode('&', $params);
1042
1043 // #12370
1044 if(!stristr($command['link'], '?'))
1045 {
1046 $command['link'] .= '?'.$params;
1047 }
1048 else
1049 {
1050 $command['link'] .= '&'.$params;
1051 }
1052 }
1053 return $command;
1054 }
1055
1068 function getCommandLink($a_cmd)
1069 {
1070 if($this->context == self::CONTEXT_REPOSITORY)
1071 {
1072 // BEGIN WebDAV Get mount webfolder link.
1073 require_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1074 if ($a_cmd == 'mount_webfolder' && ilDAVActivationChecker::_isActive())
1075 {
1076 require_once ('Services/WebDAV/classes/class.ilDAVServer.php');
1077 $davServer = ilDAVServer::getInstance();
1078
1079 // XXX: The following is a very dirty, ugly trick.
1080 // To mount URI needs to be put into two attributes:
1081 // href and folder. This hack returns both attributes
1082 // like this: http://...mount_uri..." folder="http://...folder_uri...
1083 return $davServer->getMountURI($this->ref_id).
1084 '" folder="'.$davServer->getFolderURI($this->ref_id);
1085 }
1086 // END WebDAV Get mount webfolder link.
1087
1088 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
1089 $cmd_link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
1090 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
1091 return $cmd_link;
1092
1093 /* separate method for this line
1094 $cmd_link = $this->ctrl->getLinkTargetByClass($this->gui_class_name,
1095 $a_cmd);
1096 return $cmd_link;
1097 */
1098 }
1099 else
1100 {
1101 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", "");
1102 $this->ctrl->setParameterByClass($this->gui_class_name, "wsp_id", $this->ref_id);
1103 return $this->ctrl->getLinkTargetByClass($this->gui_class_name, $a_cmd);
1104 }
1105 }
1106
1107
1117 function getCommandFrame($a_cmd)
1118 {
1119 // BEGIN WebDAV Get mount webfolder link.
1120 require_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1121 if ($a_cmd == 'mount_webfolder' && ilDAVActivationChecker::_isActive())
1122 {
1123 return '_blank';
1124 }
1125 // begin-patch fm
1126 if($a_cmd == 'fileManagerLaunch')
1127 {
1128 return '_blank';
1129 }
1130 // end-patch fm
1131 return "";
1132 }
1133
1143 function getCommandImage($a_cmd)
1144 {
1145 return "";
1146 }
1147
1159 public function getProperties()
1160 {
1161 global $objDefinition;
1162
1163 $props = array();
1164 // please list alert properties first
1165 // example (use $lng->txt instead of "Status"/"Offline" strings):
1166 // $props[] = array("alert" => true, "property" => "Status", "value" => "Offline");
1167 // $props[] = array("alert" => false, "property" => ..., "value" => ...);
1168 // ...
1169
1170 // #8280: WebDav is only supported in repository
1171 if($this->context == self::CONTEXT_REPOSITORY)
1172 {
1173 // BEGIN WebDAV Display locking information
1174 require_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1176 {
1177 require_once ('Services/WebDAV/classes/class.ilDAVServer.php');
1178 global $ilias, $lng;
1179
1180 // Show lock info
1181 require_once('Services/WebDAV/classes/class.ilDAVLocks.php');
1182 $davLocks = new ilDAVLocks();
1183 if ($ilias->account->getId() != ANONYMOUS_USER_ID)
1184 {
1185 $locks =& $davLocks->getLocksOnObjectObj($this->obj_id);
1186 if (count($locks) > 0)
1187 {
1188 $lockUser = new ilObjUser($locks[0]['ilias_owner']);
1189
1190 $props[] = array(
1191 "alert" => false,
1192 "property" => $lng->txt("in_use_by"),
1193 "value" => $lockUser->getLogin(),
1194 "link" => "./ilias.php?user=".$locks[0]['ilias_owner'].'&cmd=showUserProfile&cmdClass=ilpersonaldesktopgui&cmdNode=1&baseClass=ilPersonalDesktopGUI',
1195 );
1196 }
1197 }
1198 // END WebDAV Display locking information
1199
1200 if($this->getDetailsLevel() == self::DETAILS_SEARCH)
1201 {
1202 return $props;
1203 }
1204
1205 // BEGIN WebDAV Display warning for invisible Unix files and files with special characters
1206 if (preg_match('/^(\\.|\\.\\.)$/', $this->title))
1207 {
1208 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1209 "value" => $lng->txt("filename_special_filename"),
1210 'propertyNameVisible' => false);
1211 }
1212 else if (preg_match('/^\\./', $this->title))
1213 {
1214 $props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"),
1215 "value" => $lng->txt("filename_hidden_unix_file"),
1216 'propertyNameVisible' => false);
1217 }
1218 else if (preg_match('/~$/', $this->title))
1219 {
1220 $props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"),
1221 "value" => $lng->txt("filename_hidden_backup_file"),
1222 'propertyNameVisible' => false);
1223 }
1224 else if (preg_match('/[\\/]/', $this->title))
1225 {
1226 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1227 "value" => $lng->txt("filename_special_characters"),
1228 'propertyNameVisible' => false);
1229 }
1230 else if (preg_match('/[\\\\\\/:*?"<>|]/', $this->title))
1231 {
1232 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1233 "value" => $lng->txt("filename_windows_special_characters"),
1234 'propertyNameVisible' => false);
1235 }
1236 else if (preg_match('/\\.$/', $this->title))
1237 {
1238 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1239 "value" => $lng->txt("filename_windows_empty_extension"),
1240 'propertyNameVisible' => false);
1241 }
1242 else if (preg_match('/^(\\.|\\.\\.)$/', $this->title))
1243 {
1244 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1245 "value" => $lng->txt("filename_special_filename"),
1246 'propertyNameVisible' => false);
1247 }
1248 else if (preg_match('/#/', $this->title))
1249 {
1250 $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1251 "value" => $lng->txt("filename_windows_webdav_issue"),
1252 'propertyNameVisible' => false);
1253 }
1254 }
1255 // END WebDAV Display warning for invisible files and files with special characters
1256 }
1257
1258 return $props;
1259 }
1260
1264 function addCustomProperty($a_property = "", $a_value = "",
1265 $a_alert = false, $a_newline = false)
1266 {
1267 $this->cust_prop[] = array("property" => $a_property, "value" => $a_value,
1268 "alert" => $a_alert, "newline" => $a_newline);
1269 }
1270
1274 function getCustomProperties($a_prop)
1275 {
1276 if (is_array($this->cust_prop))
1277 {
1278 foreach($this->cust_prop as $prop)
1279 {
1280 $a_prop[] = $prop;
1281 }
1282 }
1283 return $a_prop;
1284 }
1285
1290 public function getAlertProperties()
1291 {
1292 $alert = array();
1293 foreach((array)$this->getProperties() as $prop)
1294 {
1295 if($prop['alert'] == true)
1296 {
1297 $alert[] = $prop;
1298 }
1299 }
1300 return $alert;
1301 }
1302
1307 {
1308 $this->notice_prop = array();
1309 if($infos = $this->ldap_mapping->getInfoStrings($this->obj_id,true))
1310 {
1311 foreach($infos as $info)
1312 {
1313 $this->notice_prop[] = array('value' => $info);
1314 }
1315 }
1316 return $this->notice_prop ? $this->notice_prop : array();
1317 }
1321 public function addCustomCommand($a_link, $a_lang_var, $a_frame = "", $onclick = "")
1322 {
1323 $this->cust_commands[] =
1324 array("link" => $a_link, "lang_var" => $a_lang_var,
1325 "frame" => $a_frame, "onclick" => $onclick);
1326 }
1327
1332 public function forceVisibleOnly($a_stat)
1333 {
1334 $this->force_visible_only = $a_stat;
1335 }
1336
1341 public function isVisibleOnlyForced()
1342 {
1344 }
1345
1369 public function getCommands()
1370 {
1371 global $ilAccess, $ilBench;
1372
1373 $ref_commands = array();
1374 foreach($this->commands as $command)
1375 {
1376 $permission = $command["permission"];
1377 $cmd = $command["cmd"];
1378 $lang_var = $command["lang_var"];
1379 $txt = "";
1380 $info_object = null;
1381
1382 if (isset($command["txt"]))
1383 {
1384 $txt = $command["txt"];
1385 }
1386
1387 // BEGIN WebDAV: Suppress commands that don't make sense for anonymous users.
1388 // Suppress commands that don't make sense for anonymous users
1389 global $ilias;
1390 if ($ilias->account->getId() == ANONYMOUS_USER_ID &&
1391 $command['enable_anonymous'] == 'false')
1392 {
1393 continue;
1394 }
1395 // END WebDAV: Suppress commands that don't make sense for anonymous users.
1396
1397 // all access checking should be made within $ilAccess and
1398 // the checkAccess of the ilObj...Access classes
1399 $ilBench->start("ilObjectListGUI", "4110_get_commands_check_access");
1400 //$access = $ilAccess->checkAccess($permission, $cmd, $this->ref_id, $this->type);
1401 $access = $this->checkCommandAccess($permission,$cmd,$this->ref_id,$this->type);
1402 $ilBench->stop("ilObjectListGUI", "4110_get_commands_check_access");
1403
1404 if ($access)
1405 {
1406 $cmd_link = $this->getCommandLink($command["cmd"]);
1407 $cmd_frame = $this->getCommandFrame($command["cmd"]);
1408 $cmd_image = $this->getCommandImage($command["cmd"]);
1409 $access_granted = true;
1410 }
1411 else
1412 {
1413 $access_granted = false;
1414 $info_object = $ilAccess->getInfo();
1415 }
1416
1417 if (!isset($command["default"]))
1418 {
1419 $command["default"] = "";
1420 }
1421 $ref_commands[] = array(
1422 "permission" => $permission,
1423 "cmd" => $cmd,
1424 "link" => $cmd_link,
1425 "frame" => $cmd_frame,
1426 "lang_var" => $lang_var,
1427 "txt" => $txt,
1428 "granted" => $access_granted,
1429 "access_info" => $info_object,
1430 "img" => $cmd_image,
1431 "default" => $command["default"]
1432 );
1433 }
1434
1435 return $ref_commands;
1436 }
1437
1438 // BEGIN WebDAV: Visualize object state in its icon.
1446 public function getIconImageType()
1447 {
1448 if ($this->type == "sahs" && $this->offline_mode) {
1449 return $this->type . "_offline";
1450 }
1451 return $this->type;
1452 }
1453 // END WebDAV: Visualize object state in its icon.
1454
1462 public function insertTitle()
1463 {
1464 if($this->restrict_to_goto)
1465 {
1466 $this->default_command = array("frame" => "",
1467 "link" => $this->buildGotoLink());
1468 }
1469 // begin-patch lok
1470 if (
1471 !$this->default_command ||
1472 (!$this->getCommandsStatus() && !$this->restrict_to_goto) ||
1473 $this->title_link_disabled
1474 )
1475 // end-patch lok
1476 {
1477 $this->tpl->setCurrentBlock("item_title");
1478 $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
1479 $this->tpl->parseCurrentBlock();
1480 }
1481 else
1482 {
1483 $this->default_command['link'] = $this->modifyTitleLink($this->default_command['link']);
1484
1485 $this->default_command["link"] =
1486 $this->modifySAHSlaunch($this->default_command["link"],$this->default_command["frame"]);
1487
1488 if ($this->default_command["frame"] != "")
1489 {
1490 $this->tpl->setCurrentBlock("title_linked_frame");
1491 $this->tpl->setVariable("TARGET_TITLE_LINKED", $this->default_command["frame"]);
1492 $this->tpl->parseCurrentBlock();
1493 }
1494
1495 // workaround for repository frameset
1496 #var_dump("<pre>",$this->default_command['link'],"</pre>");
1497 $this->default_command["link"] =
1498 $this->appendRepositoryFrameParameter($this->default_command["link"]);
1499
1500 #var_dump("<pre>",$this->default_command['link'],"</pre>");
1501
1502
1503 // the default command is linked with the title
1504 $this->tpl->setCurrentBlock("item_title_linked");
1505 $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
1506 $this->tpl->setVariable("HREF_TITLE_LINKED", $this->default_command["link"]);
1507
1508 // has preview?
1509 include_once("./Services/Preview/classes/class.ilPreview.php");
1510 if (ilPreview::hasPreview($this->obj_id, $this->type))
1511 {
1512 include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
1513
1514 // get context for access checks later on
1515 $access_handler = null;
1516 $context;
1517 switch ($this->context)
1518 {
1522 include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php");
1523 $access_handler = new ilWorkspaceAccessHandler();
1524 break;
1525
1526 default:
1527 global $ilAccess;
1529 $access_handler = $ilAccess;
1530 break;
1531 }
1532
1533 $preview = new ilPreviewGUI($this->ref_id, $context, $this->obj_id, $access_handler);
1534 $preview_status = ilPreview::lookupRenderStatus($this->obj_id);
1535 $preview_status_class = "";
1536 $preview_text_topic = "preview_show";
1537 if ($preview_status == ilPreview::RENDER_STATUS_NONE)
1538 {
1539 $preview_status_class = "ilPreviewStatusNone";
1540 $preview_text_topic = "preview_none";
1541 }
1542 $this->tpl->setCurrentBlock("item_title_linked");
1543 $this->tpl->setVariable("PREVIEW_STATUS_CLASS", $preview_status_class);
1544 $this->tpl->setVariable("SRC_PREVIEW_ICON", ilUtil::getImagePath("preview.png", "Services/Preview"));
1545 $this->tpl->setVariable("TXT_PREVIEW", $this->lng->txt($preview_text_topic));
1546 $this->tpl->setVariable("SCRIPT_PREVIEW_CLICK", $preview->getJSCall($this->getUniqueItemId(true)));
1547 $this->tpl->parseCurrentBlock();
1548 }
1549
1550 $this->tpl->parseCurrentBlock();
1551 }
1552
1553 if ($this->bold_title == true)
1554 {
1555 $this->tpl->touchBlock('bold_title_start');
1556 $this->tpl->touchBlock('bold_title_end');
1557 }
1558 }
1559
1560 protected function buildGotoLink()
1561 {
1562 switch($this->context)
1563 {
1565 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
1566 return ilWorkspaceAccessHandler::getGotoLink($this->ref_id, $this->obj_id);
1567
1568 default:
1569 // not implemented yet
1570 break;
1571 }
1572 }
1573
1580 public function insertSubstitutions()
1581 {
1582 $fields_shown = false;
1583 foreach($this->substitutions->getParsedSubstitutions($this->ref_id,$this->obj_id) as $data)
1584 {
1585 if($data['bold'])
1586 {
1587 $data['name'] = '<strong>'.$data['name'].'</strong>';
1588 $data['value'] = '<strong>'.$data['value'].'</strong>';
1589 }
1590 $this->tpl->touchBlock("std_prop");
1591 $this->tpl->setCurrentBlock('item_property');
1592 if($data['show_field'])
1593 {
1594 $this->tpl->setVariable('TXT_PROP',$data['name']);
1595 }
1596 $this->tpl->setVariable('VAL_PROP',$data['value']);
1597 $this->tpl->parseCurrentBlock();
1598
1599 if($data['newline'])
1600 {
1601 $this->tpl->touchBlock('newline_prop');
1602 }
1603 $fields_shown = false;
1604
1605 }
1606 if($fields_shown)
1607 {
1608 $this->tpl->touchBlock('newline_prop');
1609 }
1610 }
1611
1612
1621 {
1622 if($this->getSubstitutionStatus())
1623 {
1624 $this->insertSubstitutions();
1625 if(!$this->substitutions->isDescriptionEnabled())
1626 {
1627 return true;
1628 }
1629 }
1630
1631 // see bug #16519
1632 $d = $this->getDescription();
1633 $d = strip_tags($d, "<b>");
1634 $this->tpl->setCurrentBlock("item_description");
1635 $this->tpl->setVariable("TXT_DESC", $d);
1636 $this->tpl->parseCurrentBlock();
1637 }
1638
1643 public function insertSearchFragment()
1644 {
1645 if(strlen($this->getSearchFragment()))
1646 {
1647 $this->tpl->setCurrentBlock('search_fragment');
1648 $this->tpl->setVariable('TXT_SEARCH_FRAGMENT',$this->getSearchFragment().' ...');
1649 $this->tpl->parseCurrentBlock();
1650 }
1651 }
1652
1658 public function insertRelevance()
1659 {
1660 global $lng;
1661
1662 if(!$this->enabledRelevance() or !(int) $this->getRelevance())
1663 {
1664 return false;
1665 }
1666
1667 include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php";
1669 $pbar->setCurrent($this->getRelevance());
1670
1671 $this->tpl->setCurrentBlock('relevance');
1672 $this->tpl->setVariable('REL_PBAR', $pbar->render());
1673 $this->tpl->parseCurrentBlock();
1674 }
1675
1681 function setMode($a_mode)
1682 {
1683 $this->mode = $a_mode;
1684 }
1685
1691 function getMode()
1692 {
1693 return $this->mode;
1694 }
1695
1699 function setConditionDepth($a_depth)
1700 {
1701 $this->condition_depth = $a_depth;
1702 }
1703
1711 function isMode($a_mode)
1712 {
1713 if ($a_mode == $this->mode)
1714 {
1715 return true;
1716 }
1717 else
1718 {
1719 return false;
1720 }
1721 }
1722
1729 {
1730 global $ilAccess, $lng, $ilUser;
1731
1732 $props = $this->getProperties();
1733 $props = $this->getCustomProperties($props);
1734
1735 if($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING)
1736 {
1737 // add learning progress custom property
1738 include_once "Services/Tracking/classes/class.ilLPStatus.php";
1739 $lp = ilLPStatus::getListGUIStatus($this->obj_id);
1740 if($lp)
1741 {
1742 $props[] = array("alert" => false,
1743 "property" => $lng->txt("learning_progress"),
1744 "value" => $lp,
1745 "newline" => true);
1746 }
1747
1748 // add no item access note in public section
1749 // for items that are visible but not readable
1750 if ($this->ilias->account->getId() == ANONYMOUS_USER_ID)
1751 {
1752 if (!$ilAccess->checkAccess("read", "", $this->ref_id, $this->type, $this->obj_id))
1753 {
1754 $props[] = array("alert" => true,
1755 "value" => $lng->txt("no_access_item_public"),
1756 "newline" => true);
1757 }
1758 }
1759 }
1760
1761 // reference objects have translated ids, revert to originals
1762 $note_ref_id = $this->ref_id;
1763 $note_obj_id = $this->obj_id;
1764 if($this->reference_ref_id)
1765 {
1766 $note_ref_id = $this->reference_ref_id;
1767 $note_obj_id = $this->reference_obj_id;
1768 }
1769
1770 $redraw_js = "il.Object.redrawListItem(".$note_ref_id.");";
1771
1772 // add common properties (comments, notes, tags)
1773 if ((self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] > 0 ||
1774 self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] > 0 ||
1775 self::$cnt_tags[$note_obj_id] > 0 ||
1776 is_array(self::$tags[$note_obj_id])) &&
1777 ($ilUser->getId() != ANONYMOUS_USER_ID))
1778 {
1779 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
1780 include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
1781
1782 $nl = true;
1783 if ($this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, false, false)
1784 && self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] > 0)
1785 {
1786 $props[] = array("alert" => false,
1787 "property" => $lng->txt("notes_comments"),
1788 "value" => "<a href='#' onclick=\"return ".
1789 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js)."\">".
1790 self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC]."</a>",
1791 "newline" => $nl);
1792 $nl = false;
1793 }
1794
1795 if ($this->notes_enabled && self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] > 0)
1796 {
1797 $props[] = array("alert" => false,
1798 "property" => $lng->txt("notes"),
1799 "value" => "<a href='#' onclick=\"return ".
1800 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js)."\">".
1801 self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE]."</a>",
1802 "newline" => $nl);
1803 $nl = false;
1804 }
1805 if ($this->tags_enabled &&
1806 (self::$cnt_tags[$note_obj_id] > 0 ||
1807 is_array(self::$tags[$note_obj_id])))
1808 {
1809 $tags_set = new ilSetting("tags");
1810 if ($tags_set->get("enable"))
1811 {
1812 $tags_url = ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js);
1813
1814 // list object tags
1815 if(is_array(self::$tags[$note_obj_id]))
1816 {
1817 $tags_tmp = array();
1818 foreach(self::$tags[$note_obj_id] as $tag => $is_tag_owner)
1819 {
1820 if($is_tag_owner)
1821 {
1822 $tags_tmp[] = "<a class=\"ilTag ilTagRelHigh\" href='#' onclick=\"return ".
1823 $tags_url."\">".$tag."</a>";
1824 }
1825 else
1826 {
1827 $tags_tmp[] = "<span class=\"ilTag ilTagRelMiddle\">".$tag."</span>";
1828 }
1829 }
1830 $tags_value = implode(" ", $tags_tmp);
1831 $nl = true;
1832 $prop_text = "";
1833 }
1834 // tags counter
1835 else
1836 {
1837 $tags_value = "<a href='#' onclick=\"return ".$tags_url."\">".
1838 self::$cnt_tags[$note_obj_id]."</a>";
1839 $prop_text = $lng->txt("tagging_tags");
1840 }
1841 $props[] = array("alert" => false,
1842 "property" => $prop_text,
1843 "value" => $tags_value,
1844 "newline" => $nl);
1845 $nl = false;
1846 }
1847 }
1848 }
1849
1850 $cnt = 1;
1851 if (is_array($props) && count($props) > 0)
1852 {
1853 foreach($props as $prop)
1854 {
1855 // BEGIN WebDAV: Display a separator between properties.
1856 if ($cnt > 1)
1857 {
1858 $this->tpl->touchBlock("separator_prop");
1859 }
1860 // END WebDAV: Display a separator between properties.
1861
1862 if ($prop["alert"] == true)
1863 {
1864 $this->tpl->touchBlock("alert_prop");
1865 }
1866 else
1867 {
1868 $this->tpl->touchBlock("std_prop");
1869 }
1870 if ($prop["newline"] == true && $cnt > 1)
1871 {
1872 $this->tpl->touchBlock("newline_prop");
1873 }
1874 //BEGIN WebDAV: Support hidden property names.
1875 if (isset($prop["property"]) && $prop['propertyNameVisible'] !== false && $prop["property"] != "")
1876 //END WebDAV: Support hidden property names.
1877 {
1878 $this->tpl->setCurrentBlock("prop_name");
1879 $this->tpl->setVariable("TXT_PROP", $prop["property"]);
1880 $this->tpl->parseCurrentBlock();
1881 }
1882 $this->tpl->setCurrentBlock("item_property");
1883 //BEGIN WebDAV: Support links in property values.
1884 if ($prop['link'])
1885 {
1886 $this->tpl->setVariable("LINK_PROP", $prop['link']);
1887 $this->tpl->setVariable("LINK_VAL_PROP", $prop["value"]);
1888 }
1889 else
1890 {
1891 $this->tpl->setVariable("VAL_PROP", $prop["value"]);
1892 }
1893 //END WebDAV: Support links in property values.
1894 $this->tpl->parseCurrentBlock();
1895
1896 $cnt++;
1897 }
1898 $this->tpl->setCurrentBlock("item_properties");
1899 $this->tpl->parseCurrentBlock();
1900 }
1901 }
1902
1904 {
1905 $this->getNoticeProperties();
1906 foreach($this->notice_prop as $property)
1907 {
1908 $this->tpl->setCurrentBlock('notice_item');
1909 $this->tpl->setVariable('NOTICE_ITEM_VALUE',$property['value']);
1910 $this->tpl->parseCurrentBlock();
1911 }
1912 $this->tpl->setCurrentBlock('notice_property');
1913 $this->tpl->parseCurrentBlock();
1914 }
1915
1916 protected function parseConditions($toggle_id,$conditions,$obligatory = true)
1917 {
1918 global $ilAccess, $lng, $objDefinition,$tree;
1919
1920 $num_required = ilConditionHandler::calculateRequiredTriggers($this->ref_id, $this->obj_id);
1921 $num_optional_required =
1922 $num_required - count($conditions) + count(ilConditionHandler::getOptionalConditionsOfTarget($this->ref_id, $this->obj_id));
1923
1924 // Check if all conditions are fullfilled
1925 $visible_conditions = array();
1926 $passed_optional = 0;
1927 foreach($conditions as $condition)
1928 {
1929 if($obligatory and !$condition['obligatory'])
1930 {
1931 continue;
1932 }
1933 if(!$obligatory and $condition['obligatory'])
1934 {
1935 continue;
1936 }
1937
1938 if($tree->isDeleted($condition['trigger_ref_id']))
1939 {
1940 continue;
1941 }
1942
1943 include_once 'Services/Container/classes/class.ilMemberViewSettings.php';
1944 $ok = ilConditionHandler::_checkCondition($condition['id']) and
1945 !ilMemberViewSettings::getInstance()->isActive();
1946
1947 if(!$ok)
1948 {
1949 $visible_conditions[] = $condition['id'];
1950 }
1951
1952 if(!$obligatory and $ok)
1953 {
1954 ++$passed_optional;
1955 // optional passed
1956 if($passed_optional >= $num_optional_required)
1957 {
1958 return true;
1959 }
1960 }
1961 }
1962
1963 foreach($conditions as $condition)
1964 {
1965 if(!in_array($condition['id'], $visible_conditions))
1966 {
1967 continue;
1968 }
1969
1970 include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
1971 $cond_txt = ilConditionHandlerGUI::translateOperator($condition['trigger_obj_id'],$condition['operator']).' '.$condition['value'];
1972
1973 // display trigger item
1974 $class = $objDefinition->getClassName($condition["trigger_type"]);
1975 $location = $objDefinition->getLocation($condition["trigger_type"]);
1976 if ($class == "" && $location == "")
1977 {
1978 continue;
1979 }
1980 $missing_cond_exist = true;
1981
1982 $full_class = "ilObj".$class."ListGUI";
1983 include_once($location."/class.".$full_class.".php");
1984 $item_list_gui = new $full_class($this);
1985 $item_list_gui->setMode(IL_LIST_AS_TRIGGER);
1986 $item_list_gui->enablePath(false);
1987 $item_list_gui->enableIcon(true);
1988 $item_list_gui->setConditionDepth($this->condition_depth + 1);
1989 $item_list_gui->setParentRefId($this->getUniqueItemId()); // yes we can
1990 $item_list_gui->addCustomProperty($this->lng->txt("precondition_required_itemlist"), $cond_txt, false, true);
1991
1992 $item_list_gui->enableCommands($this->commands_enabled, $this->std_cmd_only);
1993 $item_list_gui->enableProperties($this->properties_enabled);
1994
1995 $trigger_html = $item_list_gui->getListItemHTML($condition['trigger_ref_id'],
1996 $condition['trigger_obj_id'], ilObject::_lookupTitle($condition["trigger_obj_id"]),
1997 "");
1998 $this->tpl->setCurrentBlock("precondition");
1999 if ($trigger_html == "")
2000 {
2001 $trigger_html = $this->lng->txt("precondition_not_accessible");
2002 }
2003 $this->tpl->setVariable("TXT_CONDITION", trim($cond_txt));
2004 $this->tpl->setVariable("TRIGGER_ITEM", $trigger_html);
2005 $this->tpl->parseCurrentBlock();
2006 }
2007
2008 if ($missing_cond_exist and $obligatory)
2009 {
2010 $this->tpl->setCurrentBlock("preconditions");
2011 $this->tpl->setVariable("CONDITION_TOGGLE_ID", "_obl_".$toggle_id);
2012 $this->tpl->setVariable("TXT_PRECONDITIONS", $lng->txt("preconditions_obligatory_hint"));
2013 $this->tpl->parseCurrentBlock();
2014
2015 }
2016 elseif($missing_cond_exist and !$obligatory)
2017 {
2018 $this->tpl->setCurrentBlock("preconditions");
2019 $this->tpl->setVariable("CONDITION_TOGGLE_ID", "_opt_".$toggle_id);
2020 $this->tpl->setVariable("TXT_PRECONDITIONS", sprintf($lng->txt("preconditions_optional_hint"),$num_optional_required));
2021 $this->tpl->parseCurrentBlock();
2022 }
2023
2024 return !$missing_cond_exist;
2025 }
2026
2031 {
2032 global $ilAccess, $lng, $objDefinition,$tree;
2033
2034 include_once("./Services/AccessControl/classes/class.ilConditionHandler.php");
2035
2036 $missing_cond_exist = false;
2037
2038 // do not show multi level conditions (messes up layout)
2039 if ($this->condition_depth > 0)
2040 {
2041 return;
2042 }
2043
2044 // Sort by title
2045 /*
2046 foreach(ilConditionHandler::_getConditionsOfTarget($this->ref_id, $this->obj_id) as $condition)
2047 {
2048 $condition['title'] = ilObject::_lookupTitle($condition['trigger_obj_id']);
2049 }
2050 */
2051
2052 if($this->condition_target)
2053 {
2055 $this->condition_target['ref_id'],
2056 $this->condition_target['obj_id'],
2057 $this->condition_target['target_type']
2058 );
2059 }
2060 else
2061 {
2062 $conditions = ilConditionHandler::_getConditionsOfTarget($this->ref_id, $this->obj_id);
2063 }
2064
2065 if(sizeof($conditions))
2066 {
2067 for($i = 0; $i < count($conditions); $i++)
2068 {
2069 $conditions[$i]['title'] = ilObject::_lookupTitle($conditions[$i]['trigger_obj_id']);
2070 }
2071 $conditions = ilUtil::sortArray($conditions,'title','DESC');
2072
2074
2075 // Show obligatory and optional preconditions seperated
2076 $all_done_obl = $this->parseConditions(self::$js_unique_id,$conditions,true);
2077 $all_done_opt = $this->parseConditions(self::$js_unique_id,$conditions,false);
2078
2079 if(!$all_done_obl || !$all_done_opt)
2080 {
2081 $this->tpl->setCurrentBlock("preconditions_toggle");
2082 $this->tpl->setVariable("PRECONDITION_TOGGLE_INTRO", $this->lng->txt("precondition_toggle"));
2083 $this->tpl->setVariable("PRECONDITION_TOGGLE_TRIGGER", $this->lng->txt("show"));
2084 $this->tpl->setVariable("PRECONDITION_TOGGLE_ID", self::$js_unique_id);
2085 $this->tpl->setVariable("TXT_PRECONDITION_SHOW", $this->lng->txt("show"));
2086 $this->tpl->setVariable("TXT_PRECONDITION_HIDE", $this->lng->txt("hide"));
2087 $this->tpl->parseCurrentBlock();
2088 }
2089 }
2090 }
2091
2100 function insertCommand($a_href, $a_text, $a_frame = "", $a_img = "", $a_cmd = "", $a_onclick = "")
2101 {
2102 // #11099
2103 $chksum = md5($a_href.$a_text);
2104 if($a_href == "#" ||
2105 !in_array($chksum, $this->prevent_duplicate_commands))
2106 {
2107 if($a_href != "#")
2108 {
2109 $this->prevent_duplicate_commands[] = $chksum;
2110 }
2111
2112 $prevent_background_click = false;
2113 if ($a_cmd == 'mount_webfolder')
2114 {
2115 $prevent_background_click = true;
2116 }
2117
2118 if ($a_cmd == "downloadFolder")
2119 {
2120 include_once "Services/BackgroundTask/classes/class.ilFolderDownloadBackgroundTaskHandler.php";
2122 {
2124 $a_href = "#";
2125 }
2126 }
2127
2128 $this->current_selection_list->addItem($a_text, "", $a_href, $a_img, $a_text, $a_frame,
2129 "", $prevent_background_click, $a_onclick);
2130 }
2131 }
2132
2141 {
2142 if ($this->std_cmd_only)
2143 {
2144 return;
2145 }
2146
2147 if(is_object($this->getContainerObject()) and
2149 {
2150 if($this->checkCommandAccess('delete','',$this->ref_id,$this->type))
2151 {
2152 $this->ctrl->setParameter($this->getContainerObject(),'item_ref_id',$this->getCommandId());
2153 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "delete");
2154 $this->insertCommand($cmd_link, $this->lng->txt("delete"));
2155 $this->adm_commands_included = true;
2156 return true;
2157 }
2158 return false;
2159 }
2160
2161 if($this->checkCommandAccess('delete','',$this->ref_id,$this->type))
2162 {
2163 $this->ctrl->setParameter($this->container_obj, "ref_id",
2164 $this->container_obj->object->getRefId());
2165 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2166 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "delete");
2167 $this->insertCommand($cmd_link, $this->lng->txt("delete"), "",
2168 "");
2169 $this->adm_commands_included = true;
2170 }
2171 }
2172
2181 {
2182 global $objDefinition;
2183
2184 if ($this->std_cmd_only)
2185 {
2186 return;
2187 }
2188
2189 // #17307
2190 if(!$this->checkCommandAccess('delete','',$this->ref_id,$this->type) or
2191 !$objDefinition->allowLink($this->type))
2192 {
2193 return false;
2194 }
2195
2196 // BEGIN PATCH Lucene search
2197
2198 if(is_object($this->getContainerObject()) and
2200 {
2201 $this->ctrl->setParameter($this->getContainerObject(),'item_ref_id',$this->getCommandId());
2202 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "link");
2203 $this->insertCommand($cmd_link, $this->lng->txt("link"));
2204 $this->adm_commands_included = true;
2205 return true;
2206 }
2207 // END PATCH Lucene Search
2208
2209 // if the permission is changed here, it has
2210 // also to be changed in ilContainerGUI, admin command check
2211 $this->ctrl->setParameter($this->container_obj, "ref_id",
2212 $this->container_obj->object->getRefId());
2213 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2214 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "link");
2215 $this->insertCommand($cmd_link, $this->lng->txt("link"), "",
2216 "");
2217 $this->adm_commands_included = true;
2218 return true;
2219 }
2220
2227 function insertCutCommand($a_to_repository = false)
2228 {
2229 global $ilAccess;
2230
2231 if ($this->std_cmd_only)
2232 {
2233 return;
2234 }
2235 // BEGIN PATCH Lucene search
2236 if(is_object($this->getContainerObject()) and
2238 {
2239 if($this->checkCommandAccess('delete','',$this->ref_id,$this->type))
2240 {
2241 $this->ctrl->setParameter($this->getContainerObject(),'item_ref_id',$this->getCommandId());
2242 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "cut");
2243 $this->insertCommand($cmd_link, $this->lng->txt("move"));
2244 $this->adm_commands_included = true;
2245 return true;
2246 }
2247 return false;
2248 }
2249 // END PATCH Lucene Search
2250
2251 // if the permission is changed here, it has
2252 // also to be changed in ilContainerContentGUI, determineAdminCommands
2253 if($this->checkCommandAccess('delete','',$this->ref_id,$this->type) &&
2254 $this->container_obj->object)
2255 {
2256 $this->ctrl->setParameter($this->container_obj, "ref_id",
2257 $this->container_obj->object->getRefId());
2258 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2259
2260 if(!$a_to_repository)
2261 {
2262 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "cut");
2263 $this->insertCommand($cmd_link, $this->lng->txt("move"), "",
2264 "");
2265 }
2266 else
2267 {
2268 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "cut_for_repository");
2269 $this->insertCommand($cmd_link, $this->lng->txt("wsp_move_to_repository"), "",
2270 "");
2271 }
2272
2273 $this->adm_commands_included = true;
2274 }
2275 }
2276
2282 public function insertCopyCommand($a_to_repository = false)
2283 {
2284 global $objDefinition;
2285
2286 if($this->std_cmd_only)
2287 {
2288 return;
2289 }
2290
2291 if($this->checkCommandAccess('copy', 'copy', $this->ref_id, $this->type) &&
2292 $objDefinition->allowCopy($this->type))
2293 {
2294 if($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING)
2295 {
2296 $this->ctrl->setParameterByClass('ilobjectcopygui','source_id',$this->getCommandId());
2297 $cmd_copy = $this->ctrl->getLinkTargetByClass('ilobjectcopygui','initTargetSelection');
2298 $this->insertCommand($cmd_copy, $this->lng->txt('copy'));
2299 }
2300 else
2301 {
2302 $this->ctrl->setParameter($this->container_obj, "ref_id",
2303 $this->container_obj->object->getRefId());
2304 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2305
2306 if(!$a_to_repository)
2307 {
2308 $cmd_copy = $this->ctrl->getLinkTarget($this->container_obj, 'copy');
2309 $this->insertCommand($cmd_copy, $this->lng->txt('copy'));
2310 }
2311 else
2312 {
2313 $cmd_copy = $this->ctrl->getLinkTarget($this->container_obj, 'copy_to_repository');
2314 $this->insertCommand($cmd_copy, $this->lng->txt('wsp_copy_to_repository'));
2315 }
2316 }
2317
2318 $this->adm_commands_included = true;
2319 }
2320 return;
2321 }
2322
2323
2328 {
2329 global $ilAccess, $objDefinition;
2330
2331 if ($this->std_cmd_only)
2332 {
2333 return;
2334 }
2335
2336 if(!$objDefinition->isContainer(ilObject::_lookupType($this->obj_id)))
2337 {
2338 return false;
2339 }
2340
2341 if(is_object($this->getContainerObject()) and
2343 isset($_SESSION['clipboard']))
2344 {
2345 $this->ctrl->setParameter($this->getContainerObject(),'item_ref_id',$this->getCommandId());
2346 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "paste");
2347 $this->insertCommand($cmd_link, $this->lng->txt("paste"));
2348 $this->adm_commands_included = true;
2349 return true;
2350 }
2351 return false;
2352 }
2353
2362 {
2363 global $ilSetting, $ilUser;
2364
2365 if ($this->std_cmd_only)
2366 {
2367 return;
2368 }
2369
2370 if((int)$ilSetting->get('disable_my_offers'))
2371 {
2372 return;
2373 }
2374
2376
2377 if ($ilUser->getId() != ANONYMOUS_USER_ID)
2378 {
2379 // #17467 - add ref_id to link (in repository only!)
2380 if(is_object($this->container_obj) &&
2381 !($this->container_obj instanceof ilAdministrationCommandHandling) &&
2382 is_object($this->container_obj->object))
2383 {
2384 $this->ctrl->setParameter($this->container_obj, "ref_id", $this->container_obj->object->getRefId());
2385 }
2386
2387 if (!$ilUser->isDesktopItem($this->getCommandId(), $type))
2388 {
2389 // Pass type and object ID to ilAccess to improve performance
2390 global $ilAccess;
2391 if ($this->checkCommandAccess("read", "", $this->ref_id, $this->type, $this->obj_id))
2392 {
2393 if($this->getContainerObject() instanceof ilDesktopItemHandling)
2394 {
2395 $this->ctrl->setParameter($this->container_obj, "type", $type);
2396 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2397 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "addToDesk");
2398 $this->insertCommand($cmd_link, $this->lng->txt("to_desktop"), "",
2399 "");
2400 }
2401 }
2402 }
2403 else
2404 {
2405 if ($this->getContainerObject() instanceof ilDesktopItemHandling)
2406 {
2407 $this->ctrl->setParameter($this->container_obj, "type", $type);
2408 $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2409 $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "removeFromDesk");
2410 $this->insertCommand($cmd_link, $this->lng->txt("unsubscribe"), "",
2411 "");
2412 }
2413 }
2414 }
2415 }
2416
2421 {
2422 if ($this->std_cmd_only)
2423 {
2424 return;
2425 }
2426 $cmd_link = $this->getCommandLink("infoScreen");
2427 $cmd_frame = $this->getCommandFrame("infoScreen");
2428 $this->insertCommand($cmd_link, $this->lng->txt("info_short"), $cmd_frame,
2429 ilUtil::getImagePath("icon_info.svg"));
2430 }
2431
2438 function insertCommonSocialCommands($a_header_actions = false)
2439 {
2440 global $ilSetting, $lng, $ilUser, $tpl;
2441
2442 if ($this->std_cmd_only ||
2443 ($ilUser->getId() == ANONYMOUS_USER_ID))
2444 {
2445 return;
2446 }
2447 $lng->loadLanguageModule("notes");
2448 $lng->loadLanguageModule("tagging");
2449 $cmd_link = $this->getCommandLink("infoScreen")."#notes_top";
2450 $cmd_tag_link = $this->getCommandLink("infoScreen");
2451 $cmd_frame = $this->getCommandFrame("infoScreen");
2452 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
2453
2454 // reference objects have translated ids, revert to originals
2455 $note_ref_id = $this->ref_id;
2456 if($this->reference_ref_id)
2457 {
2458 $note_ref_id = $this->reference_ref_id;
2459 }
2460
2461 $js_updater = $a_header_actions
2462 ? "il.Object.redrawActionHeader();"
2463 : "il.Object.redrawListItem(".$note_ref_id.")";
2464
2465 $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, $a_header_actions, true);
2467 {
2468 $this->insertCommand("#", $this->lng->txt("notes_comments"), $cmd_frame,
2469 "", "", ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $js_updater));
2470 }
2471
2472 if($this->notes_enabled)
2473 {
2474 $this->insertCommand("#", $this->lng->txt("notes"), $cmd_frame,
2475 "", "", ilNoteGUI::getListNotesJSCall($this->ajax_hash, $js_updater));
2476 }
2477
2478 if ($this->tags_enabled)
2479 {
2480 include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
2481 //$this->insertCommand($cmd_tag_link, $this->lng->txt("tagging_set_tag"), $cmd_frame);
2482 $this->insertCommand("#", $this->lng->txt("tagging_set_tag"), $cmd_frame,
2483 "", "", ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $js_updater));
2484 }
2485 }
2486
2493 {
2494 if ($this->std_cmd_only || !$this->container_obj->object)
2495 {
2496 return;
2497 }
2498
2499 $parent_ref_id = $this->container_obj->object->getRefId();
2500 $parent_type = $this->container_obj->object->getType();
2501
2502 // #18737
2503 if($this->reference_ref_id)
2504 {
2505 $this->ctrl->setParameterByClass('ilobjectactivationgui', 'ref_id', $this->reference_ref_id);
2506 }
2507
2508 if($this->checkCommandAccess('write','',$parent_ref_id,$parent_type) ||
2509 $this->checkCommandAccess('write','',$this->ref_id,$this->type))
2510 {
2511 $this->ctrl->setParameterByClass('ilobjectactivationgui','cadh',
2512 $this->ajax_hash);
2513 $this->ctrl->setParameterByClass('ilobjectactivationgui','parent_id',
2515 $cmd_lnk = $this->ctrl->getLinkTargetByClass(array($this->gui_class_name, 'ilcommonactiondispatchergui', 'ilobjectactivationgui'),
2516 'edit');
2517
2518 $this->insertCommand($cmd_lnk, $this->lng->txt('obj_activation_list_gui'));
2519 }
2520
2521 if($this->reference_ref_id)
2522 {
2523 $this->ctrl->setParameterByClass('ilobjectactivationgui', 'ref_id', $this->ref_id);
2524 }
2525 }
2526
2534 function insertCommands($a_use_asynch = false, $a_get_asynch_commands = false,
2535 $a_asynch_url = "", $a_header_actions = false)
2536 {
2537 global $lng, $ilUser;
2538
2539 if (!$this->getCommandsStatus())
2540 {
2541 return;
2542 }
2543
2544 include_once("Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2545 $this->current_selection_list = new ilAdvancedSelectionListGUI();
2546 $this->current_selection_list->setAsynch($a_use_asynch && !$a_get_asynch_commands);
2547 $this->current_selection_list->setAsynchUrl($a_asynch_url);
2548 if ($a_header_actions)
2549 {
2550 $this->current_selection_list->setListTitle("<span class='hidden-xs'>".$lng->txt("actions")."</span>");
2551 }
2552 else
2553 {
2554 $this->current_selection_list->setListTitle("");
2555 }
2556 $this->current_selection_list->setId("act_".$this->getUniqueItemId(false));
2557 $this->current_selection_list->setSelectionHeaderClass("small");
2558 $this->current_selection_list->setItemLinkClass("xsmall");
2559 $this->current_selection_list->setLinksMode("il_ContainerItemCommand2");
2560 $this->current_selection_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
2561 $this->current_selection_list->setUseImages(false);
2562 $this->current_selection_list->setAdditionalToggleElement($this->getUniqueItemId(true), "ilContainerListItemOuterHighlight");
2563
2564 $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", $this->ref_id);
2565
2566 // only standard command?
2567 $only_default = false;
2568 if ($a_use_asynch && !$a_get_asynch_commands)
2569 {
2570 $only_default = true;
2571 }
2572
2573 $this->default_command = false;
2574 $this->prevent_duplicate_commands = array();
2575
2576 // we only allow the following commands inside the header actions
2577 $valid_header_commands = array("mount_webfolder");
2578
2579 $commands = $this->getCommands($this->ref_id, $this->obj_id);
2580 foreach($commands as $command)
2581 {
2582 if($a_header_actions && !in_array($command["cmd"], $valid_header_commands))
2583 {
2584 continue;
2585 }
2586
2587 if ($command["granted"] == true )
2588 {
2589 if (!$command["default"] === true)
2590 {
2591 if (!$this->std_cmd_only && !$only_default)
2592 {
2593 // workaround for repository frameset
2594 $command["link"] =
2595 $this->appendRepositoryFrameParameter($command["link"]);
2596
2597 $cmd_link = $command["link"];
2598 $txt = ($command["lang_var"] == "")
2599 ? $command["txt"]
2600 : $this->lng->txt($command["lang_var"]);
2601 $this->insertCommand($cmd_link, $txt,
2602 $command["frame"], $command["img"], $command["cmd"]);
2603 }
2604 }
2605 else
2606 {
2607 $this->default_command = $this->createDefaultCommand($command);
2608 //$this->default_command = $command;
2609 }
2610 }
2611 elseif($command["default"] === true)
2612 {
2613 $items =& $command["access_info"];
2614 foreach ($items as $item)
2615 {
2616 if ($item["type"] == IL_NO_LICENSE)
2617 {
2618 $this->addCustomProperty($this->lng->txt("license"),$item["text"],true);
2619 $this->enableProperties(true);
2620 break;
2621 }
2622 }
2623 }
2624 }
2625
2626 if (!$only_default)
2627 {
2628 // custom commands
2629 if (is_array($this->cust_commands))
2630 {
2631 foreach ($this->cust_commands as $command)
2632 {
2633 $this->insertCommand($command["link"], $this->lng->txt($command["lang_var"]),
2634 $command["frame"], "", $command["cmd"], $command["onclick"]);
2635 }
2636 }
2637
2638 // info screen commmand
2639 if ($this->getInfoScreenStatus())
2640 {
2641 $this->insertInfoScreenCommand();
2642 }
2643
2644 if (!$this->isMode(IL_LIST_AS_TRIGGER))
2645 {
2646 // edit timings
2647 if($this->timings_enabled)
2648 {
2649 $this->insertTimingsCommand();
2650 }
2651
2652 // delete
2653 if ($this->delete_enabled)
2654 {
2655 $this->insertDeleteCommand();
2656 }
2657
2658 // link
2659 if ($this->link_enabled)
2660 {
2661 $this->insertLinkCommand();
2662 }
2663
2664 // cut
2665 if ($this->cut_enabled)
2666 {
2667 $this->insertCutCommand();
2668 }
2669
2670 // copy
2671 if ($this->copy_enabled)
2672 {
2673 $this->insertCopyCommand();
2674 }
2675
2676 // cut/copy from workspace to repository
2677 if ($this->repository_transfer_enabled)
2678 {
2679 $this->insertCutCommand(true);
2680 $this->insertCopyCommand(true);
2681 }
2682
2683 // subscribe
2684 if ($this->subscribe_enabled)
2685 {
2686 $this->insertSubscribeCommand();
2687 }
2688
2689 // multi download
2690 if ($this->multi_download_enabled && $a_header_actions)
2691 {
2693 }
2694
2695 // BEGIN PATCH Lucene search
2696 if($this->cut_enabled or $this->link_enabled)
2697 {
2698 $this->insertPasteCommand();
2699 }
2700 // END PATCH Lucene Search
2701 }
2702 }
2703
2704 // common social commands (comment, notes, tags)
2705 if (!$only_default && !$this->isMode(IL_LIST_AS_TRIGGER))
2706 {
2707 $this->insertCommonSocialCommands($a_header_actions);
2708 }
2709
2710 if(!$a_header_actions)
2711 {
2712 $this->ctrl->clearParametersByClass($this->gui_class_name);
2713 }
2714
2715 // fix bug #12417
2716 // there is one case, where no action menu should be displayed:
2717 // public area, category, no info tab
2718 // todo: make this faster and remove type specific implementation if possible
2719 if ($a_use_asynch && !$a_get_asynch_commands && !$a_header_actions)
2720 {
2721 if ($ilUser->getId() == ANONYMOUS_USER_ID && $this->type == "cat")
2722 {
2723 include_once("./Services/Container/classes/class.ilContainer.php");
2724 include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
2726 $this->obj_id,
2728 true))
2729 {
2730 return;
2731 }
2732 }
2733 }
2734
2735 if ($a_use_asynch && $a_get_asynch_commands)
2736 {
2737 return $this->current_selection_list->getHTML(true);
2738 }
2739
2740 return $this->current_selection_list->getHTML();
2741 }
2742
2748 function enableComments($a_value, $a_enable_comments_settings = true)
2749 {
2750 global $ilSetting;
2751
2752 // global switch
2753 if($ilSetting->get("disable_comments"))
2754 {
2755 $a_value = false;
2756 }
2757
2758 $this->comments_enabled = (bool)$a_value;
2759 $this->comments_settings_enabled = (bool)$a_enable_comments_settings;
2760 }
2761
2767 function enableNotes($a_value)
2768 {
2769 global $ilSetting;
2770
2771 // global switch
2772 if($ilSetting->get("disable_notes"))
2773 {
2774 $a_value = false;
2775 }
2776
2777 $this->notes_enabled = (bool)$a_value;
2778 }
2779
2785 function enableTags($a_value)
2786 {
2787 $tags_set = new ilSetting("tags");
2788 if (!$tags_set->get("enable"))
2789 {
2790 $a_value = false;
2791 }
2792 $this->tags_enabled = (bool)$a_value;
2793 }
2794
2803 function enableRating($a_value, $a_text = null, $a_categories = false, array $a_ctrl_path = null)
2804 {
2805 $this->rating_enabled = (bool)$a_value;
2806
2807 if($this->rating_enabled)
2808 {
2809 $this->rating_categories_enabled = (bool)$a_categories;
2810 $this->rating_text = $a_text;
2811 $this->rating_ctrl_path = $a_ctrl_path;
2812 }
2813 }
2814
2820 function enableMultiDownload($a_value)
2821 {
2822 $folder_set = new ilSetting("fold");
2823 if (!$folder_set->get("enable_multi_download"))
2824 {
2825 $a_value = false;
2826 }
2827 $this->multi_download_enabled = (bool)$a_value;
2828 }
2829
2831 {
2832 global $ilAccess, $objDefinition;
2833
2834 if ($this->std_cmd_only)
2835 return;
2836
2837 if(!$objDefinition->isContainer(ilObject::_lookupType($this->obj_id)))
2838 return false;
2839
2840 if(is_object($this->getContainerObject()) &&
2841 $this->getContainerObject() instanceof ilContainerGUI)
2842 {
2843 $this->ctrl->setParameter($this->getContainerObject(), "type", "");
2844 $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", "");
2845 $this->ctrl->setParameter($this->getContainerObject(), "active_node", "");
2846 $cmd = $_GET["cmd"] == "enableMultiDownload" ? "render" : "enableMultiDownload";
2847 $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), $cmd);
2848 $this->insertCommand($cmd_link, $this->lng->txt("download_multiple_objects"));
2849 return true;
2850 }
2851
2852 return false;
2853 }
2854
2855 function enableDownloadCheckbox($a_ref_id, $a_value)
2856 {
2857 global $ilAccess;
2858
2859 // TODO: delegate to list object class!
2860 if (!$this->getContainerObject()->isActiveAdministrationPanel() || $_SESSION["clipboard"])
2861 {
2862 if (in_array($this->type, array("file", "fold")) &&
2863 $ilAccess->checkAccess("read", "", $a_ref_id, $this->type))
2864 {
2865 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_ENABLED;
2866 }
2867 else
2868 {
2869 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_DISABLED;
2870 }
2871 }
2872 else
2873 {
2874 $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_NONE;
2875 }
2876 }
2877
2879 {
2881 }
2882
2886 static function prepareJsLinks($a_redraw_url, $a_notes_url, $a_tags_url, $a_tpl = null)
2887 {
2888 global $tpl;
2889
2890 if (is_null($a_tpl))
2891 {
2892 $a_tpl = $tpl;
2893 }
2894
2895 if($a_notes_url)
2896 {
2897 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
2898 ilNoteGUI::initJavascript($a_notes_url);
2899 }
2900
2901 if($a_tags_url)
2902 {
2903 include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
2904 ilTaggingGUI::initJavascript($a_tags_url);
2905 }
2906
2907 if($a_redraw_url)
2908 {
2909 $a_tpl->addOnLoadCode("il.Object.setRedrawAHUrl('".
2910 $a_redraw_url."');");
2911 }
2912 }
2913
2921 {
2922 $this->sub_obj_type = $a_type;
2923 $this->sub_obj_id = (int)$a_id;
2924 }
2925
2935 function addHeaderIcon($a_id, $a_img, $a_tooltip = null, $a_onclick = null, $a_status_text = null, $a_href = null)
2936 {
2937 $this->header_icons[$a_id] = array("img" => $a_img,
2938 "tooltip" => $a_tooltip,
2939 "onclick" => $a_onclick,
2940 "status_text" => $a_status_text,
2941 "href" => $a_href);
2942 }
2943
2949 function addHeaderIconHTML($a_id, $a_html)
2950 {
2951 $this->header_icons[$a_id] = $a_html;
2952 }
2953
2959 function addHeaderGlyph($a_id, $a_glyph, $a_onclick = null)
2960 {
2961 $this->header_icons[$a_id] = array("glyph" => $a_glyph, "onclick" => $a_onclick);
2962 }
2963
2964 function setAjaxHash($a_hash)
2965 {
2966 $this->ajax_hash = $a_hash;
2967 }
2968
2975 {
2976 global $ilUser, $lng, $tpl;
2977
2978 $htpl = new ilTemplate("tpl.header_action.html", true, true, "Services/Repository");
2979
2980 $redraw_js = "il.Object.redrawActionHeader();";
2981
2982 // tags
2983 if($this->tags_enabled)
2984 {
2985 include_once("./Services/Tagging/classes/class.ilTagging.php");
2987 ilObject::_lookupType($this->obj_id), 0, "", $ilUser->getId());
2988 if (count($tags) > 0)
2989 {
2990 include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
2991 $lng->loadLanguageModule("tagging");
2992 /*$this->addHeaderIcon("tags",
2993 ilUtil::getImagePath("icon_tag.svg"),
2994 $lng->txt("tagging_tags").": ".count($tags),
2995 ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js),
2996 count($tags));*/
2997
2998 $f = $this->ui->factory();
2999 $this->addHeaderGlyph("tags", $f->glyph()->tag("#")
3000 ->withCounter($f->counter()->status((int) count($tags))),
3001 ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js));
3002
3003 }
3004 }
3005
3006 // notes and comments
3007 $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, true, false);
3008 if($this->notes_enabled || $comments_enabled)
3009 {
3010 include_once("./Services/Notes/classes/class.ilNote.php");
3011 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
3012 $cnt = ilNote::_countNotesAndComments($this->obj_id, $this->sub_obj_id);
3013
3014 if($this->notes_enabled && $cnt[$this->obj_id][IL_NOTE_PRIVATE] > 0)
3015 {
3016 /*$this->addHeaderIcon("notes",
3017 ilUtil::getImagePath("note_unlabeled.svg"),
3018 $lng->txt("private_notes").": ".$cnt[$this->obj_id][IL_NOTE_PRIVATE],
3019 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js),
3020 $cnt[$this->obj_id][IL_NOTE_PRIVATE]
3021 );*/
3022
3023 $f = $this->ui->factory();
3024 $this->addHeaderGlyph("notes", $f->glyph()->note("#")
3025 ->withCounter($f->counter()->status((int) $cnt[$this->obj_id][IL_NOTE_PRIVATE])),
3026 ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js));
3027
3028 }
3029
3030 if($comments_enabled && $cnt[$this->obj_id][IL_NOTE_PUBLIC] > 0)
3031 {
3032 $lng->loadLanguageModule("notes");
3033
3034 /*$this->addHeaderIcon("comments",
3035 ilUtil::getImagePath("comment_unlabeled.svg"),
3036 $lng->txt("notes_public_comments").": ".$cnt[$this->obj_id][IL_NOTE_PUBLIC],
3037 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js),
3038 $cnt[$this->obj_id][IL_NOTE_PUBLIC]);*/
3039
3040 $f = $this->ui->factory();
3041 $this->addHeaderGlyph("comments", $f->glyph()->comment("#")
3042 ->withCounter($f->counter()->status((int) $cnt[$this->obj_id][IL_NOTE_PUBLIC])),
3043 ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js));
3044
3045 }
3046 }
3047
3048 // rating
3049 if($this->rating_enabled)
3050 {
3051 include_once("./Services/Rating/classes/class.ilRatingGUI.php");
3052 $rating_gui = new ilRatingGUI();
3053 $rating_gui->enableCategories($this->rating_categories_enabled);
3054 // never rate sub objects from header action!
3055 $rating_gui->setObject($this->obj_id, $this->type);
3056 if($this->rating_text)
3057 {
3058 $rating_gui->setYourRatingText($this->rating_text);
3059 }
3060
3061 $this->ctrl->setParameterByClass("ilRatingGUI", "cadh", $this->ajax_hash);
3062 $this->ctrl->setParameterByClass("ilRatingGUI", "rnsb", true);
3063 if($this->rating_ctrl_path)
3064 {
3065 $rating_gui->setCtrlPath($this->rating_ctrl_path);
3066 $ajax_url = $this->ctrl->getLinkTargetByClass($this->rating_ctrl_path, "saveRating", "", true, false);
3067 }
3068 else
3069 {
3070 // ???
3071 $ajax_url = $this->ctrl->getLinkTargetByClass("ilRatingGUI", "saveRating", "", true, false);
3072 }
3073 $tpl->addOnLoadCode("il.Object.setRatingUrl('".$ajax_url."');");
3074
3075 $this->addHeaderIconHTML("rating",
3076 $rating_gui->getHtml(true,
3077 $this->checkCommandAccess("read", "", $this->ref_id, $this->type),
3078 "il.Object.saveRating(%rating%);"));
3079 }
3080
3081 if($this->header_icons)
3082 {
3083 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
3084
3085 $chunks = array();
3086 foreach($this->header_icons as $id => $attr)
3087 {
3088 $id = "headp_".$id;
3089
3090 if(is_array($attr))
3091 {
3092 if($attr["glyph"])
3093 {
3094 if ($attr["onclick"])
3095 {
3096 $htpl->setCurrentBlock("prop_glyph_oc");
3097 $htpl->setVariable("GLYPH_ONCLICK", $attr["onclick"]);
3098 $htpl->parseCurrentBlock();
3099 }
3100 $renderer = $this->ui->renderer();
3101 $html = $renderer->render($attr["glyph"]);
3102 $htpl->setCurrentBlock("prop_glyph");
3103 $htpl->setVariable("GLYPH", $html);
3104 $htpl->parseCurrentBlock();
3105 }
3106 else
3107 {
3108 if ($attr["onclick"])
3109 {
3110 $htpl->setCurrentBlock("onclick");
3111 $htpl->setVariable("PROP_ONCLICK", $attr["onclick"]);
3112 $htpl->parseCurrentBlock();
3113 }
3114
3115 if ($attr["status_text"])
3116 {
3117 $htpl->setCurrentBlock("status");
3118 $htpl->setVariable("PROP_TXT", $attr["status_text"]);
3119 $htpl->parseCurrentBlock();
3120 }
3121
3122 if (!$attr["href"])
3123 {
3124 $attr["href"] = "#";
3125 }
3126
3127 $htpl->setCurrentBlock("prop");
3128 $htpl->setVariable("PROP_ID", $id);
3129 $htpl->setVariable("IMG", ilUtil::img($attr["img"]));
3130 $htpl->setVariable("PROP_HREF", $attr["href"]);
3131 $htpl->parseCurrentBlock();
3132
3133 if ($attr["tooltip"])
3134 {
3135 ilTooltipGUI::addTooltip($id, $attr["tooltip"]);
3136 }
3137 }
3138 }
3139 else
3140 {
3141 $chunks[] = $attr;
3142 }
3143 }
3144
3145 if(sizeof($chunks))
3146 {
3147 $htpl->setVariable("PROP_CHUNKS",
3148 implode("&nbsp;&nbsp;&nbsp;", $chunks)."&nbsp;&nbsp;&nbsp;");
3149 }
3150 }
3151
3152 $htpl->setVariable("ACTION_DROP_DOWN",
3153 $this->insertCommands(false, false, "", true));
3154
3155 return $htpl->get();
3156 }
3157
3158
3164 {
3165 $script = substr(strrchr($_SERVER["PHP_SELF"],"/"),1);
3166
3167 // we should get rid of this nonsense with 4.4 (alex)
3168 if ((strtolower($_GET["baseClass"]) != "ilrepositorygui") &&
3169 is_int(strpos($a_link,"baseClass=ilRepositoryGUI")))
3170 {
3171 if ($this->type != "frm")
3172 {
3173 $a_link =
3174 ilUtil::appendUrlParameterString($a_link, "rep_frame=1");
3175 }
3176 }
3177
3178 return $a_link;
3179 }
3180
3181 protected function modifyTitleLink($a_default_link)
3182 {
3183 if($this->default_command_params)
3184 {
3185 $params = array();
3186 foreach($this->default_command_params as $name => $value)
3187 {
3188 $params[] = $name.'='.$value;
3189 }
3190 $params = implode('&', $params);
3191
3192
3193 // #12370
3194 if(!stristr($a_default_link, '?'))
3195 {
3196 $a_default_link = ($a_default_link.'?'.$params);
3197 }
3198 else
3199 {
3200 $a_default_link = ($a_default_link.'&'.$params);
3201 }
3202 }
3203 return $a_default_link;
3204 }
3205
3209 function modifySAHSlaunch($a_link,$wtarget)
3210 {
3211 global $DIC;
3212
3213 if (strstr($a_link, 'ilSAHSPresentationGUI') && !$this->offline_mode)
3214 {
3215 include_once 'Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
3216 $sahs_obj = new ilObjSAHSLearningModule($this->ref_id);
3217 $om = $sahs_obj->getOpenMode();
3218 $width = $sahs_obj->getWidth();
3219 $height = $sahs_obj->getHeight();
3220 if ( ($om == 5 || $om == 1) && $width > 0 && $height > 0) $om++;
3221 if ($om != 0 && !$DIC['ilBrowser']->isMobile())
3222 {
3223 $this->default_command["frame"]="";
3224 $a_link = "javascript:void(0); onclick=startSAHS('".$a_link."','".$wtarget."',".$om.",".$width.",".$height.");";
3225 }
3226 }
3227 return $a_link;
3228 }
3229
3233 function insertPath()
3234 {
3235 global $tree, $lng;
3236
3237 if($this->getPathStatus() != false)
3238 {
3239 include_once 'Services/Tree/classes/class.ilPathGUI.php';
3240 $path_gui = new ilPathGUI();
3241 $path_gui->enableTextOnly(!$this->path_linked);
3242 $path_gui->setUseImages(false);
3243
3244 $start_node = $this->path_start_node
3245 ? $this->path_start_node
3246 : ROOT_FOLDER_ID;
3247
3248 $this->tpl->setCurrentBlock("path_item");
3249 $this->tpl->setVariable('PATH_ITEM',$path_gui->getPath($start_node,$this->ref_id));
3250 $this->tpl->parseCurrentBlock();
3251
3252 $this->tpl->setCurrentBlock("path");
3253 $this->tpl->setVariable("TXT_LOCATION", $lng->txt("locator"));
3254 $this->tpl->parseCurrentBlock();
3255 return true;
3256 }
3257 }
3258
3265 public function insertProgressInfo()
3266 {
3267 return true;
3268 }
3269
3270
3275 {
3276 global $lng, $objDefinition;
3277
3278 $cnt = 0;
3279 if ($this->getCheckboxStatus())
3280 {
3281 $this->tpl->setCurrentBlock("check");
3282 $this->tpl->setVariable("VAL_ID", $this->getCommandId());
3283 $this->tpl->parseCurrentBlock();
3284 $cnt += 1;
3285 }
3286 else if ($this->getDownloadCheckboxState() != self::DOWNLOAD_CHECKBOX_NONE)
3287 {
3288 $this->tpl->setCurrentBlock("check_download");
3289 if ($this->getDownloadCheckboxState() == self::DOWNLOAD_CHECKBOX_ENABLED)
3290 $this->tpl->setVariable("VAL_ID", $this->getCommandId());
3291 else
3292 $this->tpl->setVariable("VAL_VISIBILITY", "visibility: hidden;\" disabled=\"disabled");
3293 $this->tpl->parseCurrentBlock();
3294 $cnt += 1;
3295 }
3296 elseif($this->getExpandStatus())
3297 {
3298 $this->tpl->setCurrentBlock('expand');
3299
3300 if($this->isExpanded())
3301 {
3302 $this->ctrl->setParameter($this->container_obj,'expand',-1 * $this->obj_id);
3303 // "view" added, see #19922
3304 $this->tpl->setVariable('EXP_HREF',$this->ctrl->getLinkTarget($this->container_obj,'view',$this->getUniqueItemId(true)));
3305 $this->ctrl->clearParameters($this->container_obj);
3306 $this->tpl->setVariable('EXP_IMG',ilUtil::getImagePath('tree_exp.svg'));
3307 $this->tpl->setVariable('EXP_ALT',$this->lng->txt('collapse'));
3308 }
3309 else
3310 {
3311 $this->ctrl->setParameter($this->container_obj,'expand',$this->obj_id);
3312 // "view" added, see #19922
3313 $this->tpl->setVariable('EXP_HREF',$this->ctrl->getLinkTarget($this->container_obj,'view',$this->getUniqueItemId(true)));
3314 $this->ctrl->clearParameters($this->container_obj);
3315 $this->tpl->setVariable('EXP_IMG',ilUtil::getImagePath('tree_col.svg'));
3316 $this->tpl->setVariable('EXP_ALT',$this->lng->txt('expand'));
3317 }
3318
3319 $this->tpl->parseCurrentBlock();
3320 $cnt += 1;
3321 }
3322
3323 if ($this->getIconStatus())
3324 {
3325 if ($cnt == 1)
3326 {
3327 $this->tpl->touchBlock("i_1"); // indent
3328 }
3329
3330 // icon link
3331 if ($this->title_link_disabled || !$this->default_command || (!$this->getCommandsStatus() && !$this->restrict_to_goto))
3332 {
3333 }
3334 else
3335 {
3336 $this->tpl->setCurrentBlock("icon_link_s");
3337
3338 if ($this->default_command["frame"] != "")
3339 {
3340 $this->tpl->setVariable("ICON_TAR", "target='".$this->default_command["frame"]."'");
3341 }
3342
3343 $this->tpl->setVariable("ICON_HREF",
3344 $this->default_command["link"]);
3345 $this->tpl->parseCurrentBlock();
3346 $this->tpl->touchBlock("icon_link_e");
3347 }
3348
3349 $this->tpl->setCurrentBlock("icon");
3350 if (!$objDefinition->isPlugin($this->getIconImageType()))
3351 {
3352 $this->tpl->setVariable("ALT_ICON", $lng->txt("icon")." ".$lng->txt("obj_".$this->getIconImageType()));
3353 }
3354 else
3355 {
3356 include_once("Services/Component/classes/class.ilPlugin.php");
3357 $this->tpl->setVariable("ALT_ICON", $lng->txt("icon")." ".
3358 ilObjectPlugin::lookupTxtById($this->getIconImageType(), "obj_".$this->getIconImageType()));
3359 }
3360
3361 $this->tpl->setVariable("SRC_ICON",
3362 ilObject::_getIcon($this->obj_id, "small", $this->getIconImageType()));
3363 $this->tpl->parseCurrentBlock();
3364 $cnt += 1;
3365 }
3366
3367 $this->tpl->touchBlock("d_".$cnt); // indent main div
3368 }
3369
3374 {
3375 foreach ($this->sub_item_html as $sub_html)
3376 {
3377 $this->tpl->setCurrentBlock("subitem");
3378 $this->tpl->setVariable("SUBITEM", $sub_html);
3379 $this->tpl->parseCurrentBlock();
3380 }
3381 }
3382
3387 {
3388 if ($this->position_enabled)
3389 {
3390 $this->tpl->setCurrentBlock("position");
3391 $this->tpl->setVariable("POS_ID", $this->position_field_index);
3392 $this->tpl->setVariable("POS_VAL", $this->position_value);
3393 $this->tpl->parseCurrentBlock();
3394 }
3395 }
3396
3402 {
3403 return $this->adm_commands_included;
3404 }
3405
3410 {
3411 global $ilUser;
3412 if($this->acache->getLastAccessStatus() == "miss" &&
3413 !$this->prevent_access_caching)
3414 {
3415 $this->acache->storeEntry($ilUser->getId().":".$this->ref_id,
3416 serialize($this->access_cache), $this->ref_id);
3417 }
3418 }
3419
3434 function getListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description,
3435 $a_use_asynch = false, $a_get_asynch_commands = false, $a_asynch_url = "")
3436 {
3437 global $ilBench, $ilUser;
3438
3439 // this variable stores wheter any admin commands
3440 // are included in the output
3441 $this->adm_commands_included = false;
3442
3443 // only for permformance exploration
3444 $type = ilObject::_lookupType($a_obj_id);
3445
3446 // initialization
3447 $ilBench->start("ilObjectListGUI", "1000_getListHTML_init$type");
3448 $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
3449 $ilBench->stop("ilObjectListGUI", "1000_getListHTML_init$type");
3450
3451 // prepare ajax calls
3452 include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
3453 if($this->context == self::CONTEXT_REPOSITORY)
3454 {
3456 }
3457 else
3458 {
3460 }
3461 $this->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash($node_type, $a_ref_id, $type, $a_obj_id));
3462
3463 if ($a_use_asynch && $a_get_asynch_commands)
3464 {
3465 return $this->insertCommands(true, true);
3466 }
3467
3468 if($this->rating_enabled)
3469 {
3470 if(ilRating::hasRatingInListGUI($this->obj_id, $this->type))
3471 {
3472 $may_rate = $this->checkCommandAccess("read", "", $this->ref_id, $this->type);
3473
3474 $rating = new ilRatingGUI();
3475 $rating->setObject($this->obj_id, $this->type);
3476/* $this->addCustomProperty(
3477 $this->lng->txt("rating_average_rating"),
3478 $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id),
3479 false,
3480 true
3481 );*/
3482 $this->addCustomProperty(
3483 "",
3484 $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id),
3485 false,
3486 true
3487 );
3488 }
3489 }
3490
3491 // read from cache
3492 include_once("Services/Object/classes/class.ilListItemAccessCache.php");
3493 $this->acache = new ilListItemAccessCache();
3494 $cres = $this->acache->getEntry($ilUser->getId().":".$a_ref_id);
3495 if($this->acache->getLastAccessStatus() == "hit")
3496 {
3497 $this->access_cache = unserialize($cres);
3498 }
3499 else
3500 {
3501 // write to cache
3502 $this->storeAccessCache();
3503 }
3504
3505 // visible check
3506 if (!$this->checkCommandAccess("visible", "", $a_ref_id, "", $a_obj_id))
3507 {
3508 $ilBench->stop("ilObjectListGUI", "2000_getListHTML_check_visible");
3509 $this->resetCustomData();
3510 return "";
3511 }
3512
3513 // BEGIN WEBDAV
3514 if($type=='file' AND ilObjFileAccess::_isFileHidden($a_title))
3515 {
3516 $this->resetCustomData();
3517 return "";
3518 }
3519 // END WEBDAV
3520
3521
3522 $this->tpl = new ilTemplate(static::$tpl_file_name, true, true,
3523 static::$tpl_component, "DEFAULT", false, true);
3524
3525 if($this->getCommandsStatus())
3526 {
3527 if (!$this->getSeparateCommands())
3528 {
3529 $this->tpl->setVariable("COMMAND_SELECTION_LIST",
3530 $this->insertCommands($a_use_asynch, $a_get_asynch_commands, $a_asynch_url));
3531 }
3532 }
3533
3534 if($this->getProgressInfoStatus())
3535 {
3536 $this->insertProgressInfo();
3537 }
3538
3539 // insert title and describtion
3540 $this->insertTitle();
3541 if (!$this->isMode(IL_LIST_AS_TRIGGER))
3542 {
3543 if ($this->getDescriptionStatus())
3544 {
3545 $this->insertDescription();
3546 }
3547 }
3548
3549 if($this->getSearchFragmentStatus())
3550 {
3551 $this->insertSearchFragment();
3552 }
3553 if($this->enabledRelevance())
3554 {
3555 $this->insertRelevance();
3556 }
3557
3558 // properties
3559 $ilBench->start("ilObjectListGUI", "6000_insert_properties$type");
3560 if ($this->getPropertiesStatus())
3561 {
3562 $this->insertProperties();
3563 }
3564 $ilBench->stop("ilObjectListGUI", "6000_insert_properties$type");
3565
3566 // notice properties
3567 $ilBench->start("ilObjectListGUI", "6500_insert_notice_properties$type");
3568 if($this->getNoticePropertiesStatus())
3569 {
3570 $this->insertNoticeProperties();
3571 }
3572 $ilBench->stop("ilObjectListGUI", "6500_insert_notice_properties$type");
3573
3574 // preconditions
3575 $ilBench->start("ilObjectListGUI", "7000_insert_preconditions");
3576 if ($this->getPreconditionsStatus())
3577 {
3578 $this->insertPreconditions();
3579 }
3580 $ilBench->stop("ilObjectListGUI", "7000_insert_preconditions");
3581
3582 // path
3583 $ilBench->start("ilObjectListGUI", "8000_insert_path");
3584 $this->insertPath();
3585 $ilBench->stop("ilObjectListGUI", "8000_insert_path");
3586
3587 $ilBench->start("ilObjectListGUI", "8500_item_detail_links");
3588 if($this->getItemDetailLinkStatus())
3589 {
3590 $this->insertItemDetailLinks();
3591 }
3592 $ilBench->stop("ilObjectListGUI", "8500_item_detail_links");
3593
3594 // icons and checkboxes
3595 $this->insertIconsAndCheckboxes();
3596
3597 // input field for position
3598 $this->insertPositionField();
3599
3600 // subitems
3601 $this->insertSubItems();
3602
3603 // file upload
3604 if ($this->isFileUploadAllowed())
3605 {
3606 $this->insertFileUpload();
3607 }
3608
3609 $this->resetCustomData();
3610
3611 $this->tpl->setVariable("DIV_CLASS",'ilContainerListItemOuter');
3612 $this->tpl->setVariable("DIV_ID", 'id = "'.$this->getUniqueItemId(true).'"');
3613 $this->tpl->setVariable("ADDITIONAL", $this->getAdditionalInformation());
3614
3615 // #11554 - make sure that internal ids are reset
3616 $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", "");
3617
3618 return $this->tpl->get();
3619 }
3620
3624 protected function resetCustomData()
3625 {
3626 // #15747
3627 $this->cust_prop = array();
3628 $this->cust_commands = array();
3629 $this->sub_item_html = array();
3630 $this->position_enabled = false;
3631 }
3632
3638 public function setParentRefId($a_ref_id)
3639 {
3640 $this->parent_ref_id = $a_ref_id;
3641 }
3642
3649 protected function getUniqueItemId($a_as_div = false)
3650 {
3651 // use correct id for references
3652 $id_ref = ($this->reference_ref_id > 0)
3653 ? $this->reference_ref_id
3654 : $this->ref_id;
3655
3656 // add unique identifier for preconditions (objects can appear twice in same container)
3657 if($this->condition_depth)
3658 {
3659 $id_ref .= "_pc".$this->condition_depth;
3660 }
3661
3662 // unique
3663 $id_ref .= "_pref_".$this->parent_ref_id;
3664
3665 if(!$a_as_div)
3666 {
3667 return $id_ref;
3668 }
3669 else
3670 {
3671 // action menu [yellow] toggle
3672 return "lg_div_".$id_ref;
3673 }
3674 }
3675
3680 {
3681 return $this->insertCommands();
3682 }
3683
3687 function isSideBlock()
3688 {
3689 return false;
3690 }
3691
3697 public function setBoldTitle($a_bold_title)
3698 {
3699 $this->bold_title = $a_bold_title;
3700
3701 }
3702
3708 public function isTitleBold()
3709 {
3710 return $this->bold_title;
3711 }
3712
3719 static function preloadCommonProperties($a_obj_ids, $a_context)
3720 {
3721 global $lng, $ilSetting, $ilUser;
3722
3723 if($a_context == self::CONTEXT_REPOSITORY)
3724 {
3725 $active_notes = !$ilSetting->get("disable_notes");
3726 $active_comments = !$ilSetting->get("disable_comments");
3727
3728 if($active_notes || $active_comments)
3729 {
3730 include_once("./Services/Notes/classes/class.ilNote.php");
3731 }
3732
3733 if($active_comments)
3734 {
3735 // needed for action
3736 self::$comments_activation = ilNote::getRepObjActivation($a_obj_ids);
3737 }
3738
3739 // properties are optional
3740 if($ilSetting->get('comments_tagging_in_lists'))
3741 {
3742 if($active_notes || $active_comments)
3743 {
3744 self::$cnt_notes = ilNote::_countNotesAndCommentsMultiple($a_obj_ids, true);
3745
3746 $lng->loadLanguageModule("notes");
3747 }
3748
3749 $tags_set = new ilSetting("tags");
3750 if($tags_set->get("enable"))
3751 {
3752 $all_users = $tags_set->get("enable_all_users");
3753
3754 include_once("./Services/Tagging/classes/class.ilTagging.php");
3755 if(!$ilSetting->get('comments_tagging_in_lists_tags'))
3756 {
3757 self::$cnt_tags = ilTagging::_countTags($a_obj_ids, $all_users);
3758 }
3759 else
3760 {
3761 $tag_user_id = null;
3762 if(!$all_users)
3763 {
3764 $tag_user_id = $ilUser->getId();
3765 }
3766 self::$tags = ilTagging::_getListTagsForObjects($a_obj_ids, $tag_user_id);
3767 }
3768
3769 $lng->loadLanguageModule("tagging");
3770 }
3771 }
3772
3773 $lng->loadLanguageModule("rating");
3774 }
3775
3776 self::$preload_done = true;
3777 }
3778
3789 protected function isCommentsActivated($a_type, $a_ref_id, $a_obj_id, $a_header_actions, $a_check_write_access = true)
3790 {
3791 if($this->comments_enabled)
3792 {
3793 if(!$this->comments_settings_enabled)
3794 {
3795 return true;
3796 }
3797 if($a_check_write_access && $this->checkCommandAccess('write','', $a_ref_id, $a_type))
3798 {
3799 return true;
3800 }
3801 // fallback to single object check if no preloaded data
3802 // only the repository does preloadCommonProperties() yet
3803 if(!$a_header_actions && self::$preload_done)
3804 {
3805 if(self::$comments_activation[$a_obj_id][$a_type])
3806 {
3807 return true;
3808 }
3809 }
3810 else
3811 {
3812 include_once("./Services/Notes/classes/class.ilNote.php");
3813 if(ilNote::commentsActivated($a_obj_id, 0, $a_type))
3814 {
3815 return true;
3816 }
3817 }
3818 }
3819 return false;
3820 }
3821
3829 public function enableTimings($a_status)
3830 {
3831 $this->timings_enabled = (bool)$a_status;
3832 }
3833
3839 public function isFileUploadAllowed()
3840 {
3841 // check if file upload allowed
3842 include_once("./Services/FileUpload/classes/class.ilFileUploadUtil.php");
3843 return ilFileUploadUtil::isUploadAllowed($this->ref_id, $this->type);
3844 }
3845
3849 public function insertFileUpload()
3850 {
3851 include_once("./Services/FileUpload/classes/class.ilFileUploadGUI.php");
3853
3854 $upload = new ilFileUploadGUI($this->getUniqueItemId(true), $this->ref_id);
3855
3856 $this->tpl->setCurrentBlock("fileupload");
3857 $this->tpl->setVariable("FILE_UPLOAD", $upload->getHTML());
3858 $this->tpl->parseCurrentBlock();
3859 }
3860}
3861
3862?>
sprintf('%.4f', $callTime)
for($col=0; $col< 50; $col++) $d
global $tpl
Definition: ilias.php:8
$location
Definition: buildRTE.php:44
$_GET["client_id"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_NO_LICENSE
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)
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 getListNotesJSCall($a_hash, $a_update_code=null)
Get list notes js call.
static initJavascript($a_ajax_url, $a_type=IL_NOTE_PRIVATE)
Init javascript.
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.
addCustomProperty($a_property="", $a_value="", $a_alert=false, $a_newline=false)
add custom property
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.
getHeaderAction()
Get header action.
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
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)
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.
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.
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
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
getExpandStatus()
Is expand/collapse enabled.
insertProperties()
insert properties
insertCommands($a_use_asynch=false, $a_get_asynch_commands=false, $a_asynch_url="", $a_header_actions=false)
insert all commands into html code
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)
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)
$txt
Definition: error.php:12
$html
Definition: example_001.php:87
$params
Definition: example_049.php:96
$info
Definition: example_052.php:80
global $ilBench
Definition: ilias.php:18
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.
redirection script todo: (a better solution should control the processing via a xml file)
global $lng
Definition: privfeed.php:17
global $ilSetting
Definition: privfeed.php:17
$cmd
Definition: sahs_server.php:35
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$preview
global $DIC
$ilUser
Definition: imgupload.php:18
$a_type
Definition: workflow.php:93