ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMainMenuGUI Class Reference

Handles display of the main menu. More...

+ Inheritance diagram for ilMainMenuGUI:
+ Collaboration diagram for ilMainMenuGUI:

Public Member Functions

 __construct ($a_target="_top", $a_use_start_template=false, ilTemplate $a_main_tpl=null)
 
 setMode (int $a_value)
 
 getMode ()
 
 setTopBarBack ($a_url, $a_caption=null)
 
 getSpacerClass ()
 
 setActive ($a_active)
 
 setLoginTargetPar ($a_val)
 
 getLoginTargetPar ()
 
 getHTML ()
 
 renderAwareness ()
 Render awareness tool. More...
 
 showLogoOnly (bool $a_value)
 Toggle rendering of main menu, search, user info. More...
 

Static Public Member Functions

static getLanguageSelection ($a_in_topbar=false)
 
static _checkAdministrationPermission ()
 

Data Fields

 $tpl
 
 $target
 
 $start_template
 
 $mail
 
const MODE_FULL = 1
 
const MODE_TOPBAR_ONLY = 2
 
const MODE_TOPBAR_REDUCED = 3
 
const MODE_TOPBAR_MEMBERVIEW = 4
 

Protected Member Functions

 initMemberView ()
 
 addToolbarTooltip (string $element_id, string $help_id)
 Add toolbar tooltip. More...
 

Protected Attributes

 $rbacsystem
 
 $user
 
 $lng
 
 $plugin_admin
 
 $tree
 
 $access
 
 $nav_history
 
 $settings
 
 $ctrl
 
 $help
 
 $main_tpl
 
 $mode
 
 $topbar_back_url
 
 $topbar_back_caption
 

Private Member Functions

 setTemplateVars ()
 Set all template variables (images, scripts, target frames, ...) More...
 
 renderStatusBox (ilTemplate $a_tpl)
 
 renderHelpButtons ()
 
 populateWithBuddySystem ()
 Includes all buddy system/user connections related javascript code. More...
 
 populateWithOnScreenChat ()
 
 renderOnScreenChatMenu ()
 
 renderOnScreenNotifications (\ilObjUser $user, \ilTemplate $mainTpl, \ilLanguage $lng)
 
 getHeaderURL ()
 
 renderBackgroundTasks ()
 

Detailed Description

Handles display of the main menu.

Author
Alex Killing
Version
$Id$

Definition at line 15 of file class.ilMainMenuGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilMainMenuGUI::__construct (   $a_target = "_top",
  $a_use_start_template = false,
ilTemplate  $a_main_tpl = null 
)
Parameters
string$a_targettarget frame
boolean$a_use_start_templatetrue means: target scripts should be called through start template

Definition at line 83 of file class.ilMainMenuGUI.php.

84 {
85 global $DIC;
86
87 if ($a_main_tpl != null) {
88 $this->main_tpl = $a_main_tpl;
89 } else {
90 $this->main_tpl = $DIC["tpl"];
91 }
92
93 $this->rbacsystem = $DIC->rbac()->system();
94 $this->user = $DIC->user();
95 $this->lng = $DIC->language();
96 $this->plugin_admin = $DIC["ilPluginAdmin"];
97 $this->tree = $DIC->repositoryTree();
98 $this->access = $DIC->access();
99 $this->nav_history = $DIC["ilNavigationHistory"];
100 $this->settings = $DIC->settings();
101 $this->ctrl = $DIC->ctrl();
102 $this->help = $DIC["ilHelp"];
103 $this->ui = $DIC->ui();
104 $rbacsystem = $DIC->rbac()->system();
105 $ilUser = $DIC->user();
106
107 $this->tpl = new ilTemplate(
108 "tpl.main_menu.html",
109 true,
110 true,
111 "Services/MainMenu"
112 );
113 $this->target = $a_target;
114 $this->start_template = $a_use_start_template;
115
116 $this->mail = false;
117 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
118 if ($rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())) {
119 $this->mail = true;
120 }
121 }
122
123 $this->setMode(self::MODE_FULL);
124
125 // member view
127 if ($set->isActive()) {
128 $this->initMemberView();
129 }
130 }
user()
Definition: user.php:4
static getMailObjectRefId()
Determines the reference id of the mail object and stores this information in a local cache variable.
setMode(int $a_value)
static getInstance()
Get instance.
special template class to simplify handling of ITX/PEAR
mail($to, $subject, $message, $additional_headers=null, $additional_parameters=null)
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18

