ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
231  if($this->getMode() == self::MODE_FULL)
232  {
233  $mmle_html = "";
234 
235  // user interface plugin slot + default rendering
236  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
237  $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_list_entries",
238  array("main_menu_gui" => $this));
239  if (!$uip->replaced())
240  {
241  $mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu");
242  $mmle_html = $this->renderMainMenuListEntries($mmle_tpl);
243  }
244  $mmle_html = $uip->getHTML($mmle_html);
245 
246  $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html);
247  }
248 
249  if($this->getMode() != self::MODE_TOPBAR_MEMBERVIEW)
250  {
251  $link_dir = (defined("ILIAS_MODULE"))
252  ? "../"
253  : "";
254 
255  // login stuff
256  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
257  {
258  include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
260  {
261  $this->tpl->setCurrentBlock("registration_link");
262  $this->tpl->setVariable("TXT_REGISTER",$lng->txt("register"));
263  $this->tpl->setVariable("LINK_REGISTER", $link_dir."register.php?client_id=".rawurlencode(CLIENT_ID)."&lang=".$ilias->account->getCurrentLanguage());
264  $this->tpl->parseCurrentBlock();
265  }
266 
267  // language selection
268  $selection = self::getLanguageSelection();
269  if($selection)
270  {
271  // bs-patch start
272  global $ilUser, $lng;
273  $this->tpl->setVariable("TXT_LANGSELECT", $lng->txt("language"));
274  // bs-patch end
275  $this->tpl->setVariable("LANG_SELECT", $selection);
276  }
277 
278  $this->tpl->setCurrentBlock("userisanonymous");
279  $this->tpl->setVariable("TXT_NOT_LOGGED_IN",$lng->txt("not_logged_in"));
280  $this->tpl->setVariable("TXT_LOGIN",$lng->txt("log_in"));
281 
282  // #13058
283  $target_str = ($this->getLoginTargetPar() != "")
284  ? $this->getLoginTargetPar()
286  $this->tpl->setVariable("LINK_LOGIN",
287  $link_dir."login.php?target=".$target_str."&client_id=".rawurlencode(CLIENT_ID)."&cmd=force_login&lang=".$ilias->account->getCurrentLanguage());
288  $this->tpl->parseCurrentBlock();
289  }
290  else
291  {
292  if($this->getMode() != self::MODE_TOPBAR_REDUCED)
293  {
294  $notificationSettings = new ilSetting('notifications');
295  $chatSettings = new ilSetting('chatroom');
296 
300  global $tpl;
301 
302  if($chatSettings->get('chat_enabled') && $notificationSettings->get('enable_osd'))
303  {
304  $this->tpl->touchBlock('osd_enabled');
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') : '5');
323  $this->tpl->setVariable(
324  'OSD_PLAY_SOUND',
325  $chatSettings->get('play_invitation_sound') && $ilUser->getPref('chat_play_invitation_sound') ? 'true' : 'false');
326  foreach($notifications as $notification)
327  {
328  if($notification['type'] == 'osd_maint')
329  {
330  continue;
331  }
332  $this->tpl->setCurrentBlock('osd_notification_item');
333 
334  $this->tpl->setVariable('NOTIFICATION_ICON_PATH', $notification['data']->iconPath);
335  $this->tpl->setVariable('NOTIFICATION_TITLE', $notification['data']->title);
336  $this->tpl->setVariable('NOTIFICATION_LINK', $notification['data']->link);
337  $this->tpl->setVariable('NOTIFICATION_LINKTARGET', $notification['data']->linktarget);
338  $this->tpl->setVariable('NOTIFICATION_ID', $notification['notification_osd_id']);
339  $this->tpl->setVariable('NOTIFICATION_SHORT_DESCRIPTION', $notification['data']->shortDescription);
340  $this->tpl->parseCurrentBlock();
341  }
342  }
343  }
344 
345  $this->tpl->setCurrentBlock("userisloggedin");
346  $this->tpl->setVariable("TXT_LOGIN_AS",$lng->txt("login_as"));
347  $user_img_src = $ilias->account->getPersonalPicturePath("small", true);
348  $user_img_alt = $ilias->account->getFullname();
349  $this->tpl->setVariable("USER_IMG", ilUtil::img($user_img_src, $user_img_alt));
350  $this->tpl->setVariable("USR_LINK_PROFILE", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile");
351  $this->tpl->setVariable("USR_TXT_PROFILE", $lng->txt("personal_profile"));
352  $this->tpl->setVariable("USR_LINK_SETTINGS", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings");
353  $this->tpl->setVariable("USR_TXT_SETTINGS", $lng->txt("personal_settings"));
354  $this->tpl->setVariable("TXT_LOGOUT2",$lng->txt("logout"));
355  $this->tpl->setVariable("LINK_LOGOUT2", $link_dir."logout.php?lang=".$ilias->account->getCurrentLanguage());
356  $this->tpl->setVariable("USERNAME",$ilias->account->getFullname());
357  $this->tpl->setVariable("LOGIN",$ilias->account->getLogin());
358  $this->tpl->setVariable("MATRICULATION",$ilias->account->getMatriculation());
359  $this->tpl->setVariable("EMAIL",$ilias->account->getEmail());
360  $this->tpl->parseCurrentBlock();
361  }
362  }
363  else
364  {
365  // member view info
366  $this->tpl->setVariable("TOPBAR_CLASS", " ilMemberViewMainHeader");
367  $this->tpl->setVariable("MEMBER_VIEW_INFO", $lng->txt("mem_view_long"));
368  }
369 
370  if(!$this->topbar_back_url)
371  {
372  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
373  $header_top_title = ilObjSystemFolder::_getHeaderTitle();
374  if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title"))
375  {
376  $this->tpl->setCurrentBlock("header_top_title");
377  $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
378  $this->tpl->parseCurrentBlock();
379  }
380  }
381  else
382  {
383  $this->tpl->setCurrentBlock("header_back_bl");
384  $this->tpl->setVariable("URL_HEADER_BACK", $this->topbar_back_url);
385  $this->tpl->setVariable("TXT_HEADER_BACK", $this->topbar_back_caption
386  ? $this->topbar_back_caption
387  : $lng->txt("back"));
388  $this->tpl->parseCurrentBlock();
389  }
390 
391  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
392 
393  if($this->getMode() == self::MODE_FULL)
394  {
395  // $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
396  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
397  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
398  }
399 
400  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
401 
402  // set link to return to desktop, not depending on a specific position in the hierarchy
403  //$this->tpl->setVariable("SCRIPT_START", $this->getScriptTarget("start.php"));
404 
405  /*
406  else
407  {
408  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
409  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
410  }
411  */
412 
413  $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
414 
415  $this->tpl->parseCurrentBlock();
416  }
417 
421  function renderStatusBox($a_tpl)
422  {
423  global $ilUser, $lng;
424 
425  $box = false;
426 
427  // new mails?
428  if($this->mail)
429  {
430  $new_mails = ilMailGlobalServices::getNumberOfNewMailsByUserId($ilUser->getId());
431  if($new_mails > 0)
432  {
433  $a_tpl->setCurrentBlock('status_text');
434  $a_tpl->setVariable('STATUS_TXT', $new_mails);
435  $a_tpl->parseCurrentBlock();
436  }
437  $a_tpl->setCurrentBlock('status_item');
438  $a_tpl->setVariable('STATUS_IMG', ilUtil::getImagePath('icon_mail.svg'));
439  $a_tpl->setVariable('STATUS_IMG_ALT', $lng->txt("mail"));
440  $a_tpl->setVariable('STATUS_HREF', 'ilias.php?baseClass=ilMailGUI');
441  $a_tpl->parseCurrentBlock();
442  $box = true;
443  }
444 
445  if ($box)
446  {
447  $a_tpl->setCurrentBlock("status_box");
448  $a_tpl->parseCurrentBlock();
449  }
450  }
451 
452 
459  function renderMainMenuListEntries($a_tpl, $a_call_get = true)
460  {
461  global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilAccess;
462 
463  // personal desktop
464  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
465  {
466  $this->renderEntry($a_tpl, "desktop",
467  $lng->txt("personal_desktop"), "#");
468  }
469 
470  // repository
471  if($ilAccess->checkAccess('visible','',ROOT_FOLDER_ID))
472  {
473  include_once('./Services/Link/classes/class.ilLink.php');
474  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
475  $title = $nd["title"];
476  if ($title == "ILIAS")
477  {
478  $title = $lng->txt("repository");
479  }
480  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID || IS_PAYMENT_ENABLED)
481  {
482  $this->renderEntry($a_tpl, "repository",
483  $title, "#");
484  }
485  }
486 
487 
488  // webshop
489  if(IS_PAYMENT_ENABLED)
490  {
491  $title = $lng->txt("shop");
492  $this->renderEntry($a_tpl, "shop", $title, "#" );
493  }
494 
495  // administration
497  {
498  $this->renderDropDown($a_tpl, "administration");
499  }
500 
501  if ($a_call_get)
502  {
503  return $a_tpl->get();
504  }
505 
506  return "";
507  }
508 
515  function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top")
516  {
517  global $lng, $ilNavigationHistory, $ilSetting, $rbacsystem, $ilCtrl;
518 
519  $id = strtolower($a_id);
520  $id_up = strtoupper($a_id);
521  $a_tpl->setCurrentBlock("entry_".$id);
522 
523  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
524 
525  // repository
526  if ($a_id == "repository")
527  {
528  $gl = new ilGroupedListGUI();
529  $gl->setAsDropDown(true);
530 
531  include_once("./Services/Link/classes/class.ilLink.php");
533 
534  $gl->addEntry($icon." ".$a_txt." - ".$lng->txt("rep_main_page"), ilLink::_getStaticLink(1,'root',true),
535  "_top");
536 
537  $items = $ilNavigationHistory->getItems();
538  reset($items);
539  $cnt = 0;
540  $first = true;
541 
542  foreach($items as $k => $item)
543  {
544  if ($cnt >= 10) break;
545 
546  if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) ||
547  ($item["ref_id"] != $_GET["ref_id"] || !$first)) // do not list current item
548  {
549  if ($cnt == 0)
550  {
551  $gl->addGroupHeader($lng->txt("last_visited"), "ilLVNavEnt");
552  }
553  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
554  $cnt ++;
555  $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"));
556  $ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true); // #11023
557  $gl->addEntry($icon." ".$ititle, $item["link"], "_top", "", "ilLVNavEnt");
558 
559  }
560  $first = false;
561  }
562 
563  if ($cnt > 0)
564  {
565  $gl->addEntry("» ".$lng->txt("remove_entries"), "#", "",
566  "return il.MainMenu.removeLastVisitedItems('".
567  $ilCtrl->getLinkTargetByClass("ilnavigationhistorygui", "removeEntries", "", true)."');",
568  "ilLVNavEnt");
569  }
570 
571  $a_tpl->setVariable("REP_EN_OV", $gl->getHTML());
572  }
573 
574  // desktop
575  if ($a_id == "desktop")
576  {
577  $gl = new ilGroupedListGUI();
578  $gl->setAsDropDown(true);
579 
580  // overview
581  $gl->addEntry($lng->txt("overview"),
582  "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSelectedItems",
583  "_top", "", "", "mm_pd_sel_items", ilHelp::getMainMenuTooltip("mm_pd_sel_items"),
584  "left center", "right center", false);
585 
586  // my groups and courses, if both is available
587  if($ilSetting->get('disable_my_offers') == 0 &&
588  $ilSetting->get('disable_my_memberships') == 0)
589  {
590  $gl->addEntry($lng->txt("my_courses_groups"),
591  "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToMemberships",
592  "_top", "", "", "mm_pd_crs_grp", ilHelp::getMainMenuTooltip("mm_pd_crs_grp"),
593  "left center", "right center", false);
594  }
595 
596  // bookmarks
597  if (!$this->ilias->getSetting("disable_bookmarks"))
598  {
599  $gl->addEntry($lng->txt("bookmarks"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
600  "_top", "", "", "mm_pd_bookm", ilHelp::getMainMenuTooltip("mm_pd_bookm"),
601  "left center", "right center", false);
602  }
603 
604  // private notes
605  if (!$this->ilias->getSetting("disable_notes"))
606  {
607  $gl->addEntry($lng->txt("notes_and_comments"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
608  "_top", "", "", "mm_pd_notes", ilHelp::getMainMenuTooltip("mm_pd_notes"),
609  "left center", "right center", false);
610  }
611 
612  // news
613  if ($ilSetting->get("block_activated_news"))
614  {
615  $gl->addEntry($lng->txt("news"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
616  "_top", "", "", "mm_pd_news", ilHelp::getMainMenuTooltip("mm_pd_news"),
617  "left center", "right center", false);
618  }
619 
620  // overview is always active
621  $gl->addSeparator();
622 
623  $separator = false;
624 
625  if(!$ilSetting->get("disable_personal_workspace"))
626  {
627  // workspace
628  $gl->addEntry($lng->txt("personal_workspace"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
629  "_top", "", "", "mm_pd_wsp", ilHelp::getMainMenuTooltip("mm_pd_wsp"),
630  "left center", "right center", false);
631 
632  $separator = true;
633  }
634 
635  // portfolio
636  if ($ilSetting->get('user_portfolios'))
637  {
638  $gl->addEntry($lng->txt("portfolio"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
639  "_top", "", "", "mm_pd_port", ilHelp::getMainMenuTooltip("mm_pd_port"),
640  "left center", "right center", false);
641 
642  $separator = true;
643  }
644 
645  // skills
646  $skmg_set = new ilSetting("skmg");
647  if ($skmg_set->get("enable_skmg"))
648  {
649  $gl->addEntry($lng->txt("skills"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
650  "_top", "", "", "mm_pd_skill", ilHelp::getMainMenuTooltip("mm_pd_skill"),
651  "left center", "right center", false);
652 
653  $separator = true;
654  }
655 
656  // Learning Progress
657  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
661  {
662  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
663  $gl->addEntry($lng->txt("learning_progress"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
664  "_top", "", "", "mm_pd_lp", ilHelp::getMainMenuTooltip("mm_pd_lp"),
665  "left center", "right center", false);
666 
667  $separator = true;
668  }
669 
670  if($separator)
671  {
672  $gl->addSeparator();
673  }
674 
675  $separator = false;
676 
677  // calendar
678  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
679  $settings = ilCalendarSettings::_getInstance();
680  if($settings->isEnabled())
681  {
682  $gl->addEntry($lng->txt("calendar"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
683  "_top", "", "", "mm_pd_cal", ilHelp::getMainMenuTooltip("mm_pd_cal"),
684  "left center", "right center", false);
685 
686  $separator = true;
687  }
688 
689  // mail
690  if($this->mail)
691  {
692  $gl->addEntry($lng->txt('mail'), 'ilias.php?baseClass=ilMailGUI', '_top',
693  "", "", "mm_pd_mail", ilHelp::getMainMenuTooltip("mm_pd_mail"),
694  "left center", "right center", false);
695 
696  $separator = true;
697  }
698 
699  // contacts
700  if(!$this->ilias->getSetting('disable_contacts') &&
701  ($this->ilias->getSetting('disable_contacts_require_mail') ||
702  $rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())))
703  {
704  $gl->addEntry($lng->txt('mail_addressbook'),
705  'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '_top'
706  , "", "", "mm_pd_contacts", ilHelp::getMainMenuTooltip("mm_pd_contacts"),
707  "left center", "right center", false);
708 
709  $separator = true;
710  }
711 
712  if($separator)
713  {
714  $gl->addSeparator();
715  }
716 
717  // profile
718  $gl->addEntry($lng->txt("personal_profile"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
719  "_top", "", "", "mm_pd_profile", ilHelp::getMainMenuTooltip("mm_pd_profile"),
720  "left center", "right center", false);
721 
722  // settings
723  $gl->addEntry($lng->txt("personal_settings"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
724  "_top", "", "", "mm_pd_sett", ilHelp::getMainMenuTooltip("mm_pd_sett"),
725  "left center", "right center", false);
726 
727  $a_tpl->setVariable("DESK_CONT_OV", $gl->getHTML());
728  }
729 
730  if(IS_PAYMENT_ENABLED)
731  {
732  // shop
733  if ($a_id == "shop")
734  {
735  $gl = new ilGroupedListGUI();
736  $gl->setAsDropDown(true);
737 
738  // shop_content
739  $gl->addEntry($lng->txt("content"),
740  "ilias.php?baseClass=ilShopController&amp;cmd=firstpage",
741  "_top");
742 
743  // shoppingcart
744  include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php';
745  global $ilUser;
746  $objShoppingCart = new ilPaymentShoppingCart($ilUser);
747  $items = $objShoppingCart->getEntries();
748 
749  if(count($items) > 0 )
750  {
751  $gl->addEntry($lng->txt("shoppingcart").' ('.count($items).')',
752  "ilias.php?baseClass=ilShopController&amp;cmdClass=ilshopshoppingcartgui",
753  "_top");
754  }
755  $a_tpl->setVariable("SHOP_CONT_OV", $gl->getHTML());
756  }
757  }
758  $a_tpl->setVariable("TXT_".$id_up, $a_txt);
759  $a_tpl->setVariable("SCRIPT_".$id_up, $a_script);
760  $a_tpl->setVariable("TARGET_".$id_up, $a_target);
761  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
762  {
763  //$a_tpl->setVariable("MM_CLASS", "MMActive");
764  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
765  }
766  else
767  {
768  //$a_tpl->setVariable("MM_CLASS", "MMInactive");
769  }
770 
771  if($a_id == "repository")
772  {
773  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
775  {
776  $a_tpl->setVariable("ACC_KEY_REPOSITORY", 'accesskey="'.
778  }
779  }
780  if($a_id == "desktop")
781  {
782  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
784  {
785  $a_tpl->setVariable("ACC_KEY_DESKTOP", 'accesskey="'.
787  }
788  }
789 
790 
791  $a_tpl->parseCurrentBlock();
792  }
793 
794 
798  function getScriptTarget($a_script)
799  {
800  global $ilias;
801 
802  $script = "./".$a_script;
803 
804  //if ($this->start_template == true)
805  //{
806  //if(is_file("./templates/".$ilias->account->skin."/tpl.start.html"))
807  //{
808  // $script = "./start.php?script=".rawurlencode($script);
809  //}
810  //}
811  if (defined("ILIAS_MODULE"))
812  {
813  $script = ".".$script;
814  }
815  return $script;
816  }
817 
819  {
820  global $rbacsystem;
821 
822  //if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
823  if($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID))
824  {
825  return true;
826  }
827  return false;
828  }
829 
830  function getHTML()
831  {
832  // this is a workaround for bugs like 14016
833  // the main menu does not need the YUI connection, but many other
834  // features since they rely on il.Util.sendAjaxGetRequestToUrl (see Services/Javascript)
835  // which still uses YUI. This should be migrated to jQuery with a future major release
836  include_once "Services/YUI/classes/class.ilYuiUtil.php";
837  ilYUIUtil::initConnection();
838 
839  $this->setTemplateVars();
840 
841  return $this->tpl->get();
842  }
843 
848  protected function initMemberView()
849  {
850  global $lng;
851 
852  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
853  $ref_id = ilMemberViewSettings::getInstance()->getCurrentRefId();
854 
855  if(!$ref_id)
856  {
857  return FALSE;
858  }
859 
860  include_once './Services/Link/classes/class.ilLink.php';
861  $url = ilLink::_getLink(
862  $ref_id,
864  array('mv' => 0));
865 
866  $this->setMode(self::MODE_TOPBAR_MEMBERVIEW);
867  $this->setTopBarBack($url, $lng->txt('mem_view_close'));
868  }
869 
876  function renderDropDown($a_tpl, $a_id)
877  {
878  global $lng, $ilSetting, $rbacsystem;
879 
880  $id = strtolower($a_id);
881  $id_up = strtoupper($a_id);
882  $a_tpl->setCurrentBlock("entry_".$id);
883  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
884  $selection = new ilAdvancedSelectionListGUI();
885  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
886  {
887  $selection->setSelectionHeaderClass("MMActive");
888  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
889  }
890  else
891  {
892  $selection->setSelectionHeaderClass("MMInactive");
893  }
894 
895  $selection->setSelectionHeaderSpanClass("MMSpan");
896 
897  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::ICON_ARROW);
898  $selection->setItemLinkClass("small");
899  $selection->setUseImages(false);
900 
901  switch ($id)
902  {
903  // desktop drop down
904  case "desktop":
905  $selection->setListTitle($lng->txt("personal_desktop"));
906  $selection->setId("dd_pd");
907 
908  // overview
909  $selection->addItem($lng->txt("overview"), "", "ilias.php?baseClass=ilPersonalDesktopGUI",
910  "", "", "_top");
911 
912  if(!$ilSetting->get("disable_personal_workspace"))
913  {
914  // workspace
915  $selection->addItem($lng->txt("personal_workspace"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
916  "", "", "_top");
917  }
918 
919  // profile
920  $selection->addItem($lng->txt("personal_profile"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
921  "", "", "_top");
922 
923  // skills
924  $skmg_set = new ilSetting("skmg");
925  if ($skmg_set->get("enable_skmg"))
926  {
927  $selection->addItem($lng->txt("skills"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
928  "", "", "_top");
929  }
930 
931  // portfolio
932  if ($ilSetting->get('user_portfolios'))
933  {
934  $selection->addItem($lng->txt("portfolio"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
935  "", "", "_top");
936  }
937 
938  // news
939  if ($ilSetting->get("block_activated_news"))
940  {
941  $selection->addItem($lng->txt("news"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
942  "", "", "_top");
943  }
944 
945  // Learning Progress
946  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
948  {
949  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
950  $selection->addItem($lng->txt("learning_progress"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
951  "", "", "_top");
952  }
953 
954  // calendar
955  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
956  $settings = ilCalendarSettings::_getInstance();
957  if($settings->isEnabled())
958  {
959  $selection->addItem($lng->txt("calendar"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
960  "", "", "_top");
961  }
962 
963  // mail
964  if($this->mail)
965  {
966  $selection->addItem($lng->txt('mail'), '', 'ilias.php?baseClass=ilMailGUI', '', '', '_top');
967  }
968 
969  // contacts
970  if (!$this->ilias->getSetting('disable_contacts') &&
971  ($this->ilias->getSetting('disable_contacts_require_mail') ||
972  $rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())))
973  {
974  $selection->addItem($lng->txt('mail_addressbook'), '', 'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '', '', '_top');
975  }
976 
977  // private notes
978  if (!$this->ilias->getSetting("disable_notes"))
979  {
980  $selection->addItem($lng->txt("notes_and_comments"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
981  "", "", "_top");
982  }
983 
984  // bookmarks
985  if (!$this->ilias->getSetting("disable_bookmarks"))
986  {
987  $selection->addItem($lng->txt("bookmarks"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
988  "", "", "_top");
989  }
990 
991  // settings
992  $selection->addItem($lng->txt("personal_settings"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
993  "", "", "_top");
994 
995  break;
996 
997  // shop
998  case 'shop':
999  $selection->setListTitle($lng->txt("shop"));
1000  $selection->setId("dd_shp");
1001  $selection->addItem($lng->txt("shop"), "", "ilias.php?baseClass=ilShopController&cmd=firstpage",
1002  "", "", "_top");
1003  break;
1004 
1005  // administration
1006  case "administration":
1007  $selection->setListTitle($lng->txt("administration"));
1008  $selection->setId("dd_adm");
1009  $selection->setAsynch(true);
1010  $selection->setAsynchUrl("ilias.php?baseClass=ilAdministrationGUI&cmd=getDropDown&cmdMode=asynch");
1011  //$this->renderEntry($a_tpl, "administration",
1012  // $lng->txt("administration"),
1013  // $this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
1014  // $this->target);
1015 
1016  break;
1017 
1018  }
1019 
1020 // $selection->setTriggerEvent("mouseover");
1021 // $selection->setAutoHide(true);
1022 
1023  // bs-patch start
1024  global $ilUser;
1025  $a_tpl->setVariable("TXT_ADMINISTRATION", $lng->txt("administration"));
1026  $a_tpl->parseCurrentBlock();
1027  return;
1028  // bs-patch end
1029 
1030  $html = $selection->getHTML();
1031  $a_tpl->setVariable($id_up."_DROP_DOWN", $html);
1032  $a_tpl->parseCurrentBlock();
1033  }
1034 
1035 
1043  {
1044  global $ilHelp, $lng, $ilCtrl, $tpl, $ilSetting, $ilUser;
1045 
1046  // screen id
1047  if (defined("OH_REF_ID") && OH_REF_ID > 0)
1048  {
1049  if ($ilHelp->getScreenId() != "")
1050  {
1051  if($this->getMode() == self::MODE_FULL)
1052  {
1053  $this->tpl->setCurrentBlock("screen_id");
1054  $this->tpl->setVariable("SCREEN_ID", $ilHelp->getScreenId());
1055  $this->tpl->parseCurrentBlock();
1056  }
1057  }
1058  }
1059 
1060  $help_active = false;
1061 
1062  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
1063  $helpl = new ilGroupedListGUI();
1064  $helpl->setAsDropDown(true, true);
1065 
1066  if ($ilHelp->hasSections())
1067  {
1068  $help_active = true;
1069 
1070  $lng->loadLanguageModule("help");
1071  //$this->tpl->setCurrentBlock("help_icon");
1072 
1073  // add javascript needed by help (to do: move to help class)
1074  $tpl->addJavascript("./Services/Help/js/ilHelp.js");
1075  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1076  $acc = new ilAccordionGUI();
1077  $acc->addJavascript();
1078  $acc->addCss();
1079 
1080  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1081  ilTooltipGUI::addTooltip("help_tr", $lng->txt("help_open_online_help"), "",
1082  "bottom center", "top center", false);
1083  $helpl->addEntry("<span>&nbsp;</span> ".$lng->txt("help_topcis"), "#", "", "il.Help.listHelp(event, false);");
1084  }
1085 
1086  $module_id = (int) $ilSetting->get("help_module");
1087  if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
1088  $ilSetting->get("help_mode") != "1")
1089  {
1090  $help_active = true;
1091 
1092  $lng->loadLanguageModule("help");
1093  $tpl->addJavascript("./Services/Help/js/ilHelp.js");
1094 
1095  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1096  ilTooltipGUI::addTooltip("help_tt", $lng->txt("help_toggle_tooltips"), "",
1097  "bottom center", "top center", false);
1098  $helpl->addEntry('<span id="help_tt_switch_on" class="glyphicon glyphicon-ok"></span> '.$lng->txt("help_tooltips"), "#", "", "return il.Help.switchTooltips(event);");
1099  }
1100 
1101  if($help_active)
1102  {
1103  $this->tpl->setCurrentBlock("help");
1104  $this->tpl->setVariable("TXT_HELP", $lng->txt("help"));
1105  $this->tpl->setVariable("HELP_SELECT", $helpl->getHTML());
1106  $this->tpl->parseCurrentBlock();
1107 
1108  // always set ajax url
1109  $ts = $ilCtrl->getTargetScript();
1110  $ilCtrl->setTargetScript("ilias.php");
1111 
1112  $ilHelp->setCtrlPar();
1113  $tpl->addOnLoadCode("il.Help.setAjaxUrl('".
1114  $ilCtrl->getLinkTargetByClass("ilhelpgui", "", "", true)
1115  ."');");
1116  $ilCtrl->setTargetScript($ts);
1117  }
1118  }
1119 
1120 
1128  function showLogoOnly($a_value)
1129  {
1130  $this->logo_only = (bool)$a_value;
1131  }
1132 
1133  protected function getHeaderURL()
1134  {
1135  include_once './Services/User/classes/class.ilUserUtil.php';
1137 
1138  if(!$url)
1139  {
1140  $url = "./goto.php?target=root_1";
1141  }
1142 
1143  return $url;
1144  }
1145 }
1146 
1147 ?>