ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
8
9include_once 'Services/Mail/classes/class.ilMailGlobalServices.php';
10
18{
22 protected $rbacsystem;
23
27 protected $user;
28
32 protected $lng;
33
37 protected $plugin_admin;
38
42 protected $tree;
43
47 protected $access;
48
52 protected $nav_history;
53
57 protected $settings;
58
62 protected $ctrl;
63
67 protected $help;
68
72 public $tpl;
73
74 public $target;
76 public $mail; // [bool]
77
81 protected $main_tpl;
82
83 protected $mode; // [int]
84 protected $topbar_back_url; // [stringt]
85 protected $topbar_back_caption; // [string]
86
87 const MODE_FULL = 1;
91
97 public function __construct($a_target = "_top", $a_use_start_template = false, ilTemplate $a_main_tpl = null)
98 {
99 global $DIC;
100
101 if ($a_main_tpl != null) {
102 $this->main_tpl = $a_main_tpl;
103 } else {
104 $this->main_tpl = $DIC["tpl"];
105 }
106
107 $this->rbacsystem = $DIC->rbac()->system();
108 $this->user = $DIC->user();
109 $this->lng = $DIC->language();
110 $this->plugin_admin = $DIC["ilPluginAdmin"];
111 $this->tree = $DIC->repositoryTree();
112 $this->access = $DIC->access();
113 $this->nav_history = $DIC["ilNavigationHistory"];
114 $this->settings = $DIC->settings();
115 $this->ctrl = $DIC->ctrl();
116 $this->help = $DIC["ilHelp"];
117 $this->ui = $DIC->ui();
118 $rbacsystem = $DIC->rbac()->system();
119 $ilUser = $DIC->user();
120
121 $this->tpl = new ilTemplate(
122 "tpl.main_menu.html",
123 true,
124 true,
125 "Services/MainMenu"
126 );
127 $this->target = $a_target;
128 $this->start_template = $a_use_start_template;
129
130 $this->mail = false;
131 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
132 if ($rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())) {
133 $this->mail = true;
134 }
135 }
136
137 $this->setMode(self::MODE_FULL);
138
139 // member view
140 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
142 if ($set->isActive()) {
143 $this->initMemberView();
144 }
145 }
146
147 public function setMode($a_value)
148 {
149 $this->mode = (int) $a_value;
150 }
151
152 public function getMode()
153 {
154 return $this->mode;
155 }
156
157 public function setTopBarBack($a_url, $a_caption = null)
158 {
159 $this->topbar_back_url = $a_url;
160 $this->topbar_back_caption = trim($a_caption);
161 }
162
163 public function getSpacerClass()
164 {
165 switch ($this->getMode()) {
169 return "ilFixedTopSpacerBarOnly";
170
171 case self::MODE_FULL:
172 return "ilFixedTopSpacer";
173 }
174 }
175
179 public function setActive($a_active)
180 {
181 $this->active = $a_active;
182 }
183
188 public function setLoginTargetPar($a_val)
189 {
190 $this->login_target_par = $a_val;
191 }
192
196 public function getLoginTargetPar()
197 {
198 return $this->login_target_par;
199 }
200
201 public static function getLanguageSelection($a_in_topbar = false)
202 {
203 global $DIC;
204
205 $lng = $DIC->language();
206
207 include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
208 $gr_list = new ilGroupedListGUI();
209 $gr_list->setAsDropDown(true);
210
211 $languages = $lng->getInstalledLanguages();
212 if (sizeof($languages) > 1) { // #11237
213 foreach ($languages as $lang_key) {
214 $base = substr($_SERVER["REQUEST_URI"], strrpos($_SERVER["REQUEST_URI"], "/") + 1);
215 $base = preg_replace("/&*lang=[a-z]{2}&*/", "", $base);
217 $base,
218 "lang=" . $lang_key
219 );
220 $link = str_replace("?&", "?", $link);
221
222 $gr_list->addEntry($lng->_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key), $link);
223 }
224 return $gr_list->getHTML();
225 }
226 }
227
231 public function setTemplateVars()
232 {
236 $ilPluginAdmin = $this->plugin_admin;
238
239 if ($this->logo_only) {
240 $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
241 $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
242 $this->tpl->setVariable("HEADER_ICON_RESPONSIVE", ilUtil::getImagePath("HeaderIconResponsive.svg"));
243
244 // #15759
245 include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
246 $header_top_title = ilObjSystemFolder::_getHeaderTitle();
247 if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title")) {
248 $this->tpl->setCurrentBlock("header_top_title");
249 $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
250 $this->tpl->parseCurrentBlock();
251 }
252
253 return;
254 }
255
256 // get user interface plugins
257 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
258
259 if ($this->getMode() != self::MODE_TOPBAR_REDUCED &&
260 $this->getMode() != self::MODE_TOPBAR_MEMBERVIEW) {
261 // search
262 include_once 'Services/Search/classes/class.ilSearchSettings.php';
263 if ($rbacsystem->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
264 include_once './Services/Search/classes/class.ilMainMenuSearchGUI.php';
265 $main_search = new ilMainMenuSearchGUI();
266 $html = "";
267
268 // user interface plugin slot + default rendering
269 include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
270 $uip = new ilUIHookProcessor(
271 "Services/MainMenu",
272 "main_menu_search",
273 array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search)
274 );
275 if (!$uip->replaced()) {
276 $html = $main_search->getHTML();
277 }
278 $html = $uip->getHTML($html);
279
280 if (strlen($html)) {
281 $this->tpl->setVariable('SEARCHBOX', $html);
282 }
283 }
284
285 $this->renderStatusBox($this->tpl);
286
287 // online help
288 $this->renderHelpButtons();
289
290 $this->renderOnScreenChatMenu();
293 $this->renderBackgroundTasks();
294 $this->renderAwareness();
295 }
296
297 if ($this->getMode() == self::MODE_FULL) {
298 $mmle_html = "";
299
300 // user interface plugin slot + default rendering
301 include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
302 $uip = new ilUIHookProcessor(
303 "Services/MainMenu",
304 "main_menu_list_entries",
305 array("main_menu_gui" => $this)
306 );
307 if (!$uip->replaced()) {
308 $mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu");
309 $mmle_html = $this->renderMainMenuListEntries($mmle_tpl);
310 }
311 $mmle_html = $uip->getHTML($mmle_html);
312
313 $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html);
314 }
315
316 if ($this->getMode() != self::MODE_TOPBAR_MEMBERVIEW) {
317 $link_dir = (defined("ILIAS_MODULE"))
318 ? "../"
319 : "";
320
321 // login stuff
322 if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) {
323 include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
325 $this->tpl->setCurrentBlock("registration_link");
326 $this->tpl->setVariable("TXT_REGISTER", $lng->txt("register"));
327 $this->tpl->setVariable("LINK_REGISTER", $link_dir . "register.php?client_id=" . rawurlencode(CLIENT_ID) . "&lang=" . $ilUser->getCurrentLanguage());
328 $this->tpl->parseCurrentBlock();
329 }
330
331 // language selection
332 $selection = self::getLanguageSelection();
333 if ($selection) {
334 $this->tpl->setVariable("TXT_LANGSELECT", $lng->txt("language"));
335 $this->tpl->setVariable("LANG_SELECT", $selection);
336 }
337
338 $this->tpl->setCurrentBlock("userisanonymous");
339 $this->tpl->setVariable("TXT_NOT_LOGGED_IN", $lng->txt("not_logged_in"));
340 $this->tpl->setVariable("TXT_LOGIN", $lng->txt("log_in"));
341
342 // #13058
343 $target_str = ($this->getLoginTargetPar() != "")
344 ? $this->getLoginTargetPar()
346 $this->tpl->setVariable(
347 "LINK_LOGIN",
348 $link_dir . "login.php?target=" . $target_str . "&client_id=" . rawurlencode(CLIENT_ID) . "&cmd=force_login&lang=" . $ilUser->getCurrentLanguage()
349 );
350 $this->tpl->parseCurrentBlock();
351 } else {
353
354 $this->tpl->setCurrentBlock("userisloggedin");
355 $this->tpl->setVariable("TXT_LOGIN_AS", $lng->txt("login_as"));
356 $user_img_src = $ilUser->getPersonalPicturePath("small", true);
357 $user_img_alt = $ilUser->getFullname();
358 $this->tpl->setVariable("USER_IMG", ilUtil::img($user_img_src, $user_img_alt));
359 $this->tpl->setVariable("USR_LINK_PROFILE", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile");
360 $this->tpl->setVariable("USR_TXT_PROFILE", $lng->txt("personal_profile"));
361 $this->tpl->setVariable("USR_LINK_SETTINGS", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings");
362 $this->tpl->setVariable("USR_TXT_SETTINGS", $lng->txt("personal_settings"));
363 $this->tpl->setVariable("TXT_LOGOUT2", $lng->txt("logout"));
364 $this->tpl->setVariable("LINK_LOGOUT2", $link_dir . "logout.php?lang=" . $ilUser->getCurrentLanguage());
365 $this->tpl->setVariable("USERNAME", $ilUser->getFullname());
366 $this->tpl->setVariable("LOGIN", $ilUser->getLogin());
367 $this->tpl->setVariable("MATRICULATION", $ilUser->getMatriculation());
368 $this->tpl->setVariable("EMAIL", $ilUser->getEmail());
369 $this->tpl->parseCurrentBlock();
370 }
371 } else {
372 // member view info
373 $this->tpl->setVariable("TOPBAR_CLASS", " ilMemberViewMainHeader");
374 $this->tpl->setVariable("MEMBER_VIEW_INFO", $lng->txt("mem_view_long"));
375 }
376
377 if (!$this->topbar_back_url) {
378 include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
379 $header_top_title = ilObjSystemFolder::_getHeaderTitle();
380 if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title")) {
381 $this->tpl->setCurrentBlock("header_top_title");
382 // php7-workaround alex: added phpversion() to help during development of php7 compatibility
383 $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
384 $this->tpl->parseCurrentBlock();
385 }
386 } else {
387 $this->tpl->setCurrentBlock("header_back_bl");
388 $this->tpl->setVariable("URL_HEADER_BACK", $this->topbar_back_url);
389 $this->tpl->setVariable("TXT_HEADER_BACK", $this->topbar_back_caption
390 ? $this->topbar_back_caption
391 : $lng->txt("back"));
392 $this->tpl->parseCurrentBlock();
393 }
394
395 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
396
397 if ($this->getMode() == self::MODE_FULL) {
398 // $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
399 $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
400 $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
401 $this->tpl->setVariable("HEADER_ICON_RESPONSIVE", ilUtil::getImagePath("HeaderIconResponsive.svg"));
402 }
403
404 include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
405
406 $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
407
408 $this->tpl->parseCurrentBlock();
409 }
410
414 public function renderStatusBox($a_tpl)
415 {
417 $ui_factory = $this->ui->factory();
418 $ui_renderer = $this->ui->renderer();
419
420 if ($this->mail) {
422
423 $a_tpl->setCurrentBlock('status_box');
424
425 $glyph = $ui_factory->glyph()->mail("ilias.php?baseClass=ilMailGUI");
426
427 if ($new_mails > 0) {
428 $glyph = $glyph->withCounter($ui_factory->counter()->novelty($new_mails));
429 }
430
431 $a_tpl->setVariable('GLYPH', $ui_renderer->render($glyph));
432 $a_tpl->parseCurrentBlock();
433 }
434 }
435
436
443 public function renderMainMenuListEntries($a_tpl, $a_call_get = true)
444 {
447 $ilAccess = $this->access;
448
449 // personal desktop
450 if ($GLOBALS['DIC']['ilUser']->getId() != ANONYMOUS_USER_ID) {
451 $this->renderEntry(
452 $a_tpl,
453 "desktop",
454 $lng->txt("personal_desktop"),
455 "#"
456 );
457 }
458
459 // repository
460 if ($ilAccess->checkAccess('visible', '', ROOT_FOLDER_ID)) {
461 include_once('./Services/Link/classes/class.ilLink.php');
462 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
463 $title = $nd["title"];
464 if ($title == "ILIAS") {
465 $title = $lng->txt("repository");
466 }
467 if ($GLOBALS['DIC']['ilUser']->getId() != ANONYMOUS_USER_ID) {
468 $this->renderEntry(
469 $a_tpl,
470 "repository",
471 $title,
472 "#"
473 );
474 }
475 }
476
477
478 // administration
480 $this->renderDropDown($a_tpl, "administration");
481 }
482
483 if ($a_call_get) {
484 return $a_tpl->get();
485 }
486
487 return "";
488 }
489
496 public function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top")
497 {
499 $ilNavigationHistory = $this->nav_history;
502
503 $id = strtolower($a_id);
504 $id_up = strtoupper($a_id);
505 $a_tpl->setCurrentBlock("entry_" . $id);
506
507 include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
508
509 // repository
510 if ($a_id == "repository") {
511 $gl = new ilGroupedListGUI();
512 $gl->setAsDropDown(true);
513
514 include_once("./Services/Link/classes/class.ilLink.php");
516
517 $gl->addEntry(
518 $icon . " " . $a_txt . " - " . $lng->txt("rep_main_page"),
519 ilLink::_getStaticLink(1, 'root', true),
520 "_top"
521 );
522
523 $items = $ilNavigationHistory->getItems();
524 reset($items);
525 $cnt = 0;
526 $first = true;
527
528 foreach ($items as $k => $item) {
529 if ($cnt >= 10) {
530 break;
531 }
532
533 if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) ||
534 ($item["ref_id"] != $_GET["ref_id"] || !$first)) { // do not list current item
535 if ($cnt == 0) {
536 $gl->addGroupHeader($lng->txt("last_visited"), "ilLVNavEnt");
537 }
538 $obj_id = ilObject::_lookupObjId($item["ref_id"]);
539 $cnt++;
540 $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"));
541 $ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true); // #11023
542 $gl->addEntry($icon . " " . $ititle, $item["link"], "_top", "", "ilLVNavEnt");
543 }
544 $first = false;
545 }
546
547 if ($cnt > 0) {
548 $gl->addEntry(
549 "» " . $lng->txt("remove_entries"),
550 "#",
551 "",
552 "return il.MainMenu.removeLastVisitedItems('" .
553 $ilCtrl->getLinkTargetByClass("ilnavigationhistorygui", "removeEntries", "", true) . "');",
554 "ilLVNavEnt"
555 );
556 }
557
558 $a_tpl->setVariable("REP_EN_OV", $gl->getHTML());
559 }
560
561 // desktop
562 if ($a_id == "desktop") {
563 $gl = new ilGroupedListGUI();
564 $gl->setAsDropDown(true);
565
566 // overview
567 $gl->addEntry(
568 $lng->txt("overview"),
569 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSelectedItems",
570 "_top",
571 "",
572 "",
573 "mm_pd_sel_items",
574 ilHelp::getMainMenuTooltip("mm_pd_sel_items"),
575 "left center",
576 "right center",
577 false
578 );
579
580 require_once 'Services/PersonalDesktop/ItemsBlock/classes/class.ilPDSelectedItemsBlockViewSettings.php';
581 $pdItemsViewSettings = new ilPDSelectedItemsBlockViewSettings($GLOBALS['DIC']->user());
582
583 // my groups and courses, if both is available
584 if ($pdItemsViewSettings->allViewsEnabled()) {
585 $gl->addEntry(
586 $lng->txt("my_courses_groups"),
587 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToMemberships",
588 "_top",
589 "",
590 "",
591 "mm_pd_crs_grp",
592 ilHelp::getMainMenuTooltip("mm_pd_crs_grp"),
593 "left center",
594 "right center",
595 false
596 );
597 }
598
599 // bookmarks
600 if (!$ilSetting->get("disable_bookmarks")) {
601 $gl->addEntry(
602 $lng->txt("bookmarks"),
603 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToBookmarks",
604 "_top",
605 "",
606 "",
607 "mm_pd_bookm",
608 ilHelp::getMainMenuTooltip("mm_pd_bookm"),
609 "left center",
610 "right center",
611 false
612 );
613 }
614
615 // private notes
616 if (!$ilSetting->get("disable_notes") || !$ilSetting->get("disable_comments")) {
617 $lng->loadLanguageModule("notes");
618 $t = $lng->txt("notes");
619 $c = "jumpToNotes";
620 if (!$ilSetting->get("disable_notes") && !$ilSetting->get("disable_comments")) {
621 $t = $lng->txt("notes_and_comments");
622 }
623 if ($ilSetting->get("disable_notes")) {
624 $t = $lng->txt("notes_comments");
625 $c = "jumpToComments";
626 }
627 $gl->addEntry(
628 $t,
629 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=" . $c,
630 "_top",
631 "",
632 "",
633 "mm_pd_notes",
634 ilHelp::getMainMenuTooltip("mm_pd_notes"),
635 "left center",
636 "right center",
637 false
638 );
639 }
640
641 // news
642 if ($ilSetting->get("block_activated_news")) {
643 $gl->addEntry(
644 $lng->txt("news"),
645 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNews",
646 "_top",
647 "",
648 "",
649 "mm_pd_news",
650 ilHelp::getMainMenuTooltip("mm_pd_news"),
651 "left center",
652 "right center",
653 false
654 );
655 }
656
657 // overview is always active
658 $gl->addSeparator();
659
660 $separator = false;
661
662 if ($ilSetting->get("enable_my_staff") and ilMyStaffAccess::getInstance()->hasCurrentUserAccessToMyStaff() == true) {
663 // my staff
664 $gl->addEntry(
665 $lng->txt("my_staff"),
666 "ilias.php?baseClass=" . ilPersonalDesktopGUI::class . "&cmd=" . ilPersonalDesktopGUI::CMD_JUMP_TO_MY_STAFF,
667 "_top",
668 "",
669 "",
670 "mm_pd_mst",
671 ilHelp::getMainMenuTooltip("mm_pd_mst"),
672 "left center",
673 "right center",
674 false
675 );
676 $separator = true;
677 }
678
679 if (!$ilSetting->get("disable_personal_workspace")) {
680 // workspace
681 $gl->addEntry(
682 $lng->txt("personal_workspace"),
683 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace",
684 "_top",
685 "",
686 "",
687 "mm_pd_wsp",
688 ilHelp::getMainMenuTooltip("mm_pd_wsp"),
689 "left center",
690 "right center",
691 false
692 );
693
694 $separator = true;
695 }
696
697
698 // portfolio
699 if ($ilSetting->get('user_portfolios')) {
700 $gl->addEntry(
701 $lng->txt("portfolio"),
702 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio",
703 "_top",
704 "",
705 "",
706 "mm_pd_port",
707 ilHelp::getMainMenuTooltip("mm_pd_port"),
708 "left center",
709 "right center",
710 false
711 );
712
713 $separator = true;
714 }
715
716 // skills
717 $skmg_set = new ilSetting("skmg");
718 if ($skmg_set->get("enable_skmg")) {
719 $gl->addEntry(
720 $lng->txt("skills"),
721 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSkills",
722 "_top",
723 "",
724 "",
725 "mm_pd_skill",
726 ilHelp::getMainMenuTooltip("mm_pd_skill"),
727 "left center",
728 "right center",
729 false
730 );
731
732 $separator = true;
733 }
734
735 require_once 'Services/Badge/classes/class.ilBadgeHandler.php';
736 if (ilBadgeHandler::getInstance()->isActive()) {
737 $gl->addEntry(
738 $lng->txt('obj_bdga'),
739 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToBadges',
740 '_top'
741 ,
742 "",
743 "",
744 "mm_pd_contacts",
745 ilHelp::getMainMenuTooltip("mm_pd_badges"),
746 "left center",
747 "right center",
748 false
749 );
750
751 $separator = true;
752 }
753
754
755 // Learning Progress
756 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
760 //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
761 $gl->addEntry(
762 $lng->txt("learning_progress"),
763 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToLP",
764 "_top",
765 "",
766 "",
767 "mm_pd_lp",
768 ilHelp::getMainMenuTooltip("mm_pd_lp"),
769 "left center",
770 "right center",
771 false
772 );
773
774 $separator = true;
775 }
776
777 if ($separator) {
778 $gl->addSeparator();
779 }
780
781 $separator = false;
782
783 // calendar
784 include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
786 if ($settings->isEnabled()) {
787 $gl->addEntry(
788 $lng->txt("calendar"),
789 "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToCalendar",
790 "_top",
791 "",
792 "",
793 "mm_pd_cal",
794 ilHelp::getMainMenuTooltip("mm_pd_cal"),
795 "left center",
796 "right center",
797 false
798 );
799
800 $separator = true;
801 }
802
803 // mail
804 if ($this->mail) {
805 $gl->addEntry(
806 $lng->txt('mail'),
807 'ilias.php?baseClass=ilMailGUI',
808 '_top',
809 "",
810 "",
811 "mm_pd_mail",
812 ilHelp::getMainMenuTooltip("mm_pd_mail"),
813 "left center",
814 "right center",
815 false
816 );
817
818 $separator = true;
819 }
820
821 // contacts
822 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
823 if (ilBuddySystem::getInstance()->isEnabled()) {
824 $gl->addEntry(
825 $lng->txt('mail_addressbook'),
826 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToContacts',
827 '_top'
828 ,
829 "",
830 "",
831 "mm_pd_contacts",
832 ilHelp::getMainMenuTooltip("mm_pd_contacts"),
833 "left center",
834 "right center",
835 false
836 );
837
838 $separator = true;
839 }
840
841
842 $a_tpl->setVariable("DESK_CONT_OV", $gl->getHTML());
843 }
844
845 $a_tpl->setVariable("TXT_" . $id_up, $a_txt);
846 $a_tpl->setVariable("SCRIPT_" . $id_up, $a_script);
847 $a_tpl->setVariable("TARGET_" . $id_up, $a_target);
848 if ($this->active == $a_id || ($this->active == "" && $a_id == "repository")) {
849 $a_tpl->setVariable("SEL", '<span class="ilAccHidden">(' . $lng->txt("stat_selected") . ')</span>');
850 }
851
852 if ($a_id == "repository") {
853 include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
855 $a_tpl->setVariable("ACC_KEY_REPOSITORY", 'accesskey="' .
857 }
858 }
859 if ($a_id == "desktop") {
860 include_once("./Services/Accessibility/classes/class.ilAccessKey.php");
862 $a_tpl->setVariable("ACC_KEY_DESKTOP", 'accesskey="' .
864 }
865 }
866
867
868 $a_tpl->parseCurrentBlock();
869 }
870
871
875 public function getScriptTarget($a_script)
876 {
877 $script = "./" . $a_script;
878 if (defined("ILIAS_MODULE")) {
879 $script = "." . $script;
880 }
881 return $script;
882 }
883
884 public static function _checkAdministrationPermission()
885 {
886 global $DIC;
887
888 $rbacsystem = $DIC->rbac()->system();
889
890 //if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
891 if ($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID)) {
892 return true;
893 }
894 return false;
895 }
896
897 public function getHTML()
898 {
899 // this is a workaround for bugs like 14016
900 // the main menu does not need the YUI connection, but many other
901 // features since they rely on il.Util.sendAjaxGetRequestToUrl (see Services/Javascript)
902 // which still uses YUI. This should be migrated to jQuery with a future major release
903 include_once "Services/YUI/classes/class.ilYuiUtil.php";
904 ilYUIUtil::initConnection();
905
906 $this->setTemplateVars();
907
908 return $this->tpl->get();
909 }
910
915 protected function initMemberView()
916 {
918
919 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
920 $ref_id = ilMemberViewSettings::getInstance()->getCurrentRefId();
921
922 if (!$ref_id) {
923 return false;
924 }
925
926 include_once './Services/Link/classes/class.ilLink.php';
928 $ref_id,
930 array('mv' => 0)
931 );
932
933 $this->setMode(self::MODE_TOPBAR_MEMBERVIEW);
934 $this->setTopBarBack($url, $lng->txt('mem_view_close'));
935 }
936
942 public function renderDropDown($a_tpl, $a_id)
943 {
946
947 $id = strtolower($a_id);
948 $a_tpl->setCurrentBlock("entry_" . $id);
949 include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
950 $selection = new ilAdvancedSelectionListGUI();
951 if ($this->active == $a_id || ($this->active == "" && $a_id == "repository")) {
952 $selection->setSelectionHeaderClass("MMActive");
953 $a_tpl->setVariable("SEL", '<span class="ilAccHidden">(' . $lng->txt("stat_selected") . ')</span>');
954 } else {
955 $selection->setSelectionHeaderClass("MMInactive");
956 }
957
958 $selection->setSelectionHeaderSpanClass("MMSpan");
959
960 $selection->setHeaderIcon(ilAdvancedSelectionListGUI::ICON_ARROW);
961 $selection->setItemLinkClass("small");
962 $selection->setUseImages(false);
963
964 switch ($id) {
965 // desktop drop down
966 case "desktop":
967 $selection->setListTitle($lng->txt("personal_desktop"));
968 $selection->setId("dd_pd");
969
970 // overview
971 $selection->addItem(
972 $lng->txt("overview"),
973 "",
974 "ilias.php?baseClass=ilPersonalDesktopGUI",
975 "",
976 "",
977 "_top"
978 );
979
980 if (!$ilSetting->get("disable_personal_workspace")) {
981 // workspace
982 $selection->addItem(
983 $lng->txt("personal_workspace"),
984 "",
985 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToWorkspace",
986 "",
987 "",
988 "_top"
989 );
990 }
991
992 // profile
993 $selection->addItem(
994 $lng->txt("personal_profile"),
995 "",
996 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToProfile",
997 "",
998 "",
999 "_top"
1000 );
1001
1002 // skills
1003 $skmg_set = new ilSetting("skmg");
1004 if ($skmg_set->get("enable_skmg")) {
1005 $selection->addItem(
1006 $lng->txt("skills"),
1007 "",
1008 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSkills",
1009 "",
1010 "",
1011 "_top"
1012 );
1013 }
1014
1015 // portfolio
1016 if ($ilSetting->get('user_portfolios')) {
1017 $selection->addItem(
1018 $lng->txt("portfolio"),
1019 "",
1020 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToPortfolio",
1021 "",
1022 "",
1023 "_top"
1024 );
1025 }
1026
1027 // news
1028 if ($ilSetting->get("block_activated_news")) {
1029 $selection->addItem(
1030 $lng->txt("news"),
1031 "",
1032 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNews",
1033 "",
1034 "",
1035 "_top"
1036 );
1037 }
1038
1039 // Learning Progress
1040 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1042 //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
1043 $selection->addItem(
1044 $lng->txt("learning_progress"),
1045 "",
1046 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToLP",
1047 "",
1048 "",
1049 "_top"
1050 );
1051 }
1052
1053 // calendar
1054 include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
1056 if ($settings->isEnabled()) {
1057 $selection->addItem(
1058 $lng->txt("calendar"),
1059 "",
1060 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToCalendar",
1061 "",
1062 "",
1063 "_top"
1064 );
1065 }
1066
1067 // mail
1068 if ($this->mail) {
1069 $selection->addItem($lng->txt('mail'), '', 'ilias.php?baseClass=ilMailGUI', '', '', '_top');
1070 }
1071
1072 // contacts
1073 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
1074 if (ilBuddySystem::getInstance()->isEnabled()) {
1075 $selection->addItem($lng->txt('mail_addressbook'), '', 'ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToContacts', '', '', '_top');
1076 }
1077
1078 // private notes
1079 if (!$ilSetting->get("disable_notes")) {
1080 $selection->addItem(
1081 $lng->txt("notes_and_comments"),
1082 "",
1083 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToNotes",
1084 "",
1085 "",
1086 "_top"
1087 );
1088 }
1089
1090 // bookmarks
1091 if (!$ilSetting->get("disable_bookmarks")) {
1092 $selection->addItem(
1093 $lng->txt("bookmarks"),
1094 "",
1095 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToBookmarks",
1096 "",
1097 "",
1098 "_top"
1099 );
1100 }
1101
1102 // settings
1103 $selection->addItem(
1104 $lng->txt("personal_settings"),
1105 "",
1106 "ilias.php?baseClass=ilPersonalDesktopGUI&amp;cmd=jumpToSettings",
1107 "",
1108 "",
1109 "_top"
1110 );
1111
1112 break;
1113
1114 // administration
1115 case "administration":
1116 $selection->setListTitle($lng->txt("administration"));
1117 $selection->setId("dd_adm");
1118 $selection->setAsynch(true);
1119 $selection->setAsynchUrl("ilias.php?baseClass=ilAdministrationGUI&cmd=getDropDown&cmdMode=asynch");
1120 break;
1121
1122 }
1123
1124 $a_tpl->setVariable("TXT_ADMINISTRATION", $lng->txt("administration"));
1125 $a_tpl->parseCurrentBlock();
1126 }
1127
1128
1135 public function renderHelpButtons()
1136 {
1137 $ilHelp = $this->help;
1138 $lng = $this->lng;
1140 $tpl = $this->tpl;
1144
1145 // screen id
1146 if ((defined("OH_REF_ID") && OH_REF_ID > 0) || DEVMODE == 1) {
1147 if ($ilHelp->getScreenId() != "") {
1148 if ($this->getMode() == self::MODE_FULL) {
1149 $this->tpl->setCurrentBlock("screen_id");
1150 $this->tpl->setVariable("SCREEN_ID", $ilHelp->getScreenId());
1151 $this->tpl->parseCurrentBlock();
1152 }
1153 }
1154 }
1155
1156 $help_active = false;
1157
1158 include_once("./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php");
1159 $helpl = new ilGroupedListGUI();
1160 $helpl->setAsDropDown(true, true);
1161
1162 if ($ilHelp->hasSections()) {
1163 $help_active = true;
1164
1165 $lng->loadLanguageModule("help");
1166 //$this->tpl->setCurrentBlock("help_icon");
1167
1168 // add javascript needed by help (to do: move to help class)
1169 $main_tpl->addJavascript("./Services/Help/js/ilHelp.js");
1170 include_once("./Services/Accordion/classes/class.ilAccordionGUI.php");
1171 $acc = new ilAccordionGUI();
1172 $acc->addJavascript($main_tpl);
1173 $acc->addCss();
1174
1175 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1177 "help_tr",
1178 $lng->txt("help_open_online_help"),
1179 "",
1180 "bottom center",
1181 "top center",
1182 false
1183 );
1184 $helpl->addEntry("<span>&nbsp;</span> " . $lng->txt("help_topcis"), "#", "", "il.Help.listHelp(event, false);");
1185 }
1186
1187 $module_id = (int) $ilSetting->get("help_module");
1188 if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de" &&
1189 $ilSetting->get("help_mode") != "1") {
1190 $help_active = true;
1191
1192 $lng->loadLanguageModule("help");
1193 $main_tpl->addJavascript("./Services/Help/js/ilHelp.js");
1194
1195 include_once("./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php");
1197 "help_tt",
1198 $lng->txt("help_toggle_tooltips"),
1199 "",
1200 "bottom center",
1201 "top center",
1202 false
1203 );
1204 $helpl->addEntry('<span id="help_tt_switch_on" class="glyphicon glyphicon-ok"></span> ' . $lng->txt("help_tooltips"), "#", "", "return il.Help.switchTooltips(event);");
1205 }
1206
1207 if ($help_active) {
1208 $this->tpl->setCurrentBlock("help");
1209 $this->tpl->setVariable("TXT_HELP", $lng->txt("help"));
1210 $this->tpl->setVariable("HELP_SELECT", $helpl->getHTML());
1211 $this->tpl->parseCurrentBlock();
1212
1213 // always set ajax url
1214 $ts = $ilCtrl->getTargetScript();
1215 $ilCtrl->setTargetScript("ilias.php");
1216
1217 $ilHelp->setCtrlPar();
1218 $this->main_tpl->addOnLoadCode("il.Help.setAjaxUrl('" .
1219 $ilCtrl->getLinkTargetByClass("ilhelpgui", "", "", true)
1220 . "');");
1221 $ilCtrl->setTargetScript($ts);
1222 }
1223 }
1224
1228 protected function populateWithBuddySystem()
1229 {
1230 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystem.php';
1231 if (ilBuddySystem::getInstance()->isEnabled()) {
1232 require_once 'Services/Contact/BuddySystem/classes/class.ilBuddySystemGUI.php';
1234 }
1235 }
1236
1237 protected function populateWithOnScreenChat()
1238 {
1239 require_once 'Services/OnScreenChat/classes/class.ilOnScreenChatGUI.php';
1240
1242 }
1243
1244 protected function renderOnScreenChatMenu()
1245 {
1246 require_once 'Services/OnScreenChat/classes/class.ilOnScreenChatMenuGUI.php';
1247
1248 $menu = new ilOnScreenChatMenuGUI();
1249 $this->tpl->setVariable('ONSCREENCHAT', $menu->getMainMenuHTML());
1250 }
1251
1255 public function renderAwareness()
1256 {
1257 include_once("./Services/Awareness/classes/class.ilAwarenessGUI.php");
1259
1260 $this->tpl->setVariable("AWARENESS", $aw->getMainMenuHTML());
1261 }
1262
1269 {
1270 if ($this->getMode() != self::MODE_TOPBAR_REDUCED && !$user->isAnonymous()) {
1271 $this->tpl->touchBlock('osd_container');
1272
1273 require_once 'Services/Notifications/classes/class.ilNotificationOSDGUI.php';
1274 $osdGui = new ilNotificationOSDGUI($user, $mainTpl, $lng);
1275 $osdGui->render();
1276 }
1277 }
1278
1279
1287 public function showLogoOnly($a_value)
1288 {
1289 $this->logo_only = (bool) $a_value;
1290 }
1291
1292 protected function getHeaderURL()
1293 {
1294 include_once './Services/User/classes/class.ilUserUtil.php';
1296
1297 if (!$url) {
1298 $url = "./goto.php?target=root_1";
1299 }
1300
1301 return $url;
1302 }
1303
1304 protected function renderBackgroundTasks()
1305 {
1306 global $DIC;
1307
1309
1310 if ($DIC->user()->isAnonymous() || (int) $DIC->user()->getId() === 0) {
1311 return;
1312 }
1313
1314 $DIC->language()->loadLanguageModule("background_tasks");
1315 $factory = $DIC->ui()->factory();
1316 $persistence = $DIC->backgroundTasks()->persistence();
1317 $metas = $persistence->getBucketMetaOfUser($DIC->user()->getId());
1318 if (!count($metas)) {
1319 return;
1320 }
1321
1322 $numberOfUserInteractions = count(array_filter($metas, function (BucketMeta $meta) {
1323 return $meta->getState() == State::USER_INTERACTION;
1324 }));
1325 $numberOfNotUserInteractions = count($metas) - $numberOfUserInteractions;
1326
1327 $popover = $factory->popover()
1328 ->listing(array())
1329 ->withFixedPosition()
1330 ->withTitle($DIC->language()->txt("background_tasks_running")); // needs to have empty content
1331 $DIC->ctrl()->clearParametersByClass(ilBTControllerGUI::class);
1332 $DIC->ctrl()->setParameterByClass(
1333 ilBTControllerGUI::class,
1335 ilBTControllerGUI::hash("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}")
1336 );
1337 $DIC->ctrl()->setParameterByClass(
1338 ilBTControllerGUI::class,
1340 $popover->getReplaceContentSignal()->getId()
1341 );
1342
1343 $url = $DIC->ctrl()->getLinkTargetByClass([ ilBTControllerGUI::class ], ilBTControllerGUI::CMD_GET_POPOVER_CONTENT, "", true);
1344 $popover = $popover->withAsyncContentUrl($url);
1345
1346 $glyph = $factory->glyph()
1347 ->briefcase()
1348 ->withOnClick($popover->getShowSignal())
1349 ->withCounter($factory->counter()->novelty($numberOfUserInteractions))
1350 ->withCounter($factory->counter()->status($numberOfNotUserInteractions));
1351
1352 $main_tpl->addJavascript('./Services/BackgroundTasks/js/background_task_refresh.js');
1353
1354 $this->tpl->setVariable(
1355 'BACKGROUNDTASKS',
1356 $DIC->ui()->renderer()->render([$glyph, $popover])
1357 );
1358
1359 $this->tpl->setVariable('BACKGROUNDTASKS_REFRESH_URI', $url);
1360 }
1361}
user()
Definition: user.php:4
$factory
Definition: metadata.php:47
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_COMP_SERVICE
static getKey($a_func_id, $lang_key="0", $a_ignore_default=false)
Get single access key.
Accordion user interface class.
User interface class for advanced drop-down selection lists.
static getInstance()
Get instance.
static getInstance()
Constructor.
static _getInstance()
get singleton instance
Grouped list GUI class.
static getMainMenuTooltip($a_item_id)
Get main menu tooltip.
language handling
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable.
static getNumberOfNewMailsByUserId($usr_id)
Determines the number of new mails for the passed user id and stores this information in a local cach...
Handles display of the main menu.
populateWithBuddySystem()
Includes all buddy system/user connections related javascript code.
setTopBarBack($a_url, $a_caption=null)
renderOnScreenNotifications(\ilObjUser $user, \ilTemplate $mainTpl, \ilLanguage $lng)
setTemplateVars()
set all template variables (images, scripts, target frames, ...)
renderDropDown($a_tpl, $a_id)
GetDropDownHTML.
getLoginTargetPar()
Get target parameter for login.
__construct($a_target="_top", $a_use_start_template=false, ilTemplate $a_main_tpl=null)
renderMainMenuListEntries($a_tpl, $a_call_get=true)
desc
showLogoOnly($a_value)
Toggle rendering of main menu, search, user info.
renderAwareness()
Render awareness tool.
static getLanguageSelection($a_in_topbar=false)
renderStatusBox($a_tpl)
Render status box.
renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target="_top")
Render main menu entry.
static _checkAdministrationPermission()
renderHelpButtons()
Render help button.
getScriptTarget($a_script)
generates complete script target (private)
initMemberView()
Init member view @global type $lng.
setLoginTargetPar($a_val)
Set target parameter for login (public sector).
Add a search box to main menu.
static getInstance()
Get instance.
Class ilNotificationOSDGUI.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _lookupObjId($a_id)
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _lookupType($a_id, $a_reference=false)
lookup object type
static initializeFrontend()
Initialize frontend and delivers required javascript files and configuration to the global template.
Class ilOnScreenChatMenuGUI.
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
ILIAS Setting Class.
special template class to simplify handling of ITX/PEAR
static buildLoginTarget()
Add current object (repository/workspace) as target for login url.
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.
UI interface hook processor.
static getStartingPointAsUrl()
Get current starting point setting as URL.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$nd
Definition: error.php:10
$html
Definition: example_001.php:87
if(!array_key_exists('StateId', $_REQUEST)) $id
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
$base
Definition: index.php:4
mail($to, $subject, $message, $additional_headers=null, $additional_parameters=null)
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
global $ilSetting
Definition: privfeed.php:17
$url
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$ilUser
Definition: imgupload.php:18