References $DIC, $ilUser, $rbacsystem, ilMemberViewSettings\getInstance(), ilMailGlobalServices\getMailObjectRefId(), initMemberView(), Monolog\Handler\mail(), setMode(), settings(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _checkAdministrationPermission()

static ilMainMenuGUI::_checkAdministrationPermission ( )
static
Returns
bool
Deprecated:
Please use RBAC directly

Definition at line 454 of file class.ilMainMenuGUI.php.

455 {
456 global $DIC;
457
458 $rbacsystem = $DIC->rbac()->system();
459
460 //if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
461 if ($rbacsystem->checkAccess("visible", SYSTEM_FOLDER_ID)) {
462 return true;
463 }
464
465 return false;
466 }

References $DIC, and $rbacsystem.

Referenced by ilObjMediaPoolGUI\createMediaFromUploadDir(), ilObjMediaPoolGUI\listMedia(), and ilObjMediaPoolGUI\selectUploadDirFiles().

+ Here is the caller graph for this function:

◆ addToolbarTooltip()

ilMainMenuGUI::addToolbarTooltip ( string  $element_id,
string  $help_id 
)
protected

Add toolbar tooltip.

Parameters
string$element_id
string$help_id

Definition at line 764 of file class.ilMainMenuGUI.php.

765 {
766 if (ilHelp::getMainMenuTooltip($help_id) != "") {
768 $element_id,
770 "",
771 "top right",
772 "top left",
773 false
774 );
775 }
776 }
static getMainMenuTooltip($a_item_id)
Get main menu tooltip.
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.

References ilTooltipGUI\addTooltip(), and ilHelp\getMainMenuTooltip().

Referenced by renderAwareness(), renderBackgroundTasks(), renderHelpButtons(), renderOnScreenChatMenu(), renderStatusBox(), and setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHeaderURL()

ilMainMenuGUI::getHeaderURL ( )
private
Returns
string

Definition at line 673 of file class.ilMainMenuGUI.php.

673 : string
674 {
676
677 if (!$url) {
678 $url = "./goto.php?target=root_1";
679 }
680
681 return $url;
682 }
static getStartingPointAsUrl()
Get current starting point setting as URL.
$url

References $url, and ilUserUtil\getStartingPointAsUrl().

Referenced by setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilMainMenuGUI::getHTML ( )
Returns
string
Exceptions
ilTemplateException
Deprecated:

Reimplemented in LTI\ilMainMenuGUI.

Definition at line 474 of file class.ilMainMenuGUI.php.

475 {
476 // this is a workaround for bugs like 14016
477 // the main menu does not need the YUI connection, but many other
478 // features since they rely on il.Util.sendAjaxGetRequestToUrl (see Services/Javascript)
479 // which still uses YUI. This should be migrated to jQuery with a future major release
481
482 $this->setTemplateVars();
483
484 return $this->tpl->get();
485 }
setTemplateVars()
Set all template variables (images, scripts, target frames, ...)
static initConnection(ilTemplate $a_main_tpl=null)
Init YUI Connection module.

References ilYuiUtil\initConnection(), and setTemplateVars().

+ Here is the call graph for this function:

◆ getLanguageSelection()

static ilMainMenuGUI::getLanguageSelection (   $a_in_topbar = false)
static
Parameters
bool$a_in_topbar
Returns
string

Definition at line 221 of file class.ilMainMenuGUI.php.

221 : string
222 {
223 global $DIC;
224
225 $lng = $DIC->language();
226
227 $gr_list = new ilGroupedListGUI();
228 $gr_list->setAsDropDown(true);
229
230 $languages = $lng->getInstalledLanguages();
231 if (sizeof($languages) > 1) { // #11237
232 foreach ($languages as $lang_key) {
233 $base = substr($_SERVER["REQUEST_URI"], strrpos($_SERVER["REQUEST_URI"], "/") + 1);
234 $base = preg_replace("/&*lang=[a-z]{2}&*/", "", $base);
236 $base,
237 "lang=" . $lang_key
238 );
239 $link = str_replace("?&", "?", $link);
240
241 $gr_list->addEntry($lng->_lookupEntry($lang_key, "meta", "meta_l_" . $lang_key), $link);
242 }
243
244 return $gr_list->getHTML();
245 }
246
247 return "";
248 }
Grouped list GUI class.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
$languages
Definition: cssgen2.php:34
$base
Definition: index.php:4
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_SERVER, $base, $DIC, $languages, $lng, and ilUtil\appendUrlParameterString().

