Esempio n. 1
0
 /**
  * @since version 0.84
  *
  * @see Rule::getAdditionalCriteriaDisplayPattern()
  **/
 function getAdditionalCriteriaDisplayPattern($ID, $condition, $pattern)
 {
     $crit = $this->getCriteria($ID);
     if ($crit['field'] == '_source') {
         $name = Plugin::getInfo($pattern, 'name');
         if (empty($name)) {
             return false;
         }
         return $name;
     }
 }
Esempio n. 2
0
 /**
  * Print a nice HTML head for help page
  *
  * @param $title  title of the page
  * @param $url    not used anymore (default '')
  **/
 static function helpHeader($title, $url = '')
 {
     global $CFG_GLPI, $HEADER_LOADED, $PLUGIN_HOOKS;
     // Print a nice HTML-head for help page
     if ($HEADER_LOADED) {
         return;
     }
     $HEADER_LOADED = true;
     self::includeHeader($title);
     // Body
     $body_class = "layout_" . $_SESSION['glpilayout'];
     if (strpos($_SERVER['REQUEST_URI'], "form.php") !== false && isset($_GET['id']) && $_GET['id'] > 0) {
         if (!CommonGLPI::isLayoutExcludedPage()) {
             $body_class .= " form";
         } else {
             $body_class = "";
         }
     }
     echo "<body class='{$body_class}'>";
     // Main Headline
     echo "<div id='header'>";
     echo "<div id='header_top'>";
     echo "<div id='c_logo'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' accesskey='1' title=\"" . __s('Home') . "\"><span class='invisible'>Logo</span></a>";
     echo "</div>";
     // Les préférences + lien déconnexion
     echo "<div id='c_preference' >";
     echo "<ul>";
     echo "<li id='deconnexion'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/logout.php";
     /// logout witout noAuto login for extauth
     if (isset($_SESSION['glpiextauth']) && $_SESSION['glpiextauth']) {
         echo "?noAUTO=1";
     }
     echo "' title=\"" . __s('Logout') . "\">";
     // check user id : header used for display messages when session logout
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/logout.png' title=\"" . __s('Logout') . "\"  alt=\"" . __s('Logout') . "\" class='button-icon'>";
     echo "</a>";
     echo "</li>\n";
     echo "<li id='preferences_link'><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('My settings') . "\">";
     echo "<span id='preferences_icon' title=\"" . __s('My settings') . "\"  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>";
     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') . "\" class='button-icon'>";
     echo "</a></li>";
     echo "<li id='help_link'>" . "<a href='" . (empty($CFG_GLPI["helpdesk_doc_url"]) ? "http://glpi-project.org/help-helpdesk" : $CFG_GLPI["helpdesk_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\">" . "<img src='" . $CFG_GLPI["root_doc"] . "/pics/help.png' title=\"" . __s('Help') . "\"  alt=\"" . __s('Help') . "\" class='button-icon'>";
     "</a></li>";
     echo "</ul>";
     echo "</div>";
     //-- Le moteur de recherche --
     echo "<div id='c_recherche'></div>";
     echo "</div>";
     //-- Le menu principal --
     echo "<div id='c_menu'>";
     echo "<ul id='menu'>";
     // Build the navigation-elements
     // Home
     echo "<li id='menu1'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\" class='itemP'>" . __('Home') . "</a>";
     echo "</li>";
     //  Create ticket
     if (Session::haveRight("ticket", CREATE)) {
         echo "<li id='menu2'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1' " . "title=\"" . __s('Create a ticket') . "\" class='itemP'>" . __('Create a ticket') . "</a>";
         echo "</li>";
     }
     //  Suivi ticket
     if (Session::haveRight("ticket", Ticket::READMY) || Session::haveRight("followup", TicketFollowup::SEEPUBLIC)) {
         echo "<li id='menu3'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.php' title=\"" . __s('Ticket followup') . "\" class='itemP'>" . _n('Ticket', 'Tickets', Session::getPluralNumber()) . "</a>";
         echo "</li>";
     }
     // Reservation
     if (Session::haveRight("reservation", ReservationItem::RESERVEANITEM)) {
         echo "<li id='menu4'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.php' title=\"" . _sn('Reservation', 'Reservations', Session::getPluralNumber()) . "\" class='itemP'>" . _n('Reservation', 'Reservations', Session::getPluralNumber()) . "</a>";
         echo "</li>";
     }
     // FAQ
     if (Session::haveRight('knowbase', KnowbaseItem::READFAQ)) {
         echo "<li id='menu5' >";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.faq.php' title=\"" . __s('FAQ') . "\" class='itemP'>" . __('FAQ') . "</a>";
         echo "</li>";
     }
     // PLUGINS
     $plugins = array();
     if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"]) && count($PLUGIN_HOOKS["helpdesk_menu_entry"])) {
         foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) {
             if ($active) {
                 $plugins[$plugin] = Plugin::getInfo($plugin);
             }
         }
     }
     if (isset($plugins) && count($plugins) > 0) {
         $list = array();
         foreach ($plugins as $key => $val) {
             $list[$key] = $val["name"];
         }
         asort($list);
         echo "<li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\">";
         echo "<a href='#' title=\"" . _sn('Plugin', 'Plugins', Session::getPluralNumber()) . "\" class='itemP'>" . __('Plugins') . "</a>";
         // default none
         echo "<ul class='ssmenu'>";
         // list menu item
         foreach ($list as $key => $val) {
             $link = "";
             if (is_string($PLUGIN_HOOKS["helpdesk_menu_entry"][$key])) {
                 $link = $PLUGIN_HOOKS["helpdesk_menu_entry"][$key];
             }
             echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . $link . "'>" . $plugins[$key]["name"] . "</a></li>\n";
         }
         echo "</ul></li>";
     }
     echo "</ul>";
     echo "</div>";
     // End navigation bar
     // End headline
     //  Le fil d ariane
     echo "<div id='c_ssmenu2'>";
     echo "<ul>";
     echo "<li class='breadcrumb_item'>" . "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\">" . __('Home') . "</a></li>";
     if (TicketValidation::getValidateRights()) {
         $opt = array();
         $opt['reset'] = 'reset';
         $opt['criteria'][0]['field'] = 55;
         // validation status
         $opt['criteria'][0]['searchtype'] = 'equals';
         $opt['criteria'][0]['value'] = TicketValidation::WAITING;
         $opt['criteria'][0]['link'] = 'AND';
         $opt['criteria'][1]['field'] = 59;
         // validation aprobator
         $opt['criteria'][1]['searchtype'] = 'equals';
         $opt['criteria'][1]['value'] = Session::getLoginUserID();
         $opt['criteria'][1]['link'] = 'AND';
         $url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&amp;');
         $pic_validate = "<a href='{$url_validate}'>" . "<img title=\"" . __s('Ticket waiting for your approval') . "\" alt=\"" . __s('Ticket waiting for your approval') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' class='pointer'></a>";
         echo "<li class='icons_block'>{$pic_validate}</li>\n";
     }
     if (Session::haveRight('ticket', CREATE) && strpos($_SERVER['PHP_SELF'], "ticket")) {
         echo "<li class='icons_block'><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1'>";
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\" class='pointer'></a></li>";
     }
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
     }
     echo "</ul></div>";
     echo "</div>";
     // fin header
     echo "<div id='page' >";
     // call static function callcron() every 5min
     CronTask::callCron();
     self::displayMessageAfterRedirect();
 }
 /**
  * @since version 0.84
  **/
 static function title()
 {
     global $PLUGIN_HOOKS, $CFG_GLPI;
     $opt_list["Ticket"] = __('Tickets');
     $stat_list["Ticket"]["Ticket_Global"]["name"] = __('Global');
     $stat_list["Ticket"]["Ticket_Global"]["file"] = "stat.global.php?itemtype=Ticket";
     $stat_list["Ticket"]["Ticket_Ticket"]["name"] = __('By ticket');
     $stat_list["Ticket"]["Ticket_Ticket"]["file"] = "stat.tracking.php?itemtype=Ticket";
     $stat_list["Ticket"]["Ticket_Location"]["name"] = __('By hardware characteristics');
     $stat_list["Ticket"]["Ticket_Location"]["file"] = "stat.location.php?itemtype=Ticket";
     $stat_list["Ticket"]["Ticket_Item"]["name"] = __('By hardware');
     $stat_list["Ticket"]["Ticket_Item"]["file"] = "stat.item.php";
     if (Problem::canView()) {
         $opt_list["Problem"] = _n('Problem', 'Problems', Session::getPluralNumber());
         $stat_list["Problem"]["Problem_Global"]["name"] = __('Global');
         $stat_list["Problem"]["Problem_Global"]["file"] = "stat.global.php?itemtype=Problem";
         $stat_list["Problem"]["Problem_Problem"]["name"] = __('By problem');
         $stat_list["Problem"]["Problem_Problem"]["file"] = "stat.tracking.php?itemtype=Problem";
     }
     if (Change::canView()) {
         $opt_list["Change"] = _n('Change', 'Changes', Session::getPluralNumber());
         $stat_list["Change"]["Change_Global"]["name"] = __('Global');
         $stat_list["Change"]["Change_Global"]["file"] = "stat.global.php?itemtype=Change";
         $stat_list["Change"]["Change_Change"]["name"] = __('By change');
         $stat_list["Change"]["Change_Change"]["file"] = "stat.tracking.php?itemtype=Change";
     }
     //Affichage du tableau de presentation des stats
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . __('Select statistics to be displayed') . "</th></tr>";
     echo "<tr class='tab_bg_1'><td class='center'>";
     $values = array($CFG_GLPI["root_doc"] . '/front/stat.php' => Dropdown::EMPTY_VALUE);
     $i = 0;
     $selected = -1;
     $count = count($stat_list);
     foreach ($opt_list as $opt => $group) {
         while ($data = each($stat_list[$opt])) {
             $name = $data[1]["name"];
             $file = $data[1]["file"];
             $comment = "";
             if (isset($data[1]["comment"])) {
                 $comment = $data[1]["comment"];
             }
             $key = $CFG_GLPI["root_doc"] . "/front/" . $file;
             $values[$group][$key] = $name;
             if (stripos($_SERVER['REQUEST_URI'], $key) !== false) {
                 $selected = $key;
             }
         }
     }
     // Manage plugins
     $names = array();
     $optgroup = array();
     if (isset($PLUGIN_HOOKS["stats"]) && is_array($PLUGIN_HOOKS["stats"])) {
         foreach ($PLUGIN_HOOKS["stats"] as $plug => $pages) {
             if (is_array($pages) && count($pages)) {
                 foreach ($pages as $page => $name) {
                     $names[$plug . '/' . $page] = array("name" => $name, "plug" => $plug);
                     $optgroup[$plug] = Plugin::getInfo($plug, 'name');
                 }
             }
         }
         asort($names);
     }
     foreach ($optgroup as $opt => $title) {
         $group = $title;
         foreach ($names as $key => $val) {
             if ($opt == $val["plug"]) {
                 $file = $CFG_GLPI["root_doc"] . "/plugins/" . $key;
                 $values[$group][$file] = $val["name"];
                 if (stripos($_SERVER['REQUEST_URI'], $file) !== false) {
                     $selected = $file;
                 }
             }
         }
     }
     Dropdown::showFromArray('statmenu', $values, array('on_change' => "window.location.href=this.options[this.selectedIndex].value", 'value' => $selected));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
 }
 /**
  * Show report title
  **/
 static function title()
 {
     global $PLUGIN_HOOKS, $CFG_GLPI;
     // Report generation
     // Default Report included
     $report_list["default"]["name"] = __('Default report');
     $report_list["default"]["file"] = "report.default.php";
     if (Contract::canView()) {
         // Rapport ajoute par GLPI V0.2
         $report_list["Contrats"]["name"] = __('By contract');
         $report_list["Contrats"]["file"] = "report.contract.php";
     }
     if (Infocom::canView()) {
         $report_list["Par_annee"]["name"] = __('By year');
         $report_list["Par_annee"]["file"] = "report.year.php";
         $report_list["Infocoms"]["name"] = __('Hardware financial and administrative information');
         $report_list["Infocoms"]["file"] = "report.infocom.php";
         $report_list["Infocoms2"]["name"] = __('Other financial and administrative information (licenses, cartridges, consumables)');
         $report_list["Infocoms2"]["file"] = "report.infocom.conso.php";
     }
     if (Session::haveRight("networking", READ)) {
         $report_list["Rapport prises reseau"]["name"] = __('Network report');
         $report_list["Rapport prises reseau"]["file"] = "report.networking.php";
     }
     if (Session::haveRight("reservation", READ)) {
         $report_list["reservation"]["name"] = __('Loan');
         $report_list["reservation"]["file"] = "report.reservation.php";
     }
     if (Computer::canView() || Monitor::canView() || Session::haveRight("networking", READ) || Peripheral::canView() || Printer::canView() || Phone::canView()) {
         $report_list["state"]["name"] = _n('Status', 'Statuses', Session::getPluralNumber());
         $report_list["state"]["file"] = "report.state.php";
     }
     //Affichage du tableau de presentation des stats
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . __('Select the report you want to generate') . "</th></tr>";
     echo "<tr class='tab_bg_1'><td class='center'>";
     $count = count($report_list);
     $selected = -1;
     $values = array($CFG_GLPI["root_doc"] . '/front/report.php' => Dropdown::EMPTY_VALUE);
     while ($data = each($report_list)) {
         $val = $data[0];
         $name = $report_list["{$val}"]["name"];
         $file = $report_list["{$val}"]["file"];
         $key = $CFG_GLPI["root_doc"] . "/front/" . $file;
         $values[$key] = $name;
         if (stripos($_SERVER['REQUEST_URI'], $key) !== false) {
             $selected = $key;
         }
     }
     $names = array();
     $optgroup = array();
     if (isset($PLUGIN_HOOKS["reports"]) && is_array($PLUGIN_HOOKS["reports"])) {
         foreach ($PLUGIN_HOOKS["reports"] as $plug => $pages) {
             if (is_array($pages) && count($pages)) {
                 foreach ($pages as $page => $name) {
                     $names[$plug . '/' . $page] = array("name" => $name, "plug" => $plug);
                     $optgroup[$plug] = Plugin::getInfo($plug, 'name');
                 }
             }
         }
         asort($names);
     }
     foreach ($optgroup as $opt => $title) {
         $group = $title;
         foreach ($names as $key => $val) {
             if ($opt == $val["plug"]) {
                 $file = $CFG_GLPI["root_doc"] . "/plugins/" . $key;
                 $values[$group][$file] = $val["name"];
                 if (stripos($_SERVER['REQUEST_URI'], $file) !== false) {
                     $selected = $file;
                 }
             }
         }
     }
     Dropdown::showFromArray('statmenu', $values, array('on_change' => "window.location.href=this.options[this.selectedIndex].value", 'value' => $selected));
     echo "</td>";
     echo "</tr>";
     echo "</table>";
 }
