ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMainMenuGUI Class Reference

Handles display of the main menu. More...

+ Collaboration diagram for ilMainMenuGUI:

Public Member Functions

 ilMainMenuGUI ($a_target="_top", $a_use_start_template=false)
 setSmallMode ($a_small)
 setActive ($a_active)
 setTemplate (&$tpl)
 set output template
 getTemplate ()
 get output template
 setLoginTargetPar ($a_val)
 Set target parameter for login (public sector).
 getLoginTargetPar ()
 Get target parameter for login.
 setTemplateVars ()
 set all template variables (images, scripts, target frames, ...)
 renderMainMenuListEntries ($a_tpl, $a_call_get=true)
 desc
 renderEntry ($a_tpl, $a_id, $a_txt, $a_script, $a_target="_top")
 Render main menu entry.
 getScriptTarget ($a_script)
 generates complete script target (private)
 _checkAdministrationPermission ()
 getHTML ()

Data Fields

 $ilias
 $tpl
 $target
 $start_template

Protected Member Functions

 getMemberViewHTML ()

Detailed Description

Handles display of the main menu.

Author
Alex Killing
Version
Id:
class.ilMainMenuGUI.php 28989 2011-05-13 10:57:16Z akill

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

Member Function Documentation

ilMainMenuGUI::_checkAdministrationPermission ( )

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

Referenced by ilAdministrationGUI\executeCommand(), and renderMainMenuListEntries().