Referenced by ilStartUpGUI\getLanguageSelection(), and setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLoginTargetPar()

ilMainMenuGUI::getLoginTargetPar ( )
Deprecated:
Get target parameter for login

Definition at line 210 of file class.ilMainMenuGUI.php.

211 {
212 return $this->login_target_par;
213 }

Referenced by setTemplateVars().

+ Here is the caller graph for this function:

◆ getMode()

ilMainMenuGUI::getMode ( )
Returns
int

Definition at line 149 of file class.ilMainMenuGUI.php.

149 : int
150 {
151 return $this->mode;
152 }

References $mode.

Referenced by getSpacerClass(), renderHelpButtons(), renderOnScreenNotifications(), and setTemplateVars().

+ Here is the caller graph for this function:

◆ getSpacerClass()

ilMainMenuGUI::getSpacerClass ( )
Returns
string

Reimplemented in LTI\ilMainMenuGUI.

Definition at line 169 of file class.ilMainMenuGUI.php.

170 {
171 switch ($this->getMode()) {
175 return "ilFixedTopSpacerBarOnly";
176
177 case self::MODE_FULL:
178 return "ilFixedTopSpacer";
179 }
180 }

References getMode(), MODE_FULL, MODE_TOPBAR_MEMBERVIEW, MODE_TOPBAR_ONLY, and MODE_TOPBAR_REDUCED.

+ Here is the call graph for this function:

◆ initMemberView()

ilMainMenuGUI::initMemberView ( )
protected
Returns
bool

Definition at line 491 of file class.ilMainMenuGUI.php.

491 : bool
492 {
494
495 $ref_id = ilMemberViewSettings::getInstance()->getCurrentRefId();
496
497 if (!$ref_id) {
498 return false;
499 }
500
502 $ref_id,
504 array('mv' => 0)
505 );
506
507 $this->setMode(self::MODE_TOPBAR_MEMBERVIEW);
508 $this->setTopBarBack($url, $lng->txt('mem_view_close'));
509
510 return true;
511 }
setTopBarBack($a_url, $a_caption=null)
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type

References $lng, $url, ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilMemberViewSettings\getInstance(), setMode(), and setTopBarBack().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateWithBuddySystem()

ilMainMenuGUI::populateWithBuddySystem ( )
private

Includes all buddy system/user connections related javascript code.

Definition at line 604 of file class.ilMainMenuGUI.php.

605 {
606 if (ilBuddySystem::getInstance()->isEnabled()) {
608 }
609 }

References ilBuddySystem\getInstance(), and ilBuddySystemGUI\initializeFrontend().

Referenced by setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateWithOnScreenChat()

ilMainMenuGUI::populateWithOnScreenChat ( )
private

Definition at line 612 of file class.ilMainMenuGUI.php.

613 {
615 }
static initializeFrontend()
Initialize frontend and delivers required javascript files and configuration to the global template.

References ilOnScreenChatGUI\initializeFrontend().

Referenced by setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderAwareness()

ilMainMenuGUI::renderAwareness ( )

Render awareness tool.

Definition at line 629 of file class.ilMainMenuGUI.php.

630 {
631 include_once("./Services/Awareness/classes/class.ilAwarenessGUI.php");
633
634 $this->tpl->setVariable("AWARENESS", $aw->getMainMenuHTML());
635 $this->addToolbarTooltip("awareness_trigger", "mm_tb_aware");
636 }
static getInstance()
Get instance.
addToolbarTooltip(string $element_id, string $help_id)
Add toolbar tooltip.

References addToolbarTooltip(), and ilAwarenessGUI\getInstance().

Referenced by setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderBackgroundTasks()

ilMainMenuGUI::renderBackgroundTasks ( )
private

Definition at line 685 of file class.ilMainMenuGUI.php.