Esempio n. 5
0
 /**
  * Show report title
  **/
 static function title()
 {
     global $PLUGIN_HOOKS, $CFG_GLPI;
     // Report generation
     // Default Report included
     $report_list["default"]["name"] = __('Default report');
     $report_list["default"]["file"] = "report.default.php";
     if (Session::haveRight("contract", "r")) {
         // Rapport ajoute par GLPI V0.2
         $report_list["Contrats"]["name"] = __('By contract');
         $report_list["Contrats"]["file"] = "report.contract.php";
     }
     if (Session::haveRight("infocom", "r")) {
         $report_list["Par_annee"]["name"] = __('By year');
         $report_list["Par_annee"]["file"] = "report.year.php";
         $report_list["Infocoms"]["name"] = __('Hardware financial and administrative information');
         $report_list["Infocoms"]["file"] = "report.infocom.php";
         $report_list["Infocoms2"]["name"] = __('Other financial and administrative information (licenses, cartridges, consumables)');
         $report_list["Infocoms2"]["file"] = "report.infocom.conso.php";
     }
     if (Session::haveRight("networking", "r")) {
         $report_list["Rapport prises reseau"]["name"] = __('Network report');
         $report_list["Rapport prises reseau"]["file"] = "report.networking.php";
     }
     if (Session::haveRight("reservation_central", "r")) {
         $report_list["reservation"]["name"] = __('Loan');
         $report_list["reservation"]["file"] = "report.reservation.php";
     }
     if (Session::haveRight("computer", "r") || Session::haveRight("monitor", "r") || Session::haveRight("networking", "r") || Session::haveRight("peripheral", "r") || Session::haveRight("printer", "r") || Session::haveRight("phone", "r")) {
         $report_list["state"]["name"] = _n('Status', 'Statuses', 2);
         $report_list["state"]["file"] = "report.state.php";
     }
     //Affichage du tableau de presentation des stats
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . __('Select the report you want to generate') . "</th></tr>";
     echo "<tr class='tab_bg_1'><td class='center'>";
     echo "<select name='statmenu' onchange='window.location.href=this.options\n             [this.selectedIndex].value'>";
     echo "<option value='-1' selected>" . Dropdown::EMPTY_VALUE . "</option>";
     $i = 0;
     $count = count($report_list);
     while ($data = each($report_list)) {
         $val = $data[0];
         $name = $report_list["{$val}"]["name"];
         $file = $report_list["{$val}"]["file"];
         echo "<option value='" . $CFG_GLPI["root_doc"] . "/front/" . $file . "'>" . $name . "</option>";
         $i++;
     }
     $names = array();
     $optgroup = array();
     if (isset($PLUGIN_HOOKS["reports"]) && is_array($PLUGIN_HOOKS["reports"])) {
         foreach ($PLUGIN_HOOKS["reports"] as $plug => $pages) {
             if (is_array($pages) && count($pages)) {
                 foreach ($pages as $page => $name) {
                     $names[$plug . '/' . $page] = array("name" => $name, "plug" => $plug);
                     $optgroup[$plug] = Plugin::getInfo($plug, 'name');
                 }
             }
         }
         asort($names);
     }
     foreach ($optgroup as $opt => $title) {
         echo "<optgroup label=\"" . $title . "\">";
         foreach ($names as $key => $val) {
             if ($opt == $val["plug"]) {
                 echo "<option value='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . "'>" . $val["name"] . "</option>";
             }
         }
         echo "</optgroup>";
     }
     echo "</select>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
 }
