Html::helpHeader PHP Méthode

helpHeader() static public méthode

Print a nice HTML head for help page
static public helpHeader ( $title, $url = '' )
$title title of the page
$url not used anymore (default '')
    static function helpHeader($title, $url = '')
    {
        global $CFG_GLPI, $HEADER_LOADED, $PLUGIN_HOOKS;
        // Print a nice HTML-head for help page
        if ($HEADER_LOADED) {
            return;
        }
        $HEADER_LOADED = true;
        self::includeHeader($title);
        // Body
        $body_class = "layout_" . $_SESSION['glpilayout'];
        if (strpos($_SERVER['REQUEST_URI'], "form.php") !== false && isset($_GET['id']) && $_GET['id'] > 0) {
            if (!CommonGLPI::isLayoutExcludedPage()) {
                $body_class .= " form";
            } else {
                $body_class = "";
            }
        }
        echo "<body class='{$body_class}'>";
        // Main Headline
        echo "<div id='header'>";
        echo "<div id='header_top'>";
        echo "<div id='c_logo'>";
        echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' accesskey='1' title=\"" . __s('Home') . "\"><span class='invisible'>Logo</span></a>";
        echo "</div>";
        // Les préférences + lien déconnexion
        echo "<div id='c_preference' >";
        echo "<ul>";
        echo "<li id='deconnexion'>";
        echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/logout.php";
        /// logout witout noAuto login for extauth
        if (isset($_SESSION['glpiextauth']) && $_SESSION['glpiextauth']) {
            echo "?noAUTO=1";
        }
        echo "' title=\"" . __s('Logout') . "\">";
        // check user id : header used for display messages when session logout
        echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/logout.png' title=\"" . __s('Logout') . "\"  alt=\"" . __s('Logout') . "\" class='button-icon'>";
        echo "</a>";
        echo "</li>\n";
        echo "<li id='preferences_link'><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('My settings') . "\">";
        echo "<span id='preferences_icon' title=\"" . __s('My settings') . "\" class='button-icon' /></span>";
        // check user id : header used for display messages when session logout
        if (Session::getLoginUserID()) {
            echo "<span id='myname'>";
            echo formatUserName(0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20);
            echo "</span>";
        }
        echo "</a></li>";
        echo "<li>";
        Ajax::createIframeModalWindow('loadbookmark', $CFG_GLPI["root_doc"] . "/front/bookmark.php?action=load", array('title' => __('Load a bookmark'), 'reloadonclose' => true));
        echo "<a href='#' onClick=\"" . Html::jsGetElementbyID('loadbookmark') . ".dialog('open');\">";
        echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/bookmark.png' title=\"" . __s('Load a bookmark') . "\" class='button-icon'>";
        echo "</a></li>";
        echo "<li id='help_link'>" . "<a href='" . (empty($CFG_GLPI["helpdesk_doc_url"]) ? "http://glpi-project.org/help-helpdesk" : $CFG_GLPI["helpdesk_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\">" . "<img src='" . $CFG_GLPI["root_doc"] . "/pics/help.png' title=\"" . __s('Help') . "\" class='button-icon'>";
        "</a></li>";
        echo "</ul>";
        echo "</div>";
        // c_preference
        //-- Le moteur de recherche --
        echo "<div id='c_recherche'></div>";
        echo "</div>";
        // c_recherche
        //-- Le menu principal --
        echo "<div id='c_menu'>";
        // Build the navigation-elements
        $menu = array();
        //  Create ticket
        if (Session::haveRight("ticket", CREATE)) {
            $menu['create_ticket']['id'] = "menu2";
            $menu['create_ticket']['default'] = '/front/helpdesk.public.php?create_ticket=1';
            $menu['create_ticket']['title'] = __s('Create a ticket');
            $menu['create_ticket']['content'] = array(true);
        }
        //  Tickets
        if (Session::haveRight("ticket", CREATE) || Session::haveRight("ticket", Ticket::READMY) || Session::haveRight("followup", TicketFollowup::SEEPUBLIC)) {
            $menu['tickets']['id'] = "menu3";
            $menu['tickets']['default'] = '/front/ticket.php';
            $menu['tickets']['title'] = _n('Ticket', 'Tickets', Session::getPluralNumber());
            $menu['tickets']['content'] = array(true);
        }
        // Reservation
        if (Session::haveRight("reservation", ReservationItem::RESERVEANITEM)) {
            $menu['reservation']['id'] = "menu4";
            $menu['reservation']['default'] = '/front/reservationitem.php';
            $menu['reservation']['title'] = _n('Reservation', 'Reservations', Session::getPluralNumber());
            $menu['reservation']['content'] = array(true);
        }
        // FAQ
        if (Session::haveRight('knowbase', KnowbaseItem::READFAQ)) {
            $menu['faq']['id'] = "menu5";
            $menu['faq']['default'] = '/front/helpdesk.faq.php';
            $menu['faq']['title'] = __s('FAQ');
            $menu['faq']['content'] = array(true);
        }
        echo "<ul id='menu'>";
        // Display Home menu
        echo "<li id='menu1'>";
        echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\" class='itemP'>" . __('Home') . "</a>";
        echo "</li>";
        // display menu items
        foreach ($menu as $menu_item) {
            echo "<li id='" . $menu_item['id'] . "'>";
            echo "<a href='" . $CFG_GLPI["root_doc"] . $menu_item['default'] . "' " . "title=\"" . $menu_item['title'] . "\" class='itemP'>" . $menu_item['title'] . "</a>";
            echo "</li>";
        }
        // Plugins
        $menu['plugins']['id'] = "menu5";
        $menu['plugins']['default'] = "#";
        $menu['plugins']['title'] = _sn('Plugin', 'Plugins', Session::getPluralNumber());
        $menu['plugins']['content'] = array();
        if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"]) && count($PLUGIN_HOOKS["helpdesk_menu_entry"])) {
            foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) {
                if ($active) {
                    $infos = Plugin::getInfo($plugin);
                    $link = "";
                    if (is_string($PLUGIN_HOOKS["helpdesk_menu_entry"][$plugin])) {
                        $link = $PLUGIN_HOOKS["helpdesk_menu_entry"][$plugin];
                    }
                    $infos['page'] = $link;
                    $infos['title'] = $infos['name'];
                    $menu['plugins']['content'][$plugin] = $infos;
                }
            }
        }
        // Display plugins
        if (isset($menu['plugins']['content']) && count($menu['plugins']['content']) > 0) {
            asort($menu['plugins']['content']);
            echo "<li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\">";
            echo "<a href='#' title=\"" . _sn('Plugin', 'Plugins', Session::getPluralNumber()) . "\" class='itemP'>" . __('Plugins') . "</a>";
            // default none
            echo "<ul class='ssmenu'>";
            // list menu item
            foreach ($menu['plugins']['content'] as $key => $val) {
                echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . $val['page'] . "'>" . $val["title"] . "</a></li>";
            }
            echo "</ul></li>";
        }
        echo "</ul>";
        // Display MENU ALL
        self::displayMenuAll($menu);
        // End navigation bar
        // End headline
        //  Le fil d ariane
        echo "<div id='c_ssmenu2'>";
        echo "<ul>";
        echo "<li class='breadcrumb_item'>" . "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\">" . __('Home') . "</a></li>";
        if (TicketValidation::getValidateRights()) {
            $opt = array();
            $opt['reset'] = 'reset';
            $opt['criteria'][0]['field'] = 55;
            // validation status
            $opt['criteria'][0]['searchtype'] = 'equals';
            $opt['criteria'][0]['value'] = TicketValidation::WAITING;
            $opt['criteria'][0]['link'] = 'AND';
            $opt['criteria'][1]['field'] = 59;
            // validation aprobator
            $opt['criteria'][1]['searchtype'] = 'equals';
            $opt['criteria'][1]['value'] = Session::getLoginUserID();
            $opt['criteria'][1]['link'] = 'AND';
            $url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&amp;');
            $pic_validate = "<a href='{$url_validate}'>" . "<img title=\"" . __s('Ticket waiting for your approval') . "\" alt=\"" . __s('Ticket waiting for your approval') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' class='pointer'></a>";
            echo "<li class='icons_block'>{$pic_validate}</li>\n";
        }
        if (Session::haveRight('ticket', CREATE) && strpos($_SERVER['PHP_SELF'], "ticket")) {
            echo "<li class='icons_block'><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1'>";
            echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\" class='pointer'></a></li>";
        }
        // check user id : header used for display messages when session logout
        if (Session::getLoginUserID()) {
            self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
        }
        echo "</ul></div>";
        // fin c_ssmenu2
        echo "</div>";
        // fin c_menu
        echo "</div>";
        // fin header
        echo "<div id='page' >";
        // call static function callcron() every 5min
        CronTask::callCron();
        self::displayMessageAfterRedirect();
    }

Usage Example

$user = new User();
// Manage lost password
if (isset($_GET['lostpassword'])) {
    Html::nullHeader();
    if (isset($_GET['password_forget_token'])) {
        User::showPasswordForgetChangeForm($_GET['password_forget_token']);
    } else {
        User::showPasswordForgetRequestForm();
    }
    Html::nullFooter();
    exit;
}
Session::checkLoginUser();
if (isset($_POST["update"]) && $_POST["id"] === Session::getLoginUserID()) {
    $user->update($_POST);
    Event::log($_POST["id"], "users", 5, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
    Html::back();
} else {
    if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
        Html::header(Preference::getTypeName(1), $_SERVER['PHP_SELF'], 'preference');
    } else {
        Html::helpHeader(Preference::getTypeName(1), $_SERVER['PHP_SELF']);
    }
    $pref = new Preference();
    $pref->display();
    if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
        Html::footer();
    } else {
        Html::helpFooter();
    }
}
All Usage Examples Of Html::helpHeader
Html