ILIAS  Release_3_10_x_branch Revision 61812
 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
 addMenuBlock ($a_var="CONTENT", $a_block="navigation")
 add menu template as block
 setTemplateVars ()
 set all template variables (images, scripts, target frames, ...)
 getScriptTarget ($a_script)
 generates complete script target (private)
 _checkAdministrationPermission ()
 getHTML ()

Data Fields

 $ilias
 $tpl
 $target
 $start_template

Detailed Description

Handles display of the main menu.

Author
Alex Killing
Version
Id:
class.ilMainMenuGUI.php 17967 2008-11-18 16:06:48Z mjansen

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

Member Function Documentation

ilMainMenuGUI::_checkAdministrationPermission ( )

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

References ilUtil\_getObjectsByOperations().

Referenced by ilObjForumGUI\createObject(), ilAdministrationGUI\executeCommand(), and setTemplateVars().

{
global $rbacsystem;
if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
{
return true;
}
return false;
// Allow all local admins to use the administration
return count(ilUtil::_getObjectsByOperations('cat','cat_administrate_users')) ? true : false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMainMenuGUI::addMenuBlock (   $a_var = "CONTENT",
  $a_block = "navigation" 
)

add menu template as block

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

{
echo "ilMainMenu->addMenuBlick is deprecated. Use getHTML instead.";
return;
$this->tpl->addBlockFile($a_var, $a_block, "tpl.main_buttons.html");
}
ilMainMenuGUI::getHTML ( )

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

References setTemplateVars().

{
$this->setTemplateVars();
return $this->tpl->get();
}

+ Here is the call graph for this function:

ilMainMenuGUI::getScriptTarget (   $a_script)

generates complete script target (private)

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

References $ilias.

Referenced by setTemplateVars().

{
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 87 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 49 of file class.ilMainMenuGUI.php.

References $ilias.

{
global $ilias;
$this->tpl = new ilTemplate("tpl.main_buttons.html", true, true);
$this->ilias =& $ilias;
$this->target = $a_target;
$this->start_template = $a_use_start_template;
$this->small = false;
}
ilMainMenuGUI::setActive (   $a_active)
Parameters
string$a_active"desktop"|"repository"|"search"|"mail"|"chat_invitation"|"administration"

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

{
$this->active = $a_active;
}
ilMainMenuGUI::setSmallMode (   $a_small)

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

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

set output template

Definition at line 77 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 106 of file class.ilMainMenuGUI.php.

References $_GET, $_SESSION, $ilias, $lng, $nav_hist, $title, _checkAdministrationPermission(), ilMailbox\_countNewMails(), ilObjSystemFolder\_getHeaderTitle(), ilGeneralSettings\_getInstance(), ilSearchSettings\_getSearchSettingRefId(), ilLink\_getStaticLink(), ilLanguage\_lookupEntry(), ilObject\_lookupObjId(), ilRegistrationSettings\_lookupRegistrationType(), ilObject\_lookupType(), ilUtil\getImagePath(), getScriptTarget(), ilUtil\getStyleSheetLocation(), ilMailbox\hasNewMail(), and IL_REG_DISABLED.

Referenced by getHTML().

{
global $rbacsystem, $lng, $ilias, $tree, $ilUser;
// navigation history
require_once("Services/Navigation/classes/class.ilNavigationHistoryGUI.php");
$nav_html = $nav_hist->getHTML();
if ($nav_html != "")
{
$this->tpl->setCurrentBlock("nav_history");
$this->tpl->setVariable("NAVIGATION_HISTORY", $nav_html);
$this->tpl->parseCurrentBlock();
}
// administration button
{
$this->tpl->setCurrentBlock("userisadmin");
$this->tpl->setVariable("IMG_ADMIN", ilUtil::getImagePath("navbar/admin.gif", false));
$this->tpl->setVariable("IMG_SPACE_ADMIN", ilUtil::getImagePath("spacer.gif", false));
$this->tpl->setVariable("TXT_ADMINISTRATION", $lng->txt("administration"));
$this->tpl->setVariable("SCRIPT_ADMIN", $this->getScriptTarget("ilias.php?baseClass=ilAdministrationGUI"));
$this->tpl->setVariable("TARGET_ADMIN", $this->target);
if ($this->active == "administration")
{
$this->tpl->setVariable("MM_CLASS", "MMActive");
}
else
{
$this->tpl->setVariable("MM_CLASS", "MMInactive");
}
$this->tpl->parseCurrentBlock();
}
// search
include_once 'Services/Search/classes/class.ilSearchSettings.php';
if($rbacsystem->checkAccess('search',ilSearchSettings::_getSearchSettingRefId()))
{
$this->tpl->setCurrentBlock("searchbutton");
$this->tpl->setVariable("SCRIPT_SEARCH",$this->getScriptTarget('ilias.php?baseClass=ilSearchController'));
$this->tpl->setVariable("TARGET_SEARCH",$this->target);
$this->tpl->setVariable("TXT_SEARCH", $lng->txt("search"));
if ($this->active == "search")
{
$this->tpl->setVariable("MM_CLASS", "MMActive");
}
else
{
$this->tpl->setVariable("MM_CLASS", "MMInactive");
}
$this->tpl->parseCurrentBlock();
}
// webshop
include_once 'payment/classes/class.ilGeneralSettings.php';
if((bool)ilGeneralSettings::_getInstance()->get('shop_enabled'))
{
$this->tpl->setCurrentBlock('shopbutton');
$this->tpl->setVariable('SCRIPT_SHOP', $this->getScriptTarget('ilias.php?baseClass=ilShopController&cmd=clearFilter'));
$this->tpl->setVariable('TARGET_SHOP', $this->target);
include_once 'payment/classes/class.ilPaymentShoppingCart.php';
$objShoppingCart = new ilPaymentShoppingCart($ilUser);
$items = $objShoppingCart->getEntries();
$this->tpl->setVariable('TXT_SHOP', $lng->txt('shop').(count($items) > 0 ? ' ('.count($items).')' : ''));
if($this->active == 'shop')
{
$this->tpl->setVariable('MM_CLASS', 'MMActive');
}
else
{
$this->tpl->setVariable('MM_CLASS', 'MMInactive');
}
$this->tpl->parseCurrentBlock();
}
// help button
//$this->tpl->setCurrentBlock("userhelp");
//$this->tpl->setVariable("TXT_HELP", $lng->txt("help"));
//$this->tpl->setVariable("SCRIPT_HELP", "ilias.php?baseClass=ilHelpGUI");
//$this->tpl->setVariable("TARGET_HELP", "ilias_help");
//$this->tpl->parseCurrentBlock();
$this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
// mail & desktop button
if ($_SESSION["AccountId"] != ANONYMOUS_USER_ID)
{
$this->tpl->setCurrentBlock("desktopbutton");
$this->tpl->setVariable("IMG_DESK", ilUtil::getImagePath("navbar/desk.gif", false));
$this->tpl->setVariable("IMG_SPACE_DESK", ilUtil::getImagePath("spacer.gif", false));
$this->tpl->setVariable("TXT_PERSONAL_DESKTOP", $lng->txt("personal_desktop"));
$this->tpl->setVariable("SCRIPT_DESK", $this->getScriptTarget("ilias.php?baseClass=ilPersonalDesktopGUI&PDHistory=1"));
$this->tpl->setVariable("TARGET_DESK", $this->target);
if ($this->active == "desktop")
{
$this->tpl->setVariable("MM_CLASS", "MMActive");
}
else
{
$this->tpl->setVariable("MM_CLASS", "MMInactive");
}
$this->tpl->parseCurrentBlock();
include_once "Services/Mail/classes/class.ilMail.php";
$mail =& new ilMail($_SESSION["AccountId"]);
if($rbacsystem->checkAccess('mail_visible',$mail->getMailObjectReferenceId()))
{
#$link = "mail_frameset.php";
$link = "ilias.php?baseClass=ilMailGUI";
if ($mail_id = ilMailbox::hasNewMail($_SESSION["AccountId"]))
{
$mbox = new ilMailbox($_SESSION["AccountId"]);
$mail =& new ilMail($_SESSION['AccountId']);
$folder_id = $mbox->getInboxFolder();
//$link = "mail_frameset.php?target=".
// htmlentities(urlencode("mail_read.php?mobj_id=".
// $folder_id."&mail_id=".$mail_id));
$add = " ".sprintf($lng->txt("cnt_new"),
}
$this->tpl->setCurrentBlock("mailbutton");
$this->tpl->setVariable("IMG_MAIL", ilUtil::getImagePath("navbar/mail.gif", false));
$this->tpl->setVariable("IMG_SPACE_MAIL", ilUtil::getImagePath("spacer.gif", false));
$this->tpl->setVariable("TXT_MAIL", $lng->txt("mail").$add);
$this->tpl->setVariable("SCRIPT_MAIL", $this->getScriptTarget($link));
$this->tpl->setVariable("TARGET_MAIL", $this->target);
if ($this->active == "mail")
{
$this->tpl->setVariable("MM_CLASS", "MMActive");
}
else
{
$this->tpl->setVariable("MM_CLASS", "MMInactive");
}
$this->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) != '')
{
$this->tpl->setCurrentBlock('chatbutton');
$this->tpl->setVariable('CHAT_INVITATIONS', $chat_invitation_html);
$this->tpl->parseCurrentBlock();
}
// repository link
$this->tpl->setCurrentBlock("rep_button");
# $this->tpl->setVariable("SCRIPT_CATALOG",'goto__target__root_1__client__ilias38.html');
# #$this->getScriptTarget("repository.php?cmd=frameset&getlast=true"));
include_once('classes/class.ilLink.php');
$this->tpl->setVariable('SCRIPT_CATALOG',ilLink::_getStaticLink(1,'root',true));
$nd = $tree->getNodeData(ROOT_FOLDER_ID);
$title = $nd["title"];
if ($title == "ILIAS")
{
$title = $lng->txt("repository");
}
$this->tpl->setVariable("TXT_CATALOG", $title);
if ($this->active == "repository" || $this->active == "")
{
$this->tpl->setVariable("MM_CLASS", "MMActive");
}
else
{
$this->tpl->setVariable("MM_CLASS", "MMInactive");
}
// set target frame
$this->tpl->setVariable("TARGET", $this->target);
$this->tpl->parseCurrentBlock();
$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();
}
$languages = $lng->getInstalledLanguages();
foreach ($languages as $lang_key)
{
$this->tpl->setCurrentBlock("languages");
$this->tpl->setVariable("LANG_KEY", $lang_key);
$this->tpl->setVariable("LANG_NAME",
ilLanguage::_lookupEntry($lang_key, "meta", "meta_l_".$lang_key));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable("TXT_OK", $lng->txt("ok"));
//$this->tpl->setVariable("LANG_FORM_ACTION", "repository.php?ref_id=".$_GET["ref_id"]);
$this->tpl->setVariable("LANG_FORM_ACTION", "#");
$this->tpl->setVariable("TXT_CHOOSE_LANGUAGE", $lng->txt("choose_language"));
$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 ($_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"));
}
$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilMainMenuGUI::$ilias

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

Referenced by getScriptTarget(), ilMainMenuGUI(), and setTemplateVars().

ilMainMenuGUI::$start_template

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

ilMainMenuGUI::$target

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

ilMainMenuGUI::$tpl

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

Referenced by setTemplate().


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