Esempio n. 6
0
 /**
  * @since version 0.84
  **/
 static function title()
 {
     global $PLUGIN_HOOKS, $CFG_GLPI;
     $show_problem = Session::haveRight("edit_all_problem", "1") || Session::haveRight("show_all_problem", "1");
     $opt_list["Ticket"] = __('Tickets');
     $stat_list["Ticket"]["Ticket_Global"]["name"] = __('Global');
     $stat_list["Ticket"]["Ticket_Global"]["file"] = "stat.global.php?itemtype=Ticket";
     $stat_list["Ticket"]["Ticket_Ticket"]["name"] = __('By ticket');
     $stat_list["Ticket"]["Ticket_Ticket"]["file"] = "stat.tracking.php?itemtype=Ticket";
     $stat_list["Ticket"]["Ticket_Location"]["name"] = __('By hardware characteristics');
     $stat_list["Ticket"]["Ticket_Location"]["file"] = "stat.location.php?itemtype=Ticket";
     $stat_list["Ticket"]["Ticket_Item"]["name"] = __('By hardware');
     $stat_list["Ticket"]["Ticket_Item"]["file"] = "stat.item.php";
     if ($show_problem) {
         $opt_list["Problem"] = _n('Problem', 'Problems', 2);
         $stat_list["Problem"]["Problem_Global"]["name"] = __('Global');
         $stat_list["Problem"]["Problem_Global"]["file"] = "stat.global.php?itemtype=Problem";
         $stat_list["Problem"]["Problem_Problem"]["name"] = __('By problem');
         $stat_list["Problem"]["Problem_Problem"]["file"] = "stat.tracking.php?itemtype=Problem";
     }
     //Affichage du tableau de presentation des stats
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . __('Select statistics to be displayed') . "</th></tr>";
     echo "<tr class='tab_bg_1'><td class='center'>";
     echo "<select name='statmenu' onchange='window.location.href=this.options\n               [this.selectedIndex].value'>";
     echo "<option value='-1' selected>" . Dropdown::EMPTY_VALUE . "</option>";
     $i = 0;
     $count = count($stat_list);
     foreach ($opt_list as $opt => $group) {
         echo "<optgroup label=\"" . $group . "\">";
         while ($data = each($stat_list[$opt])) {
             $name = $data[1]["name"];
             $file = $data[1]["file"];
             $comment = "";
             if (isset($data[1]["comment"])) {
                 $comment = $data[1]["comment"];
             }
             echo "<option value='" . $CFG_GLPI["root_doc"] . "/front/" . $file . "'\n                   title=\"" . Html::cleanInputText($comment) . "\">" . $name . "</option>";
             $i++;
         }
         echo "</optgroup>";
     }
     $names = array();
     $optgroup = array();
     if (isset($PLUGIN_HOOKS["stats"]) && is_array($PLUGIN_HOOKS["stats"])) {
         foreach ($PLUGIN_HOOKS["stats"] as $plug => $pages) {
             if (is_array($pages) && count($pages)) {
                 foreach ($pages as $page => $name) {
                     $names[$plug . '/' . $page] = array("name" => $name, "plug" => $plug);
                     $optgroup[$plug] = Plugin::getInfo($plug, 'name');
                 }
             }
         }
         asort($names);
     }
     foreach ($optgroup as $opt => $title) {
         echo "<optgroup label=\"" . $title . "\">";
         foreach ($names as $key => $val) {
             if ($opt == $val["plug"]) {
                 echo "<option value='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . "'>" . $val["name"] . "</option>";
             }
         }
         echo "</optgroup>";
     }
     echo "</select>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
 }
