ILIAS  Release_4_4_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 
25 
31  function ilMainMenuGUI($a_target = "_top", $a_use_start_template = false)
32  {
33  global $ilias, $rbacsystem, $ilUser;
34 
35  $this->tpl = new ilTemplate("tpl.main_menu.html", true, true,
36  "Services/MainMenu");
37  $this->ilias =& $ilias;
38  $this->target = $a_target;
39  $this->start_template = $a_use_start_template;
40  $this->small = false;
41 
42  $this->mail = false;
43  if($ilUser->getId() != ANONYMOUS_USER_ID)
44  {
45  if($rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId()))
46  {
47  $this->mail = true;
48  }
49  }
50  }
51 
52  function setSmallMode($a_small)
53  {
54  $this->small = $a_small;
55  }
56 
60  function setActive($a_active)
61  {
62  $this->active = $a_active;
63  }
64 
68  function setTemplate(&$tpl)
69  {
70  echo "ilMainMenu->setTemplate is deprecated. Use getHTML instead.";
71  return;
72  $this->tpl =& $tpl;
73  }
74 
78  function getTemplate()
79  {
80  echo "ilMainMenu->getTemplate is deprecated. Use getHTML instead.";
81  return;
82  }
83 
88  public function setLoginTargetPar($a_val)
89  {
90  $this->login_target_par = $a_val;
91  }
92 
96  public function getLoginTargetPar()
97  {
98  return $this->login_target_par;
99  }
100 
101  static function getLanguageSelection($a_in_topbar = false)
102  {
103  global $lng;
104 
105  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
106  $selection = new ilAdvancedSelectionListGUI();
107  $selection->setFormSelectMode("change_lang_to", "ilLanguageSelection", true,
108  "#", "ilNavHistory", "ilNavHistoryForm",
109  "", $lng->txt("ok"), "ilLogin");
110  //$selection->setListTitle($lng->txt("choose_language"));
111  $selection->setListTitle($lng->txt("language"));
112  $selection->setItemLinkClass("small");
113 
114  if($a_in_topbar)
115  {
116  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_TOPBAR);
117  }
118 
119  $languages = $lng->getInstalledLanguages();
120  if(sizeof($languages) > 1) // #11237
121  {
122  foreach ($languages as $lang_key)
123  {
124  $base = substr($_SERVER["REQUEST_URI"], strrpos($_SERVER["REQUEST_URI"], "/") + 1);
125  $base = preg_replace("/&*lang=[a-z]{2}&*/", "", $base);
126  $link = ilUtil::appendUrlParameterString($base,
127  "lang=".$lang_key);
128  $link = str_replace("?&", "?", $link);
129  $selection->addItem($lng->_lookupEntry($lang_key, "meta", "meta_l_".$lang_key),
130  $lang_key, $link, "", "", "");
131  }
132  return $selection->getHTML();
133  }
134  }
135 
139  function setTemplateVars()
140  {
141  global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilPluginAdmin;
142 
143  if($this->logo_only)
144  {
145  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
146  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
147  return;
148  }
149 
150  // get user interface plugins
151  $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
152 
153  // search
154  include_once 'Services/Search/classes/class.ilSearchSettings.php';
155  if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
156  {
157  include_once './Services/Search/classes/class.ilMainMenuSearchGUI.php';
158  $main_search = new ilMainMenuSearchGUI();
159  $html = "";
160 
161  // user interface plugin slot + default rendering
162  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
163  $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_search",
164  array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search));
165  if (!$uip->replaced())
166  {
167  $html = $main_search->getHTML();
168  }
169  $html = $uip->getHTML($html);
170 
171  if (strlen($html))
172  {
173  $this->tpl->setVariable('SEARCHBOX',$html);
174  }
175  }
176 
177  $this->renderStatusBox($this->tpl);
178 
179  // online help
180  $this->renderHelpButtons();
181 
182  $mmle_html = "";
183 
184  // user interface plugin slot + default rendering
185  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
186  $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_list_entries",
187  array("main_menu_gui" => $this));
188  if (!$uip->replaced())
189  {
190  $mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu");
191  $mmle_html = $this->renderMainMenuListEntries($mmle_tpl);
192  }
193  $mmle_html = $uip->getHTML($mmle_html);
194 
195  $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html);
196 
197  $link_dir = (defined("ILIAS_MODULE"))
198  ? "../"
199  : "";
200 
201  if (!$this->small)
202  {
203 
204  // login stuff
205  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
206  {
207  include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
209  {
210  $this->tpl->setCurrentBlock("registration_link");
211  $this->tpl->setVariable("TXT_REGISTER",$lng->txt("register"));
212  $this->tpl->setVariable("LINK_REGISTER", $link_dir."register.php?client_id=".rawurlencode(CLIENT_ID)."&lang=".$ilias->account->getCurrentLanguage());
213  $this->tpl->parseCurrentBlock();
214  }
215 
216  // language selection
217  $selection = self::getLanguageSelection();
218  if($selection)
219  {
220  $this->tpl->setVariable("LANG_SELECT", $selection);
221  }
222 
223  $this->tpl->setCurrentBlock("userisanonymous");
224  $this->tpl->setVariable("TXT_NOT_LOGGED_IN",$lng->txt("not_logged_in"));
225  $this->tpl->setVariable("TXT_LOGIN",$lng->txt("log_in"));
226 
227  // #13058
228  $target_str = ($this->getLoginTargetPar() != "")
229  ? $this->getLoginTargetPar()
231  $this->tpl->setVariable("LINK_LOGIN",
232  $link_dir."login.php?target=".$target_str."&client_id=".rawurlencode(CLIENT_ID)."&cmd=force_login&lang=".$ilias->account->getCurrentLanguage());
233  $this->tpl->parseCurrentBlock();
234  }
235  else
236  {
237  $notificationSettings = new ilSetting('notifications');
238  $chatSettings = new ilSetting('chatroom');
239 
243  global $tpl;
244 
245  if($chatSettings->get('chat_enabled') && $notificationSettings->get('enable_osd'))
246  {
247  $this->tpl->touchBlock('osd_enabled');
248  $this->tpl->touchBlock('osd_container');
249 
250  include_once "Services/jQuery/classes/class.iljQueryUtil.php";
252 
253  include_once 'Services/MediaObjects/classes/class.ilPlayerUtil.php';
255 
256  $tpl->addJavaScript('Services/Notifications/templates/default/notifications.js');
257  $tpl->addCSS('Services/Notifications/templates/default/osd.css');
258 
259  require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
260  $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId());
261  $this->tpl->setVariable('INITIAL_NOTIFICATIONS', json_encode($notifications));
262  $this->tpl->setVariable('OSD_POLLING_INTERVALL', $notificationSettings->get('osd_polling_intervall') ? $notificationSettings->get('osd_polling_intervall') : '5');
263  $this->tpl->setVariable(
264  'OSD_PLAY_SOUND',
265  $chatSettings->get('play_invitation_sound') && $ilUser->getPref('chat_play_invitation_sound') ? 'true' : 'false');
266  foreach($notifications as $notification)
267  {
268  if($notification['type'] == 'osd_maint')
269  {
270  continue;
271  }
272  $this->tpl->setCurrentBlock('osd_notification_item');
273 
274  $this->tpl->setVariable('NOTIFICATION_ICON_PATH', $notification['data']->iconPath);
275  $this->tpl->setVariable('NOTIFICATION_TITLE', $notification['data']->title);
276  $this->tpl->setVariable('NOTIFICATION_LINK', $notification['data']->link);
277  $this->tpl->setVariable('NOTIFICATION_LINKTARGET', $notification['data']->linktarget);
278  $this->tpl->setVariable('NOTIFICATION_ID', $notification['notification_osd_id']);
279  $this->tpl->setVariable('NOTIFICATION_SHORT_DESCRIPTION', $notification['data']->shortDescription);
280  $this->tpl->parseCurrentBlock();
281  }
282  }
283 
284  $this->tpl->setCurrentBlock("userisloggedin");
285  $this->tpl->setVariable("TXT_LOGIN_AS",$lng->txt("login_as"));
286  $this->tpl->setVariable("TXT_LOGOUT2",$lng->txt("logout"));
287  $this->tpl->setVariable("LINK_LOGOUT2", $link_dir."logout.php?lang=".$ilias->account->getCurrentLanguage());
288  $this->tpl->setVariable("USERNAME",$ilias->account->getFullname());
289  $this->tpl->setVariable("LOGIN",$ilias->account->getLogin());
290  $this->tpl->setVariable("MATRICULATION",$ilias->account->getMatriculation());
291  $this->tpl->setVariable("EMAIL",$ilias->account->getEmail());
292  $this->tpl->parseCurrentBlock();
293  }
294 
295  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
296  $header_top_title = ilObjSystemFolder::_getHeaderTitle();
297  if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title"))
298  {
299  $this->tpl->setCurrentBlock("header_top_title");
300  $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
301  $this->tpl->parseCurrentBlock();
302  }
303 
304  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
305 
306  $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
307  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
308  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
309  $this->tpl->setVariable("HEADER_BG_IMAGE", ilUtil::getImagePath("HeaderBackground.png"));
310  include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
311 
312  // set link to return to desktop, not depending on a specific position in the hierarchy
313  //$this->tpl->setVariable("SCRIPT_START", $this->getScriptTarget("start.php"));
314  }
315  else
316  {
317  $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
318  $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
319  }
320 
321  $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
322 
323  $this->tpl->parseCurrentBlock();
324  }
325 
329  function renderStatusBox($a_tpl)
330  {
331  global $ilUser, $lng;
332 
333  $box = false;
334 
335  // new mails?
336  if($this->mail)
337  {
338  $new_mails = ilMailGlobalServices::getNumberOfNewMailsByUserId($ilUser->getId());
339  if($new_mails > 0)
340  {
341  $a_tpl->setCurrentBlock('status_text');
342  $a_tpl->setVariable('STATUS_TXT', $new_mails);
343  $a_tpl->parseCurrentBlock();
344  }
345  $a_tpl->setCurrentBlock('status_item');
346  $a_tpl->setVariable('STATUS_IMG', ilUtil::getImagePath('icon_mail_s.png'));
347  $a_tpl->setVariable('STATUS_IMG_ALT', $lng->txt("mail"));
348  $a_tpl->setVariable('STATUS_HREF', 'ilias.php?baseClass=ilMailGUI');
349  $a_tpl->parseCurrentBlock();
350  $box = true;
351  }
352 
353  if ($box)
354  {
355  $a_tpl->setCurrentBlock("status_box");
356  $a_tpl->parseCurrentBlock();
357  }
358  }
359 
360 
367  function renderMainMenuListEntries($a_tpl, $a_call_get = true)
368  {
369  global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilAccess;
370 
371  // personal desktop
372  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
373  {
374  /*$this->renderEntry($a_tpl, "desktop",
375  $lng->txt("personal_desktop"),
376  $this->getScriptTarget("ilias.php?baseClass=ilPersonalDesktopGUI"),
377  $this->target);*/
378 // $this->renderDropDown($a_tpl, "desktop");
379  $this->renderEntry($a_tpl, "desktop",
380  $lng->txt("personal_desktop"), "#");
381 
382  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
383  $ov = new ilOverlayGUI("mm_desk_ov");
384  $ov->setTrigger("mm_desk_tr");
385  $ov->setAnchor("mm_desk_tr");
386  $ov->setAutoHide(false);
387  $ov->add();
388 
389  }
390 
391  // repository
392  if($ilAccess->checkAccess('visible','',ROOT_FOLDER_ID))
393  {
394  include_once('./Services/Link/classes/class.ilLink.php');
395  $nd = $tree->getNodeData(ROOT_FOLDER_ID);
396  $title = $nd["title"];
397  if ($title == "ILIAS")
398  {
399  $title = $lng->txt("repository");
400  }
401  //$this->renderEntry($a_tpl, "repository",
402  // $title,
403  // ilLink::_getStaticLink(1,'root',true),
404  // $this->target);
405  if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID || IS_PAYMENT_ENABLED)
406  {
407  $this->renderEntry($a_tpl, "repository",
408  $title, "#");
409  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
410  $ov = new ilOverlayGUI("mm_rep_ov");
411  $ov->setTrigger("mm_rep_tr");
412  $ov->setAnchor("mm_rep_tr");
413  $ov->setAutoHide(false);
414  $ov->add();
415  }
416  }
417 
418  // search
419  include_once 'Services/Search/classes/class.ilSearchSettings.php';
420  if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
421  {
422 /* $this->renderEntry($a_tpl, "search",
423  $lng->txt("search"),
424  $this->getScriptTarget('ilias.php?baseClass=ilSearchController'),
425  $this->target); */
426  }
427 
428  // webshop
429  if(IS_PAYMENT_ENABLED)
430  {
431  $title = $lng->txt("shop");
432  $this->renderEntry($a_tpl, "shop", $title, "#" );
433  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
434  $ov = new ilOverlayGUI("mm_shop_ov");
435  $ov->setTrigger("mm_shop_tr");
436  $ov->setAnchor("mm_shop_tr");
437  $ov->setAutoHide(false);
438  $ov->add();
439  }
440 
441  // administration
443  {
444  //$this->renderEntry($a_tpl, "administration",
445  // $lng->txt("administration"),
446  // $this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
447  // $this->target);
448  $this->renderDropDown($a_tpl, "administration");
449  }
450 
451 
452  // navigation history
453 /* require_once("Services/Navigation/classes/class.ilNavigationHistoryGUI.php");
454  $nav_hist = new ilNavigationHistoryGUI();
455  $nav_html = $nav_hist->getHTML();
456  if ($nav_html != "")
457  {
458 
459  $a_tpl->setCurrentBlock("nav_history");
460  $a_tpl->setVariable("TXT_LAST_VISITED", $lng->txt("last_visited"));
461  $a_tpl->setVariable("NAVIGATION_HISTORY", $nav_html);
462  $a_tpl->parseCurrentBlock();
463  }*/
464 
465 
466  if ($a_call_get)
467  {
468  return $a_tpl->get();
469  }
470 
471  return "";
472  }
473 
480  function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top")
481  {
482  global $lng, $ilNavigationHistory, $ilSetting, $rbacsystem, $ilCtrl;
483 
484  $id = strtolower($a_id);
485  $id_up = strtoupper($a_id);
486  $a_tpl->setCurrentBlock("entry_".$id);
487 
488  include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
489 
490  // repository
491  if ($a_id == "repository")
492  {
493  $gl = new ilGroupedListGUI();
494 
495  include_once("./Services/Link/classes/class.ilLink.php");
496  $a_tpl->setVariable("ARROW_IMG", ilUtil::getImagePath("mm_down_arrow.png"));
498 
499  $gl->addEntry($icon." ".$a_txt." - ".$lng->txt("rep_main_page"), ilLink::_getStaticLink(1,'root',true),
500  "_top");
501 
502  $items = $ilNavigationHistory->getItems();
503  reset($items);
504  $cnt = 0;
505  $first = true;
506 
507  foreach($items as $k => $item)
508  {
509  if ($cnt >= 10) break;
510 
511  if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) ||
512  ($item["ref_id"] != $_GET["ref_id"] || !$first)) // do not list current item
513  {
514  if ($cnt == 0)
515  {
516  $gl->addGroupHeader($lng->txt("last_visited"), "ilLVNavEnt");
517  }
518  $obj_id = ilObject::_lookupObjId($item["ref_id"]);
519  $cnt ++;
520  $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"));
521  $ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true); // #11023
522  $gl->addEntry($icon." ".$ititle, $item["link"], "_top", "", "ilLVNavEnt");
523 
524  }
525  $first = false;
526  }
527 
528  if ($cnt > 0)
529  {
530  $gl->addEntry("» ".$lng->txt("remove_entries"), "#", "",
531  "return il.MainMenu.removeLastVisitedItems('".
532  $ilCtrl->getLinkTargetByClass("ilnavigationhistorygui", "removeEntries", "", true)."');",
533  "ilLVNavEnt");
534  }
535 
536  $a_tpl->setVariable("REP_EN_OV", $gl->getHTML());
537  }
538 
539  // desktop
540  if ($a_id == "desktop")
541  {
542  $gl = new ilGroupedListGUI();
543 
544  $a_tpl->setVariable("ARROW_IMG", ilUtil::getImagePath("mm_down_arrow.png"));
545 
546  // overview
547  $gl->addEntry($lng->txt("overview"),
548  "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSelectedItems",
549  "_top", "", "", "mm_pd_sel_items", ilHelp::getMainMenuTooltip("mm_pd_sel_items"),
550  "left center", "right center", false);
551 
552  // my groups and courses, if both is available
553  if($ilSetting->get('disable_my_offers') == 0 &&
554  $ilSetting->get('disable_my_memberships') == 0)
555  {
556  $gl->addEntry($lng->txt("my_courses_groups"),
557  "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToMemberships",
558  "_top", "", "", "mm_pd_crs_grp", ilHelp::getMainMenuTooltip("mm_pd_crs_grp"),
559  "left center", "right center", false);
560  }
561 
562  // bookmarks
563  if (!$this->ilias->getSetting("disable_bookmarks"))
564  {
565  $gl->addEntry($lng->txt("bookmarks"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
566  "_top", "", "", "mm_pd_bookm", ilHelp::getMainMenuTooltip("mm_pd_bookm"),
567  "left center", "right center", false);
568  }
569 
570  // private notes
571  if (!$this->ilias->getSetting("disable_notes"))
572  {
573  $gl->addEntry($lng->txt("notes_and_comments"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
574  "_top", "", "", "mm_pd_notes", ilHelp::getMainMenuTooltip("mm_pd_notes"),
575  "left center", "right center", false);
576  }
577 
578  // news
579  if ($ilSetting->get("block_activated_news"))
580  {
581  $gl->addEntry($lng->txt("news"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
582  "_top", "", "", "mm_pd_news", ilHelp::getMainMenuTooltip("mm_pd_news"),
583  "left center", "right center", false);
584  }
585 
586  // overview is always active
587  $gl->addSeparator();
588 
589  $separator = false;
590 
591  if(!$ilSetting->get("disable_personal_workspace"))
592  {
593  // workspace
594  $gl->addEntry($lng->txt("personal_workspace"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
595  "_top", "", "", "mm_pd_wsp", ilHelp::getMainMenuTooltip("mm_pd_wsp"),
596  "left center", "right center", false);
597 
598  $separator = true;
599  }
600 
601  // portfolio
602  if ($ilSetting->get('user_portfolios'))
603  {
604  $gl->addEntry($lng->txt("portfolio"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
605  "_top", "", "", "mm_pd_port", ilHelp::getMainMenuTooltip("mm_pd_port"),
606  "left center", "right center", false);
607 
608  $separator = true;
609  }
610 
611  // skills
612  $skmg_set = new ilSetting("skmg");
613  if ($skmg_set->get("enable_skmg"))
614  {
615  $gl->addEntry($lng->txt("skills"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
616  "_top", "", "", "mm_pd_skill", ilHelp::getMainMenuTooltip("mm_pd_skill"),
617  "left center", "right center", false);
618 
619  $separator = true;
620  }
621 
622  // Learning Progress
623  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
627  {
628  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
629  $gl->addEntry($lng->txt("learning_progress"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
630  "_top", "", "", "mm_pd_lp", ilHelp::getMainMenuTooltip("mm_pd_lp"),
631  "left center", "right center", false);
632 
633  $separator = true;
634  }
635 
636  if($separator)
637  {
638  $gl->addSeparator();
639  }
640 
641  $separator = false;
642 
643  // calendar
644  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
645  $settings = ilCalendarSettings::_getInstance();
646  if($settings->isEnabled())
647  {
648  $gl->addEntry($lng->txt("calendar"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
649  "_top", "", "", "mm_pd_cal", ilHelp::getMainMenuTooltip("mm_pd_cal"),
650  "left center", "right center", false);
651 
652  $separator = true;
653  }
654 
655  // mail
656  if($this->mail)
657  {
658  $gl->addEntry($lng->txt('mail'), 'ilias.php?baseClass=ilMailGUI', '_top',
659  "", "", "mm_pd_mail", ilHelp::getMainMenuTooltip("mm_pd_mail"),
660  "left center", "right center", false);
661 
662  $separator = true;
663  }
664 
665  // contacts
666  if(!$this->ilias->getSetting('disable_contacts') &&
667  ($this->ilias->getSetting('disable_contacts_require_mail') ||
668  $rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())))
669  {
670  $gl->addEntry($lng->txt('mail_addressbook'),
671  'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '_top'
672  , "", "", "mm_pd_contacts", ilHelp::getMainMenuTooltip("mm_pd_contacts"),
673  "left center", "right center", false);
674 
675  $separator = true;
676  }
677 
678  if($separator)
679  {
680  $gl->addSeparator();
681  }
682 
683  // profile
684  $gl->addEntry($lng->txt("personal_profile"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
685  "_top", "", "", "mm_pd_profile", ilHelp::getMainMenuTooltip("mm_pd_profile"),
686  "left center", "right center", false);
687 
688  // settings
689  $gl->addEntry($lng->txt("personal_settings"), "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
690  "_top", "", "", "mm_pd_sett", ilHelp::getMainMenuTooltip("mm_pd_sett"),
691  "left center", "right center", false);
692 
693  $a_tpl->setVariable("DESK_CONT_OV", $gl->getHTML());
694  }
695 
696  if(IS_PAYMENT_ENABLED)
697  {
698  // shop
699  if ($a_id == "shop")
700  {
701  $gl = new ilGroupedListGUI();
702  $a_tpl->setVariable("ARROW_IMG", ilUtil::getImagePath("mm_down_arrow.png"));
703 
704  // shop_content
705  $gl->addEntry($lng->txt("content"),
706  "ilias.php?baseClass=ilShopController&amp;cmd=firstpage",
707  "_top");
708 
709  // shoppingcart
710  include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php';
711  global $ilUser;
712  $objShoppingCart = new ilPaymentShoppingCart($ilUser);
713  $items = $objShoppingCart->getEntries();
714 
715  if(count($items) > 0 )
716  {
717  $gl->addEntry($lng->txt("shoppingcart").' ('.count($items).')',
718  "ilias.php?baseClass=ilShopController&amp;cmdClass=ilshopshoppingcartgui",
719  "_top");
720  }
721  $a_tpl->setVariable("SHOP_CONT_OV", $gl->getHTML());
722  }
723  }
724  $a_tpl->setVariable("TXT_".$id_up, $a_txt);
725  $a_tpl->setVariable("SCRIPT_".$id_up, $a_script);
726  $a_tpl->setVariable("TARGET_".$id_up, $a_target);
727  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
728  {
729  $a_tpl->setVariable("MM_CLASS", "MMActive");
730  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
731  }
732  else
733  {
734  $a_tpl->setVariable("MM_CLASS", "MMInactive");
735  }
736 
737  if($a_id == "repository")
738  {
739  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
741  {
742  $a_tpl->setVariable("ACC_KEY_REPOSITORY", 'accesskey="'.
744  }
745  }
746  if($a_id == "desktop")
747  {
748  include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
750  {
751  $a_tpl->setVariable("ACC_KEY_DESKTOP", 'accesskey="'.
753  }
754  }
755 
756 
757  $a_tpl->parseCurrentBlock();
758  }
759 
760 
764  function getScriptTarget($a_script)
765  {
766  global $ilias;
767 
768  $script = "./".$a_script;
769 
770  //if ($this->start_template == true)
771  //{
772  //if(is_file("./templates/".$ilias->account->skin."/tpl.start.html"))
773  //{
774  // $script = "./start.php?script=".rawurlencode($script);
775  //}
776  //}
777  if (defined("ILIAS_MODULE"))
778  {
779  $script = ".".$script;
780  }
781  return $script;
782  }
783 
785  {
786  global $rbacsystem;
787 
788  //if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
789  if($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID))
790  {
791  return true;
792  }
793  return false;
794  }
795 
796  function getHTML()
797  {
798  // this is a workaround for bugs like 14016 or 16020
799  // the main menu does not need the YUI connection, but many other
800  // features since they rely on il.Util.sendAjaxGetRequestToUrl (see Services/Javascript)
801  // which still uses YUI. This should be migrated to jQuery with a future major release
802  include_once "Services/YUI/classes/class.ilYuiUtil.php";
803  ilYUIUtil::initConnection();
804 
805  include_once './Services/Container/classes/class.ilMemberViewSettings.php';
807 
808  if($set->isActive())
809  {
810  return $this->getMemberViewHTML();
811  }
812 
813 
814  $this->setTemplateVars();
815 
816  return $this->tpl->get();
817  }
818 
819  protected function getMemberViewHTML()
820  {
821  global $lng;
822 
823  $this->tpl = new ilTemplate('tpl.member_view_main_menu.html',true,true,'Services/MainMenu');
824 
825  $this->tpl->setVariable('TXT_MM_HEADER',$lng->txt('mem_view_long'));
826  $this->tpl->setVariable('TXT_MM_CLOSE_PREVIEW',$lng->txt('mem_view_close'));
827  $this->tpl->setVariable('MM_CLOSE_IMG',ilUtil::getImagePath('cancel.png'));
828 
829  include_once './Services/Link/classes/class.ilLink.php';
830 
831  $this->tpl->setVariable(
832  'HREF_CLOSE_MM',
834  (int) $_GET['ref_id'],
835  ilObject::_lookupType(ilObject::_lookupObjId((int) $_GET['ref_id'])),
836  array('mv' => 0)));
837 
838  return $this->tpl->get();
839  }
840 
847  function renderDropDown($a_tpl, $a_id)
848  {
849  global $lng, $ilSetting, $rbacsystem;
850 
851  $id = strtolower($a_id);
852  $id_up = strtoupper($a_id);
853  $a_tpl->setCurrentBlock("entry_".$id);
854  include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
855  $selection = new ilAdvancedSelectionListGUI();
856  if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
857  {
858  $selection->setSelectionHeaderClass("MMActive");
859  $a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
860  }
861  else
862  {
863  $selection->setSelectionHeaderClass("MMInactive");
864  }
865 
866  $selection->setSelectionHeaderSpanClass("MMSpan");
867 
868  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_LIGHT);
869  $selection->setItemLinkClass("small");
870  $selection->setUseImages(false);
871 
872  switch ($id)
873  {
874  // desktop drop down
875  case "desktop":
876  $selection->setListTitle($lng->txt("personal_desktop"));
877  $selection->setId("dd_pd");
878 
879  // overview
880  $selection->addItem($lng->txt("overview"), "", "ilias.php?baseClass=ilPersonalDesktopGUI",
881  "", "", "_top");
882 
883  if(!$ilSetting->get("disable_personal_workspace"))
884  {
885  // workspace
886  $selection->addItem($lng->txt("personal_workspace"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
887  "", "", "_top");
888  }
889 
890  // profile
891  $selection->addItem($lng->txt("personal_profile"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
892  "", "", "_top");
893 
894  // skills
895  $skmg_set = new ilSetting("skmg");
896  if ($skmg_set->get("enable_skmg"))
897  {
898  $selection->addItem($lng->txt("skills"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
899  "", "", "_top");
900  }
901 
902  // portfolio
903  if ($ilSetting->get('user_portfolios'))
904  {
905  $selection->addItem($lng->txt("portfolio"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
906  "", "", "_top");
907  }
908 
909  // news
910  if ($ilSetting->get("block_activated_news"))
911  {
912  $selection->addItem($lng->txt("news"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
913  "", "", "_top");
914  }
915 
916  // Learning Progress
917  include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
919  {
920  //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
921  $selection->addItem($lng->txt("learning_progress"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
922  "", "", "_top");
923  }
924 
925  // calendar
926  include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
927  $settings = ilCalendarSettings::_getInstance();
928  if($settings->isEnabled())
929  {
930  $selection->addItem($lng->txt("calendar"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
931  "", "", "_top");
932  }
933 
934  // mail
935  if($this->mail)
936  {
937  $selection->addItem($lng->txt('mail'), '', 'ilias.php?baseClass=ilMailGUI', '', '', '_top');
938  }
939 
940  // contacts
941  if (!$this->ilias->getSetting('disable_contacts') &&
942  ($this->ilias->getSetting('disable_contacts_require_mail') ||
943  $rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())))
944  {
945  $selection->addItem($lng->txt('mail_addressbook'), '', 'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '', '', '_top');
946  }
947 
948  // private notes
949  if (!$this->ilias->getSetting("disable_notes"))
950  {
951  $selection->addItem($lng->txt("notes_and_comments"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
952  "", "", "_top");
953  }
954 
955  // bookmarks
956  if (!$this->ilias->getSetting("disable_bookmarks"))
957  {
958  $selection->addItem($lng->txt("bookmarks"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
959  "", "", "_top");
960  }
961 
962  // settings
963  $selection->addItem($lng->txt("personal_settings"), "", "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
964  "", "", "_top");
965 
966  break;
967 
968  // shop
969  case 'shop':
970  $selection->setListTitle($lng->txt("shop"));
971  $selection->setId("dd_shp");
972  $selection->addItem($lng->txt("shop"), "", "ilias.php?baseClass=ilShopController&cmd=firstpage",
973  "", "", "_top");
974  break;
975 
976  // administration
977  case "administration":
978  $selection->setListTitle($lng->txt("administration"));
979  $selection->setId("dd_adm");
980  $selection->setAsynch(true);
981  $selection->setAsynchUrl("ilias.php?baseClass=ilAdministrationGUI&cmd=getDropDown&cmdMode=asynch");
982  //$this->renderEntry($a_tpl, "administration",
983  // $lng->txt("administration"),
984  // $this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
985  // $this->target);
986 
987  break;
988 
989  }
990 
991 // $selection->setTriggerEvent("mouseover");
992 // $selection->setAutoHide(true);
993 
994  $html = $selection->getHTML();
995  $a_tpl->setVariable($id_up."_DROP_DOWN", $html);
996  $a_tpl->parseCurrentBlock();
997  }
998 
999 
1007  {
1008  global $ilHelp, $lng, $ilCtrl, $tpl, $ilSetting, $ilUser;
1009 
1010  // screen id
1011  if (defined("OH_REF_ID") && OH_REF_ID > 0)
1012  {
1013  if ($ilHelp->getScreenId() != "")
1014  {
1015  $this->tpl->setCurrentBlock("screen_id");
1016  $this->tpl->setVariable("SCREEN_ID", $ilHelp->getScreenId());
1017  $this->tpl->parseCurrentBlock();
1018  }
1019  }
1020 
1021  $help_active = false;
1022 
1023  if ($ilHelp->hasSections())
1024  {
1025  $help_active = true;
1026 
1027  $lng->loadLanguageModule("help");
1028  $this->tpl->setCurrentBlock("help_icon");
1029 
1030  // add javascript needed by help (to do: move to help class)
1031  $tpl->addJavascript("./Services/Help/js/ilHelp.js");
1032  include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1033  $acc = new ilAccordionGUI();
1034  $acc->addJavascript();
1035  $acc->addCss();
1036 
1037  $this->tpl->setVariable("IMG_HELP", ilUtil::getImagePath("icon_help.png"));
1038  $this->tpl->parseCurrentBlock();
1039 
1040  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1041  ilTooltipGUI::addTooltip("help_tr", $lng->txt("help_open_online_help"), "",
1042  "bottom center", "top center", false);
1043  }
1044 
1045  $module_id = (int) $ilSetting->get("help_module");
1046  if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
1047  $ilSetting->get("help_mode") != "1")
1048  {
1049  $help_active = true;
1050 
1051  $lng->loadLanguageModule("help");
1052  $tpl->addJavascript("./Services/Help/js/ilHelp.js");
1053  $this->tpl->setCurrentBlock("help_tt_icon");
1054  $this->tpl->setVariable("IMG_TT_ON", ilUtil::getImagePath("icon_tt.png"));
1055  $this->tpl->setVariable("IMG_TT_OFF", ilUtil::getImagePath("icon_tt_off.png"));
1056  $this->tpl->parseCurrentBlock();
1057 
1058  include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1059  ilTooltipGUI::addTooltip("help_tt", $lng->txt("help_toggle_tooltips"), "",
1060  "bottom center", "top center", false);
1061  }
1062 
1063  if($help_active)
1064  {
1065  // always set ajax url
1066  $ts = $ilCtrl->getTargetScript();
1067  $ilCtrl->setTargetScript("ilias.php");
1068 
1069  $ilHelp->setCtrlPar();
1070  $tpl->addOnLoadCode("il.Help.setAjaxUrl('".
1071  $ilCtrl->getLinkTargetByClass("ilhelpgui", "", "", true)
1072  ."');");
1073  $ilCtrl->setTargetScript($ts);
1074  }
1075  }
1076 
1077 
1085  function showLogoOnly($a_value)
1086  {
1087  $this->logo_only = (bool)$a_value;
1088  }
1089 
1090  protected function getHeaderURL()
1091  {
1092  include_once './Services/User/classes/class.ilUserUtil.php';
1094 
1095  if(!$url)
1096  {
1097  $url = "./goto.php?target=root_1";
1098  }
1099 
1100  return $url;
1101  }
1102 }
1103 
1104 ?>