ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
4 define ("IL_LIST_AS_TRIGGER", "trigger");
5 define ("IL_LIST_FULL", "full");
6 
7 
24 {
25  const DETAILS_MINIMAL = 10;
26  const DETAILS_SEARCH = 20 ;
27  const DETAILS_ALL = 30;
28 
29  const CONTEXT_REPOSITORY = 1;
30  const CONTEXT_WORKSPACE = 2;
31  const CONTEXT_SHOP = 3;
34  const CONTEXT_SEARCH = 6;
35 
39 
40  var $ctrl;
43  var $properties_enabled = true;
45  var $commands_enabled = true;
46  var $cust_prop = array();
47  var $cust_commands = array();
48  var $info_screen_enabled = false;
50  var $std_cmd_only = false;
51  var $sub_item_html = array();
53  var $download_checkbox_state = self::DOWNLOAD_CHECKBOX_NONE;
54 
55  protected $obj_id;
56  protected $ref_id;
57  protected $type;
58  protected $sub_obj_id;
59  protected $sub_obj_type;
60 
61  protected $substitutions = null;
62  protected $substitutions_enabled = false;
63 
64  protected $icons_enabled = false;
65  protected $checkboxes_enabled = false;
66  protected $position_enabled = false;
67  protected $progress_enabled = false;
68  protected $item_detail_links_enabled = false;
69  protected $item_detail_links = array();
70  protected $item_detail_links_intro = '';
71 
72  protected $search_fragments_enabled = false;
73  protected $search_fragment = '';
74  protected $path_linked = false;
75 
76  protected $enabled_relevance = false;
77  protected $relevance = 0;
78 
79  protected $expand_enabled = false;
80  protected $is_expanded = true;
81  protected $bold_title = false;
82 
83  protected $copy_enabled = true;
84 
85  protected $details_level = self::DETAILS_ALL;
86 
87  protected $reference_ref_id = false;
88  protected $separate_commands = false;
89  protected $search_fragment_enabled = false;
90  protected $additional_information = false;
91  protected $static_link_enabled = false;
92 
93  protected $repository_transfer_enabled = false;
94  protected $shared = false;
95  protected $restrict_to_goto = false;
96 
97  protected $comments_enabled = false;
98  protected $comments_settings_enabled = false;
99  protected $notes_enabled = false;
100  protected $tags_enabled = false;
101 
102  protected $rating_enabled = false;
103  protected $rating_categories_enabled = false;
104  protected $rating_text = false;
105  protected $rating_ctrl_path = false;
106 
107  protected $timings_enabled = true;
108  protected $force_visible_only = false;
109  protected $prevent_duplicate_commands = array();
110  protected $parent_ref_id;
111 
112  static protected $cnt_notes = array();
113  static protected $cnt_tags = array();
114  static protected $comments_activation = array();
115  static protected $preload_done = false;
116 
121  function ilObjectListGUI()
122  {
123  global $rbacsystem, $ilCtrl, $lng, $ilias;
124 
125  $this->rbacsystem = $rbacsystem;
126  $this->ilias = $ilias;
127  $this->ctrl = $ilCtrl;
128  $this->lng = $lng;
129  $this->mode = IL_LIST_FULL;
130  $this->path_enabled = false;
131 
132  $this->enableComments(false);
133  $this->enableNotes(false);
134  $this->enableTags(false);
135 
136  // unique js-ids
137  $this->setParentRefId($_REQUEST["ref_id"]);
138 
139 //echo "list";
140  $this->init();
141 
142  include_once('Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
143  $this->ldap_mapping = ilLDAPRoleGroupMapping::_getInstance();
144 
145  $lng->loadLanguageModule("obj");
146  }
147 
148 
155  function setContainerObject($container_obj)
156  {
157  $this->container_obj = $container_obj;
158  }
159 
167  public function getContainerObject()
168  {
169  return $this->container_obj;
170  }
171 
172 
178  function init()
179  {
180  // Create static links for default command (linked title) or not
181  $this->static_link_enabled = true;
182  $this->delete_enabled = true;
183  $this->cut_enabled = true;
184  $this->subscribe_enabled = true;
185  $this->link_enabled = false;
186  $this->copy_enabled = false;
187  $this->payment_enabled = false;
188  $this->progress_enabled = false;
189  $this->notice_properties_enabled = true;
190  $this->info_screen_enabled = false;
191  $this->type = ""; // "cat", "course", ...
192  $this->gui_class_name = ""; // "ilobjcategorygui", "ilobjcoursegui", ...
193 
194  // general commands array, e.g.
195  include_once('./Services/Object/classes/class.ilObjectAccess.php');
196  $this->commands = ilObjectAccess::_getCommands();
197  }
198 
199  // Single get set methods
206  function enableProperties($a_status)
207  {
208  $this->properties_enabled = $a_status;
209 
210  return;
211  }
219  {
221  }
228  function enablePreconditions($a_status)
229  {
230  $this->preconditions_enabled = $a_status;
231 
232  return;
233  }
234 
236  {
238  }
239 
246  function enableNoticeProperties($a_status)
247  {
248  $this->notice_properties_enabled = $a_status;
249 
250  return;
251  }
259  {
261  }
268  function enableDescription($a_status)
269  {
270  $this->description_enabled = $a_status;
271 
272  return;
273  }
281  {
283  }
284 
292  {
294  }
295 
302  function enableSearchFragments($a_status)
303  {
304  $this->search_fragment_enabled = $a_status;
305 
306  return;
307  }
308 
314  public function enableLinkedPath($a_status)
315  {
316  $this->path_linked = $a_status;
317  }
318 
323  public function enabledRelevance()
324  {
326  }
327 
332  public function enableRelevance($a_status)
333  {
334  $this->enabled_relevance = $a_status;
335  }
336 
342  public function setRelevance($a_rel)
343  {
344  $this->relevance = $a_rel;
345  }
346 
352  public function getRelevance()
353  {
354  return $this->relevance;
355  }
356 
362  function enableIcon($a_status)
363  {
364  $this->icons_enabled = $a_status;
365  }
366 
372  function getIconStatus()
373  {
374  return $this->icons_enabled;
375  }
376 
382  function enableCheckbox($a_status)
383  {
384  $this->checkboxes_enabled = $a_status;
385  }
386 
392  function getCheckboxStatus()
393  {
395  }
396 
402  function enableExpand($a_status)
403  {
404  $this->expand_enabled = $a_status;
405  }
406 
412  function getExpandStatus()
413  {
414  return $this->expand_enabled;
415  }
416 
417  function setExpanded($a_status)
418  {
419  $this->is_expanded = $a_status;
420  }
421 
422  function isExpanded()
423  {
424  return $this->is_expanded;
425  }
432  function setPositionInputField($a_field_index, $a_position_value)
433  {
434  $this->position_enabled = true;
435  $this->position_field_index = $a_field_index;
436  $this->position_value = $a_position_value;
437  }
438 
445  function enableDelete($a_status)
446  {
447  $this->delete_enabled = $a_status;
448 
449  return;
450  }
457  function getDeleteStatus()
458  {
459  return $this->delete_enabled;
460  }
461 
468  function enableCut($a_status)
469  {
470  $this->cut_enabled = $a_status;
471 
472  return;
473  }
479  function getCutStatus()
480  {
481  return $this->cut_enabled;
482  }
483 
490  function enableCopy($a_status)
491  {
492  $this->copy_enabled = $a_status;
493 
494  return;
495  }
501  function getCopyStatus()
502  {
503  return $this->copy_enabled;
504  }
505 
512  function enableSubscribe($a_status)
513  {
514  $this->subscribe_enabled = $a_status;
515 
516  return;
517  }
524  {
525  return $this->subscribe_enabled;
526  }
533  function enablePayment($a_status)
534  {
535  $this->payment_enabled = $a_status;
536 
537  return;
538  }
544  function getPaymentStatus()
545  {
546  return $this->payment_enabled;
547  }
554  function enableLink($a_status)
555  {
556  $this->link_enabled = $a_status;
557 
558  return;
559  }
565  function getLinkStatus()
566  {
567  return $this->link_enabled;
568  }
569 
576  function enablePath($a_path)
577  {
578  $this->path_enabled = $a_path;
579  }
580 
586  function getPathStatus()
587  {
588  return $this->path_enabled;
589  }
590 
597  function enableCommands($a_status, $a_std_only = false)
598  {
599  $this->commands_enabled = $a_status;
600  $this->std_cmd_only = $a_std_only;
601  }
607  function getCommandsStatus()
608  {
610  }
611 
618  function enableInfoScreen($a_info_screen)
619  {
620  $this->info_screen_enabled = $a_info_screen;
621  }
622 
628  function addSubItemHTML($a_html)
629  {
630  $this->sub_item_html[] = $a_html;
631  }
632 
639  {
641  }
642 
650  public function enableProgressInfo($a_status)
651  {
652  $this->progress_enabled = $a_status;
653  }
654 
662  public function getProgressInfoStatus()
663  {
665  }
666 
674  public function enableSubstitutions($a_status)
675  {
676  $this->substitutions_enabled = $a_status;
677  }
678 
685  public function getSubstitutionStatus()
686  {
688  }
689 
698  public function enableItemDetailLinks($a_status)
699  {
700  $this->item_detail_links_enabled = $a_status;
701  }
702 
709  public function getItemDetailLinkStatus()
710  {
712  }
713 
721  public function setItemDetailLinks($a_detail_links,$a_intro_txt = '')
722  {
723  $this->item_detail_links = $a_detail_links;
724  $this->item_detail_links_intro = $a_intro_txt;
725  }
726 
734  public function insertItemDetailLinks()
735  {
736  if(!count($this->item_detail_links))
737  {
738  return true;
739  }
740  if(strlen($this->item_detail_links_intro))
741  {
742  $this->tpl->setCurrentBlock('item_detail_intro');
743  $this->tpl->setVariable('ITEM_DETAIL_INTRO_TXT',$this->item_detail_links_intro);
744  $this->tpl->parseCurrentBlock();
745  }
746 
747  foreach($this->item_detail_links as $info)
748  {
749  $this->tpl->setCurrentBlock('item_detail_link');
750  $this->tpl->setVariable('ITEM_DETAIL_LINK_TARGET',$info['target']);
751  $this->tpl->setVariable('ITEM_DETAIL_LINK_DESC',$info['desc']);
752  $this->tpl->setVariable('ITEM_DETAIL_LINK_HREF',$info['link']);
753  $this->tpl->setVariable('ITEM_DETAIL_LINK_NAME',$info['name']);
754  $this->tpl->parseCurrentBlock();
755  }
756  $this->tpl->setCurrentBlock('item_detail_links');
757  $this->tpl->parseCurrentBlock();
758  }
759 
760 
761 
766  function setTitle($a_title)
767  {
768  $this->title = $a_title;
769  }
770 
776  function getTitle()
777  {
778  return $this->title;
779  }
780 
785  function setDescription($a_description)
786  {
787  $this->description = $a_description;
788  }
789 
795  function getDescription()
796  {
797  return $this->description;
798  }
799 
805  public function setSearchFragment($a_text)
806  {
807  $this->search_fragment = $a_text;
808  }
809 
814  public function getSearchFragment()
815  {
816  return $this->search_fragment;
817  }
818 
824  function setSeparateCommands($a_val)
825  {
826  $this->separate_commands = $a_val;
827  }
828 
835  {
837  }
847  public function getCommandId()
848  {
849  return $this->ref_id;
850  }
851 
857  function setAdditionalInformation($a_val)
858  {
859  $this->additional_information = $a_val;
860  }
861 
868  {
870  }
871 
879  public function setDetailsLevel($a_level)
880  {
881  $this->details_level = $a_level;
882  }
883 
888  public function getDetailsLevel()
889  {
890  return $this->details_level;
891  }
892 
898  public function enableRepositoryTransfer($a_value)
899  {
900  $this->repository_transfer_enabled = (bool)$a_value;
901  }
902 
908  public function restrictToGoto($a_value)
909  {
910  $this->restrict_to_goto = (bool)$a_value;
911  }
912 
918  public function checkCommandAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id="")
919  {
920  global $ilAccess;
921 
922  // e.g: subitems should not be readable since their parent sesssion is readonly.
923  if($a_permission != 'visible' and $this->isVisibleOnlyForced())
924  {
925  return false;
926  }
927 
928  $cache_prefix = null;
929  if($this->context == self::CONTEXT_WORKSPACE || $this->context == self::CONTEXT_WORKSPACE_SHARING)
930  {
931  $cache_prefix = "wsp";
932  if(!$this->ws_access)
933  {
934  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
935  $this->ws_access = new ilWorkspaceAccessHandler();
936  }
937  }
938 
939  if (isset($this->access_cache[$a_permission]["-".$a_cmd][$cache_prefix.$a_ref_id]))
940  {
941  return $this->access_cache[$a_permission]["-".$a_cmd][$cache_prefix.$a_ref_id];
942  }
943 
944  if($this->context == self::CONTEXT_REPOSITORY || $this->context == self::CONTEXT_SHOP)
945  {
946  $access = $ilAccess->checkAccess($a_permission,$a_cmd,$a_ref_id,$a_type,$a_obj_id);
947  if ($ilAccess->getPreventCachingLastResult())
948  {
949  $this->prevent_access_caching = true;
950  }
951  }
952  else
953  {
954  $access = $this->ws_access->checkAccess($a_permission,$a_cmd,$a_ref_id,$a_type);
955  }
956 
957  $this->access_cache[$a_permission]["-".$a_cmd][$cache_prefix.$a_ref_id] = $access;
958  return $access;
959  }
960 
970  function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "", $a_context = self::CONTEXT_REPOSITORY)
971  {
972  $this->offline_mode = false;
973  include_once('Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php');
974  if ($this->type == "sahs") {
975  $this->offline_mode = ilObjSAHSLearningModuleAccess::_lookupUserIsOfflineMode($a_obj_id);
976  }
977  $this->access_cache = array();
978  $this->ref_id = $a_ref_id;
979  $this->obj_id = $a_obj_id;
980  $this->context = $a_context;
981  $this->setTitle($a_title);
982  $this->setDescription($a_description);
983  #$this->description = $a_description;
984 
985  // checks, whether any admin commands are included in the output
986  $this->adm_commands_included = false;
987  $this->prevent_access_caching = false;
988 
989  }
990 
1000  public function createDefaultCommand($command)
1001  {
1002  if($this->static_link_enabled)
1003  {
1004  include_once('./Services/Link/classes/class.ilLink.php');
1005  if($link = ilLink::_getStaticLink($this->ref_id,$this->type,false))
1006  {
1007  $command['link'] = $link;
1008  $command['frame'] = '_top';
1009  }
1010  }
1011  return $command;
1012  }
1013 
1014 
1027  function getCommandLink($a_cmd)
1028  {
1029  if($this->context == self::CONTEXT_REPOSITORY || $this->context == self::CONTEXT_SHOP)
1030  {
1031  // BEGIN WebDAV Get mount webfolder link.
1032  require_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1033  if ($a_cmd == 'mount_webfolder' && ilDAVActivationChecker::_isActive())
1034  {
1035  require_once ('Services/WebDAV/classes/class.ilDAVServer.php');
1036  $davServer = ilDAVServer::getInstance();
1037 
1038  // XXX: The following is a very dirty, ugly trick.
1039  // To mount URI needs to be put into two attributes:
1040  // href and folder. This hack returns both attributes
1041  // like this: http://...mount_uri..." folder="http://...folder_uri...
1042  return $davServer->getMountURI($this->ref_id).
1043  '" folder="'.$davServer->getFolderURI($this->ref_id);
1044  }
1045  // END WebDAV Get mount webfolder link.
1046 
1047  $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getCommandId());
1048  $cmd_link = $this->ctrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
1049  $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
1050  return $cmd_link;
1051 
1052  /* separate method for this line
1053  $cmd_link = $this->ctrl->getLinkTargetByClass($this->gui_class_name,
1054  $a_cmd);
1055  return $cmd_link;
1056  */
1057  }
1058  else
1059  {
1060  $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", "");
1061  $this->ctrl->setParameterByClass($this->gui_class_name, "wsp_id", $this->ref_id);
1062  return $this->ctrl->getLinkTargetByClass($this->gui_class_name, $a_cmd);
1063  }
1064  }
1065 
1066 
1076  function getCommandFrame($a_cmd)
1077  {
1078  // BEGIN WebDAV Get mount webfolder link.
1079  require_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1080  if ($a_cmd == 'mount_webfolder' && ilDAVActivationChecker::_isActive())
1081  {
1082  return '_blank';
1083  }
1084  // begin-patch fm
1085  if($a_cmd == 'fileManagerLaunch')
1086  {
1087  return '_blank';
1088  }
1089  // end-patch fm
1090  return "";
1091  }
1092 
1102  function getCommandImage($a_cmd)
1103  {
1104  return "";
1105  }
1106 
1118  public function getProperties($a_item = '')
1119  {
1120  global $objDefinition;
1121 
1122  $props = array();
1123  // please list alert properties first
1124  // example (use $lng->txt instead of "Status"/"Offline" strings):
1125  // $props[] = array("alert" => true, "property" => "Status", "value" => "Offline");
1126  // $props[] = array("alert" => false, "property" => ..., "value" => ...);
1127  // ...
1128 
1129  // #8280: WebDav is only supported in repository
1130  if($this->context == self::CONTEXT_REPOSITORY)
1131  {
1132  // BEGIN WebDAV Display locking information
1133  require_once ('Services/WebDAV/classes/class.ilDAVActivationChecker.php');
1135  {
1136  require_once ('Services/WebDAV/classes/class.ilDAVServer.php');
1137  global $ilias, $lng;
1138 
1139  // Show lock info
1140  require_once('Services/WebDAV/classes/class.ilDAVLocks.php');
1141  $davLocks = new ilDAVLocks();
1142  if ($ilias->account->getId() != ANONYMOUS_USER_ID)
1143  {
1144  $locks =& $davLocks->getLocksOnObjectObj($this->obj_id);
1145  if (count($locks) > 0)
1146  {
1147  $lockUser = new ilObjUser($locks[0]['ilias_owner']);
1148 
1149  $props[] = array(
1150  "alert" => false,
1151  "property" => $lng->txt("in_use_by"),
1152  "value" => $lockUser->getLogin(),
1153  "link" => "./ilias.php?user=".$locks[0]['ilias_owner'].'&cmd=showUserProfile&cmdClass=ilpersonaldesktopgui&cmdNode=1&baseClass=ilPersonalDesktopGUI',
1154  );
1155  }
1156  }
1157  // END WebDAV Display locking information
1158 
1159  if($this->getDetailsLevel() == self::DETAILS_SEARCH)
1160  {
1161  return $props;
1162  }
1163 
1164  // BEGIN WebDAV Display warning for invisible Unix files and files with special characters
1165  if (preg_match('/^(\\.|\\.\\.)$/', $this->title))
1166  {
1167  $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1168  "value" => $lng->txt("filename_special_filename"),
1169  'propertyNameVisible' => false);
1170  }
1171  else if (preg_match('/^\\./', $this->title))
1172  {
1173  $props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"),
1174  "value" => $lng->txt("filename_hidden_unix_file"),
1175  'propertyNameVisible' => false);
1176  }
1177  else if (preg_match('/~$/', $this->title))
1178  {
1179  $props[] = array("alert" => false, "property" => $lng->txt("filename_visibility"),
1180  "value" => $lng->txt("filename_hidden_backup_file"),
1181  'propertyNameVisible' => false);
1182  }
1183  else if (preg_match('/[\\/]/', $this->title))
1184  {
1185  $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1186  "value" => $lng->txt("filename_special_characters"),
1187  'propertyNameVisible' => false);
1188  }
1189  else if (preg_match('/[\\\\\\/:*?"<>|]/', $this->title))
1190  {
1191  $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1192  "value" => $lng->txt("filename_windows_special_characters"),
1193  'propertyNameVisible' => false);
1194  }
1195  else if (preg_match('/\\.$/', $this->title))
1196  {
1197  $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1198  "value" => $lng->txt("filename_windows_empty_extension"),
1199  'propertyNameVisible' => false);
1200  }
1201  else if (preg_match('/^(\\.|\\.\\.)$/', $this->title))
1202  {
1203  $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1204  "value" => $lng->txt("filename_special_filename"),
1205  'propertyNameVisible' => false);
1206  }
1207  else if (preg_match('/#/', $this->title))
1208  {
1209  $props[] = array("alert" => false, "property" => $lng->txt("filename_interoperability"),
1210  "value" => $lng->txt("filename_windows_webdav_issue"),
1211  'propertyNameVisible' => false);
1212  }
1213  }
1214  // END WebDAV Display warning for invisible files and files with special characters
1215 
1216  // BEGIN ChangeEvent: display changes.
1217  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1219  {
1220  global $ilias, $lng, $ilUser;
1221  if ($ilias->account->getId() != ANONYMOUS_USER_ID)
1222  {
1223  // Performance improvement: for container objects
1224  // we only display 'changed inside' events, for
1225  // leaf objects we only display 'object new/changed'
1226  // events
1227  $isContainer = in_array($this->type, array('cat', 'fold', 'crs', 'grp'));
1228  if($isContainer)
1229  {
1230  $state = ilChangeEvent::_lookupInsideChangeState($this->obj_id, $ilUser->getId());
1231  if($state > 0)
1232  {
1233  $props[] = array(
1234  "alert" => true,
1235  "value" => $lng->txt('state_changed_inside'),
1236  'propertyNameVisible' => false);
1237  }
1238  }
1239  /*
1240  * elseif(!$objDefinition->isAdministrationObject(ilObject::_lookupType($this->obj_id)))
1241  *
1242  * only files support write events properly
1243  */
1244  elseif($this->type == "file")
1245  {
1246  $state = ilChangeEvent::_lookupChangeState($this->obj_id, $ilUser->getId());
1247  if($state > 0)
1248  {
1249  $props[] = array(
1250  "alert" => true,
1251  "value" => $lng->txt(($state == 1) ? 'state_unread' : 'state_changed'),
1252  'propertyNameVisible' => false);
1253  }
1254  }
1255  }
1256  }
1257  // END ChangeEvent: display changes.
1258  }
1259 
1260  return $props;
1261  }
1262 
1266  function addCustomProperty($a_property = "", $a_value = "",
1267  $a_alert = false, $a_newline = false)
1268  {
1269  $this->cust_prop[] = array("property" => $a_property, "value" => $a_value,
1270  "alert" => $a_alert, "newline" => $a_newline);
1271  }
1272 
1276  function getCustomProperties($a_prop)
1277  {
1278  if (is_array($this->cust_prop))
1279  {
1280  foreach($this->cust_prop as $prop)
1281  {
1282  $a_prop[] = $prop;
1283  }
1284  }
1285  return $a_prop;
1286  }
1287 
1292  public function getAlertProperties()
1293  {
1294  $alert = array();
1295  foreach((array)$this->getProperties() as $prop)
1296  {
1297  if($prop['alert'] == true)
1298  {
1299  $alert[] = $prop;
1300  }
1301  }
1302  return $alert;
1303  }
1304 
1309  {
1310  $this->notice_prop = array();
1311  if($infos = $this->ldap_mapping->getInfoStrings($this->obj_id,true))
1312  {
1313  foreach($infos as $info)
1314  {
1315  $this->notice_prop[] = array('value' => $info);
1316  }
1317  }
1318  return $this->notice_prop ? $this->notice_prop : array();
1319  }
1323  public function addCustomCommand($a_link, $a_lang_var, $a_frame = "", $onclick = "")
1324  {
1325  $this->cust_commands[] =
1326  array("link" => $a_link, "lang_var" => $a_lang_var,
1327  "frame" => $a_frame, "onclick" => $onclick);
1328  }
1329 
1334  public function forceVisibleOnly($a_stat)
1335  {
1336  $this->force_visible_only = $a_stat;
1337  }
1338 
1343  public function isVisibleOnlyForced()
1344  {
1346  }
1347 
1371  public function getCommands()
1372  {
1373  global $ilAccess, $ilBench;
1374 
1375  $ref_commands = array();
1376  foreach($this->commands as $command)
1377  {
1378  $permission = $command["permission"];
1379  $cmd = $command["cmd"];
1380  $lang_var = $command["lang_var"];
1381  $txt = "";
1382  $info_object = null;
1383 
1384  if (isset($command["txt"]))
1385  {
1386  $txt = $command["txt"];
1387  }
1388 
1389  // BEGIN WebDAV: Suppress commands that don't make sense for anonymous users.
1390  // Suppress commands that don't make sense for anonymous users
1391  global $ilias;
1392  if ($ilias->account->getId() == ANONYMOUS_USER_ID &&
1393  $command['enable_anonymous'] == 'false')
1394  {
1395  continue;
1396  }
1397  // END WebDAV: Suppress commands that don't make sense for anonymous users.
1398 
1399  // all access checking should be made within $ilAccess and
1400  // the checkAccess of the ilObj...Access classes
1401  $ilBench->start("ilObjectListGUI", "4110_get_commands_check_access");
1402  //$access = $ilAccess->checkAccess($permission, $cmd, $this->ref_id, $this->type);
1403  $access = $this->checkCommandAccess($permission,$cmd,$this->ref_id,$this->type);
1404  $ilBench->stop("ilObjectListGUI", "4110_get_commands_check_access");
1405 
1406  if ($access)
1407  {
1408  $cmd_link = $this->getCommandLink($command["cmd"]);
1409  $cmd_frame = $this->getCommandFrame($command["cmd"]);
1410  $cmd_image = $this->getCommandImage($command["cmd"]);
1411  $access_granted = true;
1412  }
1413  else
1414  {
1415  $access_granted = false;
1416  $info_object = $ilAccess->getInfo();
1417  }
1418 
1419  if (!isset($command["default"]))
1420  {
1421  $command["default"] = "";
1422  }
1423  $ref_commands[] = array(
1424  "permission" => $permission,
1425  "cmd" => $cmd,
1426  "link" => $cmd_link,
1427  "frame" => $cmd_frame,
1428  "lang_var" => $lang_var,
1429  "txt" => $txt,
1430  "granted" => $access_granted,
1431  "access_info" => $info_object,
1432  "img" => $cmd_image,
1433  "default" => $command["default"]
1434  );
1435  }
1436 
1437  return $ref_commands;
1438  }
1439 
1440  // BEGIN WebDAV: Visualize object state in its icon.
1448  public function getIconImageType()
1449  {
1450  if ($this->type == "sahs" && $this->offline_mode) {
1451  return $this->type . "_offline";
1452  }
1453  return $this->type;
1454  }
1455  // END WebDAV: Visualize object state in its icon.
1456 
1464  public function insertTitle()
1465  {
1466  if($this->restrict_to_goto)
1467  {
1468  $this->default_command = array("frame" => "",
1469  "link" => $this->buildGotoLink());
1470  }
1471 
1472  if (!$this->default_command || (!$this->getCommandsStatus() && !$this->restrict_to_goto))
1473  {
1474  $this->tpl->setCurrentBlock("item_title");
1475  $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
1476  $this->tpl->parseCurrentBlock();
1477  }
1478  else
1479  {
1480  $this->default_command["link"] =
1481  $this->modifySAHSlaunch($this->default_command["link"],$this->default_command["frame"]);
1482 
1483  if ($this->default_command["frame"] != "")
1484  {
1485  $this->tpl->setCurrentBlock("title_linked_frame");
1486  $this->tpl->setVariable("TARGET_TITLE_LINKED", $this->default_command["frame"]);
1487  $this->tpl->parseCurrentBlock();
1488  }
1489 
1490  // workaround for repository frameset
1491  #var_dump("<pre>",$this->default_command['link'],"</pre>");
1492  $this->default_command["link"] =
1493  $this->appendRepositoryFrameParameter($this->default_command["link"]);
1494 
1495  #var_dump("<pre>",$this->default_command['link'],"</pre>");
1496 
1497 
1498  // the default command is linked with the title
1499  $this->tpl->setCurrentBlock("item_title_linked");
1500  $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
1501  $this->tpl->setVariable("HREF_TITLE_LINKED", $this->default_command["link"]);
1502 
1503  // has preview?
1504  include_once("./Services/Preview/classes/class.ilPreview.php");
1505  if (ilPreview::hasPreview($this->obj_id, $this->type))
1506  {
1507  include_once("./Services/Preview/classes/class.ilPreviewGUI.php");
1508 
1509  // get context for access checks later on
1510  $access_handler = null;
1511  $context;
1512  switch ($this->context)
1513  {
1514  case self::CONTEXT_WORKSPACE:
1515  case self::CONTEXT_WORKSPACE_SHARING:
1517  include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php");
1518  $access_handler = new ilWorkspaceAccessHandler();
1519  break;
1520 
1521  default:
1522  global $ilAccess;
1524  $access_handler = $ilAccess;
1525  break;
1526  }
1527 
1528  $preview = new ilPreviewGUI($this->ref_id, $context, $this->obj_id, $access_handler);
1529  $preview_status = ilPreview::lookupRenderStatus($this->obj_id);
1530  $preview_status_class = "";
1531  $preview_text_topic = "preview_show";
1532  if ($preview_status == ilPreview::RENDER_STATUS_NONE)
1533  {
1534  $preview_status_class = "ilPreviewStatusNone";
1535  $preview_text_topic = "preview_none";
1536  }
1537  $this->tpl->setCurrentBlock("item_title_linked");
1538  $this->tpl->setVariable("PREVIEW_STATUS_CLASS", $preview_status_class);
1539  $this->tpl->setVariable("SRC_PREVIEW_ICON", ilUtil::getImagePath("preview.png", "Services/Preview"));
1540  $this->tpl->setVariable("TXT_PREVIEW", $this->lng->txt($preview_text_topic));
1541  $this->tpl->setVariable("SCRIPT_PREVIEW_CLICK", $preview->getJSCall($this->getUniqueItemId(true)));
1542  $this->tpl->parseCurrentBlock();
1543  }
1544 
1545  $this->tpl->parseCurrentBlock();
1546  }
1547 
1548  if ($this->bold_title == true)
1549  {
1550  $this->tpl->touchBlock('bold_title_start');
1551  $this->tpl->touchBlock('bold_title_end');
1552  }
1553  }
1554 
1555  protected function buildGotoLink()
1556  {
1557  switch($this->context)
1558  {
1559  case self::CONTEXT_WORKSPACE_SHARING:
1560  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
1561  return ilWorkspaceAccessHandler::getGotoLink($this->ref_id, $this->obj_id);
1562 
1563  default:
1564  // not implemented yet
1565  break;
1566  }
1567  }
1568 
1575  public function insertSubstitutions()
1576  {
1577  $fields_shown = false;
1578  foreach($this->substitutions->getParsedSubstitutions($this->ref_id,$this->obj_id) as $data)
1579  {
1580  if($data['bold'])
1581  {
1582  $data['name'] = '<strong>'.$data['name'].'</strong>';
1583  $data['value'] = '<strong>'.$data['value'].'</strong>';
1584  }
1585  $this->tpl->touchBlock("std_prop");
1586  $this->tpl->setCurrentBlock('item_property');
1587  if($data['show_field'])
1588  {
1589  $this->tpl->setVariable('TXT_PROP',$data['name']);
1590  }
1591  $this->tpl->setVariable('VAL_PROP',$data['value']);
1592  $this->tpl->parseCurrentBlock();
1593 
1594  if($data['newline'])
1595  {
1596  $this->tpl->touchBlock('newline_prop');
1597  }
1598  $fields_shown = false;
1599 
1600  }
1601  if($fields_shown)
1602  {
1603  $this->tpl->touchBlock('newline_prop');
1604  }
1605  }
1606 
1607 
1616  {
1617  if($this->getSubstitutionStatus())
1618  {
1619  $this->insertSubstitutions();
1620  if(!$this->substitutions->isDescriptionEnabled())
1621  {
1622  return true;
1623  }
1624  }
1625 
1626  $this->tpl->setCurrentBlock("item_description");
1627  $this->tpl->setVariable("TXT_DESC", $this->getDescription());
1628  $this->tpl->parseCurrentBlock();
1629  }
1630 
1635  public function insertSearchFragment()
1636  {
1637  if(strlen($this->getSearchFragment()))
1638  {
1639  $this->tpl->setCurrentBlock('search_fragment');
1640  $this->tpl->setVariable('TXT_SEARCH_FRAGMENT',$this->getSearchFragment().' ...');
1641  $this->tpl->parseCurrentBlock();
1642  }
1643  }
1644 
1650  public function insertRelevance()
1651  {
1652  global $lng;
1653 
1654  if(!$this->enabledRelevance() or !(int) $this->getRelevance())
1655  {
1656  return false;
1657  }
1658 
1659  $width1 = (int) $this->getRelevance();
1660  $width2 = (int) (100 - $width1);
1661 
1662  $this->tpl->setCurrentBlock('relevance');
1663  #$this->tpl->setVariable('TXT_RELEVANCE',$lng->txt('search_relevance'));
1664  $this->tpl->setVariable('VAL_REL',sprintf("%.02f %%",$this->getRelevance()));
1665  $this->tpl->setVariable('WIDTH_A',$width1);
1666  $this->tpl->setVariable('WIDTH_B',$width2);
1667  $this->tpl->setVariable('IMG_A',ilUtil::getImagePath("relevance_blue.png"));
1668  $this->tpl->setVariable('IMG_B',ilUtil::getImagePath("relevance_dark.png"));
1669  $this->tpl->parseCurrentBlock();
1670 
1671  }
1672 
1678  function setMode($a_mode)
1679  {
1680  $this->mode = $a_mode;
1681  }
1682 
1688  function getMode()
1689  {
1690  return $this->mode;
1691  }
1692 
1696  function setConditionDepth($a_depth)
1697  {
1698  $this->condition_depth = $a_depth;
1699  }
1700 
1708  function isMode($a_mode)
1709  {
1710  if ($a_mode == $this->mode)
1711  {
1712  return true;
1713  }
1714  else
1715  {
1716  return false;
1717  }
1718  }
1719 
1725  function insertProperties($a_item = '')
1726  {
1727  global $ilAccess, $lng, $ilUser;
1728 
1729  $props = $this->getProperties($a_item);
1730  $props = $this->getCustomProperties($props);
1731 
1732  if($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING)
1733  {
1734  // add learning progress custom property
1735  include_once "Services/Tracking/classes/class.ilLPStatus.php";
1736  $lp = ilLPStatus::getListGUIStatus($this->obj_id);
1737  if($lp)
1738  {
1739  $props[] = array("alert" => false,
1740  "property" => $lng->txt("learning_progress"),
1741  "value" => $lp,
1742  "newline" => true);
1743  }
1744 
1745  // add no item access note in public section
1746  // for items that are visible but not readable
1747  if ($this->ilias->account->getId() == ANONYMOUS_USER_ID)
1748  {
1749  if (!$ilAccess->checkAccess("read", "", $this->ref_id, $this->type, $this->obj_id))
1750  {
1751  $props[] = array("alert" => true,
1752  "value" => $lng->txt("no_access_item_public"),
1753  "newline" => true);
1754  }
1755  }
1756  }
1757 
1758  // reference objects have translated ids, revert to originals
1759  $note_ref_id = $this->ref_id;
1760  $note_obj_id = $this->obj_id;
1761  if($this->reference_ref_id)
1762  {
1763  $note_ref_id = $this->reference_ref_id;
1764  $note_obj_id = $this->reference_obj_id;
1765  }
1766 
1767  $redraw_js = "il.Object.redrawListItem(".$note_ref_id.");";
1768 
1769  // add common properties (comments, notes, tags)
1770  if ((self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] > 0 ||
1771  self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] > 0 ||
1772  self::$cnt_tags[$note_obj_id] > 0) &&
1773  ($ilUser->getId() != ANONYMOUS_USER_ID))
1774  {
1775  include_once("./Services/Notes/classes/class.ilNoteGUI.php");
1776  include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
1777 
1778  $nl = true;
1779  if ($this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, false, false)
1780  && self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC] > 0)
1781  {
1782  $props[] = array("alert" => false,
1783  "property" => $lng->txt("notes_comments"),
1784  "value" => "<a href='#' onclick=\"return ".
1785  ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js)."\">".
1786  self::$cnt_notes[$note_obj_id][IL_NOTE_PUBLIC]."</a>",
1787  "newline" => $nl);
1788  $nl = false;
1789  }
1790 
1791  if ($this->notes_enabled && self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE] > 0)
1792  {
1793  $props[] = array("alert" => false,
1794  "property" => $lng->txt("notes"),
1795  "value" => "<a href='#' onclick=\"return ".
1796  ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js)."\">".
1797  self::$cnt_notes[$note_obj_id][IL_NOTE_PRIVATE]."</a>",
1798  "newline" => $nl);
1799  $nl = false;
1800  }
1801  if ($this->tags_enabled && self::$cnt_tags[$note_obj_id] > 0)
1802  {
1803  $tags_set = new ilSetting("tags");
1804  if ($tags_set->get("enable"))
1805  {
1806  $props[] = array("alert" => false,
1807  "property" => $lng->txt("tagging_tags"),
1808  "value" => "<a href='#' onclick=\"return ".
1809  ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js)."\">".
1810  self::$cnt_tags[$note_obj_id]."</a>",
1811  "newline" => $nl);
1812  $nl = false;
1813  }
1814  }
1815  }
1816 
1817  $cnt = 1;
1818  if (is_array($props) && count($props) > 0)
1819  {
1820  foreach($props as $prop)
1821  {
1822  // BEGIN WebDAV: Display a separator between properties.
1823  if ($cnt > 1)
1824  {
1825  $this->tpl->touchBlock("separator_prop");
1826  }
1827  // END WebDAV: Display a separator between properties.
1828 
1829  if ($prop["alert"] == true)
1830  {
1831  $this->tpl->touchBlock("alert_prop");
1832  }
1833  else
1834  {
1835  $this->tpl->touchBlock("std_prop");
1836  }
1837  if ($prop["newline"] == true && $cnt > 1)
1838  {
1839  $this->tpl->touchBlock("newline_prop");
1840  }
1841  //BEGIN WebDAV: Support hidden property names.
1842  if (isset($prop["property"]) && $prop['propertyNameVisible'] !== false)
1843  //END WebDAV: Support hidden property names.
1844  {
1845  $this->tpl->setCurrentBlock("prop_name");
1846  $this->tpl->setVariable("TXT_PROP", $prop["property"]);
1847  $this->tpl->parseCurrentBlock();
1848  }
1849  $this->tpl->setCurrentBlock("item_property");
1850  //BEGIN WebDAV: Support links in property values.
1851  if ($prop['link'])
1852  {
1853  $this->tpl->setVariable("LINK_PROP", $prop['link']);
1854  $this->tpl->setVariable("LINK_VAL_PROP", $prop["value"]);
1855  }
1856  else
1857  {
1858  $this->tpl->setVariable("VAL_PROP", $prop["value"]);
1859  }
1860  //END WebDAV: Support links in property values.
1861  $this->tpl->parseCurrentBlock();
1862 
1863  $cnt++;
1864  }
1865  $this->tpl->setCurrentBlock("item_properties");
1866  $this->tpl->parseCurrentBlock();
1867  }
1868  }
1869 
1871  {
1872  $this->getNoticeProperties();
1873  foreach($this->notice_prop as $property)
1874  {
1875  $this->tpl->setCurrentBlock('notice_item');
1876  $this->tpl->setVariable('NOTICE_ITEM_VALUE',$property['value']);
1877  $this->tpl->parseCurrentBlock();
1878  }
1879  $this->tpl->setCurrentBlock('notice_property');
1880  $this->tpl->parseCurrentBlock();
1881  }
1882 
1883 
1889  function insertPayment()
1890  {
1891  global $ilAccess,$ilObjDataCache,$ilUser;
1892 
1893  if(IS_PAYMENT_ENABLED && $this->payment_enabled)
1894  {
1895  include_once './Services/Payment/classes/class.ilPaymentObject.php';
1896  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
1897 
1898  if(ilPaymentobject::_requiresPurchaseToAccess($this->ref_id))
1899  {
1900  if(ilPaymentBookings::_hasAccess(ilPaymentObject::_lookupPobjectId($a_ref_id), $ilUser->getId()))
1901  {
1902  // get additional information about order_date and duration
1903 
1904  $order_infos = array();
1906 
1907  if(count($order_infos) > 0)
1908  {
1909  global $lng;
1910  $pay_lang = $lng;
1911  $pay_lang->loadLanguageModule('payment');
1912  $alert = true;
1913  $a_newline = true;
1914  $a_property = $pay_lang->txt('object_purchased_date');
1915  $a_value = ilDatePresentation::formatDate(new ilDateTime($order_infos["order_date"],IL_CAL_UNIX));
1916 
1917  $this->addCustomProperty($a_property, $a_value, $alert, $a_newline);
1918 
1919  $alert = true;
1920  $a_newline = true;
1921  $a_property = $this->lng->txt('object_duration');
1922  if($order_infos['duration'] == 0)
1923  $a_value = $pay_lang->txt('unlimited_duration');
1924  else
1925  $a_value = $order_infos['duration'] .' '.$this->lng->txt('months');
1926  $this->addCustomProperty($a_property, $a_value, $alert, $a_newline);
1927  }
1928 
1929  // check for extension prices
1930  if(ilPaymentObject::_hasExtensions($this->ref_id))
1931  {
1932  $has_extension_prices = true;
1933  $this->insertPaymentCommand($has_extension_prices);
1934  }
1935 
1936  }
1937  else
1938  {
1939  // only relevant and needed for the shop content page
1940 
1941  $this->ctpl = new ilTemplate("tpl.container_list_item_commands.html", true, true,
1942  "Services/Container", "DEFAULT", false, true);
1943  $this->ctpl->setCurrentBlock('payment');
1944  $this->ctpl->setVariable('PAYMENT_TYPE_IMG', ilUtil::getImagePath('icon_pays.png'));
1945  $this->ctpl->setVariable('PAYMENT_ALT_IMG', $this->lng->txt('payment_system') . ': ' . $this->lng->txt('payment_buyable'));
1946  $this->ctpl->parseCurrentBlock();
1947 
1948  $this->insertPaymentCommand();
1949  }
1950  }
1951  }
1952  }
1953 
1954  protected function insertPaymentCommand($has_extension_prices = false)
1955  {
1956  $commands = $this->getCommands($this->ref_id, $this->obj_id);
1957  foreach($commands as $command)
1958  {
1959  if($command['default'] === true)
1960  {
1961  $command = $this->createDefaultCommand($command);
1962 // if(is_null($command['link']) )
1963 // {
1964  switch($this->type)
1965  {
1966  case 'sahs':
1967  $command['link'] = 'ilias.php?baseClass=ilSAHSPresentationGUI&ref_id='.$this->ref_id;
1968  break;
1969 
1970  case 'lm':
1971  $command['link'] = 'ilias.php?baseClass=ilLMPresentationGUI&ref_id='.$this->ref_id;
1972  break;
1973  case 'exc':
1974  default:
1975  $command['link'] = 'ilias.php?baseClass=ilShopController&cmdClass=ilshoppurchasegui&ref_id='.$this->ref_id;
1976  break;
1977  }
1978 // }
1979 
1980  $type = $this->type;
1981  if(strpos($command['link'], '_'.$type.'_') !== false)
1982  {
1983  $demo_link = str_replace('_'.$type.'_', '_'.$type.'purchasetypedemo_', $command['link']);
1984  $buy_link = str_replace('_'.$type.'_', '_'.$type.'purchasetypebuy_', $command['link']);
1985  }
1986  else
1987  {
1988  $demo_link = $command['link'].(strpos($command['link'], '?') === false ? '?' : '&').'purchasetype=demo';
1989  $buy_link = $command['link'].(strpos($command['link'], '?') === false ? '?' : '&').'purchasetype=buy';
1990  }
1991 
1992  $this->current_selection_list->addItem($this->lng->txt('payment_demo'), "", $demo_link, $a_img, $this->lng->txt('payment_demo'), $command['frame']);
1993  if($has_extension_prices == true)
1994  {
1995  $this->current_selection_list->addItem($this->lng->txt('buy_extension'), "", $buy_link, $a_img, $this->lng->txt('buy_extension'), $command['frame']);
1996  }
1997  else
1998  $this->current_selection_list->addItem($this->lng->txt('buy'), "", $buy_link, $a_img, $this->lng->txt('buy'), $command['frame']);
1999 
2000  }
2001  }
2002  }
2003 
2004  protected function parseConditions($toggle_id,$conditions,$obligatory = true)
2005  {
2006  global $ilAccess, $lng, $objDefinition,$tree;
2007 
2008  $num_required = ilConditionHandler::calculateRequiredTriggers($this->ref_id, $this->obj_id);
2009  $num_optional_required =
2010  $num_required - count($conditions) + count(ilConditionHandler::getOptionalConditionsOfTarget($this->ref_id, $this->obj_id));
2011 
2012  // Check if all conditions are fullfilled
2013  $visible_conditions = array();
2014  $passed_optional = 0;
2015  foreach($conditions as $condition)
2016  {
2017  if($obligatory and !$condition['obligatory'])
2018  {
2019  continue;
2020  }
2021  if(!$obligatory and $condition['obligatory'])
2022  {
2023  continue;
2024  }
2025 
2026  if($tree->isDeleted($condition['trigger_ref_id']))
2027  {
2028  continue;
2029  }
2030 
2031  include_once 'Services/Container/classes/class.ilMemberViewSettings.php';
2032  $ok = ilConditionHandler::_checkCondition($condition['id']) and
2033  !ilMemberViewSettings::getInstance()->isActive();
2034 
2035  if(!$ok)
2036  {
2037  $visible_conditions[] = $condition['id'];
2038  }
2039 
2040  if(!$obligatory and $ok)
2041  {
2042  ++$passed_optional;
2043  // optional passed
2044  if($passed_optional >= $num_optional_required)
2045  {
2046  return true;
2047  }
2048  }
2049  }
2050 
2051  foreach($conditions as $condition)
2052  {
2053  if(!in_array($condition['id'], $visible_conditions))
2054  {
2055  continue;
2056  }
2057 
2058  $cond_txt = $lng->txt("condition_".$condition["operator"])." ".
2059  $condition["value"];
2060 
2061  // display trigger item
2062  $class = $objDefinition->getClassName($condition["trigger_type"]);
2063  $location = $objDefinition->getLocation($condition["trigger_type"]);
2064  if ($class == "" && $location == "")
2065  {
2066  continue;
2067  }
2068  $missing_cond_exist = true;
2069 
2070  $full_class = "ilObj".$class."ListGUI";
2071  include_once($location."/class.".$full_class.".php");
2072  $item_list_gui = new $full_class($this);
2073  $item_list_gui->setMode(IL_LIST_AS_TRIGGER);
2074  $item_list_gui->enablePath(false);
2075  $item_list_gui->enableIcon(true);
2076  $item_list_gui->setConditionDepth($this->condition_depth + 1);
2077  $item_list_gui->setParentRefId($this->getUniqueItemId()); // yes we can
2078  $item_list_gui->addCustomProperty($this->lng->txt("precondition_required_itemlist"), $cond_txt, false, true);
2079  $trigger_html = $item_list_gui->getListItemHTML($condition['trigger_ref_id'],
2080  $condition['trigger_obj_id'], ilObject::_lookupTitle($condition["trigger_obj_id"]),
2081  "");
2082  $this->tpl->setCurrentBlock("precondition");
2083  if ($trigger_html == "")
2084  {
2085  $trigger_html = $this->lng->txt("precondition_not_accessible");
2086  }
2087  $this->tpl->setVariable("TXT_CONDITION", trim($cond_txt));
2088  $this->tpl->setVariable("TRIGGER_ITEM", $trigger_html);
2089  $this->tpl->parseCurrentBlock();
2090  }
2091 
2092  if ($missing_cond_exist and $obligatory)
2093  {
2094  $this->tpl->setCurrentBlock("preconditions");
2095  $this->tpl->setVariable("CONDITION_TOGGLE_ID", "_obl_".$toggle_id);
2096  $this->tpl->setVariable("TXT_PRECONDITIONS", $lng->txt("preconditions_obligatory_hint"));
2097  $this->tpl->parseCurrentBlock();
2098 
2099  }
2100  elseif($missing_cond_exist and !$obligatory)
2101  {
2102  $this->tpl->setCurrentBlock("preconditions");
2103  $this->tpl->setVariable("CONDITION_TOGGLE_ID", "_opt_".$toggle_id);
2104  $this->tpl->setVariable("TXT_PRECONDITIONS", sprintf($lng->txt("preconditions_optional_hint"),$num_optional_required));
2105  $this->tpl->parseCurrentBlock();
2106  }
2107 
2108  return !$missing_cond_exist;
2109  }
2110 
2115  {
2116  global $ilAccess, $lng, $objDefinition,$tree;
2117 
2118  include_once("./Services/AccessControl/classes/class.ilConditionHandler.php");
2119 
2120  $missing_cond_exist = false;
2121 
2122  // do not show multi level conditions (messes up layout)
2123  if ($this->condition_depth > 0)
2124  {
2125  return;
2126  }
2127 
2128  // Sort by title
2129  /*
2130  foreach(ilConditionHandler::_getConditionsOfTarget($this->ref_id, $this->obj_id) as $condition)
2131  {
2132  $condition['title'] = ilObject::_lookupTitle($condition['trigger_obj_id']);
2133  }
2134  */
2135 
2136  $conditions = ilConditionHandler::_getConditionsOfTarget($this->ref_id, $this->obj_id);
2137  if(sizeof($conditions))
2138  {
2139  for($i = 0; $i < count($conditions); $i++)
2140  {
2141  $conditions[$i]['title'] = ilObject::_lookupTitle($conditions[$i]['trigger_obj_id']);
2142  }
2143  $conditions = ilUtil::sortArray($conditions,'title','DESC');
2144 
2145  $div_id = $this->getUniqueItemId();
2146 
2147  // Show obligatory and optional preconditions seperated
2148  $all_done_obl = $this->parseConditions($div_id,$conditions,true);
2149  $all_done_opt = $this->parseConditions($div_id,$conditions,false);
2150 
2151  if(!$all_done_obl || !$all_done_opt)
2152  {
2153  $this->tpl->setCurrentBlock("preconditions_toggle");
2154  $this->tpl->setVariable("PRECONDITION_TOGGLE_INTRO", $this->lng->txt("precondition_toggle"));
2155  $this->tpl->setVariable("PRECONDITION_TOGGLE_TRIGGER", $this->lng->txt("show"));
2156  $this->tpl->setVariable("PRECONDITION_TOGGLE_ID", $div_id);
2157  $this->tpl->setVariable("TXT_PRECONDITION_SHOW", $this->lng->txt("show"));
2158  $this->tpl->setVariable("TXT_PRECONDITION_HIDE", $this->lng->txt("hide"));
2159  $this->tpl->parseCurrentBlock();
2160  }
2161  }
2162  }
2163 
2172  function insertCommand($a_href, $a_text, $a_frame = "", $a_img = "", $a_cmd = "", $a_onclick = "")
2173  {
2174  // #11099
2175  $chksum = md5($a_href.$a_text);
2176  if($a_href == "#" ||
2177  !in_array($chksum, $this->prevent_duplicate_commands))
2178  {
2179  if($a_href != "#")
2180  {
2181  $this->prevent_duplicate_commands[] = $chksum;
2182  }
2183 
2184  $prevent_background_click = false;
2185  if ($a_cmd =='mount_webfolder')
2186  {
2187  $prevent_background_click = true;
2188  }
2189  $this->current_selection_list->addItem($a_text, "", $a_href, $a_img, $a_text, $a_frame,
2190  "", $prevent_background_click, $a_onclick);
2191  }
2192  }
2193 
2202  {
2203  if ($this->std_cmd_only)
2204  {
2205  return;
2206  }
2207 
2208  if(is_object($this->getContainerObject()) and
2210  {
2211  if($this->checkCommandAccess('delete','',$this->ref_id,$this->type))
2212  {
2213  $this->ctrl->setParameter($this->getContainerObject(),'item_ref_id',$this->getCommandId());
2214  $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "delete");
2215  $this->insertCommand($cmd_link, $this->lng->txt("delete"));
2216  $this->adm_commands_included = true;
2217  return true;
2218  }
2219  return false;
2220  }
2221 
2222  if($this->checkCommandAccess('delete','',$this->ref_id,$this->type))
2223  {
2224  $this->ctrl->setParameter($this->container_obj, "ref_id",
2225  $this->container_obj->object->getRefId());
2226  $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2227  $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "delete");
2228  $this->insertCommand($cmd_link, $this->lng->txt("delete"), "",
2229  ilUtil::getImagePath("cmd_delete_s.png"));
2230  $this->adm_commands_included = true;
2231  }
2232  }
2233 
2242  {
2243  global $ilAccess;
2244 
2245  if ($this->std_cmd_only)
2246  {
2247  return;
2248  }
2249  // BEGIN PATCH Lucene search
2250 
2251  if(is_object($this->getContainerObject()) and
2253  {
2254  global $objDefinition;
2255 
2256  if($this->checkCommandAccess('delete','',$this->ref_id,$this->type) and
2257  $objDefinition->allowLink(ilObject::_lookupType($this->obj_id)))
2258  {
2259  $this->ctrl->setParameter($this->getContainerObject(),'item_ref_id',$this->getCommandId());
2260  $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "link");
2261  $this->insertCommand($cmd_link, $this->lng->txt("link"));
2262  $this->adm_commands_included = true;
2263  return true;
2264  }
2265  return false;
2266  }
2267  // END PATCH Lucene Search
2268 
2269  // if the permission is changed here, it has
2270  // also to be changed in ilContainerGUI, admin command check
2271  if($this->checkCommandAccess('delete','',$this->ref_id,$this->type))
2272  {
2273  $this->ctrl->setParameter($this->container_obj, "ref_id",
2274  $this->container_obj->object->getRefId());
2275  $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2276  $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "link");
2277  $this->insertCommand($cmd_link, $this->lng->txt("link"), "",
2278  ilUtil::getImagePath("cmd_link_s.png"));
2279  $this->adm_commands_included = true;
2280  }
2281  }
2282 
2289  function insertCutCommand($a_to_repository = false)
2290  {
2291  global $ilAccess;
2292 
2293  if ($this->std_cmd_only)
2294  {
2295  return;
2296  }
2297  // BEGIN PATCH Lucene search
2298  if(is_object($this->getContainerObject()) and
2300  {
2301  if($this->checkCommandAccess('delete','',$this->ref_id,$this->type))
2302  {
2303  $this->ctrl->setParameter($this->getContainerObject(),'item_ref_id',$this->getCommandId());
2304  $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "cut");
2305  $this->insertCommand($cmd_link, $this->lng->txt("move"));
2306  $this->adm_commands_included = true;
2307  return true;
2308  }
2309  return false;
2310  }
2311  // END PATCH Lucene Search
2312 
2313  // if the permission is changed here, it has
2314  // also to be changed in ilContainerContentGUI, determineAdminCommands
2315  if($this->checkCommandAccess('delete','',$this->ref_id,$this->type) &&
2316  $this->container_obj->object)
2317  {
2318  $this->ctrl->setParameter($this->container_obj, "ref_id",
2319  $this->container_obj->object->getRefId());
2320  $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2321 
2322  if(!$a_to_repository)
2323  {
2324  $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "cut");
2325  $this->insertCommand($cmd_link, $this->lng->txt("move"), "",
2326  ilUtil::getImagePath("cmd_move_s.png"));
2327  }
2328  else
2329  {
2330  $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "cut_for_repository");
2331  $this->insertCommand($cmd_link, $this->lng->txt("wsp_move_to_repository"), "",
2332  ilUtil::getImagePath("cmd_move_s.png"));
2333  }
2334 
2335  $this->adm_commands_included = true;
2336  }
2337  }
2338 
2344  public function insertCopyCommand($a_to_repository = false)
2345  {
2346  if($this->std_cmd_only)
2347  {
2348  return;
2349  }
2350 
2351  if($this->checkCommandAccess('copy', 'copy', $this->ref_id, $this->type))
2352  {
2353  if($this->context != self::CONTEXT_WORKSPACE && $this->context != self::CONTEXT_WORKSPACE_SHARING)
2354  {
2355  $this->ctrl->setParameterByClass('ilobjectcopygui','source_id',$this->getCommandId());
2356  $cmd_copy = $this->ctrl->getLinkTargetByClass('ilobjectcopygui','initTargetSelection');
2357  $this->insertCommand($cmd_copy, $this->lng->txt('copy'));
2358  }
2359  else
2360  {
2361  $this->ctrl->setParameter($this->container_obj, "ref_id",
2362  $this->container_obj->object->getRefId());
2363  $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2364 
2365  if(!$a_to_repository)
2366  {
2367  $cmd_copy = $this->ctrl->getLinkTarget($this->container_obj, 'copy');
2368  $this->insertCommand($cmd_copy, $this->lng->txt('copy'));
2369  }
2370  else
2371  {
2372  $cmd_copy = $this->ctrl->getLinkTarget($this->container_obj, 'copy_to_repository');
2373  $this->insertCommand($cmd_copy, $this->lng->txt('wsp_copy_to_repository'));
2374  }
2375  }
2376 
2377  $this->adm_commands_included = true;
2378  }
2379  return;
2380  }
2381 
2382 
2387  {
2388  global $ilAccess, $objDefinition;
2389 
2390  if ($this->std_cmd_only)
2391  {
2392  return;
2393  }
2394 
2395  if(!$objDefinition->isContainer(ilObject::_lookupType($this->obj_id)))
2396  {
2397  return false;
2398  }
2399 
2400  if(is_object($this->getContainerObject()) and
2401  $this->getContainerObject() instanceof ilAdministrationCommandHandling and
2402  isset($_SESSION['clipboard']))
2403  {
2404  $this->ctrl->setParameter($this->getContainerObject(),'item_ref_id',$this->getCommandId());
2405  $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), "paste");
2406  $this->insertCommand($cmd_link, $this->lng->txt("paste"));
2407  $this->adm_commands_included = true;
2408  return true;
2409  }
2410  return false;
2411  }
2412 
2421  {
2422  global $ilSetting, $ilUser;
2423 
2424  if ($this->std_cmd_only)
2425  {
2426  return;
2427  }
2428 
2429  if((int)$ilSetting->get('disable_my_offers'))
2430  {
2431  return;
2432  }
2433 
2435 
2436  if ($ilUser->getId() != ANONYMOUS_USER_ID)
2437  {
2438  // BEGIN WebDAV: Lock/Unlock objects
2439  /* This code section is temporarily commented out.
2440  I will reactivate it at a later point, when I get the
2441  the backend working properly. - Werner Randelshofer 2008-04-17
2442  if (is_object($this->container_obj) && $this->rbacsystem->checkAccess("write", $this->ref_id))
2443  {
2444  require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
2445  if (ilDAVServer::_isActive() && ilDAVServer::_isActionsVisible())
2446  {
2447  $this->ctrl->setParameter($this->container_obj, "ref_id",
2448  $this->container_obj->object->getRefId());
2449  $this->ctrl->setParameter($this->container_obj, "type", $this->type);
2450  $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->ref_id);
2451  $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "lock");
2452  $this->insertCommand($cmd_link, $this->lng->txt("lock"));
2453 
2454  $this->ctrl->setParameter($this->container_obj, "ref_id",
2455  $this->container_obj->object->getRefId());
2456  $this->ctrl->setParameter($this->container_obj, "type", $this->type);
2457  $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->ref_id);
2458  $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "unlock");
2459  $this->insertCommand($cmd_link, $this->lng->txt("unlock"));
2460  }
2461  }
2462  */
2463  // END WebDAV: Lock/Unlock objects
2464 
2465  if (!$ilUser->isDesktopItem($this->getCommandId(), $type))
2466  {
2467  // Pass type and object ID to ilAccess to improve performance
2468  global $ilAccess;
2469  if ($this->checkCommandAccess("read", "", $this->ref_id, $this->type, $this->obj_id))
2470  {
2471  if($this->getContainerObject() instanceof ilDesktopItemHandling)
2472  {
2473  $this->ctrl->setParameter($this->container_obj, "type", $type);
2474  $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2475  $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "addToDesk");
2476  $this->insertCommand($cmd_link, $this->lng->txt("to_desktop"), "",
2477  ilUtil::getImagePath("cmd_pd_put_s.png"));
2478  }
2479  }
2480  }
2481  else
2482  {
2483  if ($this->getContainerObject() instanceof ilDesktopItemHandling)
2484  {
2485  $this->ctrl->setParameter($this->container_obj, "type", $type);
2486  $this->ctrl->setParameter($this->container_obj, "item_ref_id", $this->getCommandId());
2487  $cmd_link = $this->ctrl->getLinkTarget($this->container_obj, "removeFromDesk");
2488  $this->insertCommand($cmd_link, $this->lng->txt("unsubscribe"), "",
2489  ilUtil::getImagePath("cmd_pd_rem_s.png"));
2490  }
2491  }
2492  }
2493  }
2494 
2499  {
2500  if ($this->std_cmd_only)
2501  {
2502  return;
2503  }
2504  $cmd_link = $this->getCommandLink("infoScreen");
2505  $cmd_frame = $this->getCommandFrame("infoScreen");
2506  $this->insertCommand($cmd_link, $this->lng->txt("info_short"), $cmd_frame,
2507  ilUtil::getImagePath("cmd_info_s.png"));
2508  }
2509 
2516  function insertCommonSocialCommands($a_header_actions = false)
2517  {
2518  global $ilSetting, $lng, $ilUser, $tpl;
2519 
2520  if ($this->std_cmd_only ||
2521  ($ilUser->getId() == ANONYMOUS_USER_ID))
2522  {
2523  return;
2524  }
2525  $lng->loadLanguageModule("notes");
2526  $lng->loadLanguageModule("tagging");
2527  $cmd_link = $this->getCommandLink("infoScreen")."#notes_top";
2528  $cmd_tag_link = $this->getCommandLink("infoScreen");
2529  $cmd_frame = $this->getCommandFrame("infoScreen");
2530  include_once("./Services/Notes/classes/class.ilNoteGUI.php");
2531 
2532  // reference objects have translated ids, revert to originals
2533  $note_ref_id = $this->ref_id;
2534  if($this->reference_ref_id)
2535  {
2536  $note_ref_id = $this->reference_ref_id;
2537  }
2538 
2539  $js_updater = $a_header_actions
2540  ? "il.Object.redrawActionHeader();"
2541  : "il.Object.redrawListItem(".$note_ref_id.")";
2542 
2543  $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, $a_header_actions, true);
2544  if($comments_enabled)
2545  {
2546  $this->insertCommand("#", $this->lng->txt("notes_comments"), $cmd_frame,
2547  "", "", ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $js_updater));
2548  }
2549 
2550  if($this->notes_enabled)
2551  {
2552  $this->insertCommand("#", $this->lng->txt("notes"), $cmd_frame,
2553  "", "", ilNoteGUI::getListNotesJSCall($this->ajax_hash, $js_updater));
2554  }
2555 
2556  if ($this->tags_enabled)
2557  {
2558  include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
2559  //$this->insertCommand($cmd_tag_link, $this->lng->txt("tagging_set_tag"), $cmd_frame);
2560  $this->insertCommand("#", $this->lng->txt("tagging_set_tag"), $cmd_frame,
2561  "", "", ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $js_updater));
2562  }
2563  }
2564 
2571  {
2572  if ($this->std_cmd_only || !$this->container_obj->object)
2573  {
2574  return;
2575  }
2576 
2577  $parent_ref_id = $this->container_obj->object->getRefId();
2578  $parent_type = $this->container_obj->object->getType();
2579 
2580  if($this->checkCommandAccess('write','',$parent_ref_id,$parent_type) ||
2581  $this->checkCommandAccess('write','',$this->ref_id,$this->type))
2582  {
2583  $this->ctrl->setParameterByClass('ilobjectactivationgui','cadh',
2584  $this->ajax_hash);
2585  $this->ctrl->setParameterByClass('ilobjectactivationgui','parent_id',
2586  $parent_ref_id);
2587  $cmd_lnk = $this->ctrl->getLinkTargetByClass(array($this->gui_class_name, 'ilcommonactiondispatchergui', 'ilobjectactivationgui'),
2588  'edit');
2589 
2590  $this->insertCommand($cmd_lnk, $this->lng->txt('obj_activation_list_gui'));
2591  }
2592  }
2593 
2601  function insertCommands($a_use_asynch = false, $a_get_asynch_commands = false,
2602  $a_asynch_url = "", $a_header_actions = false)
2603  {
2604  global $lng, $ilUser;
2605 
2606  if (!$this->getCommandsStatus())
2607  {
2608  return;
2609  }
2610 
2611  include_once("Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
2612  $this->current_selection_list = new ilAdvancedSelectionListGUI();
2613  $this->current_selection_list->setAsynch($a_use_asynch && !$a_get_asynch_commands);
2614  $this->current_selection_list->setAsynchUrl($a_asynch_url);
2615  $this->current_selection_list->setListTitle($lng->txt("actions"));
2616  $this->current_selection_list->setId("act_".$this->getUniqueItemId(false));
2617  $this->current_selection_list->setSelectionHeaderClass("small");
2618  $this->current_selection_list->setItemLinkClass("xsmall");
2619  $this->current_selection_list->setLinksMode("il_ContainerItemCommand2");
2620  $this->current_selection_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
2621  $this->current_selection_list->setUseImages(false);
2622  $this->current_selection_list->setAdditionalToggleElement($this->getUniqueItemId(true), "ilContainerListItemOuterHighlight");
2623 
2624  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
2625 
2626  $this->ctrl->setParameterByClass($this->gui_class_name, "ref_id", $this->ref_id);
2627 
2628  // only standard command?
2629  $only_default = false;
2630  if ($a_use_asynch && !$a_get_asynch_commands)
2631  {
2632  $only_default = true;
2633  }
2634 
2635  $this->default_command = false;
2636  $this->prevent_duplicate_commands = array();
2637 
2638  // we only allow the following commands inside the header actions
2639  $valid_header_commands = array("mount_webfolder");
2640 
2641  $commands = $this->getCommands($this->ref_id, $this->obj_id);
2642  foreach($commands as $command)
2643  {
2644  if($a_header_actions && !in_array($command["cmd"], $valid_header_commands))
2645  {
2646  continue;
2647  }
2648 
2649  if ($command["granted"] == true )
2650  {
2651  if (!$command["default"] === true)
2652  {
2653  if (!$this->std_cmd_only && !$only_default)
2654  {
2655  // workaround for repository frameset
2656  $command["link"] =
2657  $this->appendRepositoryFrameParameter($command["link"]);
2658 
2659  // standard edit icon
2660  if ($command["lang_var"] == "edit" && $command["img"] == "")
2661  {
2662  $command["img"] = ilUtil::getImagePath("cmd_edit_s.png");
2663  }
2664 
2665  $cmd_link = $command["link"];
2666  $txt = ($command["lang_var"] == "")
2667  ? $command["txt"]
2668  : $this->lng->txt($command["lang_var"]);
2669  $this->insertCommand($cmd_link, $txt,
2670  $command["frame"], $command["img"], $command["cmd"]);
2671  }
2672  }
2673  else
2674  {
2675  $this->default_command = $this->createDefaultCommand($command);
2676  //$this->default_command = $command;
2677  }
2678  }
2679  elseif($command["default"] === true)
2680  {
2681  $items =& $command["access_info"];
2682  foreach ($items as $item)
2683  {
2684  if ($item["type"] == IL_NO_LICENSE)
2685  {
2686  $this->addCustomProperty($this->lng->txt("license"),$item["text"],true);
2687  $this->enableProperties(true);
2688  break;
2689  }
2690  }
2691  }
2692  }
2693 
2694  if (!$only_default)
2695  {
2696  // custom commands
2697  if (is_array($this->cust_commands))
2698  {
2699  foreach ($this->cust_commands as $command)
2700  {
2701  $this->insertCommand($command["link"], $this->lng->txt($command["lang_var"]),
2702  $command["frame"], "", $command["cmd"], $command["onclick"]);
2703  }
2704  }
2705 
2706  // info screen commmand
2707  if ($this->getInfoScreenStatus())
2708  {
2709  $this->insertInfoScreenCommand();
2710  }
2711 
2712  if (!$this->isMode(IL_LIST_AS_TRIGGER))
2713  {
2714  // edit timings
2715  if($this->timings_enabled)
2716  {
2717  $this->insertTimingsCommand();
2718  }
2719 
2720  // delete
2721  if ($this->delete_enabled)
2722  {
2723  $this->insertDeleteCommand();
2724  }
2725 
2726  // link
2727  if ($this->link_enabled)
2728  {
2729  $this->insertLinkCommand();
2730  }
2731 
2732  // cut
2733  if ($this->cut_enabled)
2734  {
2735  $this->insertCutCommand();
2736  }
2737 
2738  // copy
2739  if ($this->copy_enabled)
2740  {
2741  $this->insertCopyCommand();
2742  }
2743 
2744  // cut/copy from workspace to repository
2745  if ($this->repository_transfer_enabled)
2746  {
2747  $this->insertCutCommand(true);
2748  $this->insertCopyCommand(true);
2749  }
2750 
2751  // subscribe
2752  if ($this->subscribe_enabled)
2753  {
2754  $this->insertSubscribeCommand();
2755  }
2756 
2757  // multi download
2758  if ($this->multi_download_enabled && $a_header_actions)
2759  {
2760  $this->insertMultiDownloadCommand();
2761  }
2762 
2763  // BEGIN PATCH Lucene search
2764  if($this->cut_enabled or $this->link_enabled)
2765  {
2766  $this->insertPasteCommand();
2767  }
2768  // END PATCH Lucene Search
2769 
2770  if(IS_PAYMENT_ENABLED)
2771  {
2772  $this->insertPayment();
2773  }
2774  }
2775  }
2776 
2777  // common social commands (comment, notes, tags)
2778  if (!$only_default && !$this->isMode(IL_LIST_AS_TRIGGER))
2779  {
2780  $this->insertCommonSocialCommands($a_header_actions);
2781  }
2782 
2783  if(!$a_header_actions)
2784  {
2785  $this->ctrl->clearParametersByClass($this->gui_class_name);
2786  }
2787 
2788  // fix bug #12417
2789  // there is one case, where no action menu should be displayed:
2790  // public area, category, no info tab
2791  // todo: make this faster and remove type specific implementation if possible
2792  if ($a_use_asynch && !$a_get_asynch_commands && !$a_header_actions)
2793  {
2794  if ($ilUser->getId() == ANONYMOUS_USER_ID && $this->type == "cat")
2795  {
2796  include_once("./Services/Container/classes/class.ilContainer.php");
2797  include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
2799  $this->obj_id,
2801  true))
2802  {
2803  return;
2804  }
2805  }
2806  }
2807 
2808  if ($a_use_asynch && $a_get_asynch_commands)
2809  {
2810  return $this->current_selection_list->getHTML(true);
2811  }
2812 
2813  return $this->current_selection_list->getHTML();
2814  }
2815 
2821  function enableComments($a_value, $a_enable_comments_settings = true)
2822  {
2823  global $ilSetting;
2824 
2825  // global switch
2826  if($ilSetting->get("disable_comments"))
2827  {
2828  $a_value = false;
2829  }
2830 
2831  $this->comments_enabled = (bool)$a_value;
2832  $this->comments_settings_enabled = (bool)$a_enable_comments_settings;
2833  }
2834 
2840  function enableNotes($a_value)
2841  {
2842  global $ilSetting;
2843 
2844  // global switch
2845  if($ilSetting->get("disable_notes"))
2846  {
2847  $a_value = false;
2848  }
2849 
2850  $this->notes_enabled = (bool)$a_value;
2851  }
2852 
2858  function enableTags($a_value)
2859  {
2860  $tags_set = new ilSetting("tags");
2861  if (!$tags_set->get("enable"))
2862  {
2863  $a_value = false;
2864  }
2865  $this->tags_enabled = (bool)$a_value;
2866  }
2867 
2876  function enableRating($a_value, $a_text = null, $a_categories = false, array $a_ctrl_path = null)
2877  {
2878  $this->rating_enabled = (bool)$a_value;
2879 
2880  if($this->rating_enabled)
2881  {
2882  $this->rating_categories_enabled = (bool)$a_categories;
2883  $this->rating_text = $a_text;
2884  $this->rating_ctrl_path = $a_ctrl_path;
2885  }
2886  }
2887 
2893  function enableMultiDownload($a_value)
2894  {
2895  $folder_set = new ilSetting("fold");
2896  if (!$folder_set->get("enable_multi_download"))
2897  {
2898  $a_value = false;
2899  }
2900  $this->multi_download_enabled = (bool)$a_value;
2901  }
2902 
2904  {
2905  global $ilAccess, $objDefinition;
2906 
2907  if ($this->std_cmd_only)
2908  return;
2909 
2910  if(!$objDefinition->isContainer(ilObject::_lookupType($this->obj_id)))
2911  return false;
2912 
2913  if(is_object($this->getContainerObject()) &&
2914  $this->getContainerObject() instanceof ilContainerGUI)
2915  {
2916  $this->ctrl->setParameter($this->getContainerObject(), "type", "");
2917  $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", "");
2918  $this->ctrl->setParameter($this->getContainerObject(), "active_node", "");
2919  $cmd = $_GET["cmd"] == "enableMultiDownload" ? "render" : "enableMultiDownload";
2920  $cmd_link = $this->ctrl->getLinkTarget($this->getContainerObject(), $cmd);
2921  $this->insertCommand($cmd_link, $this->lng->txt("download_multiple_objects"));
2922  return true;
2923  }
2924 
2925  return false;
2926  }
2927 
2928  function enableDownloadCheckbox($a_ref_id, $a_value)
2929  {
2930  global $ilAccess;
2931 
2932  // TODO: delegate to list object class!
2933  if (!$this->getContainerObject()->isActiveAdministrationPanel() || $_SESSION["clipboard"])
2934  {
2935  if (in_array($this->type, array("file", "fold")) &&
2936  $ilAccess->checkAccess("read", "", $a_ref_id, $this->type))
2937  {
2938  $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_ENABLED;
2939  }
2940  else
2941  {
2942  $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_DISABLED;
2943  }
2944  }
2945  else
2946  {
2947  $this->download_checkbox_state = self::DOWNLOAD_CHECKBOX_NONE;
2948  }
2949  }
2950 
2952  {
2954  }
2955 
2959  static function prepareJsLinks($a_redraw_url, $a_notes_url, $a_tags_url, $a_tpl = null)
2960  {
2961  global $tpl;
2962 
2963  if (is_null($a_tpl))
2964  {
2965  $a_tpl = $tpl;
2966  }
2967 
2968  if($a_notes_url)
2969  {
2970  include_once("./Services/Notes/classes/class.ilNoteGUI.php");
2971  ilNoteGUI::initJavascript($a_notes_url);
2972  }
2973 
2974  if($a_tags_url)
2975  {
2976  include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
2977  ilTaggingGUI::initJavascript($a_tags_url);
2978  }
2979 
2980  if($a_redraw_url)
2981  {
2982  $a_tpl->addOnLoadCode("il.Object.setRedrawAHUrl('".
2983  $a_redraw_url."');");
2984  }
2985  }
2986 
2993  function setHeaderSubObject($a_type, $a_id)
2994  {
2995  $this->sub_obj_type = $a_type;
2996  $this->sub_obj_id = (int)$a_id;
2997  }
2998 
3008  function addHeaderIcon($a_id, $a_img, $a_tooltip = null, $a_onclick = null, $a_status_text = null, $a_href = null)
3009  {
3010  $this->header_icons[$a_id] = array("img" => $a_img,
3011  "tooltip" => $a_tooltip,
3012  "onclick" => $a_onclick,
3013  "status_text" => $a_status_text,
3014  "href" => $a_href);
3015  }
3016 
3022  function addHeaderIconHTML($a_id, $a_html)
3023  {
3024  $this->header_icons[$a_id] = $a_html;
3025  }
3026 
3027  function setAjaxHash($a_hash)
3028  {
3029  $this->ajax_hash = $a_hash;
3030  }
3031 
3037  function getHeaderAction()
3038  {
3039  global $ilUser, $lng, $tpl;
3040 
3041  $htpl = new ilTemplate("tpl.header_action.html", true, true, "Services/Repository");
3042 
3043  $redraw_js = "il.Object.redrawActionHeader();";
3044 
3045  // tags
3046  if($this->tags_enabled)
3047  {
3048  include_once("./Services/Tagging/classes/class.ilTagging.php");
3049  $tags = ilTagging::getTagsForUserAndObject($this->obj_id,
3050  ilObject::_lookupType($this->obj_id), 0, "", $ilUser->getId());
3051  if (count($tags) > 0)
3052  {
3053  include_once("./Services/Tagging/classes/class.ilTaggingGUI.php");
3054  $lng->loadLanguageModule("tagging");
3055  $this->addHeaderIcon("tags",
3056  ilUtil::getImagePath("icon_tags_s.png"),
3057  $lng->txt("tagging_tags").": ".count($tags),
3058  ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js),
3059  count($tags));
3060  }
3061  }
3062 
3063  // notes and comments
3064  $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, true, false);
3065  if($this->notes_enabled || $comments_enabled)
3066  {
3067  include_once("./Services/Notes/classes/class.ilNote.php");
3068  include_once("./Services/Notes/classes/class.ilNoteGUI.php");
3069  $cnt = ilNote::_countNotesAndComments($this->obj_id, $this->sub_obj_id);
3070 
3071  if($this->notes_enabled && $cnt[$this->obj_id][IL_NOTE_PRIVATE] > 0)
3072  {
3073  $this->addHeaderIcon("notes",
3074  ilUtil::getImagePath("note_unlabeled.png"),
3075  $lng->txt("private_notes").": ".$cnt[$this->obj_id][IL_NOTE_PRIVATE],
3076  ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js),
3078  );
3079  }
3080 
3081  if($comments_enabled && $cnt[$this->obj_id][IL_NOTE_PUBLIC] > 0)
3082  {
3083  $lng->loadLanguageModule("notes");
3084 
3085  $this->addHeaderIcon("comments",
3086  ilUtil::getImagePath("comment_unlabeled.png"),
3087  $lng->txt("notes_public_comments").": ".$cnt[$this->obj_id][IL_NOTE_PUBLIC],
3088  ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js),
3089  $cnt[$this->obj_id][IL_NOTE_PUBLIC]);
3090  }
3091  }
3092 
3093  // rating
3094  if($this->rating_enabled)
3095  {
3096  include_once("./Services/Rating/classes/class.ilRatingGUI.php");
3097  $rating_gui = new ilRatingGUI();
3098  $rating_gui->enableCategories($this->rating_categories_enabled);
3099  // never rate sub objects from header action!
3100  $rating_gui->setObject($this->obj_id, $this->type);
3101  if($this->rating_text)
3102  {
3103  $rating_gui->setYourRatingText($this->rating_text);
3104  }
3105 
3106  $this->ctrl->setParameterByClass("ilRatingGUI", "cadh", $this->ajax_hash);
3107  $this->ctrl->setParameterByClass("ilRatingGUI", "rnsb", true);
3108  if($this->rating_ctrl_path)
3109  {
3110  $rating_gui->setCtrlPath($this->rating_ctrl_path);
3111  $ajax_url = $this->ctrl->getLinkTargetByClass($this->rating_ctrl_path, "saveRating", "", true, false);
3112  }
3113  else
3114  {
3115  // ???
3116  $ajax_url = $this->ctrl->getLinkTargetByClass("ilRatingGUI", "saveRating", "", true, false);
3117  }
3118  $tpl->addOnLoadCode("il.Object.setRatingUrl('".$ajax_url."');");
3119 
3120  $this->addHeaderIconHTML("rating",
3121  $rating_gui->getHtml(true,
3122  $this->checkCommandAccess("read", "", $this->ref_id, $this->type),
3123  "il.Object.saveRating(%rating%);"));
3124  }
3125 
3126  if($this->header_icons)
3127  {
3128  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
3129 
3130  $chunks = array();
3131  foreach($this->header_icons as $id => $attr)
3132  {
3133  $id = "headp_".$id;
3134 
3135  if(is_array($attr))
3136  {
3137  if($attr["onclick"])
3138  {
3139  $htpl->setCurrentBlock("onclick");
3140  $htpl->setVariable("PROP_ONCLICK", $attr["onclick"]);
3141  $htpl->parseCurrentBlock();
3142  }
3143 
3144  if($attr["status_text"])
3145  {
3146  $htpl->setCurrentBlock("status");
3147  $htpl->setVariable("PROP_TXT", $attr["status_text"]);
3148  $htpl->parseCurrentBlock();
3149  }
3150 
3151  if(!$attr["href"])
3152  {
3153  $attr["href"] = "#";
3154  }
3155 
3156  $htpl->setCurrentBlock("prop");
3157  $htpl->setVariable("PROP_ID", $id);
3158  $htpl->setVariable("IMG", ilUtil::img($attr["img"]));
3159  $htpl->setVariable("PROP_HREF", $attr["href"]);
3160  $htpl->parseCurrentBlock();
3161 
3162  if($attr["tooltip"])
3163  {
3164  ilTooltipGUI::addTooltip($id, $attr["tooltip"]);
3165  }
3166  }
3167  else
3168  {
3169  $chunks[] = $attr;
3170  }
3171  }
3172 
3173  if(sizeof($chunks))
3174  {
3175  $htpl->setVariable("PROP_CHUNKS",
3176  implode("&nbsp;&nbsp;&nbsp;", $chunks)."&nbsp;&nbsp;&nbsp;");
3177  }
3178  }
3179 
3180  $htpl->setVariable("ACTION_DROP_DOWN",
3181  $this->insertCommands(false, false, "", true));
3182 
3183  return $htpl->get();
3184  }
3185 
3186 
3192  {
3193  $script = substr(strrchr($_SERVER["PHP_SELF"],"/"),1);
3194 
3195  // we should get rid of this nonsense with 4.4 (alex)
3196  if ((strtolower($_GET["baseClass"]) != "ilrepositorygui") &&
3197  is_int(strpos($a_link,"baseClass=ilRepositoryGUI")))
3198  {
3199  if ($this->type != "frm")
3200  {
3201  $a_link =
3202  ilUtil::appendUrlParameterString($a_link, "rep_frame=1");
3203  }
3204  }
3205 
3206  return $a_link;
3207  }
3208 
3212  function modifySAHSlaunch($a_link,$wtarget)
3213  {
3214  if (strstr($a_link, 'ilSAHSPresentationGUI') && !$this->offline_mode)
3215  {
3216  include_once 'Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
3217  $sahs_obj = new ilObjSAHSLearningModule($this->ref_id);
3218  $om = $sahs_obj->getOpenMode();
3219  $width = $sahs_obj->getWidth();
3220  $height = $sahs_obj->getHeight();
3221  if ($om != 0 && !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  $this->tpl->setCurrentBlock("path_item");
3245  $this->tpl->setVariable('PATH_ITEM',$path_gui->getPath(ROOT_FOLDER_ID,$this->ref_id));
3246  $this->tpl->parseCurrentBlock();
3247 
3248  $this->tpl->setCurrentBlock("path");
3249  $this->tpl->setVariable("TXT_LOCATION", $lng->txt("locator"));
3250  $this->tpl->parseCurrentBlock();
3251  return true;
3252  }
3253  }
3254 
3261  public function insertProgressInfo()
3262  {
3263  return true;
3264  }
3265 
3266 
3271  {
3272  global $lng, $objDefinition;
3273 
3274  $cnt = 0;
3275  if ($this->getCheckboxStatus())
3276  {
3277  $this->tpl->setCurrentBlock("check");
3278  $this->tpl->setVariable("VAL_ID", $this->getCommandId());
3279  $this->tpl->parseCurrentBlock();
3280  $cnt += 1;
3281  }
3282  else if ($this->getDownloadCheckboxState() != self::DOWNLOAD_CHECKBOX_NONE)
3283  {
3284  $this->tpl->setCurrentBlock("check_download");
3285  if ($this->getDownloadCheckboxState() == self::DOWNLOAD_CHECKBOX_ENABLED)
3286  $this->tpl->setVariable("VAL_ID", $this->getCommandId());
3287  else
3288  $this->tpl->setVariable("VAL_VISIBILITY", "visibility: hidden;\" disabled=\"disabled");
3289  $this->tpl->parseCurrentBlock();
3290  $cnt += 1;
3291  }
3292  elseif($this->getExpandStatus())
3293  {
3294  $this->tpl->setCurrentBlock('expand');
3295 
3296  if($this->isExpanded())
3297  {
3298  $this->ctrl->setParameter($this->container_obj,'expand',-1 * $this->obj_id);
3299  $this->tpl->setVariable('EXP_HREF',$this->ctrl->getLinkTarget($this->container_obj,'',$this->getUniqueItemId(true)));
3300  $this->ctrl->clearParameters($this->container_obj);
3301  #$this->tpl->setVariable('EXP_IMG',ilUtil::getImagePath('browser/minus.png'));
3302  $this->tpl->setVariable('EXP_IMG',ilUtil::getImagePath('tree_exp.png'));
3303  $this->tpl->setVariable('EXP_ALT',$this->lng->txt('collapse'));
3304  }
3305  else
3306  {
3307  $this->ctrl->setParameter($this->container_obj,'expand',$this->obj_id);
3308  $this->tpl->setVariable('EXP_HREF',$this->ctrl->getLinkTarget($this->container_obj,'',$this->getUniqueItemId(true)));
3309  $this->ctrl->clearParameters($this->container_obj);
3310  #$this->tpl->setVariable('EXP_IMG',ilUtil::getImagePath('browser/plus.png'));
3311  $this->tpl->setVariable('EXP_IMG',ilUtil::getImagePath('tree_col.png'));
3312  $this->tpl->setVariable('EXP_ALT',$this->lng->txt('expand'));
3313  }
3314 
3315  $this->tpl->parseCurrentBlock();
3316  $cnt += 1;
3317  }
3318 
3319  if ($this->getIconStatus())
3320  {
3321  if ($cnt == 1)
3322  {
3323  $this->tpl->touchBlock("i_1"); // indent
3324  }
3325 
3326  // icon link
3327  if (!$this->default_command || (!$this->getCommandsStatus() && !$this->restrict_to_goto))
3328  {
3329  }
3330  else
3331  {
3332  $this->tpl->setCurrentBlock("icon_link_s");
3333 
3334  if ($this->default_command["frame"] != "")
3335  {
3336  $this->tpl->setVariable("ICON_TAR", "target='".$this->default_command["frame"]."'");
3337  }
3338 
3339  $this->tpl->setVariable("ICON_HREF",
3340  $this->default_command["link"]);
3341  $this->tpl->parseCurrentBlock();
3342  $this->tpl->touchBlock("icon_link_e");
3343  }
3344 
3345  $this->tpl->setCurrentBlock("icon");
3346  if (!$objDefinition->isPlugin($this->getIconImageType()))
3347  {
3348  $this->tpl->setVariable("ALT_ICON", $lng->txt("icon")." ".$lng->txt("obj_".$this->getIconImageType()));
3349  }
3350  else
3351  {
3352  include_once("Services/Component/classes/class.ilPlugin.php");
3353  $this->tpl->setVariable("ALT_ICON", $lng->txt("icon")." ".
3354  ilPlugin::lookupTxt("rep_robj", $this->getIconImageType(), "obj_".$this->getIconImageType()));
3355  }
3356 
3357  $this->tpl->setVariable("SRC_ICON",
3358  ilObject::_getIcon($this->obj_id, "small", $this->getIconImageType()));
3359  $this->tpl->parseCurrentBlock();
3360  $cnt += 1;
3361  }
3362 
3363  $this->tpl->touchBlock("d_".$cnt); // indent main div
3364  }
3365 
3369  function insertSubItems()
3370  {
3371  foreach ($this->sub_item_html as $sub_html)
3372  {
3373  $this->tpl->setCurrentBlock("subitem");
3374  $this->tpl->setVariable("SUBITEM", $sub_html);
3375  $this->tpl->parseCurrentBlock();
3376  }
3377  }
3378 
3383  {
3384  if ($this->position_enabled)
3385  {
3386  $this->tpl->setCurrentBlock("position");
3387  $this->tpl->setVariable("POS_ID", $this->position_field_index);
3388  $this->tpl->setVariable("POS_VAL", $this->position_value);
3389  $this->tpl->parseCurrentBlock();
3390  }
3391  }
3392 
3398  {
3399  return $this->adm_commands_included;
3400  }
3401 
3405  function storeAccessCache()
3406  {
3407  global $ilUser;
3408  if($this->acache->getLastAccessStatus() == "miss" &&
3409  !$this->prevent_access_caching)
3410  {
3411  $this->acache->storeEntry($ilUser->getId().":".$this->ref_id,
3412  serialize($this->access_cache), $this->ref_id);
3413  }
3414  }
3415 
3430  function getListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description,
3431  $a_use_asynch = false, $a_get_asynch_commands = false, $a_asynch_url = "", $a_context = self::CONTEXT_REPOSITORY)
3432  {
3433  global $ilAccess, $ilBench, $ilUser, $ilCtrl;
3434 
3435  // this variable stores wheter any admin commands
3436  // are included in the output
3437  $this->adm_commands_included = false;
3438 
3439  // only for permformance exploration
3440  $type = ilObject::_lookupType($a_obj_id);
3441 
3442  // initialization
3443  $ilBench->start("ilObjectListGUI", "1000_getListHTML_init$type");
3444  $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description, $a_context);
3445  $ilBench->stop("ilObjectListGUI", "1000_getListHTML_init$type");
3446 
3447  // prepare ajax calls
3448  include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
3449  if($a_context == self::CONTEXT_REPOSITORY)
3450  {
3452  }
3453  else
3454  {
3456  }
3457  $this->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash($node_type, $a_ref_id, $type, $a_obj_id));
3458 
3459  if ($a_use_asynch && $a_get_asynch_commands)
3460  {
3461  return $this->insertCommands(true, true);
3462  }
3463 
3464  if($this->rating_enabled)
3465  {
3466  if(ilRating::hasRatingInListGUI($this->obj_id, $this->type))
3467  {
3468  $may_rate = $this->checkCommandAccess("read", "", $this->ref_id, $this->type);
3469 
3470  $rating = new ilRatingGUI();
3471  $rating->setObject($this->obj_id, $this->type);
3472  $this->addCustomProperty(
3473  $this->lng->txt("rating_average_rating"),
3474  $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id),
3475  false,
3476  true
3477  );
3478  }
3479  }
3480 
3481  // read from cache
3482  include_once("Services/Object/classes/class.ilListItemAccessCache.php");
3483  $this->acache = new ilListItemAccessCache();
3484  $cres = $this->acache->getEntry($ilUser->getId().":".$a_ref_id);
3485  if($this->acache->getLastAccessStatus() == "hit")
3486  {
3487  $this->access_cache = unserialize($cres);
3488  }
3489  else
3490  {
3491  // write to cache
3492  $this->storeAccessCache();
3493  }
3494 
3495  // visible check
3496  if (!$this->checkCommandAccess("visible", "", $a_ref_id, "", $a_obj_id))
3497  {
3498  $ilBench->stop("ilObjectListGUI", "2000_getListHTML_check_visible");
3499  return "";
3500  }
3501 
3502  // BEGIN WEBDAV
3503  if($type=='file' AND ilObjFileAccess::_isFileHidden($a_title))
3504  {
3505  return "";
3506  }
3507  // END WEBDAV
3508 
3509 
3510  $this->tpl = new ilTemplate("tpl.container_list_item.html", true, true,
3511  "Services/Container", "DEFAULT", false, true);
3512 
3513  if ($this->getCommandsStatus() ||
3514  ($this->payment_enabled && IS_PAYMENT_ENABLED))
3515  {
3516  if (!$this->getSeparateCommands())
3517  {
3518  $this->tpl->setVariable("COMMAND_SELECTION_LIST",
3519  $this->insertCommands($a_use_asynch, $a_get_asynch_commands, $a_asynch_url));
3520  }
3521  }
3522 
3523  if($this->getProgressInfoStatus())
3524  {
3525  $this->insertProgressInfo();
3526  }
3527 
3528  // insert title and describtion
3529  $this->insertTitle();
3530  if (!$this->isMode(IL_LIST_AS_TRIGGER))
3531  {
3532  if ($this->getDescriptionStatus())
3533  {
3534  $this->insertDescription();
3535  }
3536  }
3537 
3538  if($this->getSearchFragmentStatus())
3539  {
3540  $this->insertSearchFragment();
3541  }
3542  if($this->enabledRelevance())
3543  {
3544  $this->insertRelevance();
3545  }
3546 
3547  // properties
3548  $ilBench->start("ilObjectListGUI", "6000_insert_properties$type");
3549  if ($this->getPropertiesStatus())
3550  {
3551  $this->insertProperties();
3552  }
3553  $ilBench->stop("ilObjectListGUI", "6000_insert_properties$type");
3554 
3555  // notice properties
3556  $ilBench->start("ilObjectListGUI", "6500_insert_notice_properties$type");
3557  if($this->getNoticePropertiesStatus())
3558  {
3559  $this->insertNoticeProperties();
3560  }
3561  $ilBench->stop("ilObjectListGUI", "6500_insert_notice_properties$type");
3562 
3563  // preconditions
3564  $ilBench->start("ilObjectListGUI", "7000_insert_preconditions");
3565  if ($this->getPreconditionsStatus())
3566  {
3567  $this->insertPreconditions();
3568  }
3569  $ilBench->stop("ilObjectListGUI", "7000_insert_preconditions");
3570 
3571  // path
3572  $ilBench->start("ilObjectListGUI", "8000_insert_path");
3573  $this->insertPath();
3574  $ilBench->stop("ilObjectListGUI", "8000_insert_path");
3575 
3576  $ilBench->start("ilObjectListGUI", "8500_item_detail_links");
3577  if($this->getItemDetailLinkStatus())
3578  {
3579  $this->insertItemDetailLinks();
3580  }
3581  $ilBench->stop("ilObjectListGUI", "8500_item_detail_links");
3582 
3583  // icons and checkboxes
3584  $this->insertIconsAndCheckboxes();
3585 
3586  // input field for position
3587  $this->insertPositionField();
3588 
3589  // subitems
3590  $this->insertSubItems();
3591 
3592  // file upload
3593  if ($this->isFileUploadAllowed())
3594  {
3595  $this->insertFileUpload();
3596  }
3597 
3598  // reset properties and commands
3599  $this->cust_prop = array();
3600  $this->cust_commands = array();
3601  $this->sub_item_html = array();
3602  $this->position_enabled = false;
3603 
3604  $this->tpl->setVariable("DIV_CLASS",'ilContainerListItemOuter');
3605  $this->tpl->setVariable("DIV_ID", 'id = "'.$this->getUniqueItemId(true).'"');
3606  $this->tpl->setVariable("ADDITIONAL", $this->getAdditionalInformation());
3607 
3608  // #11554 - make sure that internal ids are reset
3609  $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", "");
3610 
3611  return $this->tpl->get();
3612  }
3613 
3619  public function setParentRefId($a_ref_id)
3620  {
3621  $this->parent_ref_id = $a_ref_id;
3622  }
3623 
3630  protected function getUniqueItemId($a_as_div = false)
3631  {
3632  // use correct id for references
3633  $id_ref = ($this->reference_ref_id > 0)
3634  ? $this->reference_ref_id
3635  : $this->ref_id;
3636 
3637  // add unique identifier for preconditions (objects can appear twice in same container)
3638  if($this->condition_depth)
3639  {
3640  $id_ref .= "_pc".$this->condition_depth;
3641  }
3642 
3643  // unique
3644  $id_ref .= "_pref_".$this->parent_ref_id;
3645 
3646  if(!$a_as_div)
3647  {
3648  return $id_ref;
3649  }
3650  else
3651  {
3652  // action menu [yellow] toggle
3653  return "lg_div_".$id_ref;
3654  }
3655  }
3656 
3660  function getCommandsHTML()
3661  {
3662  return $this->insertCommands();
3663  }
3664 
3668  function isSideBlock()
3669  {
3670  return false;
3671  }
3672 
3678  public function setBoldTitle($a_bold_title)
3679  {
3680  $this->bold_title = $a_bold_title;
3681 
3682  }
3683 
3689  public function isTitleBold()
3690  {
3691  return $this->bold_title;
3692  }
3693 
3700  static function preloadCommonProperties($a_obj_ids, $a_context)
3701  {
3702  global $lng;
3703 
3704  if($a_context == self::CONTEXT_REPOSITORY)
3705  {
3706  $lng->loadLanguageModule("notes");
3707  $lng->loadLanguageModule("tagging");
3708  $lng->loadLanguageModule("rating");
3709 
3710  include_once("./Services/Tagging/classes/class.ilTagging.php");
3711  self::$cnt_tags = ilTagging::_countTags($a_obj_ids);
3712 
3713  include_once("./Services/Notes/classes/class.ilNote.php");
3714  self::$cnt_notes = ilNote::_countNotesAndCommentsMultiple($a_obj_ids, true);
3715  self::$comments_activation = ilNote::getRepObjActivation($a_obj_ids);
3716  }
3717 
3718  self::$preload_done = true;
3719  }
3720 
3731  protected function isCommentsActivated($a_type, $a_ref_id, $a_obj_id, $a_header_actions, $a_check_write_access = true)
3732  {
3733  if($this->comments_enabled)
3734  {
3735  if(!$this->comments_settings_enabled)
3736  {
3737  return true;
3738  }
3739  if($a_check_write_access && $this->checkCommandAccess('write','', $a_ref_id, $a_type))
3740  {
3741  return true;
3742  }
3743  // fallback to single object check if no preloaded data
3744  // only the repository does preloadCommonProperties() yet
3745  if(!$a_header_actions && self::$preload_done)
3746  {
3747  if(self::$comments_activation[$a_obj_id][$a_type])
3748  {
3749  return true;
3750  }
3751  }
3752  else
3753  {
3754  include_once("./Services/Notes/classes/class.ilNote.php");
3755  if(ilNote::commentsActivated($a_obj_id, 0, $a_type))
3756  {
3757  return true;
3758  }
3759  }
3760  }
3761  return false;
3762  }
3763 
3771  public function enableTimings($a_status)
3772  {
3773  $this->timings_enabled = (bool)$a_status;
3774  }
3775 
3781  public function isFileUploadAllowed()
3782  {
3783  // check if file upload allowed
3784  include_once("./Services/FileUpload/classes/class.ilFileUploadUtil.php");
3785  return ilFileUploadUtil::isUploadAllowed($this->ref_id, $this->type);
3786  }
3787 
3791  public function insertFileUpload()
3792  {
3793  include_once("./Services/FileUpload/classes/class.ilFileUploadGUI.php");
3795 
3796  $upload = new ilFileUploadGUI($this->getUniqueItemId(true), $this->ref_id);
3797 
3798  $this->tpl->setCurrentBlock("fileupload");
3799  $this->tpl->setVariable("FILE_UPLOAD", $upload->getHTML());
3800  $this->tpl->parseCurrentBlock();
3801  }
3802 }
3803 
3804 ?>
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
parseConditions($toggle_id, $conditions, $obligatory=true)
getCommands()
get all current commands for a specific ref id (in the permission context of the current user) ...
getProgressInfoStatus()
get progress info status
static initFileUpload()
Initializes the file upload and loads the needed javascripts and styles.
insertTitle()
insert item title
insertPaymentCommand($has_extension_prices=false)
Creates a path for a start and endnode.
isMobile()
isMobile
insertIconsAndCheckboxes()
Insert icons and checkboxes.
ILIAS Setting Class.
enableInfoScreen($a_info_screen)
En/disable path.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
insertSearchFragment()
Insert highlighted search fragment.
getDescription()
getDescription overwritten in class.ilObjLinkResourceList.php
getListCommentsJSCall($a_hash, $a_update_code=null)
Get list comments js call.
isMode($a_mode)
check current output mode
getContainerObject()
get container object
init()
initialisation
insertLinkCommand()
insert link command
storeAccessCache()
Store access cache.
static _lookupInsideChangeState($parent_obj_id, $usr_id)
Returns the changed state of objects which are children of the specified parent object.
const IL_NOTE_PRIVATE
Definition: class.ilNote.php:4
getIconStatus()
Are icons enabled?
getCommandLink($a_cmd)
Get command link url.
enablePath($a_path)
En/disable path.
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
const IL_LIST_AS_TRIGGER
enableNotes($a_value)
Toogle notes action status.
static _lookupPobjectId($a_ref_id)
ilObjectListGUI()
constructor
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="")
Build img tag.
enablePayment($a_status)
En/disable payment.
enableDelete($a_status)
En/disable delete.
insertCopyCommand($a_to_repository=false)
Insert copy command.
getCheckboxStatus()
Are checkboxes enabled?
$_GET["client_id"]
const IL_NO_LICENSE
$location
Definition: buildRTE.php:44
addHeaderIcon($a_id, $a_img, $a_tooltip=null, $a_onclick=null, $a_status_text=null, $a_href=null)
insertPreconditions()
insert all missing preconditions
enableProperties($a_status)
En/disable properties.
static _countNotesAndComments($a_rep_obj_id, $a_sub_obj_id=null)
Get all notes related to a specific object.
static _isFileHidden($a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user. ...
addCustomCommand($a_link, $a_lang_var, $a_frame="", $onclick="")
add a custom command
$cmd
Definition: sahs_server.php:35
enableCut($a_status)
En/disable cut.
getAdditionalInformation()
Get additional information.
insertPasteCommand()
Insert paste command.
Access handler for personal workspace.
getItemDetailLinkStatus()
get item detail link status
getCommandsHTML()
Get commands HTML (must be called after get list item html)
static getListGUIStatus($a_obj_id)
static _lookupTitle($a_id)
lookup object title
createDefaultCommand($command)
Get default command link Overwritten for e.g categories,courses => they return a goto link If search ...
setBoldTitle($a_bold_title)
public boolean $a_bold_title set the item title bold
insertCommand($a_href, $a_text, $a_frame="", $a_img="", $a_cmd="", $a_onclick="")
insert command button
getSubstitutionStatus()
Get substitution status.
static _isActive()
Static getter.
enableSubstitutions($a_status)
Enable substitutions.
enableSearchFragments($a_status)
En/disable description.
enableMultiDownload($a_value)
Toggles whether multiple objects can be downloaded at once or not.
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 _lookupUserIsOfflineMode($a_obj_id)
Checks offlineMode and returns false if.
const IL_CAL_UNIX
const RENDER_STATUS_NONE
static _countTags($a_obj_ids)
Count all tags for repository objects.
insertSubscribeCommand()
insert subscribe command
setContainerObject($container_obj)
set the container object (e.g categorygui) Used for link, delete ...
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static preloadCommonProperties($a_obj_ids, $a_context)
Preload common properties.
static calculateRequiredTriggers($a_target_ref_id, $a_target_obj_id, $a_target_obj_type='', $a_force_update=false)
calculate number of obligatory items
static hasRatingInListGUI($a_obj_id, $a_obj_type)
insertDeleteCommand()
insert cut command
static lookupRenderStatus($a_obj_id)
Gets the render status for the object with the specified id.
isVisibleOnlyForced()
Force unreadable.
global $ilCtrl
Definition: ilias.php:18
checkCommandAccess($a_permission, $a_cmd, $a_ref_id, $a_type, $a_obj_id="")
setDescription($a_description)
restrictToGoto($a_value)
Restrict all actions/links to goto.
enableLinkedPath($a_status)
Enable linked path.
getCommandFrame($a_cmd)
Get command target frame.
static _getInstance()
Get singleton instance of this class.
enableRepositoryTransfer($a_value)
Enable copy/move to repository (from personal workspace)
insertPositionField()
Insert field for positioning.
setPositionInputField($a_field_index, $a_position_value)
Set position input field.
enableRating($a_value, $a_text=null, $a_categories=false, array $a_ctrl_path=null)
Toogle rating action status.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
modifySAHSlaunch($a_link, $wtarget)
workaround: SAHS in new javavasript-created window or iframe
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
getMode()
get output mode
isFileUploadAllowed()
Gets a value indicating whether file uploads to this object are allowed or not.
getListTagsJSCall($a_hash, $a_update_code=null)
Get tagging js call.
Class ilRatingGUI.
getNoticeProperties()
get notice properties
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.
enableSubscribe($a_status)
En/disable subscribe.
static hasPreview($a_obj_id, $a_type="")
Determines whether the object with the specified reference id has a preview.
getCommandId()
get command id Normally the ref id.
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
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.
insertProgressInfo()
insert progress info
const IL_NOTE_PUBLIC
Definition: class.ilNote.php:5
enablePreconditions($a_status)
En/disable preconditions.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
enableDownloadCheckbox($a_ref_id, $a_value)
static prepareJsLinks($a_redraw_url, $a_notes_url, $a_tags_url, $a_tpl=null)
Insert js/ajax links into template.
enableDescription($a_status)
En/disable description.
insertSubItems()
Insert subitems.
static _lookupObjId($a_id)
enabledRelevance()
enabled relevance
getProperties($a_item='')
Get item properties.
setAdditionalInformation($a_val)
Set additional information.
special template class to simplify handling of ITX/PEAR
Class ilObjectListGUI.
setSearchFragment($a_text)
set search fragment
static getOptionalConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_obj_type='')
Get optional conditions.
static getRepObjActivation($a_rep_obj_ids)
Get activation for repository objects.
insertInfoScreenCommand()
insert info screen command
initJavascript($a_ajax_url)
Init javascript.
static formatDate(ilDateTime $date)
Format a date public.
getSearchFragment()
get search fragment
Date and time handling
getListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description, $a_use_asynch=false, $a_get_asynch_commands=false, $a_asynch_url="", $a_context=self::CONTEXT_REPOSITORY)
Get all item information (title, commands, description) in HTML.
redirection script todo: (a better solution should control the processing via a xml file) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
enableProgressInfo($a_status)
enable progress info
getDetailsLevel()
Get current details level.
enableNoticeProperties($a_status)
En/disable notices.
static _lookupOrder($a_pobject_id)
const IL_LIST_FULL
getSearchFragmentStatus()
Show hide search result fragments.
getCommandImage($a_cmd)
Get command icon image.
getIconImageType()
Returns the icon image type.
insertPayment()
insert payment information
static getInstance()
Get singelton iunstance.
insertItemDetailLinks()
insert item detail links
initJavascript($a_ajax_url)
Init javascript.
forceVisibleOnly($a_stat)
Force visible access only.
enableCommands($a_status, $a_std_only=false)
En/disable commands.
static _hasAccess($a_pobject_id, $a_user_id=0, $a_transaction=0)
_getCommands()
get commands
static _lookupType($a_id, $a_reference=false)
lookup object type
enableCopy($a_status)
En/disable copy.
setDetailsLevel($a_level)
Details level Currently used in Search which shows only limited properties of forums Currently used f...
$preview
Caches (check) access information on list items.
enableComments($a_value, $a_enable_comments_settings=true)
Toogle comments action status.
appendRepositoryFrameParameter($a_link)
workaround: all links into the repository (from outside) must tell repository to setup the frameset ...
getTitle()
getTitle overwritten in class.ilObjLinkResourceList.php
addCustomProperty($a_property="", $a_value="", $a_alert=false, $a_newline=false)
add custom property
enableExpand($a_status)
En/Dis-able expand/collapse link.
User interface class for advanced drop-down selection lists.
enableIcon($a_status)
En/Dis-able icons.
insertProperties($a_item='')
insert properties
setRelevance($a_rel)
set relevance
setItemDetailLinks($a_detail_links, $a_intro_txt='')
set items detail links
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
enableItemDetailLinks($a_status)
enable item detail links E.g Direct links to chapters or pages
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
enableCheckbox($a_status)
En/Dis-able checkboxes.
_checkCondition($a_id, $a_usr_id=0)
checks wether a single condition is fulfilled every trigger object type must implement a static metho...
global $ilUser
Definition: imgupload.php:15
setParentRefId($a_ref_id)
Set current parent ref id to enable unique js-ids (sessions, etc.)
addHeaderIconHTML($a_id, $a_html)
setConditionDepth($a_depth)
set depth for precondition output (stops at level 5)
getRelevance()
get relevance
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
enableTags($a_value)
Toogle tags action status.
static isUploadAllowed($a_ref_id, $a_type="")
Determines whether files can be uploaded to the object with the specified reference id...
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.
insertTimingsCommand()
insert edit timings command
global $ilSetting
Definition: privfeed.php:40
isSideBlock()
Returns whether current item is a block in a side column or not.
static getInstance()
Get instance.
static _isActive()
Returns true, if change event tracking is active.
getUniqueItemId($a_as_div=false)
Get unique item identifier (for js-actions)
setSeparateCommands($a_val)
Set separate commands.
enableLink($a_status)
En/disable link.
setMode($a_mode)
set output mode
getSeparateCommands()
Get separate commands.
global $lng
Definition: privfeed.php:40
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
global $ilBench
Definition: ilias.php:18
Class ilContainerGUI.
insertCommands($a_use_asynch=false, $a_get_asynch_commands=false, $a_asynch_url="", $a_header_actions=false)
insert all commands into html code
getAlertProperties()
get all alert properties
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
insertCommonSocialCommands($a_header_actions=false)
Insert common social commands (comments, notes, tagging)
Interface for GUI classes (PDGUI, LuceneSearchGUI...) that have to handle administration commands (cu...
getExpandStatus()
Is expand/collapse enabled.
setHeaderSubObject($a_type, $a_id)
Set sub object identifier.
insertDescription()
insert item description
insertFileUpload()
Inserts a file upload component.
insertRelevance()
insert relevance
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="", $a_context=self::CONTEXT_REPOSITORY)
inititialize new item (is called by getItemHTML())
getCustomProperties($a_prop)
get custom properties
getListNotesJSCall($a_hash, $a_update_code=null)
Get list notes js call.
Class ilObjSCORMLearningModule.
static _hasExtensions($a_ref_id)
static _countNotesAndCommentsMultiple($a_rep_obj_ids, $a_no_sub_objs=false)
Get all notes related to multiple objcts.
enableRelevance($a_status)
enable relevance
static _lookupChangeState($obj_id, $usr_id)
Returns the change state of the object for the specified user.
adminCommandsIncluded()
returns whether any admin commands (link, delete, cut) are included in the output ...
addSubItemHTML($a_html)
Add HTML for subitem (used for sessions)
getHeaderAction()
Get header action.
enableTimings($a_status)
enable timings link
insertCutCommand($a_to_repository=false)
insert cut command
insertSubstitutions()
Insert substitutions.