Esempio n. 7
0
    /**
     * Print a nice HTML head for help page
     *
     * @param $title  title of the page
     * @param $url    not used anymore (default '')
     **/
    static function helpHeader($title, $url = '')
    {
        global $CFG_GLPI, $HEADER_LOADED, $PLUGIN_HOOKS, $DB;
        // Print a nice HTML-head for help page
        if ($HEADER_LOADED) {
            return;
        }
        $HEADER_LOADED = true;
        self::includeHeader($title);
        // Body
        echo "<body>";
        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;" />
      	<span class=\'invisible\'>Logo</span>
      </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">';
        echo "<li id='menu1'>";
        echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\" class='itemP'>" . __('Home') . "</a>";
        echo "</li>";
        //  Create ticket
        if (Session::haveRight("ticket", CREATE)) {
            echo "<li id='menu2'>";
            echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1' " . "title=\"" . __s('Create a ticket') . "\" class='itemP'>" . __('Create a ticket') . "</a>";
            echo "</li>";
        }
        //  Suivi ticket
        if (Session::haveRight("ticket", Ticket::READMY) || Session::haveRight("followup", TicketFollowup::SEEPUBLIC)) {
            echo "<li id='menu3'>";
            echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.php' title=\"" . __s('Ticket followup') . "\" class='itemP'>" . _n('Ticket', 'Tickets', Session::getPluralNumber()) . "</a>";
            echo "</li>";
        }
        // Reservation
        if (Session::haveRight("reservation", ReservationItem::RESERVEANITEM)) {
            echo "<li id='menu4'>";
            echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.php' title=\"" . _sn('Reservation', 'Reservations', Session::getPluralNumber()) . "\" class='itemP'>" . _n('Reservation', 'Reservations', Session::getPluralNumber()) . "</a>";
            echo "</li>";
        }
        // FAQ
        if (Session::haveRight('knowbase', KnowbaseItem::READFAQ)) {
            echo "<li id='menu5' >";
            echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.faq.php' title=\"" . __s('FAQ') . "\" class='itemP'>" . __('FAQ') . "</a>";
            echo "</li>";
        }
        // PLUGINS
        $plugins = array();
        if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"]) && count($PLUGIN_HOOKS["helpdesk_menu_entry"])) {
            foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) {
                if ($active) {
                    $plugins[$plugin] = Plugin::getInfo($plugin);
                }
            }
        }
        if (isset($plugins) && count($plugins) > 0) {
            $list = array();
            foreach ($plugins as $key => $val) {
                $list[$key] = $val["name"];
            }
            asort($list);
            //echo "<li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\">";
            echo "<li id='menu5'>";
            echo "<a href='#' title=\"" . _sn('Plugin', 'Plugins', Session::getPluralNumber()) . "\" class='itemP'>" . __('Plugins') . "</a>";
            // default none
            echo "<ul class='ssmenu'>";
            // list menu item
            foreach ($list as $key => $val) {
                $link = "";
                if (is_string($PLUGIN_HOOKS["helpdesk_menu_entry"][$key])) {
                    $link = $PLUGIN_HOOKS["helpdesk_menu_entry"][$key];
                }
                echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . $link . "'>" . $plugins[$key]["name"] . "</a></li>\n";
            }
            echo "</ul></li>";
        }
        echo "<div class='sep'></div>";
        echo '</ul>';
        echo '<ul class="nav navbar-nav navbar-right">';
        $sql_photo2 = "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_photo2 = $DB->query($sql_photo2);
        $pic2 = $DB->result($res_photo2, 0, 'picture');
        $photo_url2 = User::getURLForPicture($pic2);
        echo '<li class="dropdown">';
        echo '<a href="#" style="padding:0px; margin:0px;" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><img src="' . $photo_url2 . '" 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-lock'></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;">';
        // Display item
        echo "<div id='c_ssmenu2'>";
        echo "<ul>";
        echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\">" . __('Home') . "></a></li>";
        echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>";
        if (Session::haveRightsOr('ticketvalidation', array(TicketValidation::VALIDATEREQUEST, TicketValidation::VALIDATEINCIDENT))) {
            $opt = array();
            $opt['reset'] = 'reset';
            $opt['criteria'][0]['field'] = 55;
            // validation status
            $opt['criteria'][0]['searchtype'] = 'equals';
            $opt['criteria'][0]['value'] = TicketValidation::WAITING;
            $opt['criteria'][0]['link'] = 'AND';
            $opt['criteria'][1]['field'] = 59;
            // validation aprobator
            $opt['criteria'][1]['searchtype'] = 'equals';
            $opt['criteria'][1]['value'] = Session::getLoginUserID();
            $opt['criteria'][1]['link'] = 'AND';
            $url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&amp;');
            $pic_validate = "<a href='{$url_validate}'>" . "<img title=\"" . __s('Ticket waiting for your approval') . "\" alt=\"" . __s('Ticket waiting for your approval') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png'></a>";
            echo "<li>{$pic_validate}</li>\n";
        }
        echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>";
        if (Session::haveRight('ticket', CREATE) && strpos($_SERVER['PHP_SELF'], "ticket")) {
            echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1'>";
            echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"></a></li>";
        }
        echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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></li>";
        // check user id : header used for display messages when session logout
        if (Session::getLoginUserID()) {
            self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
        }
        echo "</ul></div>";
        //end c_ssmenu2
        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>";
        echo '</nav>';
    }