686 {
687 global $DIC;
688
690
691 if ($DIC->user()->isAnonymous() || (int) $DIC->user()->getId() === 0) {
692 // bugfix mantis 25348
693 $this->tpl->setVariable('BGT_HIDDEN', 'true');
694 return;
695 }
696
697 $DIC->language()->loadLanguageModule("background_tasks");
698 $factory = $DIC->ui()->factory();
699 $persistence = $DIC->backgroundTasks()->persistence();
700 $metas = $persistence->getBucketMetaOfUser($DIC->user()->getId());
701 if (!count($metas)) {
702 // bugfix mantis 25348
703 $this->tpl->setVariable('BGT_HIDDEN', 'true');
704 return;
705 }
706
707 $numberOfUserInteractions = count(
708 array_filter(
709 $metas,
710 function (BucketMeta $meta) {
711 return $meta->getState() == State::USER_INTERACTION;
712 }
713 )
714 );
715 $numberOfNotUserInteractions = count($metas) - $numberOfUserInteractions;
716
717 $popover = $factory->popover()
718 ->listing(array())
719 ->withFixedPosition()
720 ->withTitle($DIC->language()->txt("background_tasks_running")); // needs to have empty content
721 $DIC->ctrl()->clearParametersByClass(ilBTControllerGUI::class);
722 $DIC->ctrl()->setParameterByClass(
723 ilBTControllerGUI::class,
725 ilBTControllerGUI::hash("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}")
726 );
727 $DIC->ctrl()->setParameterByClass(
728 ilBTControllerGUI::class,
730 $popover->getReplaceContentSignal()->getId()
731 );
732
733 $url = $DIC->ctrl()->getLinkTargetByClass([ilBTControllerGUI::class], ilBTControllerGUI::CMD_GET_POPOVER_CONTENT, "", true);
734 $popover = $popover->withAsyncContentUrl($url);
735
736 $glyph = $factory->glyph()
737 ->briefcase()
738 ->withOnClick($popover->getShowSignal())
739 ->withCounter($factory->counter()->novelty($numberOfUserInteractions))
740 ->withCounter($factory->counter()->status($numberOfNotUserInteractions));
741
742 $main_tpl->addJavascript('./Services/BackgroundTasks/js/background_task_refresh.js');
743
744 $this->tpl->setVariable(
745 'BACKGROUNDTASKS',
746 $DIC->ui()->renderer()->render([$glyph, $popover])
747 );
748
749 // bugfix mantis 25348
750 $this->tpl->setVariable('BGT_HIDDEN', 'false');
751
752 $this->tpl->setVariable('BACKGROUNDTASKS_REFRESH_URI', $url);
753
754 $this->addToolbarTooltip("mm_tb_background_tasks", "mm_tb_bgtasks");
755 }
$factory
Definition: metadata.php:43

References $DIC, $factory, $main_tpl, $url, addToolbarTooltip(), ilBTControllerGUI\CMD_GET_POPOVER_CONTENT, ilBTControllerGUI\FROM_URL, ILIAS\BackgroundTasks\BucketMeta\getState(), ilBTControllerGUI\hash(), and ilBTControllerGUI\REPLACE_SIGNAL.

Referenced by setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderHelpButtons()

ilMainMenuGUI::renderHelpButtons ( )
private

Definition at line 514 of file class.ilMainMenuGUI.php.

515 {
516 $ilHelp = $this->help;
522
523 // screen id
524 if ((defined("OH_REF_ID") && OH_REF_ID > 0) || DEVMODE == 1) {
525 if ($ilHelp->getScreenId() != "") {
526 if ($this->getMode() == self::MODE_FULL) {
527 $this->tpl->setCurrentBlock("screen_id");
528 $this->tpl->setVariable("SCREEN_ID", $ilHelp->getScreenId());
529 $this->tpl->parseCurrentBlock();
530 }
531 }
532 }
533
534 $help_active = false;
535
536 $helpl = new ilGroupedListGUI();
537 $helpl->setAsDropDown(true, true);
538
539 if ($ilHelp->hasSections()) {
540 $help_active = true;
541
542 $lng->loadLanguageModule("help");
543 //$this->tpl->setCurrentBlock("help_icon");
544
545 // add javascript needed by help (to do: move to help class)
546 $main_tpl->addJavascript("./Services/Help/js/ilHelp.js");
547 $acc = new ilAccordionGUI();
548 $acc->addJavascript($main_tpl);
549 $acc->addCss();
550
552 "help_tr",
553 $lng->txt("help_open_online_help"),
554 "",
555 "bottom center",
556 "top center",
557 false
558 );
559 $helpl->addEntry("<span>&nbsp;</span> " . $lng->txt("help_topcis"), "#", "", "il.Help.listHelp(event, false);");
560 }
561
562 $module_id = (int) $ilSetting->get("help_module");
563 if ((OH_REF_ID > 0 || $module_id > 0) && $ilUser->getLanguage() == "de"
564 && $ilSetting->get("help_mode") != "1"
565 ) {
566 $help_active = true;
567
568 $lng->loadLanguageModule("help");
569 $main_tpl->addJavascript("./Services/Help/js/ilHelp.js");
570
572 "help_tt",
573 $lng->txt("help_toggle_tooltips"),
574 "",
575 "bottom center",
576 "top center",
577 false
578 );
579 $helpl->addEntry('<span id="help_tt_switch_on" class="glyphicon glyphicon-ok"></span> ' . $lng->txt("help_tooltips"), "#", "", "return il.Help.switchTooltips(event);");
580 }
581
582 if ($help_active && $ilHelp->hasSections()) {
583 $this->tpl->setCurrentBlock("help");
584 $this->tpl->setVariable("TXT_HELP", $lng->txt("help"));
585 $this->tpl->setVariable("HELP_CLICK", "il.Help.listHelp(event, false);");
586 $this->tpl->parseCurrentBlock();
587
588 $this->addToolbarTooltip("mm_help", "mm_tb_help");
589
590 // always set ajax url
591 $ilHelp->setCtrlPar();
592 $this->main_tpl->addOnLoadCode(
593 "il.Help.setAjaxUrl('" .
594 $ilCtrl->getLinkTargetByClass("ilhelpgui", "", "", true)
595 . "');"
596 );
597 }
598 }
Accordion user interface class.
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:17

