Html::includeHeader PHP Method

includeHeader() static public method

Include common HTML headers
static public includeHeader ( $title = '' ) : nothing
$title title used for the page (default '')
return nothing
    static function includeHeader($title = '')
    {
        global $CFG_GLPI, $PLUGIN_HOOKS;
        // complete title with id if exist
        if (isset($_GET['id']) && $_GET['id']) {
            $title = sprintf(__('%1$s - %2$s'), $title, $_GET['id']);
        }
        // Send UTF8 Headers
        header("Content-Type: text/html; charset=UTF-8");
        // Allow only frame from same server to prevent click-jacking
        header('x-frame-options:SAMEORIGIN');
        // Send extra expires header
        self::header_nocache();
        // Start the page
        echo "<!DOCTYPE html>\n";
        echo "<html lang=\"{$CFG_GLPI["languages"][$_SESSION['glpilanguage']][3]}\">";
        echo "<head><title>GLPI - " . $title . "</title>";
        echo "<meta charset=\"utf-8\">";
        //prevent IE to turn into compatible mode...
        echo "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n";
        // auto desktop / mobile viewport
        echo "<meta name='viewport' content='width=device-width, initial-scale=1'>";
        echo Html::css($CFG_GLPI["root_doc"] . "/lib/jquery/css/smoothness/jquery-ui-1.10.4.custom.min.css");
        echo Html::css($CFG_GLPI["root_doc"] . "/css/jstree/style.css");
        echo Html::css($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/rateit/rateit.min.css");
        echo Html::css($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/select2/select2.min.css");
        echo Html::css($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/qtip2/jquery.qtip.min.css");
        echo Html::css($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jcrop/jquery.Jcrop.min.css");
        echo Html::css($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/spectrum-colorpicker/spectrum.min.css");
        echo Html::css($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jquery-gantt/css/style.css");
        echo Html::css($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/fullcalendar/fullcalendar.min.css", array('media' => ''));
        echo Html::css($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/fullcalendar/fullcalendar.print.min.css", array('media' => 'print'));
        echo Html::css($CFG_GLPI["root_doc"] . "/css/jquery-glpi.css");
        if (CommonGLPI::isLayoutWithMain() && !CommonGLPI::isLayoutExcludedPage()) {
            echo Html::css($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jquery-ui-scrollable-tabs/css/jquery.scrollabletab.min.css");
        }
        //  CSS link
        echo Html::css($CFG_GLPI["root_doc"] . "/css/styles.css");
        // High constrast CSS link
        if (isset($_SESSION['glpihighcontrast_css']) && $_SESSION['glpihighcontrast_css']) {
            echo Html::css($CFG_GLPI["root_doc"] . "/css/highcontrast.css");
        }
        // CSS theme link
        if (isset($_SESSION["glpipalette"])) {
            echo Html::css($CFG_GLPI["root_doc"] . "/css/palettes/" . $_SESSION["glpipalette"] . ".css");
        }
        // surcharge CSS hack for IE
        echo "<!--[if lte IE 6]>";
        echo Html::css($CFG_GLPI["root_doc"] . "/css/styles_ie.css");
        echo "<![endif]-->";
        echo Html::css($CFG_GLPI["root_doc"] . "/css/print.css", array('media' => 'print'));
        echo "<link rel='shortcut icon' type='images/x-icon' href='" . $CFG_GLPI["root_doc"] . "/pics/favicon.ico' >\n";
        // Add specific css for plugins
        if (isset($PLUGIN_HOOKS['add_css']) && count($PLUGIN_HOOKS['add_css'])) {
            foreach ($PLUGIN_HOOKS["add_css"] as $plugin => $files) {
                if (is_array($files)) {
                    foreach ($files as $file) {
                        if (file_exists(GLPI_ROOT . "/plugins/{$plugin}/{$file}")) {
                            echo Html::css($CFG_GLPI["root_doc"] . "/plugins/{$plugin}/{$file}");
                        }
                    }
                } else {
                    if (file_exists(GLPI_ROOT . "/plugins/{$plugin}/{$files}")) {
                        echo Html::css($CFG_GLPI["root_doc"] . "/plugins/{$plugin}/{$files}");
                    }
                }
            }
        }
        // AJAX library
        if (isset($_SESSION['glpi_use_mode']) && $_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
            echo Html::script($CFG_GLPI["root_doc"] . "/lib/jquery/js/jquery-1.10.2.js");
            echo Html::script($CFG_GLPI["root_doc"] . "/lib/jquery/js/jquery-ui-1.10.4.custom.js");
        } else {
            echo Html::script($CFG_GLPI["root_doc"] . "/lib/jquery/js/jquery-1.10.2.min.js");
            echo Html::script($CFG_GLPI["root_doc"] . "/lib/jquery/js/jquery-ui-1.10.4.custom.min.js");
        }
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/tiny_mce/tinymce.min.js");
        // PLugins jquery
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/backtotop/BackToTop.min.jquery.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/select2/select2.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/qtip2/jquery.qtip.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jstree/jquery.jstree.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/rateit/jquery.rateit.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jquery-file-upload/js/jquery.iframe-transport.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jquery-file-upload/js/jquery.fileupload.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jcrop/jquery.Jcrop.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/imagepaste/jquery.image_paste.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/spectrum-colorpicker/spectrum-min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jquery-gantt/js/jquery.fn.gantt.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/autogrow/jquery.autogrow-textarea.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/fullcalendar/lib/moment.min.js");
        echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/fullcalendar/fullcalendar.min.js");
        // layout
        if (CommonGLPI::isLayoutWithMain() && !CommonGLPI::isLayoutExcludedPage()) {
            echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jquery-ui-scrollable-tabs/js/jquery.mousewheel.min.js");
            echo Html::script($CFG_GLPI["root_doc"] . "/lib/jqueryplugins/jquery-ui-scrollable-tabs/js/jquery.scrollabletab.min.js");
        }
        //locales for js library
        if (isset($_SESSION['glpilanguage'])) {
            // jquery ui
            echo Html::script($CFG_GLPI["root_doc"] . "/lib/jquery/i18n/jquery.ui.datepicker-" . $CFG_GLPI["languages"][$_SESSION['glpilanguage']][2] . ".js");
            $filename = "/lib/jqueryplugins/jquery-ui-timepicker-addon/i18n/jquery-ui-timepicker-" . $CFG_GLPI["languages"][$_SESSION['glpilanguage']][2] . ".js";
            if (file_exists(GLPI_ROOT . $filename)) {
                echo Html::script($CFG_GLPI["root_doc"] . $filename);
            }
            // select2
            $filename = "/lib/jqueryplugins/select2/select2_locale_" . $CFG_GLPI["languages"][$_SESSION['glpilanguage']][2] . ".js";
            if (file_exists(GLPI_ROOT . $filename)) {
                echo Html::script($CFG_GLPI["root_doc"] . $filename);
            }
            //fullcalendar
            $filename = "/lib/jqueryplugins/fullcalendar/locale/" . strtolower($CFG_GLPI["languages"][$_SESSION['glpilanguage']][2]) . ".js";
            if (file_exists(GLPI_ROOT . $filename)) {
                echo Html::script($CFG_GLPI["root_doc"] . $filename);
            }
        }
        // Some Javascript-Functions which we may need later
        echo Html::script($CFG_GLPI["root_doc"] . '/script.js');
        self::redefineAlert();
        self::redefineConfirm();
        // add Ajax display message after redirect
        Html::displayAjaxMessageAfterRedirect();
        // Add specific javascript for plugins
        if (isset($PLUGIN_HOOKS['add_javascript']) && count($PLUGIN_HOOKS['add_javascript'])) {
            foreach ($PLUGIN_HOOKS["add_javascript"] as $plugin => $files) {
                if (is_array($files)) {
                    foreach ($files as $file) {
                        if (file_exists(GLPI_ROOT . "/plugins/{$plugin}/{$file}")) {
                            echo Html::script($CFG_GLPI["root_doc"] . "/plugins/{$plugin}/{$file}");
                        }
                    }
                } else {
                    if (file_exists(GLPI_ROOT . "/plugins/{$plugin}/{$files}")) {
                        echo Html::script($CFG_GLPI["root_doc"] . "/plugins/{$plugin}/{$files}");
                    }
                }
            }
        }
        // End of Head
        echo "</head>\n";
    }

Usage Example

Example #1
0
https://forge.indepnet.net/projects/mreporting
-------------------------------------------------------------------------

LICENSE

This file is part of mreporting.

mreporting is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

mreporting is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with mreporting. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Html::includeHeader("");
echo "<div class='debug_content'>";
$common = new PluginMreportingCommon();
$common->debugGraph();
echo "</div></div></div>";
echo "</body></html>";
All Usage Examples Of Html::includeHeader
Html