Esempio n. 8
0
 /**
  * Print a nice HTML head for help page
  *
  * @param $title  title of the page
  * @param $url    not used anymore (default '')
  **/
 static function helpHeader($title, $url = '')
 {
     global $CFG_GLPI, $HEADER_LOADED, $PLUGIN_HOOKS;
     // Print a nice HTML-head for help page
     if ($HEADER_LOADED) {
         return;
     }
     $HEADER_LOADED = true;
     self::includeHeader($title);
     // Body
     echo "<body>";
     // Main Headline
     echo "<div id='header'>";
     echo "<div id='c_logo' >";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' accesskey='1' title=\"" . __s('Home') . "\"><span class='invisible'>Logo</span></a></div>";
     // Les préférences + lien déconnexion
     echo "<div id='c_preference' >";
     echo "<ul><li id='deconnexion'><a href='" . $CFG_GLPI["root_doc"] . "/logout.php' title=\"" . __s('Logout') . "\">" . __('Logout') . "</a>";
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         echo "&nbsp;(";
         echo formatUserName(0, $_SESSION["glpiname"], $_SESSION["glpirealname"], $_SESSION["glpifirstname"], 0, 20);
         echo ")";
     }
     echo "</li>\n";
     echo "<li><a href='" . (empty($CFG_GLPI["helpdesk_doc_url"]) ? "http://glpi-project.org/help-helpdesk" : $CFG_GLPI["helpdesk_doc_url"]) . "' target='_blank' title=\"" . __s('Help') . "\"> " . __('Help') . "</a></li>";
     echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . __s('Settings') . "\">" . __('Settings') . "</a></li>\n";
     echo "</ul>";
     echo "<div class='sep'></div>";
     echo "</div>";
     //-- Le moteur de recherche --
     echo "<div id='c_recherche'>";
     echo "<div class='sep'></div>";
     echo "</div>";
     //-- Le menu principal --
     echo "<div id='c_menu'>";
     echo "<ul id='menu'>";
     // Build the navigation-elements
     // Home
     echo "<li id='menu1'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\" class='itemP'>" . __('Home') . "</a>";
     echo "</li>";
     //  Create ticket
     if (Session::haveRight("create_ticket", "1")) {
         echo "<li id='menu2'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1' " . "title=\"" . __s('Create a ticket') . "\" class='itemP'>" . __('Create a ticket') . "</a>";
         echo "</li>";
     }
     //  Suivi ticket
     if (Session::haveRight("observe_ticket", "1") || Session::haveRight("create_ticket", "1")) {
         echo "<li id='menu3'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/ticket.php' title=\"" . __s('Ticket followup') . "\" class='itemP'>" . _n('Ticket', 'Tickets', 2) . "</a>";
         echo "</li>";
     }
     // Reservation
     if (Session::haveRight("reservation_helpdesk", "1")) {
         echo "<li id='menu4'>";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/reservationitem.php' title=\"" . _sn('Reservation', 'Reservations', 2) . "\" class='itemP'>" . _n('Reservation', 'Reservations', 2) . "</a>";
         echo "</li>";
     }
     // FAQ
     if (Session::haveRight("faq", "r")) {
         echo "<li id='menu5' >";
         echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.faq.php' title=\"" . __s('FAQ') . "\" class='itemP'>" . __('FAQ') . "</a>";
         echo "</li>";
     }
     // PLUGINS
     $plugins = array();
     if (isset($PLUGIN_HOOKS["helpdesk_menu_entry"]) && count($PLUGIN_HOOKS["helpdesk_menu_entry"])) {
         foreach ($PLUGIN_HOOKS["helpdesk_menu_entry"] as $plugin => $active) {
             if ($active) {
                 $plugins[$plugin] = Plugin::getInfo($plugin);
             }
         }
     }
     if (isset($plugins) && count($plugins) > 0) {
         $list = array();
         foreach ($plugins as $key => $val) {
             $list[$key] = $val["name"];
         }
         asort($list);
         echo "<li id='menu5' onmouseover=\"javascript:menuAff('menu5','menu');\">";
         echo "<a href='#' title=\"" . __s('Plugins') . "\" class='itemP'>" . __('Plugins') . "</a>";
         // default none
         echo "<ul class='ssmenu'>";
         // list menu item
         foreach ($list as $key => $val) {
             $link = "";
             if (is_string($PLUGIN_HOOKS["helpdesk_menu_entry"][$key])) {
                 $link = $PLUGIN_HOOKS["helpdesk_menu_entry"][$key];
             }
             echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/plugins/" . $key . $link . "'>" . $plugins[$key]["name"] . "</a></li>\n";
         }
         echo "</ul></li>";
     }
     echo "</ul>";
     echo "<div class='sep'></div>";
     echo "</div>";
     // End navigation bar
     // End headline
     ///Le sous menu contextuel 1
     echo "<div id='c_ssmenu1'>&nbsp;</div>";
     //  Le fil d ariane
     echo "<div id='c_ssmenu2'>";
     echo "<ul>";
     echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php' title=\"" . __s('Home') . "\">" . __('Home') . "></a></li>";
     echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>";
     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';
         $url_validate = $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($opt, '&amp;');
         $pic_validate = "<a href='{$url_validate}'>" . "<img title=\"" . __s('Ticket waiting for your approval') . "\" alt=\"" . __s('Ticket waiting for your approval') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png'></a>";
         echo "<li>{$pic_validate}</li>\n";
     }
     echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>";
     if (Session::haveRight('create_ticket', 1) && strpos($_SERVER['PHP_SELF'], "ticket")) {
         echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/helpdesk.public.php?create_ticket=1'>";
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add.png' title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"></a></li>";
     }
     echo "<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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=400, width=600, " . "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>";
     // check user id : header used for display messages when session logout
     if (Session::getLoginUserID()) {
         self::showProfileSelecter($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
     }
     echo "</ul></div>";
     echo "</div>";
     // fin header
     echo "<div id='page' >";
     // call static function callcron() every 5min
     CronTask::callCron();
     self::displayMessageAfterRedirect();
 }
