shortcut() static public method

to underline shortcut letter
static public shortcut ( $str, $shortcut ) : string
$str string from dico
$shortcut letter of shortcut
return string
Ejemplo n.º 1
0
    /**
     * Print a nice HTML head for every page
     *
     * @param $title     title of the page
     * @param $url       not used anymore (default '')
     * @param $sector    sector in which the page displayed is (default 'none')
     * @param $item      item corresponding to the page displayed (default 'none')
     * @param $option    option corresponding to the page displayed (default '')
     **/
    static function header($title, $url = '', $sector = "none", $item = "none", $option = "")
    {
        global $CFG_GLPI, $PLUGIN_HOOKS, $HEADER_LOADED, $DB;
        // If in modal : display popHeader
        if (isset($_REQUEST['_in_modal']) && $_REQUEST['_in_modal']) {
            return self::popHeader($title, $url);
        }
        // Print a nice HTML-head for every page
        if ($HEADER_LOADED) {
            return;
        }
        $HEADER_LOADED = true;
        // Force lower case for sector and item
        $sector = strtolower($sector);
        $item = strtolower($item);
        self::includeHeader($title);
        // Body
        echo "<body>";
        // Generate array for menu and check right
        if (!isset($_SESSION['glpimenu']) || !is_array($_SESSION['glpimenu']) || count($_SESSION['glpimenu']) == 0) {
            // INVENTORY
            //don't change order in array
            $showallassets = false;
            $menu['assets']['title'] = __('Assets');
            $menu['assets']['types'] = array('Computer', 'Monitor', 'Software', 'NetworkEquipment', 'Peripheral', 'Printer', 'CartridgeItem', 'ConsumableItem', 'Phone');
            $menu['helpdesk']['title'] = __('Assistance');
            $menu['helpdesk']['types'] = array('Ticket', 'Problem', 'Change', 'Planning', 'Stat', 'TicketRecurrent');
            $menu['management']['title'] = __('Management');
            $menu['management']['types'] = array('Budget', 'Supplier', 'Contact', 'Contract', 'Document');
            $menu['tools']['title'] = __('Tools');
            $menu['tools']['types'] = array('Project', 'Reminder', 'RSSFeed', 'KnowbaseItem', 'ReservationItem', 'Report', 'MigrationCleaner');
            $menu['plugins']['title'] = _n('Plugin', 'Plugins', Session::getPluralNumber());
            $menu['plugins']['types'] = array();
            $menu['admin']['title'] = __('Administration');
            $menu['admin']['types'] = array('User', 'Group', 'Entity', 'Rule', 'Profile', 'QueuedMail', 'Backup', 'Event');
            $menu['config']['title'] = __('Setup');
            $menu['config']['types'] = array('CommonDropdown', 'CommonDevice', 'Notification', 'SLA', 'Config', 'Control', 'Crontask', 'Auth', 'MailCollector', 'Link', 'Plugin');
            // Special items
            $menu['preference']['title'] = __('My settings');
            $menu['preference']['default'] = '/front/preference.php';
            // Permit to plugins to add entry to others sector !
            if (isset($PLUGIN_HOOKS["menu_toadd"]) && count($PLUGIN_HOOKS["menu_toadd"])) {
                foreach ($PLUGIN_HOOKS["menu_toadd"] as $plugin => $items) {
                    if (count($items)) {
                        foreach ($items as $key => $val) {
                            if (isset($menu[$key])) {
                                $menu[$key]['types'][] = $val;
                            }
                        }
                    }
                }
            }
            foreach ($menu as $category => $datas) {
                if (isset($datas['types']) && count($datas['types'])) {
                    foreach ($datas['types'] as $type) {
                        if ($data = $type::getMenuContent()) {
                            // Multi menu entries management
                            if (isset($data['is_multi_entries']) && $data['is_multi_entries']) {
                                if (!isset($menu[$category]['content'])) {
                                    $menu[$category]['content'] = array();
                                }
                                $menu[$category]['content'] += $data;
                            } else {
                                $menu[$category]['content'][strtolower($type)] = $data;
                            }
                        }
                    }
                }
                // Define default link :
                if (isset($menu[$category]['content']) && count($menu[$category]['content'])) {
                    foreach ($menu[$category]['content'] as $val) {
                        if (isset($val['page'])) {
                            $menu[$category]['default'] = $val['page'];
                            break;
                        }
                    }
                }
            }
            $allassets = array('Computer', 'Monitor', 'Peripheral', 'NetworkEquipment', 'Phone', 'Printer');
            foreach ($allassets as $type) {
                if (isset($menu['assets']['content'][strtolower($type)])) {
                    $menu['assets']['content']['allassets']['title'] = __('Global');
                    $menu['assets']['content']['allassets']['shortcut'] = '';
                    $menu['assets']['content']['allassets']['page'] = '/front/allassets.php';
                    $menu['assets']['content']['allassets']['links']['search'] = '/front/allassets.php';
                    break;
                }
            }
            //  PLUGINS
            //          if (isset($PLUGIN_HOOKS["menu_entry"]) && count($PLUGIN_HOOKS["menu_entry"])) {
            //             $plugins = array();
            //
            //             foreach  ($PLUGIN_HOOKS["menu_entry"] as $plugin => $active) {
            //                if ($active) { // true or a string
            //                   $plugins[$plugin] = Plugin::getInfo($plugin);
            //                }
            //             }
            //
            //             if (count($plugins)) {
            //                $list = array();
            //
            //                foreach ($plugins as $key => $val) {
            //                   $list[$key] = $val["name"];
            //                }
            //                asort($list);
            //
            //                foreach ($list as $key => $val) {
            //                   $menu['plugins']['content'][$key]['title'] = $val;
            //                   $menu['plugins']['content'][$key]['page']  = '/plugins/'.$key.'/';
            //
            //                   if (is_string($PLUGIN_HOOKS["menu_entry"][$key])) {
            //                      $menu['plugins']['content'][$key]['page'] .= $PLUGIN_HOOKS["menu_entry"][$key];
            //                   }
            //
            //                   // Set default link for plugins
            //                   if (!isset($menu['plugins']['default'])) {
            //                      $menu['plugins']['default'] = $menu['plugins']['content'][$key]['page'];
            //                   }
            //
            //                   if (($sector == "plugins")
            //                      && ($item == $key)) {
            //
            //                      if (isset($PLUGIN_HOOKS["submenu_entry"][$key])
            //                         && is_array($PLUGIN_HOOKS["submenu_entry"][$key])) {
            //
            //                         foreach ($PLUGIN_HOOKS["submenu_entry"][$key] as $name => $link) {
            //                            // New complete option management
            //                            if ($name == "options") {
            //                               $menu['plugins']['content'][$key]['options'] = $link;
            //                            } else { // Keep it for compatibility
            //
            //                               if (is_array($link)) {
            //                                  // Simple link option
            //                                  if (isset($link[$option])) {
            //                                     $menu['plugins']['content'][$key]['links'][$name]
            //                                                    ='/plugins/'.$key.'/'.$link[$option];
            //                                  }
            //                               } else {
            //                                  $menu['plugins']['content'][$key]['links'][$name]
            //                                                    ='/plugins/'.$key.'/'.$link;
            //                               }
            //                            }
            //                         }
            //                      }
            //                   }
            //                }
            //             }
            //          }
            $_SESSION['glpimenu'] = $menu;
            //          echo 'menu load';
        } else {
            $menu = $_SESSION['glpimenu'];
        }
        $already_used_shortcut = array('1');
        //stevenes donato
        echo "\n<style>\n.dropdown-menu > li > a:hover,\n.dropdown-menu > li > a:focus {\n  color: #fff;\n  text-decoration: none;\n  background-color: #428bca; //#f5f5f5;\n}\n</style>";
        echo '
<nav class="navbar navbar-default" id="menuHeader">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="' . $CFG_GLPI["root_doc"] . '/front/central.php"><img src="' . $CFG_GLPI["root_doc"] . '/pics/fd_logo1.png" style="margin-top:-4px;" /> </a>

      </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    <ul  class="nav navbar-nav">';
        // id = "menu" is used with javascript but also as styling selector
        //echo "<ul id='menu'>";
        // Get object-variables and build the navigation-elements
        $i = 1;
        foreach ($menu as $part => $data) {
            if (isset($data['content']) && count($data['content'])) {
                //echo "<li id='menu$i' onmouseover=\"javascript:menuAff('menu$i','menu');\" >";
                echo "<li id='menu{$i}'>";
                $link = "#";
                if (isset($data['default']) && !empty($data['default'])) {
                    $link = $CFG_GLPI["root_doc"] . $data['default'];
                }
                if (Toolbox::strlen($data['title']) > 14) {
                    $data['title'] = Toolbox::substr($data['title'], 0, 14) . "...";
                }
                echo "<a href='{$link}' class='itemP dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded='false'>" . $data['title'] . "<span class='caret'></span></a>";
                echo "<ul class='ssmenu dropdown-menu' role='menu'>";
                // list menu item
                foreach ($data['content'] as $key => $val) {
                    if (isset($val['page']) && isset($val['title'])) {
                        echo "<li><a href='" . $CFG_GLPI["root_doc"] . $val['page'] . "'";
                        if (isset($val['shortcut']) && !empty($val['shortcut'])) {
                            if (!isset($already_used_shortcut[$val['shortcut']])) {
                                echo " accesskey='" . $val['shortcut'] . "'";
                                $already_used_shortcut[$val['shortcut']] = $val['shortcut'];
                            }
                            echo ">" . Toolbox::shortcut($val['title'], $val['shortcut']) . "</a></li>\n";
                        } else {
                            echo ">" . $val['title'] . "</a></li>\n";
                        }
                    }
                }
                echo "</ul>";
                echo "</li>";
                $i++;
            }
        }
        echo '</ul>';
        //count due tickets
        $sql_due = "SELECT DISTINCT COUNT(glpi_tickets.id) AS due\n\t\tFROM glpi_tickets_users, glpi_tickets, glpi_users\n\t\tWHERE glpi_tickets.status NOT IN (5,6)\n\t\tAND glpi_tickets.is_deleted = 0\n\t\tAND glpi_tickets.id = glpi_tickets_users.tickets_id\n\t\tAND glpi_tickets_users.users_id = glpi_users.id\n\t\tAND glpi_tickets.due_date IS NOT NULL\n\t\tAND glpi_tickets.due_date < NOW()\n\t\tAND glpi_tickets_users.type = 2\n\t\tAND glpi_users.id = " . $_SESSION['glpiID'] . " ";
        $result_due = $DB->query($sql_due);
        $due = $DB->result($result_due, 0, 'due');
        if ($due > 0) {
            $href_due = "" . $CFG_GLPI["root_doc"] . "/front/ticket.php?is_deleted=0&criteria[0][field]=5\n\t\t\t\t&criteria[0][searchtype]=equals&criteria[0][value]=" . $_SESSION['glpiID'] . "&criteria[1][link]=AND\n\t\t\t\t&criteria[1][field]=12&criteria[1][searchtype]=equals&criteria[1][value]=notold\n\t\t\t\t&itemtype=Ticket&start=0";
        } else {
            $href_due = "#";
        }
        //count open tickets
        $sql_cham = "SELECT DISTINCT COUNT(glpi_tickets.id) AS number\n\t\tFROM glpi_tickets_users, glpi_tickets, glpi_users\n\t\tWHERE glpi_tickets.status NOT IN (5,6)\n\t\tAND glpi_tickets.is_deleted = 0\n\t\tAND glpi_tickets.id = glpi_tickets_users.`tickets_id`\n\t\tAND glpi_tickets_users.`users_id` = glpi_users.id\n\t\tAND glpi_tickets_users.type = 2\n\t\tAND glpi_users.id = " . $_SESSION['glpiID'] . " ";
        $result_cham = $DB->query($sql_cham);
        $number = $DB->result($result_cham, 0, 'number');
        if ($number > 0) {
            $href_cham = $CFG_GLPI["root_doc"] . "/front/ticket.php?is_deleted=0&criteria[0][field]=5\n\t\t\t\t&criteria[0][searchtype]=equals&criteria[0][value]=" . $_SESSION['glpiID'] . "&criteria[1][link]=AND\n\t\t\t\t&criteria[1][field]=12&criteria[1][searchtype]=equals&criteria[1][value]=notold\n\t\t\t\t&itemtype=Ticket&start=0";
        } else {
            $href_cham = "#";
        }
        //select tasks
        $query_task = "\n\t\tSELECT glpi_tickettasks.id AS id, glpi_tickettasks.content AS content, glpi_tickettasks.tickets_id AS tid\n\t\tFROM glpi_tickettasks, glpi_tickets\n\t\tWHERE glpi_tickettasks.users_id_tech = " . $_SESSION['glpiID'] . "\n\t\tAND glpi_tickettasks.state NOT IN (2)\n\t\tAND glpi_tickettasks.tickets_id = glpi_tickets.id\n\t\tAND glpi_tickets.is_deleted = 0\n\t\tAND glpi_tickets.status NOT IN (5,6)";
        $res_task = $DB->query($query_task);
        $num_tasks = $DB->numrows($res_task);
        //task label color
        if ($num_tasks <= 0) {
            $label3 = 'label-success';
        }
        if ($num_tasks >= 1 && $num_tasks <= 5) {
            $label3 = 'label-warning';
        }
        if ($num_tasks > 5) {
            $label3 = 'label-danger';
        }
        //label color
        if ($due <= 0) {
            $label = 'label-success';
        }
        if ($due >= 1 && $due <= 5) {
            $label = 'label-warning';
        }
        if ($due > 5) {
            $label = 'label-danger';
        }
        if ($number <= 0) {
            $label2 = 'label-success';
        }
        if ($number >= 1 && $number <= 5) {
            $label2 = 'label-warning';
        }
        if ($number > 5) {
            $label2 = 'label-danger';
        }
        echo '<ul class="nav navbar-nav navbar-right">';
        echo "<li id='count' class='dropdown' style='margin-left:2px; margin-right: -5px; font-size:12px; margin-top:-5px;' title='" . _n('Ticket task', 'Ticket tasks', 2) . "'>";
        //echo "<a href='".$CFG_GLPI["root_doc"]."/front/planning.php?type=month'>
        echo "<a href='#' class='dropdown-toggle' data-toggle='dropdown' role='button' aria-expanded='false'>\n\t\t\t\t\t<i style='vertical-align:bottom;' class='fa fa-tasks' ></i> <span class='label " . $label3 . "' style='font-size:11px;' >" . $num_tasks . "</span></a>";
        echo "<ul class=\"dropdown-menu\" role=\"menu\">";
        while ($row = $DB->fetch_assoc($res_task)) {
            echo "<li class='task'>";
            echo "<a href='" . $CFG_GLPI['url_base'] . "/front/ticket.form.php?forcetab=TicketTask\$1&id=" . $row['tid'] . "'>" . substr($row['content'], 0, 30) . "\n\t\t\t\t\t<br>" . _n('Ticket', 'Tickets', 1) . "  #" . $row['tid'] . "</a>";
            echo "</li>";
        }
        echo "</ul>";
        echo "</li>";
        echo "<li id='count' class='dropdown' style='margin-left:2px; margin-right: -5px; font-size:12px; margin-top:-5px;' title='" . _nx('ticket', 'Opened', 'Opened', 2) . "'>\n\t\t\t\t<a href='" . $href_cham . "'>\n\t\t\t\t<i style='vertical-align:bottom;' class='fa fa-ticket' ></i>\n\t\t\t\t<span class='label " . $label2 . "' style='font-size:11px;' >" . $number . "</span></a></li>";
        echo "<li id='count' class='dropdown' style='margin-left:8px; margin-right: -5px; font-size:12px; margin-top:-5px;' title='" . __('Late') . "'>\n\t\t\t\t<a href='" . $href_due . "'>\n\t\t\t\t<i style='vertical-align:bottom;' class='fa fa-clock-o'></i>\n\t\t\t\t<span class='label " . $label . "' style='font-size:11px;'>" . $due . "</span></a></li>";
        //echo "<div id='c_recherche' class='form-group'>\n";
        if ($CFG_GLPI['allow_search_global']) {
            echo "<form class='navbar-form navbar-left' role='search' method='get' action='" . $CFG_GLPI["root_doc"] . "/front/search.php'>\n";
            echo '<div class="searchbox" style="width:10px; float:right; margin-right:70px;">';
            echo '    <div class="input-group champRecherche">';
            echo '      <input type="text" class="form-control" name="globalsearch" placeholder="' . __s('Search') . '" onfocus=\\"this.value="";\\">';
            echo '      <span class="input-group-btn">';
            echo '        <button class="btn btn-default searchbtn" type="submit"><i class="fa fa-search" style="font-size:20px;" ></i></button>';
            echo '      </span>';
            echo '    </div>';
            echo '</div>';
            Html::closeForm();
        }
        //user image and name
        $sql_photo = "SELECT picture\n\t\t\t\t\t\t\t\tFROM glpi_users\n\t\t\t\t\t\t\t\tWHERE id = " . $_SESSION["glpiID"] . " ";
        $res_photo = $DB->query($sql_photo);
        $pic = $DB->result($res_photo, 0, 'picture');
        $photo_url = User::getURLForPicture($pic);
        echo ' <li class="dropdown" id="avatar">';
        echo '<a href="#" style="padding:0px; margin:0px;" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><img src="' . $photo_url . '" class="avatar" alt="" title="' . formatUserName(0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20) . '" /></a>';
        echo "<ul class=\"dropdown-menu\" role=\"menu\">";
        echo "<li><a href='" . (empty($CFG_GLPI["central_doc_url"]) ? "http://glpi-project.org/help-central" : $CFG_GLPI["central_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\"><i class='fa fa-question-circle'></i> " . __('Help') . "</a></li>";
        echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('My settings') . "\"><i class='fa fa-cog'></i> " . __('My settings') . "</a></li>";
        echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . addslashes(Dropdown::getLanguageName($_SESSION['glpilanguage'])) . "\"><i class='fa fa-flag'></i> " . Dropdown::getLanguageName($_SESSION['glpilanguage']) . "</a></li>";
        echo "<li id='deconnexion'><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') . "\"><i class='fa fa-sign-out'></i> " . __('Logout') . "</a>";
        // check user id : header used for display messages when session logout
        if (Session::getLoginUserID()) {
            //echo " (";
            // echo formatUserName (0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20);
            // echo ")";
        }
        echo "</li>\n";
        echo "</ul>";
        echo '  </li>';
        echo '
			      </ul>
			    </div><!-- /.navbar-collapse -->
			  </div><!-- /.container-fluid -->
			</nav> ';
        echo '<nav class="navbar navbar-default nav2" style="margin-top: -20px;">';
        echo "<div id='c_ssmenu1'>";
        echo "<ul>";
        // list sous-menu item
        if (isset($menu[$sector])) {
            if (isset($menu[$sector]['content']) && is_array($menu[$sector]['content'])) {
                $ssmenu = $menu[$sector]['content'];
                if (count($ssmenu) > 12) {
                    foreach ($ssmenu as $key => $val) {
                        if (isset($val['hide'])) {
                            unset($ssmenu[$key]);
                        }
                    }
                    $ssmenu = array_splice($ssmenu, 0, 12);
                }
                foreach ($ssmenu as $key => $val) {
                    if (isset($val['page']) && isset($val['title'])) {
                        echo "<a href='" . $CFG_GLPI["root_doc"] . $val['page'] . "'";
                        if (isset($val['shortcut']) && !empty($val['shortcut'])) {
                            echo ">" . Toolbox::shortcut($val['title'], $val['shortcut']) . "</a>\n";
                        } else {
                            echo ">" . $val['title'] . "</a>\n";
                        }
                    }
                }
            } else {
                echo "&nbsp;";
            }
        } else {
            echo "&nbsp;";
        }
        echo "</ul></div>";
        //echo "</div>";
        // Display item
        echo "<div id='c_ssmenu2'>";
        echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/central.php' title=\"" . __s('Home') . "\">" . __('Home') . "</a> >";
        if (isset($menu[$sector])) {
            $link = "/front/central.php";
            if (isset($menu[$sector]['default'])) {
                $link = $menu[$sector]['default'];
            }
            echo "<a href='" . $CFG_GLPI["root_doc"] . $link . "' title=\"" . $menu[$sector]['title'] . "\">" . $menu[$sector]['title'] . "</a> >";
        }
        if (isset($menu[$sector]['content'][$item])) {
            // Title
            $with_option = false;
            if (!empty($option) && isset($menu[$sector]['content'][$item]['options'][$option]['title']) && isset($menu[$sector]['content'][$item]['options'][$option]['page'])) {
                $with_option = true;
            }
            if (isset($menu[$sector]['content'][$item]['page'])) {
                echo "<a href='" . $CFG_GLPI["root_doc"] . $menu[$sector]['content'][$item]['page'] . "' " . ($with_option ? "" : "class='here'") . " title=\"" . $menu[$sector]['content'][$item]['title'] . "\" >" . $menu[$sector]['content'][$item]['title'] . "</a>" . (!$with_option ? "" : " > ") . "";
            }
            if ($with_option) {
                echo "<a href='" . $CFG_GLPI["root_doc"] . $menu[$sector]['content'][$item]['options'][$option]['page'] . "' class='here' title=\"" . $menu[$sector]['content'][$item]['options'][$option]['title'] . "\" >";
                echo self::resume_name($menu[$sector]['content'][$item]['options'][$option]['title'], 17);
                echo "</a>";
            }
            echo "<a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            $links = array();
            // Item with Option case
            if (!empty($option) && isset($menu[$sector]['content'][$item]['options'][$option]['links']) && is_array($menu[$sector]['content'][$item]['options'][$option]['links'])) {
                $links = $menu[$sector]['content'][$item]['options'][$option]['links'];
                // Without option case : only item links
            } else {
                if (isset($menu[$sector]['content'][$item]['links']) && is_array($menu[$sector]['content'][$item]['links'])) {
                    $links = $menu[$sector]['content'][$item]['links'];
                }
            }
            // Add item
            //echo "<li>";
            if (isset($links['add'])) {
                echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_add.png", array('alt' => __('Add'), 'url' => $CFG_GLPI["root_doc"] . $links['add']));
            } else {
                echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_add_off.png", array('alt' => __('Add')));
            }
            //echo "</li>";
            // Search Item
            //echo "<li>";
            if (isset($links['search'])) {
                echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_search.png", array('alt' => __('Search'), 'url' => $CFG_GLPI["root_doc"] . $links['search']));
            } else {
                echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_search_off.png", array('alt' => __('Search')));
            }
            // echo "</li>";
            // Links
            if (count($links) > 0) {
                foreach ($links as $key => $val) {
                    switch ($key) {
                        case "add":
                        case "search":
                            break;
                        case "template":
                            //echo "<li>";
                            echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_addtemplate.png", array('alt' => __('Manage templates...'), 'url' => $CFG_GLPI["root_doc"] . $val));
                            //echo "</li>";
                            break;
                        case "showall":
                            //echo "<li>";
                            echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_showall.png", array('alt' => __('Show all'), 'url' => $CFG_GLPI["root_doc"] . $val));
                            //echo "</li>";
                            break;
                        case "summary":
                            //echo "<li>";
                            echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_show.png", array('alt' => __('Summary'), 'url' => $CFG_GLPI["root_doc"] . $val));
                            //echo "</li>";
                            break;
                        case "config":
                            //echo "<li>";
                            echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_config.png", array('alt' => __('Setup'), 'url' => $CFG_GLPI["root_doc"] . $val));
                            //echo "</li>";
                            break;
                        default:
                            echo "" . Html::link($key, $CFG_GLPI["root_doc"] . $val) . "";
                            break;
                    }
                }
            }
        } else {
            echo "<a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>";
            echo "<a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "&nbsp;&nbsp;&nbsp;&nbsp;</a>";
        }
        // Add common items
        //echo "<li>";
        // Display MENU ALL
        echo "<div id='show_all_menu' class='starthidden invisiblex'>";
        $items_per_columns = 15;
        $i = -1;
        echo "<table class='table table-striped'><tr><td class='top'><table>";
        foreach ($menu as $part => $data) {
            if (isset($data['content']) && count($data['content'])) {
                if ($i > $items_per_columns) {
                    $i = 0;
                    echo "</table></td><td class='top'><table>";
                }
                $link = "#";
                if (isset($data['default']) && !empty($data['default'])) {
                    $link = $CFG_GLPI["root_doc"] . $data['default'];
                }
                echo "<tr><td class='tab_bg_1 b'>";
                echo "<a href='{$link}' title=\"" . $data['title'] . "\" class='itemP'>" . $data['title'] . "</a>";
                echo "</td></tr>";
                $i++;
                // list menu item
                foreach ($data['content'] as $key => $val) {
                    if ($i > $items_per_columns) {
                        $i = 0;
                        echo "</table></td><td class='top'><table>";
                    }
                    if (isset($val['page']) && isset($val['title'])) {
                        echo "<tr><td><a href='" . $CFG_GLPI["root_doc"] . $val['page'] . "'";
                        if (isset($data['shortcut']) && !empty($data['shortcut'])) {
                            echo " accesskey='" . $val['shortcut'] . "'";
                        }
                        echo ">" . $val['title'] . "</a></td></tr>\n";
                        $i++;
                    }
                }
            }
        }
        echo "</table></td></tr></table>";
        echo "</div>";
        //end show_all
        Html::scriptStart();
        echo self::jsGetElementbyID('show_all_menu') . ".dialog({\n         height: 'auto',\n         width: 'auto',\n         modal: true,\n         autoOpen: false\n         }); ";
        echo Html::scriptEnd();
        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        // echo "</li>";
        /// Bookmark load
        //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') . "\"  alt=\"" . __s('Load a bookmark') . "\">";
        echo "</a>";
        /// MENU ALL
        //echo "<li>";
        echo "<a href='#' onClick=\"" . self::jsGetElementbyID('show_all_menu') . ".dialog('open');\">";
        echo "<img alt='' src='" . $CFG_GLPI["root_doc"] . "/pics/menu_all.png'>";
        echo "</a>";
        // check user id : header used for display messages when session logout
        if (Session::getLoginUserID()) {
            echo self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/central.php");
        }
        echo "</div>";
        echo '</nav>';
        echo "</div>\n";
        // fin header
        echo "<div id='page' >";
        if ($DB->isSlave() && !$DB->first_connection) {
            echo "<div id='dbslave-float'>";
            echo "<a href='#see_debug'>" . __('MySQL replica: read only') . "</a>";
            echo "</div>";
        }
        // Back to top
        Html::scriptStart();
        echo "\$(document).ready(function(){\n               BackToTop({\n               text : '" . __s("^Top^") . "',\n               autoShow : true,\n               timeEffect : 100,\n               autoShowOffset : '0',\n               appearMethod : '',\n               effectScroll : 'linear'\n               });\n            });";
        echo Html::scriptEnd();
        // call static function callcron() every 5min
        CronTask::callCron();
        self::displayMessageAfterRedirect();
    }
Ejemplo n.º 2
0
 /**
  * Print a nice HTML head for every page
  *
  * @param $title     title of the page
  * @param $url       not used anymore (default '')
  * @param $sector    sector in which the page displayed is (default 'none')
  * @param $item      item corresponding to the page displayed (default 'none')
  * @param $option    option corresponding to the page displayed (default '')
  **/
 static function header($title, $url = '', $sector = "none", $item = "none", $option = "")
 {
     global $CFG_GLPI, $PLUGIN_HOOKS, $HEADER_LOADED, $DB;
     // If in modal : display popHeader
     if (isset($_REQUEST['_in_modal']) && $_REQUEST['_in_modal']) {
         return self::popHeader($title, $url);
     }
     // Print a nice HTML-head for every page
     if ($HEADER_LOADED) {
         return;
     }
     $HEADER_LOADED = true;
     // Force lower case for sector and item
     $sector = strtolower($sector);
     $item = strtolower($item);
     self::includeHeader($title);
     $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 = "";
         }
     }
     // Body
     echo "<body class='{$body_class}'>";
     // Generate array for menu and check right
     if (!isset($_SESSION['glpimenu']) || !is_array($_SESSION['glpimenu']) || count($_SESSION['glpimenu']) == 0) {
         // INVENTORY
         //don't change order in array
         $showallassets = false;
         $menu = self::getMenuInfos();
         // Permit to plugins to add entry to others sector !
         if (isset($PLUGIN_HOOKS["menu_toadd"]) && count($PLUGIN_HOOKS["menu_toadd"])) {
             foreach ($PLUGIN_HOOKS["menu_toadd"] as $plugin => $items) {
                 if (count($items)) {
                     foreach ($items as $key => $val) {
                         if (isset($menu[$key])) {
                             $menu[$key]['types'][] = $val;
                         }
                     }
                 }
             }
         }
         foreach ($menu as $category => $datas) {
             if (isset($datas['types']) && count($datas['types'])) {
                 foreach ($datas['types'] as $type) {
                     if ($data = $type::getMenuContent()) {
                         // Multi menu entries management
                         if (isset($data['is_multi_entries']) && $data['is_multi_entries']) {
                             if (!isset($menu[$category]['content'])) {
                                 $menu[$category]['content'] = array();
                             }
                             $menu[$category]['content'] += $data;
                         } else {
                             $menu[$category]['content'][strtolower($type)] = $data;
                         }
                     }
                 }
             }
             // Define default link :
             if (isset($menu[$category]['content']) && count($menu[$category]['content'])) {
                 foreach ($menu[$category]['content'] as $val) {
                     if (isset($val['page'])) {
                         $menu[$category]['default'] = $val['page'];
                         break;
                     }
                 }
             }
         }
         $allassets = array('Computer', 'Monitor', 'Peripheral', 'NetworkEquipment', 'Phone', 'Printer');
         foreach ($allassets as $type) {
             if (isset($menu['assets']['content'][strtolower($type)])) {
                 $menu['assets']['content']['allassets']['title'] = __('Global');
                 $menu['assets']['content']['allassets']['shortcut'] = '';
                 $menu['assets']['content']['allassets']['page'] = '/front/allassets.php';
                 $menu['assets']['content']['allassets']['links']['search'] = '/front/allassets.php';
                 break;
             }
         }
         //  PLUGINS
         //          if (isset($PLUGIN_HOOKS["menu_entry"]) && count($PLUGIN_HOOKS["menu_entry"])) {
         //             $plugins = array();
         //
         //             foreach  ($PLUGIN_HOOKS["menu_entry"] as $plugin => $active) {
         //                if ($active) { // true or a string
         //                   $plugins[$plugin] = Plugin::getInfo($plugin);
         //                }
         //             }
         //
         //             if (count($plugins)) {
         //                $list = array();
         //
         //                foreach ($plugins as $key => $val) {
         //                   $list[$key] = $val["name"];
         //                }
         //                asort($list);
         //
         //                foreach ($list as $key => $val) {
         //                   $menu['plugins']['content'][$key]['title'] = $val;
         //                   $menu['plugins']['content'][$key]['page']  = '/plugins/'.$key.'/';
         //
         //                   if (is_string($PLUGIN_HOOKS["menu_entry"][$key])) {
         //                      $menu['plugins']['content'][$key]['page'] .= $PLUGIN_HOOKS["menu_entry"][$key];
         //                   }
         //
         //                   // Set default link for plugins
         //                   if (!isset($menu['plugins']['default'])) {
         //                      $menu['plugins']['default'] = $menu['plugins']['content'][$key]['page'];
         //                   }
         //
         //                   if (($sector == "plugins")
         //                      && ($item == $key)) {
         //
         //                      if (isset($PLUGIN_HOOKS["submenu_entry"][$key])
         //                         && is_array($PLUGIN_HOOKS["submenu_entry"][$key])) {
         //
         //                         foreach ($PLUGIN_HOOKS["submenu_entry"][$key] as $name => $link) {
         //                            // New complete option management
         //                            if ($name == "options") {
         //                               $menu['plugins']['content'][$key]['options'] = $link;
         //                            } else { // Keep it for compatibility
         //
         //                               if (is_array($link)) {
         //                                  // Simple link option
         //                                  if (isset($link[$option])) {
         //                                     $menu['plugins']['content'][$key]['links'][$name]
         //                                                    ='/plugins/'.$key.'/'.$link[$option];
         //                                  }
         //                               } else {
         //                                  $menu['plugins']['content'][$key]['links'][$name]
         //                                                    ='/plugins/'.$key.'/'.$link;
         //                               }
         //                            }
         //                         }
         //                      }
         //                   }
         //                }
         //             }
         //          }
         $_SESSION['glpimenu'] = $menu;
         //          echo 'menu load';
     } else {
         $menu = $_SESSION['glpimenu'];
     }
     $already_used_shortcut = array('1');
     echo "<div id='header'>";
     echo "<div id='header_top'>";
     echo "<div id='c_logo'>";
     echo Html::link('', $CFG_GLPI["root_doc"] . "/front/central.php", array('accesskey' => '1', 'title' => __('Home')));
     echo "</div>";
     /// Prefs / Logout link
     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') . "\">";
     echo "<span id='logout_icon' 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') . "\"  alt=\"" . __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>";
     /// Bookmark load
     echo "<li id='bookmark_link'>";
     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 "<span id='bookmark_icon' title=\"" . __s('Load a bookmark') . "\"  alt=\"" . __s('Load a bookmark') . "\" class='button-icon' />";
     echo "</a></li>";
     echo "<li id='help_link'><a href='" . (empty($CFG_GLPI["central_doc_url"]) ? "http://glpi-project.org/help-central" : $CFG_GLPI["central_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\">" . "<span id='help_icon' title=\"" . __s('Help') . "\"  alt=\"" . __s('Help') . "\" class='button-icon' />";
     "</a></li>";
     echo "<li id='language_link'><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php?forcetab=User\$1' title=\"" . addslashes(Dropdown::getLanguageName($_SESSION['glpilanguage'])) . "\">" . Dropdown::getLanguageName($_SESSION['glpilanguage']) . "</a></li>";
     /// Search engine
     echo "<li id='c_recherche'>\n";
     if ($CFG_GLPI['allow_search_global']) {
         echo "<form method='get' action='" . $CFG_GLPI["root_doc"] . "/front/search.php'>\n";
         echo "<span id='champRecherche'><input size='15' type='text' name='globalsearch'\n                                         placeholder='" . __s('Search') . "'>";
         echo "</span>";
         Html::closeForm();
     }
     echo "</li>";
     echo "</ul>";
     echo "</div>\n";
     echo "</div>";
     ///Main menu
     echo "<div id='c_menu'>";
     echo "<ul id='menu'>";
     // Get object-variables and build the navigation-elements
     $i = 1;
     foreach ($menu as $part => $data) {
         if (isset($data['content']) && count($data['content'])) {
             $menu_class = "";
             if (isset($menu[$sector]) && $menu[$sector]['title'] == $data['title']) {
                 $menu_class = "active";
             }
             echo "<li id='menu{$i}' class='{$menu_class}' onmouseover=\"javascript:menuAff('menu{$i}','menu');\" >";
             $link = "#";
             if (isset($data['default']) && !empty($data['default'])) {
                 $link = $CFG_GLPI["root_doc"] . $data['default'];
             }
             if (Toolbox::strlen($data['title']) > 14) {
                 $data['title'] = Toolbox::substr($data['title'], 0, 14) . "...";
             }
             echo "<a href='{$link}' class='itemP'>" . $data['title'] . "</a>";
             echo "<ul class='ssmenu'>";
             // list menu item
             foreach ($data['content'] as $key => $val) {
                 $menu_class = "";
                 $tmp_active_item = explode("/", $item);
                 $active_item = array_pop($tmp_active_item);
                 if (isset($menu[$sector]['content']) && isset($menu[$sector]['content'][$active_item]) && isset($val['title']) && $menu[$sector]['content'][$active_item]['title'] == $val['title']) {
                     $menu_class = "active";
                 }
                 if (isset($val['page']) && isset($val['title'])) {
                     echo "<li class='{$menu_class}'><a href='" . $CFG_GLPI["root_doc"] . $val['page'] . "'";
                     if (isset($val['shortcut']) && !empty($val['shortcut'])) {
                         if (!isset($already_used_shortcut[$val['shortcut']])) {
                             echo " accesskey='" . $val['shortcut'] . "'";
                             $already_used_shortcut[$val['shortcut']] = $val['shortcut'];
                         }
                         echo ">" . Toolbox::shortcut($val['title'], $val['shortcut']) . "</a></li>\n";
                     } else {
                         echo ">" . $val['title'] . "</a></li>\n";
                     }
                 }
             }
             echo "</ul></li>";
             $i++;
         }
     }
     echo "</ul>";
     // #menu
     // Display MENU ALL
     echo "<div id='show_all_menu' class='invisible'>";
     $items_per_columns = 15;
     $i = -1;
     foreach ($menu as $part => $data) {
         if (isset($data['content']) && count($data['content'])) {
             echo "<table class='all_menu_block'>";
             $link = "#";
             if (isset($data['default']) && !empty($data['default'])) {
                 $link = $CFG_GLPI["root_doc"] . $data['default'];
             }
             echo "<tr><td class='tab_bg_1 b'>";
             echo "<a href='{$link}' title=\"" . $data['title'] . "\" class='itemP'>" . $data['title'] . "</a>";
             echo "</td></tr>";
             $i++;
             // list menu item
             foreach ($data['content'] as $key => $val) {
                 /*if ($i > $items_per_columns) {
                      $i = 0;
                      echo "</table></td><td class='top'><table>";
                   }*/
                 if (isset($val['page']) && isset($val['title'])) {
                     echo "<tr><td><a href='" . $CFG_GLPI["root_doc"] . $val['page'] . "'";
                     if (isset($data['shortcut']) && !empty($data['shortcut'])) {
                         echo " accesskey='" . $val['shortcut'] . "'";
                     }
                     echo ">" . $val['title'] . "</a></td></tr>\n";
                     $i++;
                 }
             }
             echo "</table>";
         }
     }
     echo "</div>";
     Html::scriptStart();
     echo self::jsGetElementbyID('show_all_menu') . ".dialog({\n         height: 'auto',\n         width: 'auto',\n         modal: true,\n         autoOpen: false\n         });";
     echo Html::scriptEnd();
     /// MENU ALL
     echo "<a href='#' onClick=\"" . self::jsGetElementbyID('show_all_menu') . ".dialog('open');\"\n            id='menu_all_button' class='button-icon'>";
     echo "</a>";
     echo "</div>";
     // End navigation bar
     // End headline
     //  Le fil d ariane
     echo "<div id='c_ssmenu2' >";
     echo "<ul>";
     // Display item
     echo "<li class='breadcrumb_item'><a href='" . $CFG_GLPI["root_doc"] . "/front/central.php' title=\"" . __s('Home') . "\">" . __('Home') . "</a></li>";
     if (isset($menu[$sector])) {
         $link = "/front/central.php";
         if (isset($menu[$sector]['default'])) {
             $link = $menu[$sector]['default'];
         }
         echo "<li class='breadcrumb_item'><a href='" . $CFG_GLPI["root_doc"] . $link . "' title=\"" . $menu[$sector]['title'] . "\">" . $menu[$sector]['title'] . "</a></li>";
     }
     if (isset($menu[$sector]['content'][$item])) {
         // Title
         $with_option = false;
         if (!empty($option) && isset($menu[$sector]['content'][$item]['options'][$option]['title']) && isset($menu[$sector]['content'][$item]['options'][$option]['page'])) {
             $with_option = true;
         }
         if (isset($menu[$sector]['content'][$item]['page'])) {
             echo "<li class='breadcrumb_item'><a href='" . $CFG_GLPI["root_doc"] . $menu[$sector]['content'][$item]['page'] . "' " . ($with_option ? "" : "class='here'") . " title=\"" . $menu[$sector]['content'][$item]['title'] . "\" >" . $menu[$sector]['content'][$item]['title'] . "</a>" . "</li>";
         }
         if ($with_option) {
             echo "<li class='breadcrumb_item'><a href='" . $CFG_GLPI["root_doc"] . $menu[$sector]['content'][$item]['options'][$option]['page'] . "' class='here' title=\"" . $menu[$sector]['content'][$item]['options'][$option]['title'] . "\" >";
             echo self::resume_name($menu[$sector]['content'][$item]['options'][$option]['title'], 17);
             echo "</a></li>";
         }
         $links = array();
         // Item with Option case
         if (!empty($option) && isset($menu[$sector]['content'][$item]['options'][$option]['links']) && is_array($menu[$sector]['content'][$item]['options'][$option]['links'])) {
             $links = $menu[$sector]['content'][$item]['options'][$option]['links'];
             // Without option case : only item links
         } else {
             if (isset($menu[$sector]['content'][$item]['links']) && is_array($menu[$sector]['content'][$item]['links'])) {
                 $links = $menu[$sector]['content'][$item]['links'];
             }
         }
         // Add item
         echo "<li class='icons_block'>";
         echo "<span>";
         if (isset($links['add'])) {
             echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_add.png", array('alt' => __('Add'), 'url' => $CFG_GLPI["root_doc"] . $links['add']));
         } else {
             echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_add_off.png", array('alt' => __('Add')));
         }
         echo "</span>";
         // Search Item
         echo "<span>";
         if (isset($links['search'])) {
             echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_search.png", array('alt' => __('Search'), 'url' => $CFG_GLPI["root_doc"] . $links['search']));
         } else {
             echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_search_off.png", array('alt' => __('Search')));
         }
         echo "</span>";
         // Links
         if (count($links) > 0) {
             foreach ($links as $key => $val) {
                 switch ($key) {
                     case "add":
                     case "search":
                         break;
                     case "template":
                         echo "<span>";
                         echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_addtemplate.png", array('alt' => __('Manage templates...'), 'url' => $CFG_GLPI["root_doc"] . $val));
                         echo "</span>";
                         break;
                     case "showall":
                         echo "<span>";
                         echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_showall.png", array('alt' => __('Show all'), 'url' => $CFG_GLPI["root_doc"] . $val));
                         echo "</span>";
                         break;
                     case "summary":
                         echo "<span>";
                         echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_show.png", array('alt' => __('Summary'), 'url' => $CFG_GLPI["root_doc"] . $val));
                         echo "</span>";
                         break;
                     case "config":
                         echo "<span>";
                         echo Html::image($CFG_GLPI["root_doc"] . "/pics/menu_config.png", array('alt' => __('Setup'), 'url' => $CFG_GLPI["root_doc"] . $val));
                         echo "</span>";
                         break;
                     default:
                         echo "<span>" . Html::link($key, $CFG_GLPI["root_doc"] . $val) . "</span>";
                         break;
                 }
             }
         }
         echo "</li>";
     } else {
         echo "<li>&nbsp;</li>";
     }
     // Add common items
     // Profile selector
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/central.php");
     }
     echo "</ul>";
     echo "</div>";
     echo "</div>\n";
     // fin header
     echo "<div id='page' >";
     if ($DB->isSlave() && !$DB->first_connection) {
         echo "<div id='dbslave-float'>";
         echo "<a href='#see_debug'>" . __('MySQL replica: read only') . "</a>";
         echo "</div>";
     }
     // Back to top
     Html::scriptStart();
     echo "\$(document).ready(function(){\n               BackToTop({\n               text : '^',\n               class: 'vsubmit',\n               autoShow : true,\n               timeEffect : 100,\n               autoShowOffset : '0',\n               appearMethod : '',\n               effectScroll : 'linear'\n               });\n            });";
     echo Html::scriptEnd();
     // call static function callcron() every 5min
     CronTask::callCron();
     self::displayMessageAfterRedirect();
 }
Ejemplo n.º 3
0
 /**
  * Print a nice HTML head for every page
  *
  * @param $title     title of the page
  * @param $url       not used anymore (default '')
  * @param $sector    sector in which the page displayed is (default 'none')
  * @param $item      item corresponding to the page displayed (default 'none')
  * @param $option    option corresponding to the page displayed (default '')
  **/
 static function header($title, $url = '', $sector = "none", $item = "none", $option = "")
 {
     global $CFG_GLPI, $PLUGIN_HOOKS, $HEADER_LOADED, $DB;
     // Print a nice HTML-head for every page
     if ($HEADER_LOADED) {
         return;
     }
     $HEADER_LOADED = true;
     self::includeHeader($title);
     // Body
     echo "<body>";
     // Generate array for menu and check right
     // INVENTORY
     $showallassets = false;
     $menu['inventory']['title'] = __('Assets');
     if (Session::haveRight("computer", "r")) {
         $menu['inventory']['default'] = '/front/computer.php';
         $menu['inventory']['content']['computer']['title'] = _n('Computer', 'Computers', 2);
         $menu['inventory']['content']['computer']['shortcut'] = 'o';
         $menu['inventory']['content']['computer']['page'] = '/front/computer.php';
         $menu['inventory']['content']['computer']['links']['search'] = '/front/computer.php';
         if (Session::haveRight("computer", "w")) {
             $menu['inventory']['content']['computer']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Computer&amp;add=1';
             $menu['inventory']['content']['computer']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Computer&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("monitor", "r")) {
         $menu['inventory']['content']['monitor']['title'] = _n('Monitor', 'Monitors', 2);
         $menu['inventory']['content']['monitor']['shortcut'] = '';
         $menu['inventory']['content']['monitor']['page'] = '/front/monitor.php';
         $menu['inventory']['content']['monitor']['links']['search'] = '/front/monitor.php';
         if (Session::haveRight("monitor", "w")) {
             $menu['inventory']['content']['monitor']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Monitor&amp;add=1';
             $menu['inventory']['content']['monitor']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Monitor&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("software", "r")) {
         $menu['inventory']['content']['software']['title'] = _n('Software', 'Software', 2);
         $menu['inventory']['content']['software']['shortcut'] = 's';
         $menu['inventory']['content']['software']['page'] = '/front/software.php';
         $menu['inventory']['content']['software']['links']['search'] = '/front/software.php';
         if (Session::haveRight("software", "w")) {
             $menu['inventory']['content']['software']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Software&amp;add=1';
             $menu['inventory']['content']['software']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Software&amp;add=0';
         }
     }
     if (Session::haveRight("networking", "r")) {
         $menu['inventory']['content']['networking']['title'] = _n('Network', 'Networks', 2);
         $menu['inventory']['content']['networking']['shortcut'] = '';
         $menu['inventory']['content']['networking']['page'] = '/front/networkequipment.php';
         $menu['inventory']['content']['networking']['links']['search'] = '/front/networkequipment.php';
         $menu['inventory']['content']['networking']['options']['networkport']['title'] = _n('Network port', 'Network ports', 2);
         $menu['inventory']['content']['networking']['options']['networkport']['page'] = '/front/networkport.form.php';
         $menu['inventory']['content']['networking']['options']['networkport']['links'] = array();
         if (Session::haveRight("networking", "w")) {
             $menu['inventory']['content']['networking']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=NetworkEquipment&amp;add=1';
             $menu['inventory']['content']['networking']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=NetworkEquipment&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("peripheral", "r")) {
         $menu['inventory']['content']['peripheral']['title'] = _n('Device', 'Devices', 2);
         $menu['inventory']['content']['peripheral']['shortcut'] = '';
         $menu['inventory']['content']['peripheral']['page'] = '/front/peripheral.php';
         $menu['inventory']['content']['peripheral']['links']['search'] = '/front/peripheral.php';
         if (Session::haveRight("peripheral", "w")) {
             $menu['inventory']['content']['peripheral']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Peripheral&amp;add=1';
             $menu['inventory']['content']['peripheral']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Peripheral&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("printer", "r")) {
         $menu['inventory']['content']['printer']['title'] = _n('Printer', 'Printers', 2);
         $menu['inventory']['content']['printer']['shortcut'] = '';
         $menu['inventory']['content']['printer']['page'] = '/front/printer.php';
         $menu['inventory']['content']['printer']['links']['search'] = '/front/printer.php';
         if (Session::haveRight("printer", "w")) {
             $menu['inventory']['content']['printer']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Printer&amp;add=1';
             $menu['inventory']['content']['printer']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Printer&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("cartridge", "r")) {
         $menu['inventory']['content']['cartridge']['title'] = _n('Cartridge', 'Cartridges', 2);
         $menu['inventory']['content']['cartridge']['shortcut'] = '';
         $menu['inventory']['content']['cartridge']['page'] = '/front/cartridgeitem.php';
         $menu['inventory']['content']['cartridge']['links']['search'] = '/front/cartridgeitem.php';
         if (Session::haveRight("cartridge", "w")) {
             $menu['inventory']['content']['cartridge']['links']['add'] = '/front/cartridgeitem.form.php';
         }
     }
     if (Session::haveRight("consumable", "r")) {
         $menu['inventory']['content']['consumable']['title'] = _n('Consumable', 'Consumables', 2);
         $menu['inventory']['content']['consumable']['shortcut'] = '';
         $menu['inventory']['content']['consumable']['page'] = '/front/consumableitem.php';
         $menu['inventory']['content']['consumable']['links']['search'] = '/front/consumableitem.php';
         if (Session::haveRight("consumable", "w")) {
             $menu['inventory']['content']['consumable']['links']['add'] = '/front/consumableitem.form.php';
         }
         $menu['inventory']['content']['consumable']['links']['summary'] = '/front/consumableitem.php?' . 'synthese=yes';
     }
     if (Session::haveRight("phone", "r")) {
         $menu['inventory']['content']['phone']['title'] = _n('Phone', 'Phones', 2);
         $menu['inventory']['content']['phone']['shortcut'] = '';
         $menu['inventory']['content']['phone']['page'] = '/front/phone.php';
         $menu['inventory']['content']['phone']['links']['search'] = '/front/phone.php';
         if (Session::haveRight("phone", "w")) {
             $menu['inventory']['content']['phone']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Phone&amp;add=1';
             $menu['inventory']['content']['phone']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Phone&amp;add=0';
         }
         $showallassets = true;
     }
     if ($showallassets) {
         $menu['inventory']['content']['allassets']['title'] = __('Global');
         $menu['inventory']['content']['allassets']['shortcut'] = '';
         $menu['inventory']['content']['allassets']['page'] = '/front/allassets.php';
         $menu['inventory']['content']['allassets']['links']['search'] = '/front/allassets.php';
     }
     // ASSISTANCE
     $menu['maintain']['title'] = __('Assistance');
     if (Session::haveRight("observe_ticket", "1") || Session::haveRight("show_all_ticket", "1") || Session::haveRight("create_ticket", "1")) {
         $menu['maintain']['default'] = '/front/ticket.php';
         $menu['maintain']['content']['ticket']['title'] = _n('Ticket', 'Tickets', 2);
         $menu['maintain']['content']['ticket']['shortcut'] = 't';
         $menu['maintain']['content']['ticket']['page'] = '/front/ticket.php';
         $menu['maintain']['content']['ticket']['links']['search'] = '/front/ticket.php';
         if (Session::haveRight('tickettemplate', 'r')) {
             $menu['maintain']['content']['ticket']['options']['TicketTemplate']['title'] = _n('Ticket template', 'Ticket templates', 2);
             $menu['maintain']['content']['ticket']['options']['TicketTemplate']['page'] = '/front/tickettemplate.php';
             $menu['maintain']['content']['ticket']['options']['TicketTemplate']['links']['search'] = '/front/tickettemplate.php';
             if (Session::haveRight('tickettemplate', 'w')) {
                 $menu['maintain']['content']['ticket']['options']['TicketTemplate']['links']['add'] = '/front/tickettemplate.form.php';
             }
             $menu['maintain']['content']['ticket']['links']['template'] = '/front/tickettemplate.php';
         }
         if (Session::haveRight('validate_incident', 1) || Session::haveRight('validate_request', 1)) {
             $opt = array();
             $opt['reset'] = 'reset';
             $opt['field'][0] = 55;
             // validation status
             $opt['searchtype'][0] = 'equals';
             $opt['contains'][0] = 'waiting';
             $opt['link'][0] = 'AND';
             $opt['field'][1] = 59;
             // validation aprobator
             $opt['searchtype'][1] = 'equals';
             $opt['contains'][1] = Session::getLoginUserID();
             $opt['link'][1] = 'AND';
             $pic_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'>";
             $menu['maintain']['content']['ticket']['links'][$pic_validate] = '/front/ticket.php?' . Toolbox::append_params($opt, '&amp;');
         }
     }
     if (Session::haveRight("create_ticket", "1")) {
         $menu['maintain']['content']['ticket']['links']['add'] = '/front/ticket.form.php';
     }
     if (Session::haveRight("show_all_problem", "1") || Session::haveRight("show_my_problem", "1") || Session::haveRight("delete_problem", "1")) {
         $menu['maintain']['content']['problem']['title'] = _n('Problem', 'Problems', 2);
         $menu['maintain']['content']['problem']['shortcut'] = '';
         $menu['maintain']['content']['problem']['page'] = '/front/problem.php';
         $menu['maintain']['content']['problem']['links']['search'] = '/front/problem.php';
         if (Session::haveRight("edit_all_problem", "1")) {
             $menu['maintain']['content']['problem']['links']['add'] = '/front/problem.form.php';
         }
     }
     //       if (Session::haveRight("show_all_change","1")
     //           || Session::haveRight("show_my_change","1")) {
     //          $menu['maintain']['content']['change']['title']           = _n('Change', 'Changes', 2);
     //          $menu['maintain']['content']['change']['shortcut']        = '';
     //          $menu['maintain']['content']['change']['page']            = '/front/change.php';
     //          $menu['maintain']['content']['change']['links']['search'] = '/front/change.php';
     //          if (Session::haveRight("edit_all_change","1")) {
     //             $menu['maintain']['content']['change']['links']['add'] = '/front/change.form.php';
     //          }
     //       }
     if (Session::haveRight("show_planning", "1") || Session::haveRight("show_all_planning", "1") || Session::haveRight("show_group_planning", "1")) {
         $menu['maintain']['content']['planning']['title'] = __('Planning');
         $menu['maintain']['content']['planning']['shortcut'] = 'p';
         $menu['maintain']['content']['planning']['page'] = '/front/planning.php';
         $menu['maintain']['content']['planning']['links']['search'] = '/front/planning.php';
     }
     if (Session::haveRight("statistic", "1")) {
         $menu['maintain']['content']['stat']['title'] = __('Statistics');
         $menu['maintain']['content']['stat']['shortcut'] = 'a';
         $menu['maintain']['content']['stat']['page'] = '/front/stat.php';
     }
     if (Session::haveRight("ticketrecurrent", "r")) {
         $menu['maintain']['content']['ticketrecurrent']['title'] = __('Recurrent tickets');
         $menu['maintain']['content']['ticketrecurrent']['shortcut'] = '';
         $menu['maintain']['content']['ticketrecurrent']['page'] = '/front/ticketrecurrent.php';
         $menu['maintain']['content']['ticketrecurrent']['links']['search'] = '/front/ticketrecurrent.php';
         if (Session::haveRight("ticketrecurrent", "w")) {
             $menu['maintain']['content']['ticketrecurrent']['links']['add'] = '/front/ticketrecurrent.form.php';
         }
     }
     // FINANCIAL
     $menu['financial']['title'] = __('Management');
     if (Session::haveRight("budget", "r")) {
         $menu['financial']['default'] = '/front/budget.php';
         $menu['financial']['content']['budget']['title'] = _n('Budget', 'Budgets', 2);
         $menu['financial']['content']['budget']['shortcut'] = '';
         $menu['financial']['content']['budget']['page'] = '/front/budget.php';
         $menu['financial']['content']['budget']['links']['search'] = '/front/budget.php';
         if (Session::haveRight("budget", "w")) {
             $menu['financial']['content']['budget']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Budget&amp;add=1';
             $menu['financial']['content']['budget']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Budget&amp;add=0';
         }
     }
     if (Session::haveRight("contact_enterprise", "r")) {
         $menu['financial']['content']['supplier']['title'] = _n('Supplier', 'Suppliers', 2);
         $menu['financial']['content']['supplier']['shortcut'] = '';
         $menu['financial']['content']['supplier']['page'] = '/front/supplier.php';
         $menu['financial']['content']['supplier']['links']['search'] = '/front/supplier.php';
         $menu['financial']['content']['contact']['title'] = _n('Contact', 'Contacts', 2);
         $menu['financial']['content']['contact']['shortcut'] = '';
         $menu['financial']['content']['contact']['page'] = '/front/contact.php';
         $menu['financial']['content']['contact']['links']['search'] = '/front/contact.php';
         if (Session::haveRight("contact_enterprise", "w")) {
             $menu['financial']['content']['contact']['links']['add'] = '/front/contact.form.php';
             $menu['financial']['content']['supplier']['links']['add'] = '/front/supplier.form.php';
         }
     }
     if (Session::haveRight("contract", "r")) {
         $menu['financial']['content']['contract']['title'] = _n('Contract', 'Contracts', 2);
         $menu['financial']['content']['contract']['shortcut'] = '';
         $menu['financial']['content']['contract']['page'] = '/front/contract.php';
         $menu['financial']['content']['contract']['links']['search'] = '/front/contract.php';
         if (Session::haveRight("contract", "w")) {
             $menu['financial']['content']['contract']['links']['add'] = '/front/setup.templates.php?itemtype=Contract&amp;add=1';
             $menu['financial']['content']['contract']['links']['template'] = '/front/setup.templates.php?itemtype=Contract&amp;add=0';
         }
     }
     if (Session::haveRight("document", "r")) {
         $menu['financial']['content']['document']['title'] = _n('Document', 'Documents', 2);
         $menu['financial']['content']['document']['shortcut'] = 'd';
         $menu['financial']['content']['document']['page'] = '/front/document.php';
         $menu['financial']['content']['document']['links']['search'] = '/front/document.php';
         if (Session::haveRight("document", "w")) {
             $menu['financial']['content']['document']['links']['add'] = '/front/document.form.php';
         }
     }
     // UTILS
     $menu['utils']['title'] = __('Tools');
     $menu['utils']['default'] = '/front/reminder.php';
     if (Session::haveRight('reminder_public', 'r')) {
         $menu['utils']['content']['reminder']['title'] = _n('Reminder', 'Reminders', 2);
     } else {
         $menu['utils']['content']['reminder']['title'] = _n('Personal reminder', 'Personal reminders', 2);
     }
     $menu['utils']['content']['reminder']['page'] = '/front/reminder.php';
     $menu['utils']['content']['reminder']['links']['search'] = '/front/reminder.php';
     $menu['utils']['content']['reminder']['links']['add'] = '/front/reminder.form.php';
     $menu['utils']['content']['rssfeed']['title'] = _n('RSS feed', 'RSS feeds', 2);
     $menu['utils']['content']['rssfeed']['page'] = '/front/rssfeed.php';
     $menu['utils']['content']['rssfeed']['links']['search'] = '/front/rssfeed.php';
     $menu['utils']['content']['rssfeed']['links']['add'] = '/front/rssfeed.form.php';
     if (Session::haveRight("knowbase", "r") || Session::haveRight("faq", "r")) {
         if (Session::haveRight("knowbase", "r")) {
             $menu['utils']['content']['knowbase']['title'] = __('Knowledge base');
         } else {
             $menu['utils']['content']['knowbase']['title'] = __('FAQ');
         }
         $menu['utils']['content']['knowbase']['shortcut'] = 'b';
         $menu['utils']['content']['knowbase']['page'] = '/front/knowbaseitem.php';
         $menu['utils']['content']['knowbase']['links']['search'] = '/front/knowbaseitem.php';
         if (Session::haveRight("knowbase", "w") || Session::haveRight("faq", "w")) {
             $menu['utils']['content']['knowbase']['links']['add'] = '/front/knowbaseitem.form.php?id=new';
         }
     }
     if (Session::haveRight("reservation_helpdesk", "1") || Session::haveRight("reservation_central", "r")) {
         $menu['utils']['content']['reservation']['title'] = _n('Reservation', 'Reservations', 2);
         $menu['utils']['content']['reservation']['shortcut'] = 'r';
         $menu['utils']['content']['reservation']['page'] = '/front/reservationitem.php';
         $menu['utils']['content']['reservation']['links']['search'] = '/front/reservationitem.php';
         $menu['utils']['content']['reservation']['links']['showall'] = '/front/reservation.php';
     }
     if (Session::haveRight("reports", "r")) {
         $menu['utils']['content']['report']['title'] = _n('Report', 'Reports', 2);
         $menu['utils']['content']['report']['shortcut'] = 'e';
         $menu['utils']['content']['report']['page'] = '/front/report.php';
     }
     if (!isset($_SESSION['glpishowmigrationcleaner'])) {
         if (TableExists('glpi_networkportmigrations') && countElementsInTable('glpi_networkportmigrations') > 0) {
             $_SESSION['glpishowmigrationcleaner'] = true;
         } else {
             $_SESSION['glpishowmigrationcleaner'] = false;
         }
     }
     if ($_SESSION['glpishowmigrationcleaner'] && (Session::haveRight("networking", "w") || Session::haveRight("internet", "w"))) {
         $menu['utils']['content']['migration']['title'] = __('Migration cleaner');
         $menu['utils']['content']['migration']['page'] = '/front/migration_cleaner.php';
         $menu['utils']['content']['migration']['options']['networkportmigration']['title'] = __('Network port migration');
         $menu['utils']['content']['migration']['options']['networkportmigration']['page'] = '/front/networkportmigration.php';
         $menu['utils']['content']['migration']['options']['networkportmigration']['links']['search'] = '/front/networkportmigration.php';
     }
     // PLUGINS
     if (isset($PLUGIN_HOOKS["menu_entry"]) && count($PLUGIN_HOOKS["menu_entry"])) {
         $menu['plugins']['title'] = __('Plugins');
         $plugins = array();
         foreach ($PLUGIN_HOOKS["menu_entry"] as $plugin => $active) {
             if ($active) {
                 // true or a string
                 $plugins[$plugin] = Plugin::getInfo($plugin);
             }
         }
         if (count($plugins)) {
             $list = array();
             foreach ($plugins as $key => $val) {
                 $list[$key] = $val["name"];
             }
             asort($list);
             foreach ($list as $key => $val) {
                 $menu['plugins']['content'][$key]['title'] = $val;
                 $menu['plugins']['content'][$key]['page'] = '/plugins/' . $key . '/';
                 if (is_string($PLUGIN_HOOKS["menu_entry"][$key])) {
                     $menu['plugins']['content'][$key]['page'] .= $PLUGIN_HOOKS["menu_entry"][$key];
                 }
                 // Set default link for plugins
                 if (!isset($menu['plugins']['default'])) {
                     $menu['plugins']['default'] = $menu['plugins']['content'][$key]['page'];
                 }
                 if ($sector == "plugins" && $item == $key) {
                     if (isset($PLUGIN_HOOKS["submenu_entry"][$key]) && is_array($PLUGIN_HOOKS["submenu_entry"][$key])) {
                         foreach ($PLUGIN_HOOKS["submenu_entry"][$key] as $name => $link) {
                             // New complete option management
                             if ($name == "options") {
                                 $menu['plugins']['content'][$key]['options'] = $link;
                             } else {
                                 // Keep it for compatibility
                                 if (is_array($link)) {
                                     // Simple link option
                                     if (isset($link[$option])) {
                                         $menu['plugins']['content'][$key]['links'][$name] = '/plugins/' . $key . '/' . $link[$option];
                                     }
                                 } else {
                                     $menu['plugins']['content'][$key]['links'][$name] = '/plugins/' . $key . '/' . $link;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     /// ADMINISTRATION
     $menu['admin']['title'] = __('Administration');
     if (Session::haveRight("user", "r")) {
         $menu['admin']['default'] = '/front/user.php';
         $menu['admin']['content']['user']['title'] = _n('User', 'Users', 2);
         $menu['admin']['content']['user']['shortcut'] = 'u';
         $menu['admin']['content']['user']['page'] = '/front/user.php';
         $menu['admin']['content']['user']['links']['search'] = '/front/user.php';
         if (Session::haveRight("user", "w")) {
             $menu['admin']['content']['user']['links']['add'] = "/front/user.form.php";
         }
         $menu['admin']['content']['user']['options']['ldap']['title'] = _n('LDAP directory', 'LDAP directories', 2);
         $menu['admin']['content']['user']['options']['ldap']['page'] = "/front/ldap.php";
     }
     if (Session::haveRight("group", "r")) {
         $menu['admin']['content']['group']['title'] = _n('Group', 'Groups', 2);
         $menu['admin']['content']['group']['shortcut'] = 'g';
         $menu['admin']['content']['group']['page'] = '/front/group.php';
         $menu['admin']['content']['group']['links']['search'] = '/front/group.php';
         if (Session::haveRight("group", "w")) {
             $menu['admin']['content']['group']['links']['add'] = "/front/group.form.php";
             $menu['admin']['content']['group']['options']['ldap']['title'] = _n('LDAP directory', 'LDAP directories', 2);
             $menu['admin']['content']['group']['options']['ldap']['page'] = "/front/ldap.group.php";
         }
     }
     if (Session::haveRight("entity", "r")) {
         $menu['admin']['content']['entity']['title'] = _n('Entity', 'Entities', 2);
         $menu['admin']['content']['entity']['shortcut'] = '';
         $menu['admin']['content']['entity']['page'] = '/front/entity.php';
         $menu['admin']['content']['entity']['links']['search'] = '/front/entity.php';
         $menu['admin']['content']['entity']['links']['add'] = "/front/entity.form.php";
     }
     if (Session::haveRight("rule_ldap", "r") || Session::haveRight("rule_import", "r") || Session::haveRight("entity_rule_ticket", "r") || Session::haveRight("rule_softwarecategories", "r") || Session::haveRight("rule_mailcollector", "r")) {
         $menu['admin']['content']['rule']['title'] = _n('Rule', 'Rules', 2);
         $menu['admin']['content']['rule']['shortcut'] = '';
         $menu['admin']['content']['rule']['page'] = '/front/rule.php';
         if ($sector == 'admin' && $item == 'rule') {
             foreach ($CFG_GLPI["rulecollections_types"] as $rulecollectionclass) {
                 $rulecollection = new $rulecollectionclass();
                 if ($rulecollection->canList()) {
                     $ruleclassname = $rulecollection->getRuleClassName();
                     $menu['admin']['content']['rule']['options'][$rulecollection->menu_option]['title'] = $rulecollection->getRuleClass()->getTitle();
                     $menu['admin']['content']['rule']['options'][$rulecollection->menu_option]['page'] = Toolbox::getItemTypeSearchURL($ruleclassname, false);
                     $menu['admin']['content']['rule']['options'][$rulecollection->menu_option]['links']['search'] = Toolbox::getItemTypeSearchURL($ruleclassname, false);
                     if ($rulecollection->canCreate()) {
                         $menu['admin']['content']['rule']['options'][$rulecollection->menu_option]['links']['add'] = Toolbox::getItemTypeFormURL($ruleclassname, false);
                     }
                 }
             }
         }
     }
     if (Session::haveRight("transfer", "r") && Session::isMultiEntitiesMode()) {
         $menu['admin']['content']['rule']['options']['transfer']['title'] = __('Transfer');
         $menu['admin']['content']['rule']['options']['transfer']['page'] = "/front/transfer.php";
         $menu['admin']['content']['rule']['options']['transfer']['links']['search'] = "/front/transfer.php";
         if (Session::haveRight("transfer", "w")) {
             $menu['admin']['content']['rule']['options']['transfer']['links']['summary'] = "/front/transfer.action.php";
             $menu['admin']['content']['rule']['options']['transfer']['links']['add'] = "/front/transfer.form.php";
         }
     }
     if (Session::haveRight("rule_dictionnary_dropdown", "r") || Session::haveRight("rule_dictionnary_software", "r") || Session::haveRight("rule_dictionnary_printer", "r")) {
         $menu['admin']['content']['dictionnary']['title'] = __('Dictionaries');
         $menu['admin']['content']['dictionnary']['shortcut'] = '';
         $menu['admin']['content']['dictionnary']['page'] = '/front/dictionnary.php';
         if ($sector == 'admin' && $item == 'dictionnary') {
             $menu['admin']['content']['dictionnary']['options']['manufacturers']['title'] = _n('Manufacturer', 'Manufacturers', 2);
             $menu['admin']['content']['dictionnary']['options']['manufacturers']['page'] = '/front/ruledictionnarymanufacturer.php';
             $menu['admin']['content']['dictionnary']['options']['manufacturers']['links']['search'] = '/front/ruledictionnarymanufacturer.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['manufacturers']['links']['add'] = '/front/ruledictionnarymanufacturer.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['software']['title'] = _n('Software', 'Software', 2);
             $menu['admin']['content']['dictionnary']['options']['software']['page'] = '/front/ruledictionnarysoftware.php';
             $menu['admin']['content']['dictionnary']['options']['software']['links']['search'] = '/front/ruledictionnarysoftware.php';
             if (Session::haveRight("rule_dictionnary_software", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['software']['links']['add'] = '/front/ruledictionnarysoftware.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['model.computer']['title'] = _n('Computer model', 'Computer models', 2);
             $menu['admin']['content']['dictionnary']['options']['model.computer']['page'] = '/front/ruledictionnarycomputermodel.php';
             $menu['admin']['content']['dictionnary']['options']['model.computer']['links']['search'] = '/front/ruledictionnarycomputermodel.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['model.computer']['links']['add'] = '/front/ruledictionnarycomputermodel.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['model.monitor']['title'] = _n('Monitor model', 'Monitor models', 2);
             $menu['admin']['content']['dictionnary']['options']['model.monitor']['page'] = '/front/ruledictionnarymonitormodel.php';
             $menu['admin']['content']['dictionnary']['options']['model.monitor']['links']['search'] = '/front/ruledictionnarymonitormodel.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['model.monitor']['links']['add'] = '/front/ruledictionnarymonitormodel.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['model.printer']['title'] = _n('Printer model', 'Printer models', 2);
             $menu['admin']['content']['dictionnary']['options']['model.printer']['page'] = '/front/ruledictionnaryprintermodel.php';
             $menu['admin']['content']['dictionnary']['options']['model.printer']['links']['search'] = '/front/ruledictionnaryprintermodel.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['model.printer']['links']['add'] = '/front/ruledictionnaryprintermodel.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['model.peripheral']['title'] = _n('Peripheral model', 'Peripheral models', 2);
             $menu['admin']['content']['dictionnary']['options']['model.peripheral']['page'] = '/front/ruledictionnaryperipheralmodel.php';
             $menu['admin']['content']['dictionnary']['options']['model.peripheral']['links']['search'] = '/front/ruledictionnaryperipheralmodel.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['model.peripheral']['links']['add'] = '/front/ruledictionnaryperipheralmodel.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['model.networking']['title'] = _n('Networking equipment model', 'Networking equipment models', 2);
             $menu['admin']['content']['dictionnary']['options']['model.networking']['page'] = '/front/ruledictionnarynetworkequipmentmodel.php';
             $menu['admin']['content']['dictionnary']['options']['model.networking']['links']['search'] = '/front/ruledictionnarynetworkequipmentmodel.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['model.networking']['links']['add'] = '/front/ruledictionnarynetworkequipmentmodel.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['model.phone']['title'] = _n('Phone model', 'Phone models', 2);
             $menu['admin']['content']['dictionnary']['options']['model.phone']['page'] = '/front/ruledictionnaryphonemodel.php';
             $menu['admin']['content']['dictionnary']['options']['model.phone']['links']['search'] = '/front/ruledictionnaryphonemodel.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['model.phone']['links']['add'] = '/front/ruledictionnaryphonemodel.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['type.computer']['title'] = _n('Computer type', 'Computer types', 2);
             $menu['admin']['content']['dictionnary']['options']['type.computer']['page'] = '/front/ruledictionnarycomputertype.php';
             $menu['admin']['content']['dictionnary']['options']['type.computer']['links']['search'] = '/front/ruledictionnarycomputertype.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['type.computer']['links']['add'] = '/front/ruledictionnarycomputertype.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['type.monitor']['title'] = _n('Monitor type', 'Monitors types', 2);
             $menu['admin']['content']['dictionnary']['options']['type.monitor']['page'] = '/front/ruledictionnarymonitortype.php';
             $menu['admin']['content']['dictionnary']['options']['type.monitor']['links']['search'] = '/front/ruledictionnarymonitortype.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['type.monitor']['links']['add'] = '/front/ruledictionnarymonitortype.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['type.printer']['title'] = _n('Printer type', 'Printer types', 2);
             $menu['admin']['content']['dictionnary']['options']['type.printer']['page'] = '/front/ruledictionnaryprintertype.php';
             $menu['admin']['content']['dictionnary']['options']['type.printer']['links']['search'] = '/front/ruledictionnaryprintertype.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['type.printer']['links']['add'] = '/front/ruledictionnaryprintertype.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['type.peripheral']['title'] = _n('Peripheral type', 'Peripheral types', 2);
             $menu['admin']['content']['dictionnary']['options']['type.peripheral']['page'] = '/front/ruledictionnaryperipheraltype.php';
             $menu['admin']['content']['dictionnary']['options']['type.peripheral']['links']['search'] = '/front/ruledictionnaryperipheraltype.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['type.peripheral']['links']['add'] = '/front/ruledictionnaryperipheraltype.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['type.networking']['title'] = _n('Networking equipment type', 'Networking equipment types', 2);
             $menu['admin']['content']['dictionnary']['options']['type.networking']['page'] = '/front/ruledictionnarynetworkequipmenttype.php';
             $menu['admin']['content']['dictionnary']['options']['type.networking']['links']['search'] = '/front/ruledictionnarynetworkequipmenttype.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['type.networking']['links']['add'] = '/front/ruledictionnarynetworkequipmenttype.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['type.phone']['title'] = _n('Phone type', 'Phone types', 2);
             $menu['admin']['content']['dictionnary']['options']['type.phone']['page'] = '/front/ruledictionnaryphonetype.php';
             $menu['admin']['content']['dictionnary']['options']['type.phone']['links']['search'] = '/front/ruledictionnaryphonetype.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['type.phone']['links']['add'] = '/front/ruledictionnaryphonetype.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['os']['title'] = __('Operating system');
             $menu['admin']['content']['dictionnary']['options']['os']['page'] = '/front/ruledictionnaryoperatingsystem.php';
             $menu['admin']['content']['dictionnary']['options']['os']['links']['search'] = '/front/ruledictionnaryoperatingsystem.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['os']['links']['add'] = '/front/ruledictionnaryoperatingsystem.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['os_sp']['title'] = __('Service pack');
             $menu['admin']['content']['dictionnary']['options']['os_sp']['page'] = '/front/ruledictionnaryoperatingsystemservicepack.php';
             $menu['admin']['content']['dictionnary']['options']['os_sp']['links']['search'] = '/front/ruledictionnaryoperatingsystemservicepack.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['os_sp']['links']['add'] = '/front/ruledictionnaryoperatingsystemservicepack.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['os_version']['title'] = __('Version of the operating system');
             $menu['admin']['content']['dictionnary']['options']['os_version']['page'] = '/front/ruledictionnaryoperatingsystemversion.php';
             $menu['admin']['content']['dictionnary']['options']['os_version']['links']['search'] = '/front/ruledictionnaryoperatingsystemversion.php';
             if (Session::haveRight("rule_dictionnary_dropdown", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['os_version']['links']['add'] = '/front/ruledictionnaryoperatingsystemversion.form.php';
             }
             $menu['admin']['content']['dictionnary']['options']['printer']['title'] = _n('Printer', 'Printers', 2);
             $menu['admin']['content']['dictionnary']['options']['printer']['page'] = '/front/ruledictionnaryprinter.php';
             $menu['admin']['content']['dictionnary']['options']['printer']['links']['search'] = '/front/ruledictionnaryprinter.php';
             if (Session::haveRight("rule_dictionnary_printer", "w")) {
                 $menu['admin']['content']['dictionnary']['options']['printer']['links']['add'] = '/front/ruledictionnaryprinter.form.php';
             }
         }
     }
     if (Session::haveRight("profile", "r")) {
         $menu['admin']['content']['profile']['title'] = _n('Profile', 'Profiles', 2);
         $menu['admin']['content']['profile']['shortcut'] = '';
         $menu['admin']['content']['profile']['page'] = '/front/profile.php';
         $menu['admin']['content']['profile']['links']['search'] = "/front/profile.php";
         if (Session::haveRight("profile", "w")) {
             $menu['admin']['content']['profile']['links']['add'] = "/front/profile.form.php";
         }
     }
     if (Session::haveRight("backup", "w")) {
         $menu['admin']['content']['backup']['title'] = __('Maintenance');
         $menu['admin']['content']['backup']['shortcut'] = '';
         $menu['admin']['content']['backup']['page'] = '/front/backup.php';
     }
     if (Session::haveRight("logs", "r")) {
         $menu['admin']['content']['log']['title'] = _n('Log', 'Logs', 2);
         $menu['admin']['content']['log']['shortcut'] = '';
         $menu['admin']['content']['log']['page'] = '/front/event.php';
     }
     /// CONFIG
     $config = array();
     $addconfig = array();
     $menu['config']['title'] = __('Setup');
     if (Session::haveRight("dropdown", "r") || Session::haveRight("entity_dropdown", "r") || Session::haveRight("internet", "r")) {
         $menu['config']['content']['dropdowns']['title'] = _n('Dropdown', 'Dropdowns', 2);
         $menu['config']['content']['dropdowns']['shortcut'] = 'n';
         $menu['config']['content']['dropdowns']['page'] = '/front/dropdown.php';
         $menu['config']['default'] = '/front/dropdown.php';
         if ($item == "dropdowns") {
             $dps = Dropdown::getStandardDropdownItemTypes();
             foreach ($dps as $tab) {
                 foreach ($tab as $key => $val) {
                     if ($key == $option) {
                         if ($tmp = getItemForItemtype($key)) {
                             $menu['config']['content']['dropdowns']['options'][$option]['title'] = $val;
                             $menu['config']['content']['dropdowns']['options'][$option]['page'] = $tmp->getSearchURL(false);
                             $menu['config']['content']['dropdowns']['options'][$option]['links']['search'] = $tmp->getSearchURL(false);
                             if ($tmp->canCreate()) {
                                 $menu['config']['content']['dropdowns']['options'][$option]['links']['add'] = $tmp->getFormURL(false);
                             }
                         }
                     }
                 }
             }
         }
     }
     if (Session::haveRight("device", "w")) {
         $menu['config']['content']['device']['title'] = _n('Component', 'Components', 2);
         $menu['config']['content']['device']['page'] = '/front/device.php';
         if ($item == "device") {
             $dps = Dropdown::getDeviceItemTypes();
             foreach ($dps as $tab) {
                 foreach ($tab as $key => $val) {
                     if ($key == $option) {
                         if ($tmp = getItemForItemtype($key)) {
                             $menu['config']['content']['device']['options'][$option]['title'] = $val;
                             $menu['config']['content']['device']['options'][$option]['page'] = $tmp->getSearchURL(false);
                             $menu['config']['content']['device']['options'][$option]['links']['search'] = $tmp->getSearchURL(false);
                             if ($tmp->canCreate()) {
                                 $menu['config']['content']['device']['options'][$option]['links']['add'] = $tmp->getFormURL(false);
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($CFG_GLPI['use_mailing'] && Session::haveRight("notification", "r") || Session::haveRight("config", "w")) {
         $menu['config']['content']['mailing']['title'] = _n('Notification', 'Notifications', 2);
         $menu['config']['content']['mailing']['page'] = '/front/setup.notification.php';
         $menu['config']['content']['mailing']['options']['notification']['title'] = _n('Notification', 'Notifications', 2);
         $menu['config']['content']['mailing']['options']['notification']['page'] = '/front/notification.php';
         $menu['config']['content']['mailing']['options']['notification']['links']['add'] = '/front/notification.form.php';
         $menu['config']['content']['mailing']['options']['notification']['links']['search'] = '/front/notification.php';
     }
     if (Session::haveRight("sla", "r")) {
         $menu['config']['content']['sla']['title'] = _n('SLA', 'SLA', 2);
         $menu['config']['content']['sla']['page'] = '/front/sla.php';
         $menu['config']['content']['sla']['links']['search'] = "/front/sla.php";
         if (Session::haveRight("sla", "w")) {
             $menu['config']['content']['sla']['links']['add'] = "/front/sla.form.php";
         }
     }
     if (Session::haveRight("config", "w")) {
         //TRANS: menu title for "General setup""
         $menu['config']['content']['config']['title'] = _x('setup', 'General');
         $menu['config']['content']['config']['page'] = '/front/config.form.php';
         $menu['config']['content']['control']['title'] = _n('Check', 'Checks', 2);
         $menu['config']['content']['control']['page'] = '/front/control.php';
         $menu['config']['content']['control']['options']['FieldUnicity']['title'] = __('Fields unicity');
         $menu['config']['content']['control']['options']['FieldUnicity']['page'] = '/front/fieldunicity.php';
         $menu['config']['content']['control']['options']['FieldUnicity']['links']['add'] = '/front/fieldunicity.form.php';
         $menu['config']['content']['control']['options']['FieldUnicity']['links']['search'] = '/front/fieldunicity.php';
         $menu['config']['content']['crontask']['title'] = _n('Automatic action', 'Automatic actions', 2);
         $menu['config']['content']['crontask']['page'] = '/front/crontask.php';
         $menu['config']['content']['crontask']['links']['search'] = "/front/crontask.php";
         $menu['config']['content']['mailing']['options']['config']['title'] = __('Email');
         $menu['config']['content']['mailing']['options']['config']['page'] = '/front/notificationmailsetting.form.php';
         $menu['config']['content']['mailing']['options']['notificationtemplate']['title'] = _n('Notification template', 'Notification templates', 2);
         $menu['config']['content']['mailing']['options']['notificationtemplate']['page'] = '/front/notificationtemplate.php';
         $menu['config']['content']['mailing']['options']['notificationtemplate']['links']['add'] = '/front/notificationtemplate.form.php';
         $menu['config']['content']['mailing']['options']['notificationtemplate']['links']['search'] = '/front/notificationtemplate.php';
         $menu['config']['content']['extauth']['title'] = __('Authentication');
         $menu['config']['content']['extauth']['page'] = '/front/setup.auth.php';
         $menu['config']['content']['extauth']['options']['ldap']['title'] = _n('LDAP directory', 'LDAP directories', 2);
         $menu['config']['content']['extauth']['options']['ldap']['page'] = '/front/authldap.php';
         $menu['config']['content']['extauth']['options']['imap']['title'] = _n('Mail server', 'Mail servers', 2);
         $menu['config']['content']['extauth']['options']['imap']['page'] = '/front/authmail.php';
         $menu['config']['content']['extauth']['options']['others']['title'] = __('Others');
         $menu['config']['content']['extauth']['options']['others']['page'] = '/front/auth.others.php';
         $menu['config']['content']['extauth']['options']['settings']['title'] = __('Setup');
         $menu['config']['content']['extauth']['options']['settings']['page'] = '/front/auth.settings.php';
         switch ($option) {
             case "ldap":
                 // LDAP
                 $menu['config']['content']['extauth']['options']['ldap']['links']['search'] = '/front/authldap.php';
                 $menu['config']['content']['extauth']['options']['ldap']['links']['add'] = '' . '/front/authldap.form.php';
                 break;
             case "imap":
                 // IMAP
                 $menu['config']['content']['extauth']['links']['search'] = '/front/authmail.php';
                 $menu['config']['content']['extauth']['links']['add'] = '' . '/front/authmail.form.php';
                 break;
         }
         $menu['config']['content']['mailcollector']['title'] = _n('Receiver', 'Receivers', 2);
         $menu['config']['content']['mailcollector']['page'] = '/front/mailcollector.php';
         if (Toolbox::canUseImapPop()) {
             $menu['config']['content']['mailcollector']['links']['search'] = '/front/mailcollector.php';
             $menu['config']['content']['mailcollector']['links']['add'] = '/front/mailcollector.form.php';
             $menu['config']['content']['mailcollector']['options']['rejectedemails']['links']['search'] = '/front/notimportedemail.php';
         }
     }
     if (Session::haveRight("link", "r")) {
         $menu['config']['content']['link']['title'] = _n('External link', 'External links', 2);
         $menu['config']['content']['link']['page'] = '/front/link.php';
         $menu['config']['content']['link']['hide'] = true;
         $menu['config']['content']['link']['links']['search'] = '/front/link.php';
         if (Session::haveRight("link", "w")) {
             $menu['config']['content']['link']['links']['add'] = "/front/link.form.php";
         }
     }
     if (Session::haveRight("config", "w")) {
         $menu['config']['content']['plugins']['title'] = __('Plugins');
         $menu['config']['content']['plugins']['page'] = '/front/plugin.php';
     }
     // Special items
     $menu['preference']['title'] = __('My settings');
     $menu['preference']['default'] = '/front/preference.php';
     $already_used_shortcut = array('1');
     echo "<div id='header'>";
     echo "<div id='c_logo'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/central.php' accesskey='1' title=\"" . __s('Home') . "\">";
     echo "</a></div>";
     /// Prefs / Logout link
     echo "<div id='c_preference' >";
     echo "<ul>";
     echo "<li id='deconnexion'><a href='" . $CFG_GLPI["root_doc"] . "/logout.php";
     /// logout witout noAuto login for extauth
     if (isset($_SESSION['glpiextauth']) && $_SESSION['glpiextauth']) {
         echo "?noAUTO=1";
     }
     echo "' title=\"" . __s('Logout') . "\">" . __('Logout') . "</a>";
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         echo " (";
         echo formatUserName(0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20);
         echo ")";
     }
     echo "</li>\n";
     echo "<li><a href='" . (empty($CFG_GLPI["central_doc_url"]) ? "http://glpi-project.org/help-central" : $CFG_GLPI["central_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\">" . __('Help') . "</a></li>";
     echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('My settings') . "\">" . __('My settings') . "</a></li>";
     echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . addslashes(Dropdown::getLanguageName($_SESSION['glpilanguage'])) . "\">" . Dropdown::getLanguageName($_SESSION['glpilanguage']) . "</a></li>";
     echo "</ul>";
     echo "<div class='sep'></div>";
     echo "</div>\n";
     /// Search engine
     echo "<div id='c_recherche' >\n";
     if ($CFG_GLPI['allow_search_global']) {
         echo "<form method='get' action='" . $CFG_GLPI["root_doc"] . "/front/search.php'>\n";
         echo "<div id='boutonRecherche'>";
         echo "<input type='image' src='" . $CFG_GLPI["root_doc"] . "/pics/search.png' value='OK'\n                title=\"" . _sx('button', 'Post') . "\"  alt=\"" . _sx('button', 'Post') . "\"></div>";
         echo "<div id='champRecherche'><input size='15' type='text' name='globalsearch'\n                                         value='" . __s('Search') . "' onfocus=\"this.value='';\">";
         echo "</div>";
         Html::closeForm();
     }
     //echo "</div>";
     echo "<div class='sep'></div>\n";
     echo "</div>";
     ///Main menu
     echo "<div id='c_menu'>";
     echo "<ul id='menu'>";
     // Get object-variables and build the navigation-elements
     $i = 1;
     foreach ($menu as $part => $data) {
         if (isset($data['content']) && count($data['content'])) {
             echo "<li id='menu{$i}' onmouseover=\"javascript:menuAff('menu{$i}','menu');\" >";
             $link = "#";
             if (isset($data['default']) && !empty($data['default'])) {
                 $link = $CFG_GLPI["root_doc"] . $data['default'];
             }
             if (Toolbox::strlen($data['title']) > 14) {
                 $data['title'] = Toolbox::substr($data['title'], 0, 14) . "...";
             }
             echo "<a href='{$link}' class='itemP'>" . $data['title'] . "</a>";
             echo "<ul class='ssmenu'>";
             // list menu item
             foreach ($data['content'] as $key => $val) {
                 if (isset($val['page']) && isset($val['title'])) {
                     echo "<li><a href='" . $CFG_GLPI["root_doc"] . $val['page'] . "'";
                     if (isset($val['shortcut']) && !empty($val['shortcut'])) {
                         if (!isset($already_used_shortcut[$val['shortcut']])) {
                             echo " accesskey='" . $val['shortcut'] . "'";
                             $already_used_shortcut[$val['shortcut']] = $val['shortcut'];
                         }
                         echo ">" . Toolbox::shortcut($val['title'], $val['shortcut']) . "</a></li>\n";
                     } else {
                         echo ">" . $val['title'] . "</a></li>\n";
                     }
                 }
             }
             echo "</ul></li>";
             $i++;
         }
     }
     echo "</ul>";
     echo "<div class='sep'></div>";
     echo "</div>";
     // End navigation bar
     // End headline
     // Le sous menu contextuel 1
     echo "<div id='c_ssmenu1' >";
     echo "<ul>";
     // list sous-menu item
     if (isset($menu[$sector])) {
         if (isset($menu[$sector]['content']) && is_array($menu[$sector]['content'])) {
             $ssmenu = $menu[$sector]['content'];
             if (count($ssmenu) > 12) {
                 foreach ($ssmenu as $key => $val) {
                     if (isset($val['hide'])) {
                         unset($ssmenu[$key]);
                     }
                 }
                 $ssmenu = array_splice($ssmenu, 0, 12);
             }
             foreach ($ssmenu as $key => $val) {
                 if (isset($val['page']) && isset($val['title'])) {
                     echo "<li><a href='" . $CFG_GLPI["root_doc"] . $val['page'] . "'";
                     if (isset($val['shortcut']) && !empty($val['shortcut'])) {
                         echo ">" . Toolbox::shortcut($val['title'], $val['shortcut']) . "</a></li>\n";
                     } else {
                         echo ">" . $val['title'] . "</a></li>\n";
                     }
                 }
             }
         } else {
             echo "<li>&nbsp;</li>";
         }
     } else {
         echo "<li>&nbsp;</li>";
     }
     echo "</ul></div>";
     //  Le fil d ariane
     echo "<div id='c_ssmenu2' >";
     echo "<ul>";
     // Display item
     echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/central.php' title=\"" . __s('Home') . "\">" . __('Home') . "</a> ></li>";
     if (isset($menu[$sector])) {
         $link = "/front/central.php";
         if (isset($menu[$sector]['default'])) {
             $link = $menu[$sector]['default'];
         }
         echo "<li><a href='" . $CFG_GLPI["root_doc"] . $link . "' title=\"" . $menu[$sector]['title'] . "\">" . $menu[$sector]['title'] . "</a> ></li>";
     }
     if (isset($menu[$sector]['content'][$item])) {
         // Title
         $with_option = false;
         if (!empty($option) && isset($menu[$sector]['content'][$item]['options'][$option]['title']) && isset($menu[$sector]['content'][$item]['options'][$option]['page'])) {
             $with_option = true;
         }
         if (isset($menu[$sector]['content'][$item]['page'])) {
             echo "<li><a href='" . $CFG_GLPI["root_doc"] . $menu[$sector]['content'][$item]['page'] . "' " . ($with_option ? "" : "class='here'") . " title=\"" . $menu[$sector]['content'][$item]['title'] . "\" >" . $menu[$sector]['content'][$item]['title'] . "</a>" . (!$with_option ? "" : " > ") . "</li>";
         }
         if ($with_option) {
             echo "<li><a href='" . $CFG_GLPI["root_doc"] . $menu[$sector]['content'][$item]['options'][$option]['page'] . "' class='here' title=\"" . $menu[$sector]['content'][$item]['options'][$option]['title'] . "\" >";
             echo self::resume_name($menu[$sector]['content'][$item]['options'][$option]['title'], 17);
             echo "</a></li>";
         }
         echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>";
         $links = array();
         // Item with Option case
         if (!empty($option) && isset($menu[$sector]['content'][$item]['options'][$option]['links']) && is_array($menu[$sector]['content'][$item]['options'][$option]['links'])) {
             $links = $menu[$sector]['content'][$item]['options'][$option]['links'];
             // Without option case : only item links
         } else {
             if (isset($menu[$sector]['content'][$item]['links']) && is_array($menu[$sector]['content'][$item]['links'])) {
                 $links = $menu[$sector]['content'][$item]['links'];
             }
         }
         // Add item
         echo "<li>";
         if (isset($links['add'])) {
             echo "<a href='" . $CFG_GLPI["root_doc"] . $links['add'] . "'>";
             echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . __s('Add') . "\"\n                   alt=\"" . __s('Add') . "\"></a>";
         } else {
             echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add_off.png' title=\"" . __s('Add') . "\"\n                   alt=\"" . __s('Add') . "\">";
         }
         echo "</li>";
         // Search Item
         if (isset($links['search'])) {
             echo "<li><a href='" . $CFG_GLPI["root_doc"] . $links['search'] . "'>";
             echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_search.png'\n                   title=\"" . __s('Search') . "\" alt=\"" . __s('Search') . "\"></a></li>";
         } else {
             echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_search_off.png'\n                       title=\"" . __s('Search') . "\" alt=\"" . __s('Search') . "\"></li>";
         }
         // Links
         if (count($links) > 0) {
             foreach ($links as $key => $val) {
                 switch ($key) {
                     case "add":
                     case "search":
                         break;
                     case "template":
                         echo "<li><a href='" . $CFG_GLPI["root_doc"] . $val . "'><img title=\"" . __s('Manage templates...') . "\" alt=\"" . __s('Manage templates...') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_addtemplate.png'></a>" . "</li>";
                         break;
                     case "showall":
                         echo "<li><a href='" . $CFG_GLPI["root_doc"] . $val . "'><img title=\"" . __s('Show all') . "\" alt=\"" . __s('Show all') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png'></a></li>";
                         break;
                     case "summary":
                         echo "<li><a href='" . $CFG_GLPI["root_doc"] . $val . "'><img title=\"" . __s('Summary') . "\" alt=\"" . __s('Summary') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_show.png'></a></li>";
                         break;
                     case "config":
                         echo "<li><a href='" . $CFG_GLPI["root_doc"] . $val . "'><img title=\"" . __s('Setup') . "\" alt=\"" . __s('Setup') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_config.png'></a></li>";
                         break;
                     default:
                         echo "<li><a href='" . $CFG_GLPI["root_doc"] . $val . "'>" . $key . "</a></li>";
                         break;
                 }
             }
         }
     } else {
         echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>";
         echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . "&nbsp;&nbsp;&nbsp;&nbsp;</li>";
     }
     // Add common items
     echo "<li>";
     // Display MENU ALL
     echo "<div id='show_all_menu' onmouseover=\"completecleandisplay('show_all_menu');\">";
     $items_per_columns = 15;
     $i = -1;
     echo "<table><tr><td class='top'><table>";
     foreach ($menu as $part => $data) {
         if (isset($data['content']) && count($data['content'])) {
             if ($i > $items_per_columns) {
                 $i = 0;
                 echo "</table></td><td class='top'><table>";
             }
             $link = "#";
             if (isset($data['default']) && !empty($data['default'])) {
                 $link = $CFG_GLPI["root_doc"] . $data['default'];
             }
             echo "<tr><td class='tab_bg_1 b'>";
             echo "<a href='{$link}' title=\"" . $data['title'] . "\" class='itemP'>" . $data['title'] . "</a>";
             echo "</td></tr>";
             $i++;
             // list menu item
             foreach ($data['content'] as $key => $val) {
                 if ($i > $items_per_columns) {
                     $i = 0;
                     echo "</table></td><td class='top'><table>";
                 }
                 if (isset($val['page']) && isset($val['title'])) {
                     echo "<tr><td><a href='" . $CFG_GLPI["root_doc"] . $val['page'] . "'";
                     if (isset($data['shortcut']) && !empty($data['shortcut'])) {
                         echo " accesskey='" . $val['shortcut'] . "'";
                     }
                     echo ">" . $val['title'] . "</a></td></tr>\n";
                     $i++;
                 }
             }
         }
     }
     echo "</table></td></tr></table>";
     echo "</div>";
     echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
     echo "</li>";
     /// Bookmark load
     echo "<li>";
     echo "<a href='#' onClick=\"var w=window.open('" . $CFG_GLPI["root_doc"] . "/front/popup.php?popup=load_bookmark' ,'glpibookmarks', 'height=500, width=" . (Bookmark::WIDTH + 250) . ", top=100, left=100, scrollbars=yes' );w.focus();\">";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/bookmark.png' title=\"" . __s('Load a bookmark') . "\"  alt=\"" . __s('Load a bookmark') . "\">";
     echo "</a></li>";
     /// MENU ALL
     echo "<li >";
     echo "<img alt='' src='" . $CFG_GLPI["root_doc"] . "/pics/menu_all.png' " . "onclick=\"completecleandisplay('show_all_menu')\">";
     echo "</li>";
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/central.php");
     }
     echo "</ul>";
     echo "</div>";
     echo "</div>\n";
     // fin header
     echo "<div id='page' >";
     if ($DB->isSlave() && !$DB->first_connection) {
         echo "<div id='dbslave-float'>";
         echo "<a href='#see_debug'>" . __('MySQL replica: read only') . "</a>";
         echo "</div>";
     }
     // call static function callcron() every 5min
     CronTask::callCron();
     self::displayMessageAfterRedirect();
 }