{
global $rbacsystem;
if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilMainMenuGUI::getHTML ( )

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

References ilMemberViewSettings\getInstance(), getMemberViewHTML(), and setTemplateVars().

{
include_once './Services/Container/classes/class.ilMemberViewSettings.php';
if($set->isActive())
{
return $this->getMemberViewHTML();
}
$this->setTemplateVars();
return $this->tpl->get();
}

+ Here is the call graph for this function:

ilMainMenuGUI::getLoginTargetPar ( )

Get target parameter for login.

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

Referenced by setTemplateVars().

{
return $this->login_target_par;
}

+ Here is the caller graph for this function:

ilMainMenuGUI::getMemberViewHTML ( )
protected

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

References $_GET, $lng, ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupType(), and ilUtil\getImagePath().

Referenced by getHTML().

{
global $lng;
$this->tpl = new ilTemplate('tpl.member_view_main_menu.html',true,true,'Services/MainMenu');
$this->tpl->setVariable('TXT_MM_HEADER',$lng->txt('mem_view_long'));
$this->tpl->setVariable('TXT_MM_CLOSE_PREVIEW',$lng->txt('mem_view_close'));
$this->tpl->setVariable('MM_CLOSE_IMG',ilUtil::getImagePath('cancel.gif'));
include_once './classes/class.ilLink.php';
$this->tpl->setVariable(
'HREF_CLOSE_MM',
(int) $_GET['ref_id'],
array('mv' => 0)));
return $this->tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMainMenuGUI::getScriptTarget (   $a_script)

generates complete script target (private)

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

References $ilias.

Referenced by renderMainMenuListEntries().

{
global $ilias;
$script = "./".$a_script;
//if ($this->start_template == true)
//{
//if(is_file("./templates/".$ilias->account->skin."/tpl.start.html"))
//{
// $script = "./start.php?script=".rawurlencode($script);
//}
//}
if (defined("ILIAS_MODULE"))
{
$script = ".".$script;
}
return $script;
}

+ Here is the caller graph for this function:

ilMainMenuGUI::getTemplate ( )

get output template

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

{
echo "ilMainMenu->getTemplate is deprecated. Use getHTML instead.";
return;
}
ilMainMenuGUI::ilMainMenuGUI (   $a_target = "_top",
  $a_use_start_template = false 
)
Parameters
string$a_targettarget frame
boolean$a_use_start_templatetrue means: target scripts should be called through start template

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

References $ilias.

{
global $ilias;
$this->tpl = new ilTemplate("tpl.main_menu.html", true, true,
"Services/MainMenu");
$this->ilias =& $ilias;
$this->target = $a_target;
$this->start_template = $a_use_start_template;
$this->small = false;
}
ilMainMenuGUI::renderEntry (   $a_tpl,
  $a_id,
  $a_txt,
  $a_script,
  $a_target = "_top" 
)

Render main menu entry.

Parameters
@return

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

References $lng.

Referenced by renderMainMenuListEntries().

{
global $lng;
$id = strtolower($a_id);
$id_up = strtoupper($a_id);
$a_tpl->setCurrentBlock("entry_".$id);
$a_tpl->setVariable("TXT_".$id_up, $a_txt);
$a_tpl->setVariable("SCRIPT_".$id_up, $a_script);
$a_tpl->setVariable("TARGET_".$id_up, $a_target);
if ($this->active == $a_id || ($this->active == "" && $a_id == "repository"))
{
$a_tpl->setVariable("MM_CLASS", "MMActive");
$a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
}
else
{
$a_tpl->setVariable("MM_CLASS", "MMInactive");
}
$a_tpl->parseCurrentBlock();
}

+ Here is the caller graph for this function:

ilMainMenuGUI::renderMainMenuListEntries (   $a_tpl,
  $a_call_get = true 
)

desc

Parameters
@return

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

References $_REQUEST, $_SESSION, $ilias, $ilSetting, $lng, $nav_hist, $target, $title, _checkAdministrationPermission(), ilMailbox\_countNewMails(), ilSearchSettings\_getSearchSettingRefId(), ilLink\_getStaticLink(), getScriptTarget(), and renderEntry().

Referenced by setTemplateVars().

{
global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting;
// personal desktop
if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
{
$this->renderEntry($a_tpl, "desktop",
$lng->txt("personal_desktop"),
$this->getScriptTarget("ilias.php?baseClass=ilPersonalDesktopGUI"),
}
// repository
include_once('classes/class.ilLink.php');
$nd = $tree->getNodeData(ROOT_FOLDER_ID);
$title = $nd["title"];
if ($title == "ILIAS")
{
$title = $lng->txt("repository");
}
$this->renderEntry($a_tpl, "repository",
ilLink::_getStaticLink(1,'root',true),
$this->target);
// search
include_once 'Services/Search/classes/class.ilSearchSettings.php';
if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
{
$this->renderEntry($a_tpl, "search",
$lng->txt("search"),
$this->getScriptTarget('ilias.php?baseClass=ilSearchController'),
}
// mail
if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
{
include_once "Services/Mail/classes/class.ilMail.php";
$mail = new ilMail($_SESSION["AccountId"]);
if($rbacsystem->checkAccess('mail_visible',$mail->getMailObjectReferenceId()))
{
$add = '';
if( $new_mails = ilMailbox::_countNewMails($_SESSION["AccountId"]) )
{
$mail = new ilMail($_SESSION['AccountId']);
$add = " ".sprintf($lng->txt("cnt_new"), $new_mails);
}
$this->renderEntry($a_tpl, "mail",
$lng->txt("mail").$add,
$this->getScriptTarget("ilias.php?baseClass=ilMailGUI"),
}
}
// webshop
if(IS_PAYMENT_ENABLED)
{
$a_tpl->setCurrentBlock('shopbutton');
$a_tpl->setVariable('SCRIPT_SHOP', $this->getScriptTarget('ilias.php?baseClass=ilShopController&cmd=clearFilter'));
$a_tpl->setVariable('TARGET_SHOP', $this->target);
include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php';
$objShoppingCart = new ilPaymentShoppingCart($ilUser);
$items = $objShoppingCart->getEntries();
$a_tpl->setVariable('TXT_SHOP', $lng->txt('shop'));
// shoppingcart
if(count($items) > 0 )
{
$a_tpl->setVariable('SCRIPT_SHOPPINGCART', $this->getScriptTarget('ilias.php?baseClass=ilShopController&cmd=redirect&redirect_class=ilshopshoppingcartgui'));
$a_tpl->setVariable('TARGET_SHOPPINGCART', $this->target);
$a_tpl->setVariable('TXT_SHOPPINGCART', '('.count($items).')');
if($this->active == 'shop')
{
$a_tpl->setVariable('MM_CLASS_SHOPPINGCART', 'MMActive');
}
else
{
$a_tpl->setVariable('MM_CLASS_SHOPPINGCART', 'MMInactive');
}
}
if($this->active == 'shop')
{
$a_tpl->setVariable('MM_CLASS', 'MMActive');
$a_tpl->setVariable("SEL", '<span class="ilAccHidden">('.$lng->txt("stat_selected").')</span>');
if(count($items) > 0 )
{
$a_tpl->setVariable('STYLE_SHOP', 'style="margin-right: 5px;"');
}
}
else
{
$a_tpl->setVariable('MM_CLASS', 'MMInactive');
if(count($items) > 0 )
{
$a_tpl->setVariable('STYLE_SHOP', 'style="margin-right: 5px;"');
}
}
$a_tpl->parseCurrentBlock();
}
// administration
{
$this->renderEntry($a_tpl, "administration",
$lng->txt("administration"),
$this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"),
}
// navigation history
require_once("Services/Navigation/classes/class.ilNavigationHistoryGUI.php");
$nav_html = $nav_hist->getHTML();
if ($nav_html != "")
{
$a_tpl->setCurrentBlock("nav_history");
$a_tpl->setVariable("TXT_LAST_VISITED", $lng->txt("last_visited"));
$a_tpl->setVariable("NAVIGATION_HISTORY", $nav_html);
$a_tpl->parseCurrentBlock();
}
// chat messages
if ($ilSetting->get('chat_message_notify_status') == 1 && $_REQUEST['baseClass'] != 'ilChatPresentationGUI' && $ilUser->getPref('chat_message_notify_status') == 1) {
include_once 'Modules/Chat/classes/class.ilChatMessageNotifyGUI.php';
$msg_notify = new ilChatMessageNotifyGUI();
$html = $msg_notify->getHtml();
if ($html) {
$a_tpl->setCurrentBlock("chat_lastmsg");
$a_tpl->setVariable('CHAT_LAST_MESSAGE', $html);
$a_tpl->parseCurrentBlock();
}
}
// chat invitations
include_once 'Modules/Chat/classes/class.ilChatInvitationGUI.php';
$chat_invitation_gui = new ilChatInvitationGUI();
$chat_invitation_html = $chat_invitation_gui->getHTML();
if(trim($chat_invitation_html) != '')
{
$a_tpl->setCurrentBlock('chatbutton');
$a_tpl->setVariable('CHAT_INVITATIONS', $chat_invitation_html);
$a_tpl->parseCurrentBlock();
}
if ($a_call_get)
{
return $a_tpl->get();
}
return "";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

{
$this->active = $a_active;
}
ilMainMenuGUI::setLoginTargetPar (   $a_val)

Set target parameter for login (public sector).

This is used by the main menu

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

{
$this->login_target_par = $a_val;
}
ilMainMenuGUI::setSmallMode (   $a_small)

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

{
$this->small = $a_small;
}
ilMainMenuGUI::setTemplate ( $tpl)

set output template

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

References $tpl.

{
echo "ilMainMenu->setTemplate is deprecated. Use getHTML instead.";
return;
$this->tpl =& $tpl;
}
ilMainMenuGUI::setTemplateVars ( )

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

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

References $_GET, $_SESSION, $ilias, $ilSetting, $lng, ilObjSystemFolder\_getHeaderTitle(), ilSearchSettings\_getSearchSettingRefId(), ilLanguage\_lookupEntry(), ilObject\_lookupObjId(), ilRegistrationSettings\_lookupRegistrationType(), ilObject\_lookupType(), ilUtil\appendUrlParameterString(), ilUtil\getImagePath(), getLoginTargetPar(), ilPluginAdmin\getPluginObject(), ilUtil\getStyleSheetLocation(), IL_COMP_SERVICE, IL_REG_DISABLED, ilUIHookPluginGUI\KEEP, renderMainMenuListEntries(), and ilUIHookPluginGUI\REPLACE.

Referenced by getHTML().

{
global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilPluginAdmin;
// search
include_once 'Services/Search/classes/class.ilSearchSettings.php';
if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
{
include_once './Services/Search/classes/class.ilMainMenuSearchGUI.php';
$main_search = new ilMainMenuSearchGUI();
if(strlen($html = $main_search->getHTML()))
{
$this->tpl->setVariable('SEARCHBOX',$html);
}
}
// user interface hook [uihk]
$pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
$plugin_html = false;
foreach ($pl_names as $pl)
{
$ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
$gui_class = $ui_plugin->getUIClassInstance();
$resp = $gui_class->getHTML("Services/MainMenu", "main_menu_list_entries",
array("main_menu_gui" => $this));
if ($resp["mode"] != ilUIHookPluginGUI::KEEP)
{
$plugin_html = true;
break; // first one wins
}
}
// default html
if (!$plugin_html || $resp["mode"] != ilUIHookPluginGUI::REPLACE)
{
$mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu");
$mmle_html = $this->renderMainMenuListEntries($mmle_tpl);
}
// combine plugin and default html
if ($plugin_html)
{
$mmle_html = $gui_class->modifyHTML($mmle_html, $resp);
}
$this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html);
$link_dir = (defined("ILIAS_MODULE"))
? "../"
: "";
if (!$this->small)
{
// login stuff
if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
{
include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php';
{
$this->tpl->setCurrentBlock("registration_link");
$this->tpl->setVariable("TXT_REGISTER",$lng->txt("register"));
$this->tpl->setVariable("LINK_REGISTER", $link_dir."register.php?client_id=".rawurlencode(CLIENT_ID)."&lang=".$ilias->account->getCurrentLanguage());
$this->tpl->parseCurrentBlock();
}
// language selection
include_once("./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php");
$selection = new ilAdvancedSelectionListGUI();
$selection->setFormSelectMode("change_lang_to", "ilLanguageSelection", true,
"#", "ilNavHistory", "ilNavHistoryForm",
"_top", $lng->txt("ok"), "ilLogin");
//$selection->setListTitle($lng->txt("choose_language"));
$selection->setListTitle($lng->txt("language"));
$selection->setItemLinkClass("small");
$languages = $lng->getInstalledLanguages();
//var_dump($_SERVER);
foreach ($languages as $lang_key)
{
$base = substr($_SERVER["REQUEST_URI"], strrpos($_SERVER["REQUEST_URI"], "/") + 1);
$base = str_replace("lang=", "", $base);
"lang=".$lang_key);
$selection->addItem(ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key),
$lang_key, $link, "", "", "_top");
}
if (count($languages) > 0)
{
$this->tpl->setVariable("LANG_SELECT", $selection->getHTML());
}
$this->tpl->setCurrentBlock("userisanonymous");
$this->tpl->setVariable("TXT_NOT_LOGGED_IN",$lng->txt("not_logged_in"));
$this->tpl->setVariable("TXT_LOGIN",$lng->txt("log_in"));
$target_str = "";
if ($this->getLoginTargetPar() != "")
{
$target_str = $this->getLoginTargetPar();
}
else if ($_GET["ref_id"] != "")
{
if ($tree->isInTree($_GET["ref_id"]) && $_GET["ref_id"] != $tree->getRootId())
{
$obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
$type = ilObject::_lookupType($obj_id);
$target_str = $type."_".$_GET["ref_id"];
}
}
$this->tpl->setVariable("LINK_LOGIN",
$link_dir."login.php?target=".$target_str."&client_id=".rawurlencode(CLIENT_ID)."&cmd=force_login&lang=".$ilias->account->getCurrentLanguage());
$this->tpl->parseCurrentBlock();
}
else
{
$this->tpl->setCurrentBlock("userisloggedin");
$this->tpl->setVariable("TXT_LOGIN_AS",$lng->txt("login_as"));
$this->tpl->setVariable("TXT_LOGOUT2",$lng->txt("logout"));
$this->tpl->setVariable("LINK_LOGOUT2", $link_dir."logout.php?lang=".$ilias->account->getCurrentLanguage());
$this->tpl->setVariable("USERNAME",$ilias->account->getFullname());
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
$this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));
$this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
$this->tpl->setVariable("HEADER_BG_IMAGE", ilUtil::getImagePath("HeaderBackground.gif"));
include_once("./Modules/SystemFolder/classes/class.ilObjSystemFolder.php");
$this->tpl->setVariable("TXT_HEADER_TITLE", ilObjSystemFolder::_getHeaderTitle());
// set link to return to desktop, not depending on a specific position in the hierarchy
//$this->tpl->setVariable("SCRIPT_START", $this->getScriptTarget("start.php"));
}
else
{
$this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
}
$this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu"));
$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilMainMenuGUI::$ilias
ilMainMenuGUI::$start_template

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

ilMainMenuGUI::$target

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

Referenced by renderMainMenuListEntries().

ilMainMenuGUI::$tpl

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

Referenced by setTemplate().


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