5 include_once
'Services/Mail/classes/class.ilMailGlobalServices.php';
31 function ilMainMenuGUI($a_target =
"_top", $a_use_start_template =
false)
33 global
$ilias, $rbacsystem, $ilUser;
35 $this->tpl =
new ilTemplate(
"tpl.main_menu.html",
true,
true,
38 $this->target = $a_target;
39 $this->start_template = $a_use_start_template;
43 if($ilUser->getId() != ANONYMOUS_USER_ID)
54 $this->small = $a_small;
62 $this->active = $a_active;
70 echo
"ilMainMenu->setTemplate is deprecated. Use getHTML instead.";
80 echo
"ilMainMenu->getTemplate is deprecated. Use getHTML instead.";
90 $this->login_target_par = $a_val;
98 return $this->login_target_par;
105 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
107 $selection->setFormSelectMode(
"change_lang_to",
"ilLanguageSelection",
true,
108 "#",
"ilNavHistory",
"ilNavHistoryForm",
109 "", $lng->txt(
"ok"),
"ilLogin");
111 $selection->setListTitle($lng->txt(
"language"));
112 $selection->setItemLinkClass(
"small");
119 $languages = $lng->getInstalledLanguages();
120 if(
sizeof($languages) > 0)
122 foreach ($languages as $lang_key)
124 $base = substr($_SERVER[
"REQUEST_URI"], strrpos($_SERVER[
"REQUEST_URI"],
"/") + 1);
125 $base = preg_replace(
"/&*lang=[a-z]{2}&*/",
"", $base);
128 $link = str_replace(
"?&",
"?", $link);
129 $selection->addItem($lng->_lookupEntry($lang_key,
"meta",
"meta_l_".$lang_key),
130 $lang_key, $link,
"",
"",
"");
132 return $selection->getHTML();
144 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"UIComponent",
"uihk");
147 include_once
'Services/Search/classes/class.ilSearchSettings.php';
150 include_once
'./Services/Search/classes/class.ilMainMenuSearchGUI.php';
155 include_once(
"./Services/UIComponent/classes/class.ilUIHookProcessor.php");
157 array(
"main_menu_gui" => $this,
"main_menu_search_gui" => $main_search));
158 if (!$uip->replaced())
160 $html = $main_search->getHTML();
162 $html = $uip->getHTML($html);
166 $this->tpl->setVariable(
'SEARCHBOX',$html);
175 include_once(
"./Services/UIComponent/classes/class.ilUIHookProcessor.php");
177 array(
"main_menu_gui" => $this));
178 if (!$uip->replaced())
180 $mmle_tpl =
new ilTemplate(
"tpl.main_menu_list_entries.html",
true,
true,
"Services/MainMenu");
183 $mmle_html = $uip->getHTML($mmle_html);
185 $this->tpl->setVariable(
"MAIN_MENU_LIST_ENTRIES", $mmle_html);
187 $link_dir = (defined(
"ILIAS_MODULE"))
195 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
197 include_once
'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
200 $this->tpl->setCurrentBlock(
"registration_link");
201 $this->tpl->setVariable(
"TXT_REGISTER",$lng->txt(
"register"));
202 $this->tpl->setVariable(
"LINK_REGISTER", $link_dir.
"register.php?client_id=".rawurlencode(CLIENT_ID).
"&lang=".$ilias->account->getCurrentLanguage());
203 $this->tpl->parseCurrentBlock();
210 $this->tpl->setVariable(
"LANG_SELECT", $selection);
213 $this->tpl->setCurrentBlock(
"userisanonymous");
214 $this->tpl->setVariable(
"TXT_NOT_LOGGED_IN",$lng->txt(
"not_logged_in"));
215 $this->tpl->setVariable(
"TXT_LOGIN",$lng->txt(
"log_in"));
222 else if (
$_GET[
"ref_id"] !=
"")
224 if ($tree->isInTree(
$_GET[
"ref_id"]) &&
$_GET[
"ref_id"] != $tree->getRootId())
228 $target_str = $type.
"_".
$_GET[
"ref_id"];
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();
240 $notificationSettings =
new ilSetting(
'notifications');
241 $chatSettings =
new ilSetting(
'chatroom');
244 if ($chatSettings->get(
'chat_enabled') && $notificationSettings->get(
'enable_osd')) {
245 $this->tpl->touchBlock(
'osd_enabled');
246 $this->tpl->touchBlock(
'osd_container');
247 $tpl->addJavaScript(
'Services/Notifications/templates/default/notifications.js');
248 $tpl->addCSS(
'Services/Notifications/templates/default/osd.css');
250 include_once
"Services/jQuery/classes/class.iljQueryUtil.php";
253 require_once
'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
255 $this->tpl->setVariable(
'INITIAL_NOTIFICATIONS', json_encode($notifications));
256 $this->tpl->setVariable(
'OSD_POLLING_INTERVALL', $notificationSettings->get(
'osd_polling_intervall') ? $notificationSettings->get(
'osd_polling_intervall') :
'5');
257 $this->tpl->setVariable(
'OSD_PLAY_SOUND', $chatSettings->get(
'play_invitation_sound') ?
'true' :
'false');
258 foreach($notifications as $notification) {
259 if ($notification[
'type'] ==
'osd_maint') {
260 #var_dump($notification);
263 #var_dump($notification);
264 $this->tpl->setCurrentBlock(
'osd_notification_item');
266 $this->tpl->setVariable(
'NOTIFICATION_ICON_PATH', $notification[
'data']->iconPath);
267 $this->tpl->setVariable(
'NOTIFICATION_TITLE', $notification[
'data']->title);
268 $this->tpl->setVariable(
'NOTIFICATION_LINK', $notification[
'data']->link);
269 $this->tpl->setVariable(
'NOTIFICATION_LINKTARGET', $notification[
'data']->linktarget);
270 $this->tpl->setVariable(
'NOTIFICATION_ID', $notification[
'notification_osd_id']);
271 $this->tpl->setVariable(
'NOTIFICATION_SHORT_DESCRIPTION', $notification[
'data']->shortDescription);
272 $this->tpl->parseCurrentBlock();
276 $this->tpl->setCurrentBlock(
"userisloggedin");
277 $this->tpl->setVariable(
"TXT_LOGIN_AS",$lng->txt(
"login_as"));
278 $this->tpl->setVariable(
"TXT_LOGOUT2",$lng->txt(
"logout"));
279 $this->tpl->setVariable(
"LINK_LOGOUT2", $link_dir.
"logout.php?lang=".$ilias->account->getCurrentLanguage());
280 $this->tpl->setVariable(
"USERNAME",$ilias->account->getFullname());
281 $this->tpl->parseCurrentBlock();
284 include_once(
"./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
286 if (trim($header_top_title) !=
"" && $this->tpl->blockExists(
"header_top_title"))
288 $this->tpl->setCurrentBlock(
"header_top_title");
289 $this->tpl->setVariable(
"TXT_HEADER_TITLE", $header_top_title);
290 $this->tpl->parseCurrentBlock();
295 $this->tpl->setVariable(
"TXT_LOGOUT", $lng->txt(
"logout"));
296 $this->tpl->setVariable(
"HEADER_URL", $this->
getHeaderURL());
299 include_once(
"./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
306 $this->tpl->setVariable(
"HEADER_URL", $this->
getHeaderURL());
310 $this->tpl->setVariable(
"TXT_MAIN_MENU", $lng->txt(
"main_menu"));
312 $this->tpl->parseCurrentBlock();
330 $a_tpl->setCurrentBlock(
'status_text');
331 $a_tpl->setVariable(
'STATUS_TXT', $new_mails);
332 $a_tpl->parseCurrentBlock();
334 $a_tpl->setCurrentBlock(
'status_item');
336 $a_tpl->setVariable(
'STATUS_HREF',
'ilias.php?baseClass=ilMailGUI');
337 $a_tpl->parseCurrentBlock();
343 $a_tpl->setCurrentBlock(
"status_box");
344 $a_tpl->parseCurrentBlock();
360 if (
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID)
368 $lng->txt(
"personal_desktop"),
"#");
370 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
372 $ov->setTrigger(
"mm_desk_tr");
373 $ov->setAnchor(
"mm_desk_tr");
374 $ov->setAutoHide(
false);
380 if($ilAccess->checkAccess(
'visible',
'',ROOT_FOLDER_ID))
382 include_once(
'classes/class.ilLink.php');
383 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
387 $title = $lng->txt(
"repository");
393 if (
$_SESSION[
"AccountId"] != ANONYMOUS_USER_ID || IS_PAYMENT_ENABLED)
397 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
399 $ov->setTrigger(
"mm_rep_tr");
400 $ov->setAnchor(
"mm_rep_tr");
401 $ov->setAutoHide(
false);
407 include_once
'Services/Search/classes/class.ilSearchSettings.php';
417 if(IS_PAYMENT_ENABLED)
419 $title = $lng->txt(
"shop");
421 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
423 $ov->setTrigger(
"mm_shop_tr");
424 $ov->setAnchor(
"mm_shop_tr");
425 $ov->setAutoHide(
false);
456 return $a_tpl->get();
468 function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target =
"_top")
472 $id = strtolower($a_id);
473 $id_up = strtoupper($a_id);
474 $a_tpl->setCurrentBlock(
"entry_".$id);
476 include_once(
"./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
479 if ($a_id ==
"repository")
483 include_once(
"./classes/class.ilLink.php");
490 $items = $ilNavigationHistory->getItems();
495 foreach($items as $k => $item)
497 if ($cnt >= 10)
break;
499 if (!isset($item[
"ref_id"]) || !isset(
$_GET[
"ref_id"]) ||
500 ($item[
"ref_id"] !=
$_GET[
"ref_id"] || !$first))
504 $gl->addGroupHeader($lng->txt(
"last_visited"));
516 $a_tpl->setVariable(
"REP_EN_OV", $gl->getHTML());
520 if ($a_id ==
"desktop")
527 $gl->addEntry($lng->txt(
"overview"),
528 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSelectedItems",
532 if($ilSetting->get(
'disable_my_offers') == 0 &&
533 $ilSetting->get(
'disable_my_memberships') == 0)
535 $gl->addEntry($lng->txt(
"my_courses_groups"),
536 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToMemberships",
541 if (!$this->ilias->getSetting(
"disable_bookmarks"))
543 $gl->addEntry($lng->txt(
"bookmarks"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToBookmarks",
548 if (!$this->ilias->getSetting(
"disable_notes"))
550 $gl->addEntry($lng->txt(
"notes_and_comments"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNotes",
555 if ($ilSetting->get(
"block_activated_news"))
557 $gl->addEntry($lng->txt(
"news"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNews",
566 if(!$ilSetting->get(
"disable_personal_workspace"))
569 $gl->addEntry($lng->txt(
"personal_workspace"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace",
576 if ($ilSetting->get(
'user_portfolios'))
578 $gl->addEntry($lng->txt(
"portfolio"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio",
586 if ($skmg_set->get(
"enable_skmg"))
588 $gl->addEntry($lng->txt(
"skills"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSkills",
595 include_once(
"Services/Tracking/classes/class.ilObjUserTracking.php");
599 $gl->addEntry($lng->txt(
"learning_progress"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToLP",
613 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
615 if($settings->isEnabled())
617 $gl->addEntry($lng->txt(
"calendar"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToCalendar",
626 $gl->addEntry($lng->txt(
'mail'),
'ilias.php?baseClass=ilMailGUI',
'_top');
632 if(!$this->ilias->getSetting(
'disable_contacts') &&
633 ($this->ilias->getSetting(
'disable_contacts_require_mail') ||
636 $gl->addEntry($lng->txt(
'mail_addressbook'),
'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToContacts',
'_top');
647 $gl->addEntry($lng->txt(
"personal_profile"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile",
651 $gl->addEntry($lng->txt(
"personal_settings"),
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings",
654 $a_tpl->setVariable(
"DESK_CONT_OV", $gl->getHTML());
657 if(IS_PAYMENT_ENABLED)
666 $gl->addEntry($lng->txt(
"content"),
667 "ilias.php?baseClass=ilShopController&cmd=firstpage",
671 include_once
'Services/Payment/classes/class.ilPaymentShoppingCart.php';
674 $items = $objShoppingCart->getEntries();
676 if(count($items) > 0 )
678 $gl->addEntry($lng->txt(
"shoppingcart").
' ('.count($items).
')',
679 "ilias.php?baseClass=ilShopController&cmdClass=ilshopshoppingcartgui",
682 $a_tpl->setVariable(
"SHOP_CONT_OV", $gl->getHTML());
685 $a_tpl->setVariable(
"TXT_".$id_up, $a_txt);
686 $a_tpl->setVariable(
"SCRIPT_".$id_up, $a_script);
687 $a_tpl->setVariable(
"TARGET_".$id_up, $a_target);
688 if ($this->active == $a_id || ($this->active ==
"" && $a_id ==
"repository"))
690 $a_tpl->setVariable(
"MM_CLASS",
"MMActive");
691 $a_tpl->setVariable(
"SEL",
'<span class="ilAccHidden">('.$lng->txt(
"stat_selected").
')</span>');
695 $a_tpl->setVariable(
"MM_CLASS",
"MMInactive");
698 if($a_id ==
"repository")
700 include_once(
"./Services/Accessibility/classes/class.ilAccessKey.php");
703 $a_tpl->setVariable(
"ACC_KEY_REPOSITORY",
'accesskey="'.
707 if($a_id ==
"desktop")
709 include_once(
"./Services/Accessibility/classes/class.ilAccessKey.php");
712 $a_tpl->setVariable(
"ACC_KEY_DESKTOP",
'accesskey="'.
718 $a_tpl->parseCurrentBlock();
729 $script =
"./".$a_script;
738 if (defined(
"ILIAS_MODULE"))
740 $script =
".".$script;
750 if($rbacsystem->checkAccess(
"visible", SYSTEM_FOLDER_ID))
759 include_once
'./Services/Container/classes/class.ilMemberViewSettings.php';
770 return $this->tpl->get();
777 $this->tpl =
new ilTemplate(
'tpl.member_view_main_menu.html',
true,
true,
'Services/MainMenu');
779 $this->tpl->setVariable(
'TXT_MM_HEADER',$lng->txt(
'mem_view_long'));
780 $this->tpl->setVariable(
'TXT_MM_CLOSE_PREVIEW',$lng->txt(
'mem_view_close'));
783 include_once
'./classes/class.ilLink.php';
785 $this->tpl->setVariable(
788 (
int)
$_GET[
'ref_id'],
792 return $this->tpl->get();
805 $id = strtolower($a_id);
806 $id_up = strtoupper($a_id);
807 $a_tpl->setCurrentBlock(
"entry_".$id);
808 include_once(
"./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
810 if ($this->active == $a_id || ($this->active ==
"" && $a_id ==
"repository"))
812 $selection->setSelectionHeaderClass(
"MMActive");
813 $a_tpl->setVariable(
"SEL",
'<span class="ilAccHidden">('.$lng->txt(
"stat_selected").
')</span>');
817 $selection->setSelectionHeaderClass(
"MMInactive");
820 $selection->setSelectionHeaderSpanClass(
"MMSpan");
823 $selection->setItemLinkClass(
"small");
824 $selection->setUseImages(
false);
830 $selection->setListTitle($lng->txt(
"personal_desktop"));
831 $selection->setId(
"dd_pd");
834 $selection->addItem($lng->txt(
"overview"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI",
837 if(!$ilSetting->get(
"disable_personal_workspace"))
840 $selection->addItem($lng->txt(
"personal_workspace"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace",
845 $selection->addItem($lng->txt(
"personal_profile"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile",
850 if ($skmg_set->get(
"enable_skmg"))
852 $selection->addItem($lng->txt(
"skills"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSkills",
857 if ($ilSetting->get(
'user_portfolios'))
859 $selection->addItem($lng->txt(
"portfolio"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio",
864 if ($ilSetting->get(
"block_activated_news"))
866 $selection->addItem($lng->txt(
"news"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNews",
871 include_once(
"Services/Tracking/classes/class.ilObjUserTracking.php");
875 $selection->addItem($lng->txt(
"learning_progress"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToLP",
880 include_once(
'./Services/Calendar/classes/class.ilCalendarSettings.php');
882 if($settings->isEnabled())
884 $selection->addItem($lng->txt(
"calendar"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToCalendar",
891 $selection->addItem($lng->txt(
'mail'),
'',
'ilias.php?baseClass=ilMailGUI',
'',
'',
'_top');
895 if (!$this->ilias->getSetting(
'disable_contacts') &&
896 ($this->ilias->getSetting(
'disable_contacts_require_mail') ||
899 $selection->addItem($lng->txt(
'mail_addressbook'),
'',
'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToContacts',
'',
'',
'_top');
903 if (!$this->ilias->getSetting(
"disable_notes"))
905 $selection->addItem($lng->txt(
"notes_and_comments"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNotes",
910 if (!$this->ilias->getSetting(
"disable_bookmarks"))
912 $selection->addItem($lng->txt(
"bookmarks"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToBookmarks",
917 $selection->addItem($lng->txt(
"personal_settings"),
"",
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings",
924 $selection->setListTitle($lng->txt(
"shop"));
925 $selection->setId(
"dd_shp");
926 $selection->addItem($lng->txt(
"shop"),
"",
"ilias.php?baseClass=ilShopController&cmd=firstpage",
931 case "administration":
932 $selection->setListTitle($lng->txt(
"administration"));
933 $selection->setId(
"dd_adm");
934 $selection->setAsynch(
true);
935 $selection->setAsynchUrl(
"ilias.php?baseClass=ilAdministrationGUI&cmd=getDropDown");
948 $html = $selection->getHTML();
949 $a_tpl->setVariable($id_up.
"_DROP_DOWN", $html);
950 $a_tpl->parseCurrentBlock();
958 if($ilAccess->checkAccess(
"read",
"", 1))
960 $url =
"./goto.php?target=root_1";