References $ctrl, $help, $ilCtrl, $ilSetting, $ilUser, $lng, $main_tpl, $settings, $user, addToolbarTooltip(), ilTooltipGUI\addTooltip(), and getMode().

Referenced by setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderOnScreenChatMenu()

ilMainMenuGUI::renderOnScreenChatMenu ( )
private

Definition at line 618 of file class.ilMainMenuGUI.php.

619 {
620 $menu = new ilOnScreenChatMenuGUI();
621 $this->tpl->setVariable('ONSCREENCHAT', $menu->getMainMenuHTML());
622 $this->addToolbarTooltip("onscreenchatmenu-dropdown", "mm_tb_oschat");
623 }
Class ilOnScreenChatMenuGUI.

References addToolbarTooltip().

Referenced by setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderOnScreenNotifications()

ilMainMenuGUI::renderOnScreenNotifications ( \ilObjUser  $user,
\ilTemplate  $mainTpl,
\ilLanguage  $lng 
)
private
Parameters
\ilObjUser$user
\ilTemplate$mainTpl
\ilLanguage$lng

Definition at line 644 of file class.ilMainMenuGUI.php.

645 {
646 if ($this->getMode() != self::MODE_TOPBAR_REDUCED && !$user->isAnonymous()) {
647 $this->tpl->touchBlock('osd_container');
648
649 $osdGui = new ilNotificationOSDGUI($user, $mainTpl, $lng);
650 $osdGui->render();
651 }
652 }
Class ilNotificationOSDGUI.

References $lng, $user, and getMode().

Referenced by setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderStatusBox()

ilMainMenuGUI::renderStatusBox ( ilTemplate  $a_tpl)
private
Parameters
ilTemplate$a_tpl

Definition at line 425 of file class.ilMainMenuGUI.php.

