Public Member Functions | Data Fields

ilMainMenuGUI Class Reference

Public Member Functions

 ilMainMenuGUI ($a_target="_top", $a_use_start_template=false)
 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 ()

Data Fields

 $ilias
 $tpl
 $target
 $start_template

Detailed Description

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


Member Function Documentation

ilMainMenuGUI::_checkAdministrationPermission (  ) 

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

References $rbacsystem, and ilUtil::getObjectsByOperations().

Referenced by setTemplateVars().

        {
                global $rbacsystem;

                if($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
                {
                        return true;
                }
                // 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 80 of file class.ilMainMenuGUI.php.

        {
                $this->tpl->addBlockFile($a_var, $a_block, "tpl.main_buttons.html");
        }

ilMainMenuGUI::getScriptTarget ( a_script  ) 

generates complete script target (private)

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

References $ilias, and $script.

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 72 of file class.ilMainMenuGUI.php.

        {
                return $this->tpl;
        }

ilMainMenuGUI::ilMainMenuGUI ( a_target = "_top",
a_use_start_template = false 
)
Parameters:
string $a_target target frame
boolean $a_use_start_template true means: target scripts should be called through start template

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

References $ilias.

        {
                global $ilias;

                $this->ilias =& $ilias;
                $this->target = $a_target;
                $this->start_template = $a_use_start_template;

        }

ilMainMenuGUI::setTemplate ( &$  tpl  ) 

set output template

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

References $tpl.

        {
                $this->tpl =& $tpl;
        }

ilMainMenuGUI::setTemplateVars (  ) 

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

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

References $_SESSION, $ilias, $lng, $rbacsystem, $script, _checkAdministrationPermission(), ilObjSystemFolder::_getHeaderTitle(), ilUtil::getImagePath(), ilUtil::getJSPath(), getScriptTarget(), and ilUtil::getStyleSheetLocation().

        {
                global $rbacsystem, $lng, $ilias;

                // administration button

                #if ($rbacsystem->checkAccess("visible,read", SYSTEM_FOLDER_ID))
                if(ilMainMenuGUI::_checkAdministrationPermission())
                {
                        $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("adm_index.php"));
                        $this->tpl->setVariable("TARGET_ADMIN", $this->target);
                        $this->tpl->parseCurrentBlock();
                }

                // 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("usr_personaldesktop.php"));
                        $this->tpl->setVariable("TARGET_DESK", $this->target);
                        $this->tpl->parseCurrentBlock();

                        include_once "./classes/class.ilMail.php";
                        
                        $mail =& new ilMail($_SESSION["AccountId"]);

                        if($rbacsystem->checkAccess('mail_visible',$mail->getMailObjectReferenceId()))
                        {
                                $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"));
                                $this->tpl->setVariable("SCRIPT_MAIL", $this->getScriptTarget("mail_frameset.php"));
                                $this->tpl->setVariable("TARGET_MAIL", $this->target);
                                $this->tpl->parseCurrentBlock();
                        }
                }

                $link_dir = (defined("ILIAS_MODULE"))
                        ? "../"
                        : "";

                if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
                {
                        if ($this->ilias->getSetting("enable_registration") and AUTH_CURRENT == AUTH_LOCAL)
                        {
                                $this->tpl->setCurrentBlock("registration_link");
                                $this->tpl->setVariable("TXT_REGISTER",$lng->txt("register"));
                                $this->tpl->setVariable("LINK_REGISTER", $link_dir."register.php?lang=".$ilias->account->getCurrentLanguage());
                                $this->tpl->parseCurrentBlock();
                        }

                        $this->tpl->setCurrentBlock("userisanonymous");
                        $this->tpl->setVariable("TXT_NOT_LOGGED_IN",$lng->txt("not_logged_in"));
                        $this->tpl->setVariable("TXT_LOGIN",$lng->txt("login"));
                        $this->tpl->setVariable("LINK_LOGIN", $link_dir."index.php?cmd=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();
                }

                $var2image = array( "IMG_DESK" => "navbar/desk.gif",
                                                        "IMG_DESK_O" => "navbar/desk_o.gif",
                                                        "IMG_SPACE" => "spacer.gif",
                                                        "IMG_CATALOG" => "navbar/course.gif",
                                                        "IMG_CATALOG_O" => "navbar/course_o.gif",
                                                        "IMG_MAIL" => "navbar/mail.gif",
                                                        "IMG_MAIL_O" => "navbar/mail_o.gif",
                                                        "IMG_FORUMS" => "navbar/newsgr.gif",
                                                        "IMG_FORUMS_O" => "navbar/newsgr_o.gif",
                                                        "IMG_SEARCH" => "navbar/search.gif",
                                                        "IMG_SEARCH_O" => "navbar/search_o.gif",
                                                        "IMG_LITERAT" => "navbar/literat.gif",
                                                        "IMG_LITERAT_O" => "navbar/literat_o.gif",
                                                        "IMG_GROUPS" => "navbar/groups.gif",
                                                        "IMG_GROUPS_O" => "navbar/groups_o.gif",
                                                        "IMG_HELP" => "navbar/help.gif",
                                                        "IMG_HELP_O" => "navbar/help_o.gif",
                                                        "IMG_FEEDB" => "navbar/feedb.gif",
                                                        "IMG_FEEDB_O" => "navbar/feedb_o.gif",
                                                        "IMG_ADMIN" => "navbar/admin.gif",
                                                        "IMG_ADMIN_O" => "navbar/admin_o.gif",
                                                        "IMG_DP" => "navbar/termin.gif",
                                                        "IMG_DP_O" => "navbar/termin_o.gif",
                                                        "IMG_LOGOUT" => "navbar/logout.gif",
                                                        "IMG_LOGOUT_O" => "navbar/logout_o.gif",
                                                        "IMG_ILIAS" => "navbar/ilias.gif");

                // temporary disable calendar
                unset($var2image["IMG_DP"]);
                unset($var2image["IMG_DP_O"]);

                foreach ($var2image as $var => $im)
                {
                        $this->tpl->setVariable($var, ilUtil::getImagePath($im, false));
                }

                $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
                $this->tpl->setVariable("JS_BUTTONS", ilUtil::getJSPath("buttons.js"));

                // set target scripts
                $scripts = array (      "SCRIPT_COURSE" => "lo_list.php",
                                                        "SCRIPT_CATALOG" => "repository.php?cmd=frameset&getlast=true",
                                                        "SCRIPT_SEARCH" => "search.php",
                                                        //"SCRIPT_LITERAT"=> "literature.php",
                                                        "SCRIPT_FORUMS" => "forums.php",
                                                        "SCRIPT_GROUPS" => "grp_list.php",
                                                        "SCRIPT_FEEDB"  => "feedback.php",
                                                        "SCRIPT_LOGOUT" => "logout.php" );

                foreach ($scripts as $var => $script)
                {
                        $this->tpl->setVariable($var, $this->getScriptTarget($script));
                }

                // set tooltip texts
                $this->tpl->setVariable("TXT_CATALOG", $lng->txt("repository"));
                $this->tpl->setVariable("TXT_LO_OVERVIEW", $lng->txt("lo_overview"));
                $this->tpl->setVariable("TXT_BOOKMARKS", $lng->txt("bookmarks"));
                $this->tpl->setVariable("TXT_SEARCH", $lng->txt("search"));
                //$this->tpl->setVariable("TXT_LITERATURE", $lng->txt("literature"));
                $this->tpl->setVariable("TXT_FORUMS", $lng->txt("forums"));
                $this->tpl->setVariable("TXT_GROUPS", $lng->txt("groups"));
                $this->tpl->setVariable("TXT_HELP", $lng->txt("help"));
                $this->tpl->setVariable("TXT_FEEDBACK", $lng->txt("feedback"));
                $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout"));

                // temporary disable dateplaner
                //$this->tpl->setVariable("TXT_DP",  $lng->txt("dateplaner"));

                // set target frame
                $this->tpl->setVariable("TARGET", $this->target);

                $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.png"));
                $this->tpl->setVariable("HEADER_BG_IMAGE", ilUtil::getImagePath("HeaderBackground.gif"));
                include_once("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:


Field Documentation

ilMainMenuGUI::$ilias

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

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

ilMainMenuGUI::$start_template

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

ilMainMenuGUI::$target

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

ilMainMenuGUI::$tpl

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

Referenced by setTemplate().


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