Esempio n. 9
0
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkCentralAccess();
Html::header(Rule::getTypeName(2), $_SERVER['PHP_SELF'], "admin", "rule", -1);
echo "<table class='tab_cadre'>";
echo "<tr><th>" . __('Rule type') . "</th></tr>";
foreach ($CFG_GLPI["rulecollections_types"] as $rulecollectionclass) {
    $rulecollection = new $rulecollectionclass();
    if ($rulecollection->canList()) {
        if ($plug = isPluginItemType($rulecollectionclass)) {
            $title = sprintf(__('%1$s - %2$s'), Plugin::getInfo($plug['plugin'], 'name'), $rulecollection->getTitle());
        } else {
            $title = $rulecollection->getTitle();
        }
        echo "<tr class='tab_bg_1'><td class='center b'>";
        echo "<a href='" . Toolbox::getItemTypeSearchURL($rulecollection->getRuleClassName()) . "'>";
        echo $title . "</a></td></tr>";
    }
}
if (Session::haveRight("transfer", "r") && Session::isMultiEntitiesMode()) {
    echo "<tr class='tab_bg_1'><td class='center b'>";
    echo "<a href='" . $CFG_GLPI['root_doc'] . "/front/transfer.php'>" . __('Transfer') . "</a>";
    echo "</td></tr>";
}
if (Session::haveRight("config", "r")) {
    echo "<tr class='tab_bg_1'><td class='center b'>";
Esempio n. 10
0
 static function getItemtypes()
 {
     global $PLUGIN_HOOKS;
     $tab = array(__("Assets") => array('Computer' => _n("Computer", "Computers", 2), 'Monitor' => _n("Monitor", "Monitors", 2), 'Software' => _n("Software", "Software", 2), 'NetworkEquipment' => _n("Network", "Networks", 2), 'Peripheral' => _n("Device", "Devices", 2), 'Printer' => _n("Printer", "Printers", 2), 'CartridgeItem' => _n("Cartridge", "Cartridges", 2), 'ConsumableItem' => _n("Consumable", "Consumables", 2), 'Phone' => _n("Phone", "Phones", 2)), __("Assistance") => array('Ticket' => _n("Ticket", "Tickets", 2), 'Problem' => _n("Problem", "Problems", 2), 'Change' => _n("Change", "Changes", 2), 'TicketRecurrent' => __("Recurrent tickets")), __("Management") => array('SoftwareLicense' => _n("License", "Licenses", 2), 'Budget' => _n("Budget", "Budgets", 2), 'Supplier' => _n("Supplier", "Suppliers", 2), 'Contact' => _n("Contact", "Contacts", 2), 'Contract' => _n("Contract", "Contracts", 2), 'Document' => _n("Document", "Documents", 2)), __("Tools") => array('Project' => __("Project"), 'ProjectTask' => _n("Project task", "Project tasks", 2), 'Reminder' => _n("Note", "Notes", 2), 'RSSFeed' => __("RSS feed")), __("Administration") => array('User' => _n("User", "Users", 2), 'Group' => _n("Group", "Groups", 2), 'Entity' => _n("Entity", "Entities", 2), 'Profile' => _n("Profile", "Profiles", 2)));
     foreach ($PLUGIN_HOOKS['plugin_fields'] as $itemtype) {
         $isPlugin = isPluginItemType($itemtype);
         if ($isPlugin) {
             $plugin_name = Plugin::getInfo($isPlugin['plugin'], 'name');
             $tab[__("Plugins")][$itemtype] = $plugin_name . ' - ' . $itemtype::getTypeName(Session::getPluralNumber());
         }
     }
     return $tab;
 }