ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilMainMenuGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once 'Services/Mail/classes/class.ilMailGlobalServices.php';
6 
14 {
20  var $ilias;
21  var $tpl;
22  var $target;
24  var $mail; // [bool]
25 
26  protected $mode; // [int]
27  protected $topbar_back_url; // [stringt]
28  protected $topbar_back_caption; // [string]
29 
30  const MODE_FULL = 1;
31  const MODE_TOPBAR_ONLY = 2;
34 
40  function ilMainMenuGUI($a_target = "_top", $a_use_start_template = false)
41  {
42  global $ilias, $rbacsystem, $ilUser;
43 
44  $this->tpl = new ilTemplate("tpl.main_menu.html", true, true,
45  "Services/MainMenu");
46  $this->ilias =& $ilias;
47  $this->target = $a_target;
48  $this->start_template = $a_use_start_template;
49 
50  $this->mail = false;
51  if($ilUser->getId() != ANONYMOUS_USER_ID)
52  {
53  if($rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId()))
54  {
55  $this->mail = true;
56  }
57  }
58 
59  $this->setMode(self::MODE_FULL);
60 
61  // member view
62  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
64  if($set->isActive())
65  {
66  $this->initMemberView();
67  }
68  }
69 
70  public function setMode($a_value)
71  {
72  $this->mode = (int)$a_value;
73  }
74 
75  public function getMode()
76  {
77  return $this->mode;
78  }
79 
80  public function setTopBarBack($a_url, $a_caption = null)
81  {
82  $this->topbar_back_url = $a_url;
83  $this->topbar_back_caption = trim($a_caption);
84  }
85 
86  public function getSpacerClass()
87  {
88  switch($this->getMode())
89  {
90  case self::MODE_TOPBAR_ONLY:
91  case self::MODE_TOPBAR_REDUCED:
92  case self::MODE_TOPBAR_MEMBERVIEW:
93  return "ilFixedTopSpacerBarOnly";
94 
95  case self::MODE_FULL:
96  return "ilFixedTopSpacer";
97  }
98  }
99 
103  function setActive($a_active)
104  {
105  $this->active = $a_active;
106  }
107 
111  function setTemplate(&$tpl)
112  {
113  echo "ilMainMenu->setTemplate is deprecated. Use getHTML instead.";
114  return;
115  $this->tpl =& $tpl;
116  }
117 
121  function getTemplate()
122  {
123  echo "ilMainMenu->getTemplate is deprecated. Use getHTML instead.";
124  return;
125  }
126 
131  public function setLoginTargetPar($a_val)
132  {
133  $this->login_target_par = $a_val;
134  }
135 
139  public function getLoginTargetPar()
140  {
141  return $this->login_target_par;
142  }
143 
144  static function getLanguageSelection($a_in_topbar = false)
145  {
146  global $lng;
147 
148  global $ilUser;
149  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
150  $gr_list = new ilGroupedListGUI();
151  $gr_list->setAsDropDown(true);
152 
153  $languages = $lng->getInstalledLanguages();
154  if(sizeof($languages) > 1) // #11237
155  {
156  foreach ($languages as $lang_key)
157  {
158  $base = substr($_SERVER["REQUEST_URI"], strrpos($_SERVER["REQUEST_URI"], "/") + 1);
159  $base = preg_replace("/&*lang=[a-z]{2}&*/", "", $base);
160  $link = ilUtil::appendUrlParameterString($base,
161  "lang=".$lang_key);
162  $link = str_replace("?&", "?", $link);
163 
164  $gr_list->addEntry($lng->_lookupEntry($lang_key, "meta", "meta_l_".$lang_key), $link);
165  }
166  return $gr_list->getHTML();
167  }
168  }
169 
173  function setTemplateVars()
174  {
175  global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilPluginAdmin;
176 
177  if($this->logo_only)
178  {
179  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
180  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
181 
182  // #15759
183  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
184  $header_top_title = ilObjSystemFolder::_getHeaderTitle();
185  if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title"))
186  {
187  $this->tpl->setCurrentBlock("header_top_title");
188  $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
189  $this->tpl->parseCurrentBlock();
190  }
191 
192  return;
193  }
194 
195  // get user interface plugins
196  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
197 
198  if($this->getMode() != self::MODE_TOPBAR_REDUCED &&
199  $this->getMode() != self::MODE_TOPBAR_MEMBERVIEW)
200  {
201  // search
202  include_once 'Services/Search/classes/class.ilSearchSettings.php';
203  if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
204  {
205  include_once './Services/Search/classes/class.ilMainMenuSearchGUI.php';
206  $main_search = new ilMainMenuSearchGUI();
207  $html = "";
208 
209  // user interface plugin slot + default rendering
210  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
211  $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_search",
212  array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search));
213  if (!$uip->replaced())
214  {
215  $html = $main_search->getHTML();
216  }
217  $html = $uip->getHTML($html);
218 
219  if (strlen($html))
220  {
221  $this->tpl->setVariable('SEARCHBOX',$html);
222  }
223  }
224 
225  $this->renderStatusBox($this->tpl);
226 
227  // online help
228  $this->renderHelpButtons();
229 
230  $this->populateWithBuddySystem();
231  $this->renderAwareness();
232  }
233 
234  if($this->getMode() == self::MODE_FULL)
235  {
236  $mmle_html = "";
237 
238  // user interface plugin slot + default rendering
239  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
240  $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_list_entries",
241  array("main_menu_gui" => $this));
242  if (!$uip->replaced())
243  {
244  $mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu");
245  $mmle_html = $this->renderMainMenuListEntries($mmle_tpl);
246  }
247  $mmle_html = $uip->getHTML($mmle_html);
248 
249  $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html);
250  }
251 
252  if($this->getMode() != self::MODE_TOPBAR_MEMBERVIEW)
253  {
254  $link_dir = (defined("ILIAS_MODULE"))
255  ? "../"
256  : "";
257 
258  // login stuff
259  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
260  {
261  include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
263  {
264  $this->tpl->setCurrentBlock("registration_link");
265  $this->tpl->setVariable("TXT_REGISTER",$lng->txt("register"));
266  $this->tpl->setVariable("LINK_REGISTER", $link_dir."register.php?client_id=".rawurlencode(CLIENT_ID)."&lang=".$ilias->account->getCurrentLanguage());
267  $this->tpl->parseCurrentBlock();
268  }
269 
270  // language selection
271  $selection = self::getLanguageSelection();
272  if($selection)
273  {
274  // bs-patch start
275  global $ilUser, $lng;
276  $this->tpl->setVariable("TXT_LANGSELECT", $lng->txt("language"));
277  // bs-patch end
278  $this->tpl->setVariable("LANG_SELECT", $selection);
279  }
280 
281  $this->tpl->setCurrentBlock("userisanonymous");
282  $this->tpl->setVariable("TXT_NOT_LOGGED_IN",$lng->txt("not_logged_in"));
283  $this->tpl->setVariable("TXT_LOGIN",$lng->txt("log_in"));
284 
285  // #13058
286  $target_str = ($this->getLoginTargetPar() != "")
287  ? $this->getLoginTargetPar()
289  $this->tpl->setVariable("LINK_LOGIN",
290  $link_dir."login.php?target=".$target_str."&client_id=".rawurlencode(CLIENT_ID)."&cmd=force_login&lang=".$ilias->account->getCurrentLanguage());
291  $this->tpl->parseCurrentBlock();
292  }
293  else
294  {
295  if($this->getMode() != self::MODE_TOPBAR_REDUCED && !$ilUser->isAnonymous())
296  {
297  $notificationSettings = new ilSetting('notifications');
298  $chatSettings = new ilSetting('chatroom');
299 
303  global $tpl;
304 
305  $this->tpl->touchBlock('osd_container');
306 
307  include_once "Services/jQuery/classes/class.iljQueryUtil.php";
309 
310  include_once 'Services/MediaObjects/classes/class.ilPlayerUtil.php';
312 
313  $tpl->addJavaScript('Services/Notifications/templates/default/notifications.js');
314  $tpl->addCSS('Services/Notifications/templates/default/osd.css');
315 
316  require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
317  require_once 'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
318 
319  $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId());
320  $this->tpl->setVariable('NOTIFICATION_CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $lng->txt('close'))));
321  $this->tpl->setVariable('INITIAL_NOTIFICATIONS', json_encode($notifications));
322  $this->tpl->setVariable('OSD_POLLING_INTERVALL', $notificationSettings->get('osd_polling_intervall') ? $notificationSettings->get('osd_polling_intervall') : '60');
323  $this->tpl->setVariable('OSD_PLAY_SOUND', $chatSettings->get('play_invitation_sound') && $ilUser->getPref('chat_play_invitation_sound') ? 'true' : 'false');
324  }
325 
326  $this->tpl->setCurrentBlock("userisloggedin");
327  $this->tpl->setVariable("TXT_LOGIN_AS",$lng->txt("login_as"));
328  $user_img_src = $ilias->account->getPersonalPicturePath("small", true);
329  $user_img_alt = $ilias->account->getFullname();
330  $this->tpl->setVariable("USER_IMG", ilUtil::img($user_img_src, $user_img_alt));
331  $this->tpl->setVariable("USR_LINK_PROFILE", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile");
332  $this->tpl->setVariable("USR_TXT_PROFILE", $lng->txt("personal_profile"));
333  $this->tpl->setVariable("USR_LINK_SETTINGS", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings");
334  $this->tpl->setVariable("USR_TXT_SETTINGS", $lng->txt("personal_settings"));
335  $this->tpl->setVariable("TXT_LOGOUT2",$lng->txt("logout"));
336  $this->tpl->setVariable("LINK_LOGOUT2", $link_dir."logout.php?lang=".$ilias->account->getCurrentLanguage());
337  $this->tpl->setVariable("USERNAME",$ilias->account->getFullname());
338  $this->tpl->setVariable("LOGIN",$ilias->account->getLogin());
339  $this->tpl->setVariable("MATRICULATION",$ilias->account->getMatriculation());
340  $this->tpl->setVariable("EMAIL",$ilias->account->getEmail());
341  $this->tpl->parseCurrentBlock();
342  }
343  }
344  else
345  {
346  // member view info
347  $this->tpl->setVariable("TOPBAR_CLASS", " ilMemberViewMainHeader");
348  $this->tpl->setVariable("MEMBER_VIEW_INFO", $lng->txt("mem_view_long"));
349  }
350 
351  if(!$this->topbar_back_url)
352  {
353  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
354  $header_top_title = ilObjSystemFolder::_getHeaderTitle();
355  if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title"))
356  {
357  $this->tpl->setCurrentBlock("header_top_title");
358  $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
359  $this->tpl->parseCurrentBlock();
360  }
361  }
362  else
363  {
364  $this->tpl->setCurrentBlock("header_back_bl");
365  $this->tpl->setVariable("URL_HEADER_BACK", $this->topbar_back_url);
366  $this->tpl->setVariable("TXT_HEADER_BACK", $this->topbar_back_caption
367  ? $this->topbar_back_caption
368  : $lng->txt("back"));
369  $this->tpl->parseCurrentBlock();
370  }
371 
372  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
373 
374  if($this->getMode() == self::MODE_FULL)
375  {
376  // $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
377  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
378  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
379  }
380 
381  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
382 
383  // set link to return to desktop, not depending on a specific position in the hierarchy
384  //$this->tpl->setVariable("SCRIPT_START", $this->getScriptTarget("start.php"));
385 
386  /*
387  else
388  {
389  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
390  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
391  }
392  */
393 
394  $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
395 
396  $this->tpl->parseCurrentBlock();
397  }
398 
402  function renderStatusBox($a_tpl)
403  {
404  global $ilUser, $lng;
405 
406  $box = false;
407 
408  // new mails?
409  if($this->mail)
410  {
411  $new_mails = ilMailGlobalServices::getNumberOfNewMailsByUserId($ilUser->getId());
412  if($new_mails > 0)
413  {
414  $a_tpl->setCurrentBlock('status_text');
415  $a_tpl->setVariable('STATUS_TXT', $new_mails);
416  $a_tpl->parseCurrentBlock();
417  }
418  $a_tpl->setCurrentBlock('status_item');
419  $a_tpl->setVariable('STATUS_IMG', ilUtil::getImagePath('icon_mail.svg'));
420  $a_tpl->setVariable('STATUS_IMG_ALT', $lng->txt("mail"));
421  $a_tpl->setVariable('STATUS_HREF', 'ilias.php?baseClass=ilMailGUI');
422  $a_tpl->parseCurrentBlock();
423  $box = true;
424  }
425 
426  if ($box)
427  {
428  $a_tpl->setCurrentBlock("status_box");
429  $a_tpl->parseCurrentBlock();
430  }
431  }
432 
433 
440  function renderMainMenuListEntries($a_tpl, $a_call_get = true)
441  {
442  global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilAccess;
443 
444  // personal desktop
445  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
446  {
447  $this->renderEntry($a_tpl, "desktop",
448  $lng->txt("personal_desktop"), "#");
449  }
450 
451  // repository
452  if($ilAccess->checkAccess('visible','',ROOT_FOLDER_ID))
453  {
454  include_once('./Services/Link/classes/class.ilLink.php');
455  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
456  $title = $nd["title"];
457  if ($title == "ILIAS")
458  {
459  $title = $lng->txt("repository");
460  }
461  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID || IS_PAYMENT_ENABLED)
462  {
463  $this->renderEntry($a_tpl, "repository",
464  $title, "#");
465  }
466  }
467 
468 
469  // webshop
470  if(IS_PAYMENT_ENABLED)
471  {
472  $title = $lng->txt("shop");
473  $this->renderEntry($a_tpl, "shop", $title, "#" );
474  }
475 
476  // administration
478  {
479  $this->renderDropDown($a_tpl, "administration");
480  }
481 
482  if ($a_call_get)
483  {
484  return $a_tpl->get();
485  }
486 
487  return "";
488  }
489 
496  function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top")
497  {
498  global $lng, $ilNavigationHistory, $ilSetting, $rbacsystem, $ilCtrl;
499 
500  $id = strtolower($a_id);
501  $id_up = strtoupper($a_id);
502  $a_tpl->setCurrentBlock("entry_".$id);
503 
504  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
505 
506  // repository
507  if ($a_id == "repository")
508  {
509  $gl = new ilGroupedListGUI();
510  $gl->setAsDropDown(true);
511 
512  include_once("./Services/Link/classes/class.ilLink.php");
514 
515  $gl->addEntry($icon." ".$a_txt." - ".$lng->txt("rep_main_page"), ilLink::_getStaticLink(1,'root',true),
516  "_top");
517 
518  $items = $ilNavigationHistory->getItems();
519  reset($items);
520  $cnt = 0;
521  $first = true;
522 
523  foreach($items as $k => $item)
524  {
525  if ($cnt >= 10) break;
526 
527  if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) ||
528  ($item["ref_id"] != $_GET["ref_id"] || !$first)) // do not list current item
529  {
530  if ($cnt == 0)
531  {
532  $gl->addGroupHeader($lng->txt("last_visited"), "ilLVNavEnt");
533  }
534  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
535  $cnt ++;
536  $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"));
537  $ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true); // #11023
538  $gl->addEntry($icon." ".$ititle, $item["link"], "_top", "", "ilLVNavEnt");
539 
540  }
541  $first = false;
542  }
543 
544  if ($cnt > 0)
545  {
546  $gl->addEntry("» ".$lng->txt("remove_entries"), "#", "",
547  "return il.MainMenu.removeLastVisitedItems('".
548  $ilCtrl->getLinkTargetByClass("ilnavigationhistorygui", "removeEntries", "", true)."');",
549  "ilLVNavEnt");
550  }
551 
552  $a_tpl->setVariable("REP_EN_OV", $gl->getHTML());
553  }
554 
555  // desktop
556  if ($a_id == "desktop")
557  {
558  $gl = new ilGroupedListGUI();
559  $gl->setAsDropDown(true);
560 
561  // overview
562  $gl->addEntry($lng->txt("overview"),
563  "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSelectedItems",
564  "_top", "", "", "mm_pd_sel_items", ilHelp::getMainMenuTooltip("mm_pd_sel_items"),
565  "left center", "right center", false);
566 
567  // my groups and courses, if both is available
568  if($ilSetting->get('disable_my_offers') == 0 &&
569  $ilSetting->get('disable_my_memberships') == 0)
570  {
571  $gl->addEntry($lng->txt("my_courses_groups"),
572  "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToMemberships",
573  "_top", "", "", "mm_pd_crs_grp", ilHelp::getMainMenuTooltip("mm_pd_crs_grp"),
574  "left center", "right center", false);
575  }
576 
577  // bookmarks
578  if (!$this->ilias->getSetting("disable_bookmarks"))
579  {
580  $gl->addEntry($lng->txt("bookmarks"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToBookmarks",
581  "_top", "", "", "mm_pd_bookm", ilHelp::getMainMenuTooltip("mm_pd_bookm"),
582  "left center", "right center", false);
583  }
584 
585  // private notes
586  if (!$this->ilias->getSetting("disable_notes"))
587  {
588  $gl->addEntry($lng->txt("notes_and_comments"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNotes",
589  "_top", "", "", "mm_pd_notes", ilHelp::getMainMenuTooltip("mm_pd_notes"),
590  "left center", "right center", false);
591  }
592 
593  // news
594  if ($ilSetting->get("block_activated_news"))
595  {
596  $gl->addEntry($lng->txt("news"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNews",
597  "_top", "", "", "mm_pd_news", ilHelp::getMainMenuTooltip("mm_pd_news"),
598  "left center", "right center", false);
599  }
600 
601  // overview is always active
602  $gl->addSeparator();
603 
604  $separator = false;
605 
606  if(!$ilSetting->get("disable_personal_workspace"))
607  {
608  // workspace
609  $gl->addEntry($lng->txt("personal_workspace"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace",
610  "_top", "", "", "mm_pd_wsp", ilHelp::getMainMenuTooltip("mm_pd_wsp"),
611  "left center", "right center", false);
612 
613  $separator = true;
614  }
615 
616  // portfolio
617  if ($ilSetting->get('user_portfolios'))
618  {
619  $gl->addEntry($lng->txt("portfolio"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio",
620  "_top", "", "", "mm_pd_port", ilHelp::getMainMenuTooltip("mm_pd_port"),
621  "left center", "right center", false);
622 
623  $separator = true;
624  }
625 
626  // skills
627  $skmg_set = new ilSetting("skmg");
628  if ($skmg_set->get("enable_skmg"))
629  {
630  $gl->addEntry($lng->txt("skills"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSkills",
631  "_top", "", "", "mm_pd_skill", ilHelp::getMainMenuTooltip("mm_pd_skill"),
632  "left center", "right center", false);
633 
634  $separator = true;
635  }
636 
637  // Learning Progress
638  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
642  {
643  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
644  $gl->addEntry($lng->txt("learning_progress"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToLP",
645  "_top", "", "", "mm_pd_lp", ilHelp::getMainMenuTooltip("mm_pd_lp"),
646  "left center", "right center", false);
647 
648  $separator = true;
649  }
650 
651  if($separator)
652  {
653  $gl->addSeparator();
654  }
655 
656  $separator = false;
657 
658  // calendar
659  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
660  $settings = ilCalendarSettings::_getInstance();
661  if($settings->isEnabled())
662  {
663  $gl->addEntry($lng->txt("calendar"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToCalendar",
664  "_top", "", "", "mm_pd_cal", ilHelp::getMainMenuTooltip("mm_pd_cal"),
665  "left center", "right center", false);
666 
667  $separator = true;
668  }
669 
670  // mail
671  if($this->mail)
672  {
673  $gl->addEntry($lng->txt('mail'), 'ilias.php?baseClass=ilMailGUI', '_top',
674  "", "", "mm_pd_mail", ilHelp::getMainMenuTooltip("mm_pd_mail"),
675  "left center", "right center", false);
676 
677  $separator = true;
678  }
679 
680  // contacts
681  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
682  if(ilBuddySystem::getInstance()->isEnabled())
683  {
684  $gl->addEntry($lng->txt('mail_addressbook'),
685  'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToContacts', '_top'
686  , "", "", "mm_pd_contacts", ilHelp::getMainMenuTooltip("mm_pd_contacts"),
687  "left center", "right center", false);
688 
689  $separator = true;
690  }
691 
692  if($separator)
693  {
694  $gl->addSeparator();
695  }
696 
697  // profile
698  $gl->addEntry($lng->txt("personal_profile"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile",
699  "_top", "", "", "mm_pd_profile", ilHelp::getMainMenuTooltip("mm_pd_profile"),
700  "left center", "right center", false);
701 
702  // settings
703  $gl->addEntry($lng->txt("personal_settings"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings",
704  "_top", "", "", "mm_pd_sett", ilHelp::getMainMenuTooltip("mm_pd_sett"),
705  "left center", "right center", false);
706 
707  $a_tpl->setVariable("DESK_CONT_OV", $gl->getHTML());
708  }
709 
710  if(IS_PAYMENT_ENABLED)
711  {
712  // shop
713  if ($a_id == "shop")
714  {
715  $gl = new ilGroupedListGUI();
716  $gl->setAsDropDown(true);
717 
718  // shop_content
719  $gl->addEntry($lng->txt("content"),
720  "ilias.php?baseClass=ilShopController&cmd=firstpage",
721  "_top");
722 
723  // shoppingcart
724  include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php';
725  global $ilUser;
726  $objShoppingCart = new ilPaymentShoppingCart($ilUser);
727  $items = $objShoppingCart->getEntries();
728 
729  if(count($items) > 0 )
730  {
731  $gl->addEntry($lng->txt("shoppingcart").' ('.count($items).')',
732  "ilias.php?baseClass=ilShopController&cmdClass=ilshopshoppingcartgui",
733  "_top");
734  }
735  $a_tpl->setVariable("SHOP_CONT_OV", $gl->getHTML());
736  }
737  }
738  $a_tpl->setVariable("TXT_".$id_up, $a_txt);
739  $a_tpl->setVariable("SCRIPT_".$id_up, $a_script);
740  $a_tpl->setVariable("TARGET_".$id_up, $a_target);
741  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
742  {
743  //$a_tpl->setVariable("MM_CLASS", "MMActive");
744  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
745  }
746  else
747  {
748  //$a_tpl->setVariable("MM_CLASS", "MMInactive");
749  }
750 
751  if($a_id == "repository")
752  {
753  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
755  {
756  $a_tpl->setVariable("ACC_KEY_REPOSITORY", 'accesskey="'.
758  }
759  }
760  if($a_id == "desktop")
761  {
762  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
764  {
765  $a_tpl->setVariable("ACC_KEY_DESKTOP", 'accesskey="'.
767  }
768  }
769 
770 
771  $a_tpl->parseCurrentBlock();
772  }
773 
774 
778  function getScriptTarget($a_script)
779  {
780  global $ilias;
781 
782  $script = "./".$a_script;
783 
784  //if ($this->start_template == true)
785  //{
786  //if(is_file("./templates/".$ilias->account->skin."/tpl.start.html"))
787  //{
788  // $script = "./start.php?script=".rawurlencode($script);
789  //}
790  //}
791  if (defined("ILIAS_MODULE"))
792  {
793  $script = ".".$script;
794  }
795  return $script;
796  }
797 
799  {
800  global $rbacsystem;
801 
802  //if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
803  if($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID))
804  {
805  return true;
806  }
807  return false;
808  }
809 
810  function getHTML()
811  {
812  // this is a workaround for bugs like 14016
813  // the main menu does not need the YUI connection, but many other
814  // features since they rely on il.Util.sendAjaxGetRequestToUrl (see Services/Javascript)
815  // which still uses YUI. This should be migrated to jQuery with a future major release
816  include_once "Services/YUI/classes/class.ilYuiUtil.php";
817  ilYUIUtil::initConnection();
818 
819  $this->setTemplateVars();
820 
821  return $this->tpl->get();
822  }
823 
828  protected function initMemberView()
829  {
830  global $lng;
831 
832  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
833  $ref_id = ilMemberViewSettings::getInstance()->getCurrentRefId();
834 
835  if(!$ref_id)
836  {
837  return FALSE;
838  }
839 
840  include_once './Services/Link/classes/class.ilLink.php';
842  $ref_id,
844  array('mv' => 0));
845 
846  $this->setMode(self::MODE_TOPBAR_MEMBERVIEW);
847  $this->setTopBarBack($url, $lng->txt('mem_view_close'));
848  }
849 
856  function renderDropDown($a_tpl, $a_id)
857  {
858  global $lng, $ilSetting, $rbacsystem;
859 
860  $id = strtolower($a_id);
861  $id_up = strtoupper($a_id);
862  $a_tpl->setCurrentBlock("entry_".$id);
863  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
864  $selection = new ilAdvancedSelectionListGUI();
865  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
866  {
867  $selection->setSelectionHeaderClass("MMActive");
868  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
869  }
870  else
871  {
872  $selection->setSelectionHeaderClass("MMInactive");
873  }
874 
875  $selection->setSelectionHeaderSpanClass("MMSpan");
876 
877  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::ICON_ARROW);
878  $selection->setItemLinkClass("small");
879  $selection->setUseImages(false);
880 
881  switch ($id)
882  {
883  // desktop drop down
884  case "desktop":
885  $selection->setListTitle($lng->txt("personal_desktop"));
886  $selection->setId("dd_pd");
887 
888  // overview
889  $selection->addItem($lng->txt("overview"), "", "ilias.php?baseClass=ilPersonalDesktopGUI",
890  "", "", "_top");
891 
892  if(!$ilSetting->get("disable_personal_workspace"))
893  {
894  // workspace
895  $selection->addItem($lng->txt("personal_workspace"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
896  "", "", "_top");
897  }
898 
899  // profile
900  $selection->addItem($lng->txt("personal_profile"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
901  "", "", "_top");
902 
903  // skills
904  $skmg_set = new ilSetting("skmg");
905  if ($skmg_set->get("enable_skmg"))
906  {
907  $selection->addItem($lng->txt("skills"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
908  "", "", "_top");
909  }
910 
911  // portfolio
912  if ($ilSetting->get('user_portfolios'))
913  {
914  $selection->addItem($lng->txt("portfolio"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
915  "", "", "_top");
916  }
917 
918  // news
919  if ($ilSetting->get("block_activated_news"))
920  {
921  $selection->addItem($lng->txt("news"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
922  "", "", "_top");
923  }
924 
925  // Learning Progress
926  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
928  {
929  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
930  $selection->addItem($lng->txt("learning_progress"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
931  "", "", "_top");
932  }
933 
934  // calendar
935  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
936  $settings = ilCalendarSettings::_getInstance();
937  if($settings->isEnabled())
938  {
939  $selection->addItem($lng->txt("calendar"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
940  "", "", "_top");
941  }
942 
943  // mail
944  if($this->mail)
945  {
946  $selection->addItem($lng->txt('mail'), '', 'ilias.php?baseClass=ilMailGUI', '', '', '_top');
947  }
948 
949  // contacts
950  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
951  if(ilBuddySystem::getInstance()->isEnabled())
952  {
953  $selection->addItem($lng->txt('mail_addressbook'), '', 'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '', '', '_top');
954  }
955 
956  // private notes
957  if (!$this->ilias->getSetting("disable_notes"))
958  {
959  $selection->addItem($lng->txt("notes_and_comments"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
960  "", "", "_top");
961  }
962 
963  // bookmarks
964  if (!$this->ilias->getSetting("disable_bookmarks"))
965  {
966  $selection->addItem($lng->txt("bookmarks"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
967  "", "", "_top");
968  }
969 
970  // settings
971  $selection->addItem($lng->txt("personal_settings"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
972  "", "", "_top");
973 
974  break;
975 
976  // shop
977  case 'shop':
978  $selection->setListTitle($lng->txt("shop"));
979  $selection->setId("dd_shp");
980  $selection->addItem($lng->txt("shop"), "", "ilias.php?baseClass=ilShopController&cmd=firstpage",
981  "", "", "_top");
982  break;
983 
984  // administration
985  case "administration":
986  $selection->setListTitle($lng->txt("administration"));
987  $selection->setId("dd_adm");
988  $selection->setAsynch(true);
989  $selection->setAsynchUrl("ilias.php?baseClass=ilAdministrationGUI&cmd=getDropDown&cmdMode=asynch");
990  //$this->renderEntry($a_tpl, "administration",
991  // $lng->txt("administration"),
992  // $this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
993  // $this->target);
994 
995  break;
996 
997  }
998 
999 // $selection->setTriggerEvent("mouseover");
1000 // $selection->setAutoHide(true);
1001 
1002  // bs-patch start
1003  global $ilUser;
1004  $a_tpl->setVariable("TXT_ADMINISTRATION", $lng->txt("administration"));
1005  $a_tpl->parseCurrentBlock();
1006  return;
1007  // bs-patch end
1008 
1009  $html = $selection->getHTML();
1010  $a_tpl->setVariable($id_up."_DROP_DOWN", $html);
1011  $a_tpl->parseCurrentBlock();
1012  }
1013 
1014 
1022  {
1023  global $ilHelp, $lng, $ilCtrl, $tpl, $ilSetting, $ilUser;
1024 
1025  // screen id
1026  if ((defined("OH_REF_ID") && OH_REF_ID > 0) || DEVMODE == 1)
1027  {
1028  if ($ilHelp->getScreenId() != "")
1029  {
1030  if($this->getMode() == self::MODE_FULL)
1031  {
1032  $this->tpl->setCurrentBlock("screen_id");
1033  $this->tpl->setVariable("SCREEN_ID", $ilHelp->getScreenId());
1034  $this->tpl->parseCurrentBlock();
1035  }
1036  }
1037  }
1038 
1039  $help_active = false;
1040 
1041  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
1042  $helpl = new ilGroupedListGUI();
1043  $helpl->setAsDropDown(true, true);
1044 
1045  if ($ilHelp->hasSections())
1046  {
1047  $help_active = true;
1048 
1049  $lng->loadLanguageModule("help");
1050  //$this->tpl->setCurrentBlock("help_icon");
1051 
1052  // add javascript needed by help (to do: move to help class)
1053  $tpl->addJavascript("./Services/Help/js/ilHelp.js");
1054  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1055  $acc = new ilAccordionGUI();
1056  $acc->addJavascript();
1057  $acc->addCss();
1058 
1059  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1060  ilTooltipGUI::addTooltip("help_tr", $lng->txt("help_open_online_help"), "",
1061  "bottom center", "top center", false);
1062  $helpl->addEntry("<span>&nbsp;</span> ".$lng->txt("help_topcis"), "#", "", "il.Help.listHelp(event, false);");
1063  }
1064 
1065  $module_id = (int) $ilSetting->get("help_module");
1066  if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
1067  $ilSetting->get("help_mode") != "1")
1068  {
1069  $help_active = true;
1070 
1071  $lng->loadLanguageModule("help");
1072  $tpl->addJavascript("./Services/Help/js/ilHelp.js");
1073 
1074  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1075  ilTooltipGUI::addTooltip("help_tt", $lng->txt("help_toggle_tooltips"), "",
1076  "bottom center", "top center", false);
1077  $helpl->addEntry('<span id="help_tt_switch_on" class="glyphicon glyphicon-ok"></span> '.$lng->txt("help_tooltips"), "#", "", "return il.Help.switchTooltips(event);");
1078  }
1079 
1080  if($help_active)
1081  {
1082  $this->tpl->setCurrentBlock("help");
1083  $this->tpl->setVariable("TXT_HELP", $lng->txt("help"));
1084  $this->tpl->setVariable("HELP_SELECT", $helpl->getHTML());
1085  $this->tpl->parseCurrentBlock();
1086 
1087  // always set ajax url
1088  $ts = $ilCtrl->getTargetScript();
1089  $ilCtrl->setTargetScript("ilias.php");
1090 
1091  $ilHelp->setCtrlPar();
1092  $tpl->addOnLoadCode("il.Help.setAjaxUrl('".
1093  $ilCtrl->getLinkTargetByClass("ilhelpgui", "", "", true)
1094  ."');");
1095  $ilCtrl->setTargetScript($ts);
1096  }
1097  }
1098 
1102  protected function populateWithBuddySystem()
1103  {
1104  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
1105  if(ilBuddySystem::getInstance()->isEnabled())
1106  {
1107  require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
1108  ilBuddySystemGUI::initializeFrontend();
1109  }
1110  }
1111 
1115  function renderAwareness()
1116  {
1117  include_once("./Services/Awareness/classes/class.ilAwarenessGUI.php");
1119 
1120  $this->tpl->setVariable("AWARENESS", $aw->getMainMenuHTML());
1121  }
1122 
1130  function showLogoOnly($a_value)
1131  {
1132  $this->logo_only = (bool)$a_value;
1133  }
1134 
1135  protected function getHeaderURL()
1136  {
1137  include_once './Services/User/classes/class.ilUserUtil.php';
1139 
1140  if(!$url)
1141  {
1142  $url = "./goto.php?target=root_1";
1143  }
1144 
1145  return $url;
1146  }
1147 }
1148 
1149 ?>
static buildLoginTarget()
Add current object (repository/workspace) as target for login url.
ILIAS Setting Class.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _getInstance()
get singleton instance
Handles display of the main menu.
getScriptTarget($a_script)
generates complete script target (private)
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$separator
getLoginTargetPar()
Get target parameter for login.
$_SESSION["AccountId"]
renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target="_top")
Render main menu entry.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
static getInstance()
Get instance.
renderHelpButtons()
Render help button.
static getKey($a_func_id, $lang_key="0", $a_ignore_default=false)
Get single access key.
setLoginTargetPar($a_val)
Set target parameter for login (public sector).
static get($a_glyph, $a_text="")
Get glyph html.
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
initMemberView()
Init member view type $lng.
UI interface hook processor.
$url
Definition: shib_logout.php:72
populateWithBuddySystem()
Includes all buddy system/user connections related javascript code.
static getStartingPointAsUrl()
Get current starting point setting as URL.
setTemplate(&$tpl)
set output template
global $ilCtrl
Definition: ilias.php:18
renderAwareness()
Render awareness tool.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
setTopBarBack($a_url, $a_caption=null)
$nd
Definition: error.php:11
static addTooltip($a_el_id, $a_text, $a_container="", $a_my="bottom center", $a_at="top center", $a_use_htmlspecialchars=true)
Adds a tooltip to an HTML element.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Grouped list GUI class.
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
static getLanguageSelection($a_in_topbar=false)
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
redirection script todo: (a better solution should control the processing via a xml file) ...
renderMainMenuListEntries($a_tpl, $a_call_get=true)
desc
showLogoOnly($a_value)
Toggle rendering of main menu, search, user info.
static getMainMenuTooltip($a_item_id)
Get main menu tooltip.
ilMainMenuGUI($a_target="_top", $a_use_start_template=false)
static _lookupType($a_id, $a_reference=false)
lookup object type
User interface class for advanced drop-down selection lists.
Add a search box to main menu.
static getNotificationsForUser($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
renderDropDown($a_tpl, $a_id)
GetDropDownHTML.
global $ilUser
Definition: imgupload.php:15
$ref_id
Definition: sahs_server.php:39
global $ilSetting
Definition: privfeed.php:40
static getInstance()
Get instance.
global $lng
Definition: privfeed.php:40
renderStatusBox($a_tpl)
Render status box.
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable...
static initjQuery($a_tpl=null)
Init jQuery.
static getNumberOfNewMailsByUserId($usr_id)
Determines the number of new mails for the passed user id and stores this information in a local cach...
Accordion user interface class.
getTemplate()
get output template
$html
Definition: example_001.php:87
const IL_COMP_SERVICE
_getSearchSettingRefId()
Read the ref_id of Search Settings object.