426 {
428 $ui_factory = $this->ui->factory();
429 $ui_renderer = $this->ui->renderer();
430
431 if ($this->mail) {
433
434 $a_tpl->setCurrentBlock('status_box');
435
436 $glyph = $ui_factory->glyph()->mail("ilias.php?baseClass=ilMailGUI");
437
438 if ($new_mails > 0) {
439 $glyph = $glyph->withCounter($ui_factory->counter()->novelty($new_mails));
440 }
441
442 $a_tpl->setVariable('GLYPH', $ui_renderer->render($glyph));
443 $a_tpl->setVariable('STATUS_ID', "sb_mail");
444 $this->addToolbarTooltip("sb_mail", "mm_tb_mail");
445 $a_tpl->parseCurrentBlock();
446 }
447 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:613
static getNumberOfNewMailsByUserId($usr_id)
Determines the number of new mails for the passed user id and stores this information in a local cach...
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt @access public.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.

References $ilUser, $user, addToolbarTooltip(), ilMailGlobalServices\getNumberOfNewMailsByUserId(), Monolog\Handler\mail(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by setTemplateVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setActive()

ilMainMenuGUI::setActive (   $a_active)
Parameters
string$a_active"desktop"|"repository"|"search"|"mail"|"chat_invitation"|"administration"
Deprecated:

Definition at line 189 of file class.ilMainMenuGUI.php.

190 {
191 $this->active = $a_active;
192 }

◆ setLoginTargetPar()

ilMainMenuGUI::setLoginTargetPar (   $a_val)
Deprecated:
Set target parameter for login (public sector). This is used by the main menu

Definition at line 200 of file class.ilMainMenuGUI.php.

201 {
202 $this->login_target_par = $a_val;
203 }

◆ setMode()

ilMainMenuGUI::setMode ( int  $a_value)
Parameters
int$a_valueaccepts values: self::MODE_TOPBAR_ONLY: self::MODE_TOPBAR_REDUCED: self::MODE_TOPBAR_MEMBERVIEW: case self::MODE_FULL:

Definition at line 140 of file class.ilMainMenuGUI.php.

141 {
142 $this->mode = (int) $a_value;
143 }

Referenced by LTI\ilMainMenuGUI\__construct(), __construct(), and initMemberView().

+ Here is the caller graph for this function:

◆ setTemplateVars()

ilMainMenuGUI::setTemplateVars ( )
private

Set all template variables (images, scripts, target frames, ...)

Reimplemented in LTI\ilMainMenuGUI.

Definition at line 254 of file class.ilMainMenuGUI.php.

255 {
259 $ilPluginAdmin = $this->plugin_admin;
261
262 if ($this->logo_only) {
263 $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
264 $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
265 $this->tpl->setVariable("HEADER_ICON_RESPONSIVE", ilUtil::getImagePath("HeaderIconResponsive.svg"));
266 $this->tpl->setVariable("LOGO_TITLE", $lng->txt("logo"));
267
268 // #15759
269 $header_top_title = ilObjSystemFolder::_getHeaderTitle();
270 if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title")) {
271 $this->tpl->setCurrentBlock("header_top_title");
272 $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
273 $this->tpl->parseCurrentBlock();
274 }
275
276 return;
277 }
278
279 // get user interface plugins
280
281 if ($this->getMode() != self::MODE_TOPBAR_REDUCED
282 && $this->getMode() != self::MODE_TOPBAR_MEMBERVIEW
283 ) {
284 // search
285 if ($rbacsystem->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) {
286 $main_search = new ilMainMenuSearchGUI();
287 $html = "";
288
289 // user interface plugin slot + default rendering
290 $uip = new ilUIHookProcessor(
291 "Services/MainMenu",
292 "main_menu_search",
293 array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search)
294 );
295 if (!$uip->replaced()) {
296 $html = $main_search->getHTML();
297 }
298 $html = $uip->getHTML($html);
299
300 if (strlen($html)) {
301 $this->tpl->setVariable('SEARCHBOX', $html);
302 $this->addToolbarTooltip("ilMMSearch", "mm_tb_search");
303 }
304 }
305
306 $this->renderStatusBox($this->tpl);
307
308 // online help
309 $this->renderHelpButtons();
310
311 $this->renderOnScreenChatMenu();
314 $this->renderBackgroundTasks();
315 $this->renderAwareness();
316 }
317
318 if ($this->getMode() == self::MODE_FULL) {
319 $renderer = new ilMMEntryRendererGUI();
320 $new_renderer = $renderer->getHTML();
321 $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $new_renderer);
322 }
323
324 if ($this->getMode() != self::MODE_TOPBAR_MEMBERVIEW) {
325 $link_dir = (defined("ILIAS_MODULE"))
326 ? "../"
327 : "";
328
329 // login stuff
330 if ($GLOBALS['DIC']['ilUser']->getId() == ANONYMOUS_USER_ID) {
332 $this->tpl->setCurrentBlock("registration_link");
333 $this->tpl->setVariable("TXT_REGISTER", $lng->txt("register"));
334 $this->tpl->setVariable("LINK_REGISTER", $link_dir . "register.php?client_id=" . rawurlencode(CLIENT_ID) . "&lang=" . $ilUser->getCurrentLanguage());
335 $this->tpl->parseCurrentBlock();
336 }
337
338 // language selection
339 $selection = self::getLanguageSelection();
340 if ($selection) {
341 $this->tpl->setVariable("TXT_LANGSELECT", $lng->txt("language"));
342 $this->tpl->setVariable("LANG_SELECT", $selection);
343 }
344
345 $this->tpl->setCurrentBlock("userisanonymous");
346 $this->tpl->setVariable("TXT_NOT_LOGGED_IN", $lng->txt("not_logged_in"));
347 $this->tpl->setVariable("TXT_LOGIN", $lng->txt("log_in"));
348
349 // #13058
350 $target_str = ($this->getLoginTargetPar() != "")
351 ? $this->getLoginTargetPar()
353 $this->tpl->setVariable(
354 "LINK_LOGIN",
355 $link_dir . "login.php?target=" . $target_str . "&client_id=" . rawurlencode(CLIENT_ID) . "&cmd=force_login&lang=" . $ilUser->getCurrentLanguage()
356 );
357 $this->tpl->parseCurrentBlock();
358 } else {
360
361 $this->tpl->setCurrentBlock("userisloggedin");
362 $this->tpl->setVariable("TXT_LOGIN_AS", $lng->txt("login_as"));
363 $user_img_src = $ilUser->getPersonalPicturePath("small", true);
364 $user_img_alt = $ilUser->getFullname();
365 $this->tpl->setVariable("USER_IMG", ilUtil::img($user_img_src, $user_img_alt));
366 $this->tpl->setVariable("USR_LINK_PROFILE", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile");
367 $this->tpl->setVariable("USR_TXT_PROFILE", $lng->txt("personal_profile"));
368 $this->tpl->setVariable("USR_LINK_SETTINGS", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings");
369 $this->tpl->setVariable("USR_TXT_SETTINGS", $lng->txt("personal_settings"));
370 $this->tpl->setVariable("TXT_LOGOUT2", $lng->txt("logout"));
371 $this->tpl->setVariable("LINK_LOGOUT2", $link_dir . "logout.php?lang=" . $ilUser->getCurrentLanguage());
372 $this->tpl->setVariable("USERNAME", $ilUser->getFullname());
373 $this->tpl->setVariable("LOGIN", $ilUser->getLogin());
374 $this->tpl->setVariable("MATRICULATION", $ilUser->getMatriculation());
375 $this->tpl->setVariable("EMAIL", $ilUser->getEmail());
376 $this->tpl->parseCurrentBlock();
377
378 $this->addToolbarTooltip("userlog", "mm_tb_user");
379 }
380 } else {
381 // member view info
382 $this->tpl->setVariable("TOPBAR_CLASS", " ilMemberViewMainHeader");
383 $this->tpl->setVariable("MEMBER_VIEW_INFO", $lng->txt("mem_view_long"));
384 }
385
386 if (!$this->topbar_back_url) {
387 $header_top_title = ilObjSystemFolder::_getHeaderTitle();
388 if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title")) {
389 $this->tpl->setCurrentBlock("header_top_title");
390 // php7-workaround alex: added phpversion() to help during development of php7 compatibility
391 $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title);
392 $this->tpl->parseCurrentBlock();
393 }
394 } else {
395 $this->tpl->setCurrentBlock("header_back_bl");
396 $this->tpl->setVariable("URL_HEADER_BACK", $this->topbar_back_url);
397 $this->tpl->setVariable(
398 "TXT_HEADER_BACK",
399 $this->topbar_back_caption
400 ? $this->topbar_back_caption
401 : $lng->txt("back")
402 );
403 $this->tpl->parseCurrentBlock();
404 }
405
406 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
407
408 if ($this->getMode() == self::MODE_FULL) {
409 // $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
410 $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL());
411 $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg"));
412 $this->tpl->setVariable("HEADER_ICON_RESPONSIVE", ilUtil::getImagePath("HeaderIconResponsive.svg"));
413 $this->tpl->setVariable("LOGO_TITLE", $lng->txt("logo"));
414 }
415
416 $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
417
418 $this->tpl->parseCurrentBlock();
419 }
Class ilMMEntryRendererGUI.
populateWithBuddySystem()
Includes all buddy system/user connections related javascript code.
renderOnScreenNotifications(\ilObjUser $user, \ilTemplate $mainTpl, \ilLanguage $lng)
renderStatusBox(ilTemplate $a_tpl)
renderAwareness()
Render awareness tool.
static getLanguageSelection($a_in_topbar=false)
Add a search box to main menu.
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
static buildLoginTarget()
Add current object (repository/workspace) as target for login url.
UI interface hook processor.
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=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$html
Definition: example_001.php:87
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.

References $GLOBALS, $html, $ilUser, $lng, $main_tpl, $plugin_admin, $rbacsystem, $user, ilSearchSettings\_getSearchSettingRefId(), ilRegistrationSettings\_lookupRegistrationType(), addToolbarTooltip(), ilTemplate\buildLoginTarget(), getHeaderURL(), ilUtil\getImagePath(), getLanguageSelection(), getLoginTargetPar(), getMode(), ilUtil\getStyleSheetLocation(), IL_REG_DISABLED, ilUtil\img(), populateWithBuddySystem(), populateWithOnScreenChat(), renderAwareness(), renderBackgroundTasks(), renderHelpButtons(), renderOnScreenChatMenu(), renderOnScreenNotifications(), and renderStatusBox().

Referenced by LTI\ilMainMenuGUI\getHTML(), and getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTopBarBack()

ilMainMenuGUI::setTopBarBack (   $a_url,
  $a_caption = null 
)
Parameters
$a_url
null$a_caption

Definition at line 159 of file class.ilMainMenuGUI.php.

160 {
161 $this->topbar_back_url = $a_url;
162 $this->topbar_back_caption = trim($a_caption);
163 }

Referenced by initMemberView().

+ Here is the caller graph for this function:

◆ showLogoOnly()

ilMainMenuGUI::showLogoOnly ( bool  $a_value)

Toggle rendering of main menu, search, user info.

Parameters
bool$a_value
Deprecated:
do not use in other contextx
See also
ilImprintGUI

Definition at line 664 of file class.ilMainMenuGUI.php.

665 {
666 $this->logo_only = (bool) $a_value;
667 }

Field Documentation

◆ $access

ilMainMenuGUI::$access
protected

Definition at line 41 of file class.ilMainMenuGUI.php.

◆ $ctrl

ilMainMenuGUI::$ctrl
protected

Definition at line 53 of file class.ilMainMenuGUI.php.

Referenced by renderHelpButtons().

◆ $help

ilMainMenuGUI::$help
protected

Definition at line 57 of file class.ilMainMenuGUI.php.

Referenced by renderHelpButtons().

◆ $lng

◆ $mail

ilMainMenuGUI::$mail

Definition at line 64 of file class.ilMainMenuGUI.php.

◆ $main_tpl

ilMainMenuGUI::$main_tpl
protected

◆ $mode

ilMainMenuGUI::$mode
protected

Definition at line 69 of file class.ilMainMenuGUI.php.

Referenced by getMode().

◆ $nav_history

ilMainMenuGUI::$nav_history
protected

Definition at line 45 of file class.ilMainMenuGUI.php.

◆ $plugin_admin

ilMainMenuGUI::$plugin_admin
protected

Definition at line 33 of file class.ilMainMenuGUI.php.

Referenced by setTemplateVars().

◆ $rbacsystem

◆ $settings

ilMainMenuGUI::$settings
protected

Definition at line 49 of file class.ilMainMenuGUI.php.

Referenced by renderHelpButtons().

◆ $start_template

ilMainMenuGUI::$start_template

Definition at line 63 of file class.ilMainMenuGUI.php.

◆ $target

ilMainMenuGUI::$target

Definition at line 62 of file class.ilMainMenuGUI.php.

◆ $topbar_back_caption

ilMainMenuGUI::$topbar_back_caption
protected

Definition at line 71 of file class.ilMainMenuGUI.php.

◆ $topbar_back_url

ilMainMenuGUI::$topbar_back_url
protected

Definition at line 70 of file class.ilMainMenuGUI.php.

◆ $tpl

ilMainMenuGUI::$tpl

Definition at line 61 of file class.ilMainMenuGUI.php.

◆ $tree

ilMainMenuGUI::$tree
protected

Definition at line 37 of file class.ilMainMenuGUI.php.

Referenced by LTI\ilMainMenuGUI\setTemplateVars().

◆ $user

ilMainMenuGUI::$user
protected

◆ MODE_FULL

const ilMainMenuGUI::MODE_FULL = 1

◆ MODE_TOPBAR_MEMBERVIEW

const ilMainMenuGUI::MODE_TOPBAR_MEMBERVIEW = 4

Definition at line 75 of file class.ilMainMenuGUI.php.

Referenced by getSpacerClass().

◆ MODE_TOPBAR_ONLY

const ilMainMenuGUI::MODE_TOPBAR_ONLY = 2

◆ MODE_TOPBAR_REDUCED

const ilMainMenuGUI::MODE_TOPBAR_REDUCED = 3

Definition at line 74 of file class.ilMainMenuGUI.php.

Referenced by getSpacerClass(), and ilTemplate\setLocator().


The documentation for this class was generated from the following file: