예제 #1
0
 function showNewRuleForm($ID)
 {
     global $LANG;
     echo "<form method='post' action='" . getItemTypeFormURL('Entity') . "'>";
     echo "<table  class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . $LANG['rulesengine'][19] . "</th></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:&nbsp;";
     autocompletionTextField($this, "name", array('value' => '', 'size' => 33));
     echo "&nbsp;&nbsp;&nbsp;" . $LANG['joblist'][6] . "&nbsp;:&nbsp;";
     autocompletionTextField($this, "description", array('value' => '', 'size' => 33));
     echo "&nbsp;&nbsp;&nbsp;" . $LANG['rulesengine'][9] . "&nbsp;:&nbsp;";
     $this->dropdownRulesMatch("match", "AND");
     echo "</td><td rowspan='2' class='tab_bg_2 center middle'>";
     echo "<input type=hidden name='sub_type' value='" . get_class($this) . "'>";
     echo "<input type=hidden name='entities_id' value='-1'>";
     echo "<input type=hidden name='affectentity' value='{$ID}'>";
     echo "<input type=hidden name='_method' value='addRule'>";
     echo "<input type='submit' name='execute' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='center'>" . $LANG['profiles'][22] . "&nbsp;:&nbsp;";
     Dropdown::show('Profile');
     echo "<span class='small_space'>" . $LANG['profiles'][28] . "</span>&nbsp;:&nbsp;";
     Dropdown::showYesNo("is_recursive", 0);
     echo "</td></tr>\n";
     echo "</table></form>";
 }
 function manageContacts($items_id)
 {
     global $LANG;
     $pmContact = new PluginMonitoringContact();
     $user = new User();
     $a_list = $this->find("`plugin_monitoring_hosts_id`='" . $items_id . "'");
     echo "<form name='contacts_form' id='contacts_form'\n             method='post' action=' ";
     echo getItemTypeFormURL(__CLASS__) . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th colspan='3'>";
     echo $LANG['plugin_monitoring']['contact'][20];
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td class='right'>";
     $a_contacts = $pmContact->find();
     $a_elements = array();
     foreach ($a_contacts as $data) {
         $user->getFromDB($data['users_id']);
         $a_elements[$data['id']] = $user->getName();
     }
     asort($a_elements);
     Dropdown::showFromArray('plugin_monitoring_contacts_id', $a_elements);
     echo "</td>";
     echo "<td class='center'>";
     echo "<input type='submit' class='submit' name='parent_add' value='" . $LANG['buttons'][8] . " >>'>";
     echo "<br><br>";
     if ($a_list) {
         echo "<input type='submit' class='submit' name='parent_delete' value='<< " . $LANG['buttons'][6] . "'>";
     }
     echo "</td>";
     echo "<td>";
     if ($a_list) {
         echo "<select name='parent_to_delete[]' multiple size='5'>";
         foreach ($a_list as $data) {
             $pmContact->getFromDB($data['plugin_monitoring_contacts_id']);
             $user->getFromDB($pmContact->fields['users_id']);
             echo "<option value='" . $data['plugin_monitoring_contacts_id'] . "'>" . $user->getName() . "</option>";
         }
         echo "</select>";
     } else {
         echo "&nbsp;";
     }
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "<input type='hidden' name='id' value='" . $items_id . "' />";
     echo "</form>";
 }
예제 #3
0
 /**
  * Show softwares candidates to be merged with the current
  *
  * @return nothing
  **/
 function showMergeCandidates()
 {
     global $DB, $CFG_GLPI, $LANG;
     $ID = $this->getField('id');
     $this->check($ID, "w");
     $rand = mt_rand();
     echo "<div class='center'>";
     $sql = "SELECT `glpi_softwares`.`id`,\n                     `glpi_softwares`.`name`,\n                     `glpi_entities`.`completename` AS entity\n              FROM `glpi_softwares`\n              LEFT JOIN `glpi_entities` ON (`glpi_softwares`.`entities_id` = `glpi_entities`.`id`)\n              WHERE (`glpi_softwares`.`id` != '{$ID}'\n                     AND `glpi_softwares`.`name` = '" . addslashes($this->fields["name"]) . "'\n                     AND `glpi_softwares`.`is_deleted` = '0'\n                     AND `glpi_softwares`.`is_template` = '0' " . getEntitiesRestrictRequest('AND', 'glpi_softwares', 'entities_id', getSonsOf("glpi_entities", $this->fields["entities_id"]), false) . ")\n              ORDER BY `entity`";
     $req = $DB->request($sql);
     if ($req->numrows()) {
         $link = getItemTypeFormURL('Software');
         echo "<form method='post' name='mergesoftware_form{$rand}' id='mergesoftware_form{$rand}'\n                action='" . $link . "'>";
         echo "<table class='tab_cadre_fixehov'><tr><th>&nbsp;</th>";
         echo "<th>" . $LANG['common'][16] . "</th>";
         echo "<th>" . $LANG['entity'][0] . "</th>";
         echo "<th>" . $LANG['software'][19] . "</th>";
         echo "<th>" . $LANG['software'][11] . "</th></tr>";
         foreach ($req as $data) {
             echo "<tr class='tab_bg_2'>";
             echo "<td><input type='checkbox' name='item[" . $data["id"] . "]' value='1'></td>";
             echo "<td<a href='" . $link . "?id=" . $data["id"] . "'>" . $data["name"] . "</a></td>";
             echo "<td>" . $data["entity"] . "</td>";
             echo "<td class='right'>" . Computer_SoftwareVersion::countForSoftware($data["id"]) . "</td>";
             echo "<td class='right'>" . SoftwareLicense::countForSoftware($data["id"]) . "</td></tr>\n";
         }
         echo "</table>\n";
         openArrowMassive("mergesoftware_form{$rand}", true);
         echo "<input type='hidden' name='id' value='{$ID}'>";
         closeArrowMassive('mergesoftware', $LANG['software'][48]);
         echo "</form>";
     } else {
         echo $LANG['search'][15];
     }
     echo "</div>";
 }
 /**
  * Display a software for a License (not installed)
  *
  * @param $data data used to display
  * @param $computers_id ID of the computer
  * @param $withtemplate template case of the view process
  * @param $canedit boolean user can edit software ?
  *
  * @return nothing
  */
 private static function displaySoftsByLicense($data, $computers_id, $withtemplate, $canedit)
 {
     global $LANG, $CFG_GLPI;
     if ($data["softwareversions_id_use"] > 0) {
         $ID = $data["softwareversions_id_use"];
     } else {
         $ID = $data["softwareversions_id_buy"];
     }
     $multiple = false;
     $link_item = getItemTypeFormURL('SoftwareLicense');
     $link = $link_item . "?id=" . $data['id'];
     echo "<tr class='tab_bg_1'>";
     if ($canedit) {
         echo "<td>";
         if ((empty($withtemplate) || $withtemplate != 2) && $ID > 0) {
             echo "<input type='checkbox' name='softversion_{$ID}'>";
         }
         echo "</td>";
     }
     echo "<td class='center b'>";
     echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/software.form.php?id=" . $data['softwares_id'] . "'>";
     echo $data["softname"] . ($_SESSION["glpiis_ids_visible"] ? " (" . $data['softwares_id'] . ")" : "");
     echo "</a></td>";
     echo "<td>" . $data["state"] . "</td>";
     echo "<td>" . $data["version"];
     if ((empty($withtemplate) || $withtemplate != 2) && $canedit && $ID > 0) {
         echo " - <a href='" . $CFG_GLPI["root_doc"] . "/front/computer_softwareversion.form.php" . "?install=install&amp;softwareversions_id={$ID}&amp;computers_id={$computers_id}'>";
         echo "<strong>" . $LANG['buttons'][4] . "</strong></a>";
     }
     echo "</td></td><td><strong>" . $data["name"] . "</strong> -&nbsp;" . $data["serial"] . "&nbsp; ";
     if ($data["softwarelicensetypes_id"]) {
         echo " (" . Dropdown::getDropdownName("glpi_softwarelicensetypes", $data["softwarelicensetypes_id"]) . ")&nbsp; ";
     }
     showToolTip($LANG['common'][16] . "&nbsp;: " . $data['name'] . "<br>" . $LANG['common'][19] . "&nbsp;: " . $data['serial'] . "<br>" . $data['comment'], array('link' => $link));
     echo "</td></tr>\n";
 }
예제 #5
0
 /** Show LDAP users to add or synchronise
  *
  * @return  nothing
  **/
 static function showLdapUsers()
 {
     global $CFG_GLPI, $LANG;
     $values['order'] = 'DESC';
     $values['start'] = 0;
     foreach ($_SESSION['ldap_import'] as $option => $value) {
         $values[$option] = $value;
     }
     $results = array();
     $limitexceeded = false;
     $ldap_users = self::getAllUsers($values, $results, $limitexceeded);
     if (is_array($ldap_users)) {
         $numrows = count($ldap_users);
         $action = "toprocess";
         $form_action = "process_ok";
         if ($numrows > 0) {
             if ($limitexceeded) {
                 echo "<table class='tab_cadre_fixe'>";
                 echo "<tr><th class='red'>";
                 echo "<img class='center' src='" . $CFG_GLPI["root_doc"] . "/pics/warning.png'\n                      alt='warning'>&nbsp;" . $LANG['ldap'][8];
                 echo "</th></tr></table><br>";
             }
             printPager($values['start'], $numrows, $_SERVER['PHP_SELF'], '');
             // delete end
             array_splice($ldap_users, $values['start'] + $_SESSION['glpilist_limit']);
             // delete begin
             if ($values['start'] > 0) {
                 array_splice($ldap_users, 0, $values['start']);
             }
             echo "<form method='post' id='ldap_form' name='ldap_form' action='" . $_SERVER['PHP_SELF'] . "'>";
             echo "<table class='tab_cadre_fixe'>";
             echo "<tr><th>" . (!$_SESSION['ldap_import']['mode'] ? $LANG['buttons'][37] : $LANG['ldap'][15]) . "</th>";
             $num = 0;
             echo Search::showHeaderItem(HTML_OUTPUT, $LANG['Menu'][14], $num, $_SERVER['PHP_SELF'] . "?order=" . ($values['order'] == "DESC" ? "ASC" : "DESC"));
             echo "<th>" . $LANG['common'][26] . " " . $LANG['ldap'][13] . "</th>";
             if ($_SESSION['ldap_import']['mode']) {
                 echo "<th>" . $LANG['common'][26] . " " . $LANG['ldap'][14] . "</th>";
             }
             echo "</tr>";
             foreach ($ldap_users as $userinfos) {
                 $link = $user = $userinfos["user"];
                 if (isset($userinfos['id']) && haveRight('user', 'r')) {
                     $link = "<a href='" . getItemTypeFormURL('User') . '?id=' . $userinfos['id'] . "'>{$user}</a>";
                 }
                 if (isset($userinfos["timestamp"])) {
                     $stamp = $userinfos["timestamp"];
                 } else {
                     $stamp = '';
                 }
                 if (isset($userinfos["date_sync"])) {
                     $date_sync = $userinfos["date_sync"];
                 } else {
                     $date_sync = '';
                 }
                 echo "<tr class='tab_bg_2 center'>";
                 //Need to use " instead of ' because it doesn't work with names with ' inside !
                 echo "<td><input type='checkbox' name=\"" . $action . "[" . $user . "]\"></td>";
                 echo "<td>" . $link . "</td>";
                 if ($stamp != '') {
                     echo "<td>" . convDateTime(date("Y-m-d H:i:s", $stamp)) . "</td>";
                 } else {
                     echo "<td>&nbsp;</td>";
                 }
                 if ($_SESSION['ldap_import']['mode']) {
                     if ($date_sync != '') {
                         echo "<td>" . convDateTime($date_sync) . "</td>";
                     } else {
                         echo "<td>&nbsp;</td>";
                     }
                 }
                 echo "</tr>";
             }
             if ($_SESSION['ldap_import']['mode']) {
                 $colspan = 6;
             } else {
                 $colspan = 5;
             }
             echo "</table>";
             openArrowMassive("ldap_form", true);
             closeArrowMassive($form_action, $_SESSION['ldap_import']['mode'] ? $LANG['ldap'][15] : $LANG['buttons'][37]);
             echo "</form>";
             printPager($values['start'], $numrows, $_SERVER['PHP_SELF'], '');
         } else {
             echo "<div class='center b'>" . ($_SESSION['ldap_import']['mode'] ? $LANG['ldap'][43] : $LANG['ldap'][3]) . "</div>";
         }
     } else {
         echo "<div class='center b'>" . ($_SESSION['ldap_import']['mode'] ? $LANG['ldap'][43] : $LANG['ldap'][3]) . "</div>";
     }
 }
 /**
  * Print the validation list into ticket
  *
  * @param $ticket class
  **/
 function showSummary($ticket)
 {
     global $DB, $LANG, $CFG_GLPI;
     if (!haveRight('validate_ticket', 1) && !haveRight('create_validation', 1)) {
         return false;
     }
     $tID = $ticket->fields['id'];
     //$canadd = haveRight("create_validation", "1");
     $tmp = array('tickets_id' => $tID);
     $canadd = $this->can(-1, 'w', $tmp);
     $rand = mt_rand();
     echo "<div id='viewfollowup" . $tID . "{$rand}'></div>\n";
     if ($canadd) {
         echo "<script type='text/javascript' >\n";
         echo "function viewAddValidation" . $tID . "{$rand}() {\n";
         $params = array('type' => __CLASS__, 'tickets_id' => $tID, 'id' => -1);
         ajaxUpdateItemJsCode("viewfollowup" . $tID . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewfollowup.php", $params, false);
         echo "};";
         echo "</script>\n";
         if ($ticket->fields["status"] != 'solved' && $ticket->fields["status"] != 'closed') {
             echo "<div class='center'><a href='javascript:viewAddValidation" . $tID . "{$rand}();'>";
             echo $LANG['validation'][1] . "</a></div><br>\n";
         }
     }
     $query = "SELECT *\n                FROM `" . $this->getTable() . "`\n                WHERE `tickets_id` = '" . $ticket->getField('id') . "'";
     if (!$canadd) {
         $query .= " AND `users_id_validate` = '" . getLoginUserID() . "' ";
     }
     $query .= " ORDER BY submission_date DESC";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if ($number) {
         $colonnes = array($LANG['validation'][2], $LANG['validation'][3], $LANG['validation'][18], $LANG['validation'][5], $LANG['validation'][4], $LANG['validation'][21], $LANG['validation'][6]);
         $nb_colonnes = count($colonnes);
         echo "<table class='tab_cadre_fixehov'>";
         echo "<tr><th colspan='" . $nb_colonnes . "'>" . $LANG['validation'][7] . "</th></tr>";
         echo "<tr>";
         foreach ($colonnes as $colonne) {
             echo "<th>" . $colonne . "</th>";
         }
         echo "</tr>";
         initNavigateListItems('TicketValidation', $LANG['validation'][26] . " = " . $ticket->fields['name']);
         while ($row = $DB->fetch_assoc($result)) {
             $canedit = $this->can($row["id"], 'w');
             addToNavigateListItems('TicketValidation', $row["id"]);
             $bgcolor = $this->getStatusColor($row['status']);
             $status = $this->getStatus($row['status']);
             echo "<tr class='tab_bg_1' " . ($canedit ? "style='cursor:pointer' onClick=\"viewEditValidation" . $ticket->fields['id'] . $row["id"] . "{$rand}();\"" : '') . " id='viewfollowup" . $this->fields['tickets_id'] . $row["id"] . "{$rand}'>";
             echo "<td>";
             if ($canedit) {
                 echo "\n<script type='text/javascript' >\n";
                 echo "function viewEditValidation" . $ticket->fields['id'] . $row["id"] . "{$rand}() {\n";
                 $params = array('type' => __CLASS__, 'tickets_id' => $this->fields["tickets_id"], 'id' => $row["id"]);
                 ajaxUpdateItemJsCode("viewfollowup" . $ticket->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewfollowup.php", $params, false);
                 echo "};";
                 echo "</script>\n";
             }
             echo "<div style='background-color:" . $bgcolor . ";'>" . $status . "</div></td>";
             if ($ticket->can($ticket->fields['id'], 'r') && !strstr($ticket->fields["status"], "solved") && !strstr($ticket->fields["status"], "closed")) {
                 $link_validation = getItemTypeFormURL('TicketValidation');
                 echo "<td>" . convDateTime($row["submission_date"]) . "</td>";
             } else {
                 echo "<td>" . convDateTime($row["submission_date"]) . "</a></td>";
             }
             echo "<td>" . getUserName($row["users_id"]) . "</td>";
             echo "<td>" . $row["comment_submission"] . "</td>";
             echo "<td>" . convDateTime($row["validation_date"]) . "</td>";
             echo "<td>" . getUserName($row["users_id_validate"]) . "</td>";
             echo "<td>" . $row["comment_validation"] . "</td>";
             echo "</tr>";
         }
         echo "</table>";
     } else {
         echo "<div class='center b'>" . $LANG['search'][15] . "</div>";
     }
 }
 /**
  * Show the User having a profile, in allowed Entity
  *
  * @param $prof object
  **/
 static function showForProfile(Profile $prof)
 {
     global $DB, $LANG, $CFG_GLPI;
     $ID = $prof->fields['id'];
     $canedit = haveRight("user", "w");
     if (!$prof->can($ID, 'r')) {
         return false;
     }
     echo "<div class='spaced'>";
     echo "<table class='tab_cadre_fixe'><tr>";
     echo "<th>" . $LANG['profiles'][22] . "&nbsp;:<span class='small_space'>" . $prof->fields["name"] . "</span></th></tr>\n";
     echo "<tr><th colspan='2'>" . $LANG['Menu'][14] . " (D=" . $LANG['profiles'][29] . ", R=" . $LANG['profiles'][28] . ")</th></tr>";
     echo "</table>\n";
     $query = "SELECT `glpi_users`.*,\n                       `glpi_profiles_users`.`entities_id` AS entity,\n                       `glpi_profiles_users`.`id` AS linkID,\n                       `glpi_profiles_users`.`is_dynamic`,\n                       `glpi_profiles_users`.`is_recursive`\n                FROM `glpi_profiles_users`\n                LEFT JOIN `glpi_entities`\n                     ON (`glpi_entities`.`id`=`glpi_profiles_users`.`entities_id`)\n                LEFT JOIN `glpi_users`\n                     ON (`glpi_users`.`id` = `glpi_profiles_users`.`users_id`)\n                WHERE `glpi_profiles_users`.`profiles_id` = '{$ID}'\n                      AND `glpi_users`.`is_deleted` = '0' " . getEntitiesRestrictRequest("AND", "glpi_profiles_users", 'entities_id', $_SESSION['glpiactiveentities'], true) . "\n                ORDER BY `glpi_entities`.`completename`";
     echo "<table class='tab_cadre_fixe'>";
     $i = 0;
     $nb_per_line = 3;
     $rand = mt_rand();
     // Just to avoid IDE warning
     $canedit_entity = false;
     if ($result = $DB->query($query)) {
         if ($DB->numrows($result) != 0) {
             $temp = -1;
             while ($data = $DB->fetch_array($result)) {
                 if ($data["entity"] != $temp) {
                     while ($i % $nb_per_line != 0) {
                         if ($canedit_entity) {
                             echo "<td width='10'>&nbsp;</td>";
                         }
                         echo "<td class='tab_bg_1'>&nbsp;</td>\n";
                         $i++;
                     }
                     if ($i != 0) {
                         echo "</table>";
                         if ($canedit_entity) {
                             openArrowMassive("profileuser_form" . $rand . "_{$temp}", true);
                             Dropdown::show('Entity', array('entity' => $_SESSION['glpiactiveentities']));
                             echo "&nbsp;<input type='submit' name='moveentity' value='" . $LANG['buttons'][20] . "' class='submit'>&nbsp;";
                             closeArrowMassive('delete', $LANG['buttons'][6]);
                         }
                         echo "</div></form></td></tr>\n";
                     }
                     // New entity
                     $i = 0;
                     $temp = $data["entity"];
                     $canedit_entity = $canedit && in_array($temp, $_SESSION['glpiactiveentities']);
                     $rand = mt_rand();
                     echo "<tr class='tab_bg_2'>";
                     echo "<td class='left'>";
                     echo "<a href=\"javascript:showHideDiv('entity{$temp}{$rand}','imgcat{$temp}', '" . GLPI_ROOT . "/pics/folder.png','" . GLPI_ROOT . "/pics/folder-open.png');\">";
                     echo "<img alt='' name='imgcat{$temp}' src=\"" . GLPI_ROOT . "/pics/folder.png\">&nbsp;";
                     echo "<strong>" . Dropdown::getDropdownName('glpi_entities', $data["entity"]) . "</strong>";
                     echo "</a></td></tr>\n";
                     echo "<tr><td>";
                     echo "<form name='profileuser_form" . $rand . "_{$temp}' id='profileuser_form" . $rand . "_{$temp}' method='post' action='" . getItemTypeFormURL(__CLASS__) . "'>";
                     echo "<div class='center' id='entity{$temp}{$rand}' style='display:none;'>\n";
                     echo "<table class='tab_cadre_fixe'>\n";
                 }
                 if ($i % $nb_per_line == 0) {
                     if ($i != 0) {
                         echo "</tr>\n";
                     }
                     echo "<tr class='tab_bg_1'>\n";
                     $i = 0;
                 }
                 if ($canedit_entity) {
                     echo "<td width='10'>";
                     $sel = "";
                     if (isset($_GET["select"]) && $_GET["select"] == "all") {
                         $sel = "checked";
                     }
                     echo "<input type='checkbox' name='item[" . $data["linkID"] . "]' value='1' {$sel}>";
                     echo "</td>";
                 }
                 echo "<td class='tab_bg_1'>" . formatUserName($data["id"], $data["name"], $data["realname"], $data["firstname"], 1);
                 if ($data["is_dynamic"] || $data["is_recursive"]) {
                     echo "<strong>&nbsp;(";
                     if ($data["is_dynamic"]) {
                         echo "D";
                     }
                     if ($data["is_dynamic"] && $data["is_recursive"]) {
                         echo ", ";
                     }
                     if ($data["is_recursive"]) {
                         echo "R";
                     }
                     echo ")</strong>";
                 }
                 echo "</td>\n";
                 $i++;
             }
             if ($i % $nb_per_line != 0) {
                 while ($i % $nb_per_line != 0) {
                     if ($canedit_entity) {
                         echo "<td width='10'>&nbsp;</td>";
                     }
                     echo "<td class='tab_bg_1'>" . DROPDOWN_EMPTY_VALUE . "</td>";
                     $i++;
                 }
             }
             if ($i != 0) {
                 echo "</table>\n";
                 if ($canedit_entity) {
                     openArrowMassive("profileuser_form" . $rand . "_{$temp}", true);
                     Dropdown::show('Entity', array('entity' => $_SESSION['glpiactiveentities']));
                     echo "&nbsp;<input type='submit' name='moveentity' value='" . $LANG['buttons'][20] . "' class='submit'>&nbsp;";
                     closeArrowMassive('delete', $LANG['buttons'][6]);
                 }
                 echo "</div></form></td></tr>\n";
             }
         } else {
             echo "<tr><td class='tab_bg_1 center'>" . $LANG['profiles'][33] . "</td></tr>\n";
         }
     }
     echo "</table></div>\n";
 }
$fup = new TicketFollowup();
if (isset($_POST["add"])) {
    $fup->check(-1, 'w', $_POST);
    $fup->add($_POST);
    Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . "  " . $LANG['log'][21]);
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST['add_close']) || isset($_POST['add_reopen'])) {
        $ticket = new Ticket();
        if ($ticket->getFromDB($_POST["tickets_id"]) && $ticket->canApprove()) {
            $fup->add($_POST);
            Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . "  " . $LANG['log'][29]);
            glpi_header($_SERVER['HTTP_REFERER']);
        }
    } else {
        if (isset($_POST["update"])) {
            $fup->check($_POST['id'], 'w');
            $fup->update($_POST);
            Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . "  " . $LANG['log'][21]);
            glpi_header(getItemTypeFormURL('Ticket') . "?id=" . $fup->getField('tickets_id'));
        } else {
            if (isset($_POST["delete"])) {
                $fup->check($_POST['id'], 'w');
                $fup->delete($_POST);
                Event::log($fup->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
                glpi_header(getItemTypeFormURL('Ticket') . "?id=" . $fup->getField('tickets_id'));
            }
        }
    }
}
displayErrorAndDie('Lost');
예제 #9
0
 function showForSLA(SLA $sla)
 {
     global $DB, $CFG_GLPI, $LANG;
     $ID = $sla->getField('id');
     if (!$sla->can($ID, 'r')) {
         return false;
     }
     $canedit = $sla->can($ID, 'w');
     $rand = mt_rand();
     echo "<form name='slalevel_form{$rand}' id='slalevel_form{$rand}' method='post' action='";
     echo getItemTypeFormURL(__CLASS__) . "'>";
     if ($canedit) {
         echo "<div class='center first-bloc'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['sla'][4] . "</tr>";
         echo "<tr class='tab_bg_2'><td class='center'>" . $LANG['common'][16] . "&nbsp;: ";
         echo "<input type='hidden' name='slas_id' value='{$ID}'>";
         echo "<input type='hidden' name='entities_id' value='" . $sla->getEntityID() . "'>";
         echo "<input type='hidden' name='is_recursive' value='" . $sla->isRecursive() . "'>";
         echo "<input  name='name' value=''>";
         echo "</td><td class='center'>" . $LANG['sla'][3] . "&nbsp;: ";
         self::dropdownExecutionTime('execution_time', array('max_time' => $sla->fields['resolution_time'], 'used' => self::getAlreadyUsedExecutionTime($sla->fields['id'])));
         echo "</td><td class='center'>" . $LANG['common'][60] . "&nbsp;: ";
         Dropdown::showYesNo("is_active", array('value' => 1));
         echo "</td><td class='center'>";
         echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table></div>";
         $query = "SELECT *\n                  FROM `glpi_slalevels`\n                  WHERE `slas_id` = '{$ID}'\n                  ORDER BY `execution_time`";
         $result = $DB->query($query);
         if ($DB->numrows($result) > 0) {
             echo "<div class='center'><table class='tab_cadre_fixehov'>";
             echo "<tr><th colspan='2'>" . $LANG['common'][16] . "</th>";
             echo "<th>" . $LANG['sla'][3] . "</th>";
             echo "<th>" . $LANG['common'][60] . "</th>";
             echo "</tr>";
             initNavigateListItems('SlaLevel', $LANG['sla'][1] . " - " . $sla->getName());
             while ($data = $DB->fetch_array($result)) {
                 addToNavigateListItems('SlaLevel', $data["id"]);
                 echo "<tr class='tab_bg_2'>";
                 echo "<td width='10'>";
                 if ($canedit) {
                     echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>";
                 } else {
                     echo "&nbsp;";
                 }
                 echo "</td>";
                 echo "<td>";
                 if ($canedit) {
                     echo "<a href='" . getItemTypeFormURL('SlaLevel') . "?id=" . $data["id"] . "'>";
                 }
                 echo $data["name"];
                 if (empty($data["name"])) {
                     echo "(" . $data['id'] . ")";
                 }
                 if ($canedit) {
                     echo "</a>";
                 }
                 echo "</td>";
                 echo "<td>" . ($data["execution_time"] != 0 ? timestampToString($data["execution_time"], false) : $LANG['sla'][5]) . "</td>";
                 echo "<td>" . Dropdown::getYesNo($data["is_active"]) . "</td>";
                 echo "</tr>";
                 echo "<tr class='tab_bg_1'><td colspan='4'>";
                 $this->getRuleWithCriteriasAndActions($data['id'], 0, 1);
                 $this->showActionsList($data["id"], array('readonly' => true));
                 echo "</td></tr>";
             }
             openArrowMassive("slalevel_form{$rand}", true);
             closeArrowMassive('delete', $LANG['buttons'][6]);
             echo "</table></div>";
         }
     }
     echo "</form>";
 }
예제 #10
0
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 GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
checkRight("config", "w");
$config = new Config();
if (!empty($_POST["update_auth"])) {
    $config->update($_POST);
    glpi_header($_SERVER['HTTP_REFERER']);
}
if (!empty($_POST["update"])) {
    $config->update($_POST);
    if (isset($_POST["use_ocs_mode"]) && $_POST["use_ocs_mode"] && !$CFG_GLPI["use_ocs_mode"]) {
        glpi_header(getItemTypeSearchURL('OcsServer'));
    } else {
        glpi_header(getItemTypeFormURL('Config'));
    }
}
commonHeader($LANG['common'][12], $_SERVER['PHP_SELF'], "config", "config");
$config->showForm(1);
commonFooter();
 /**
  * Show segments of a calendar
  *
  * @param $calendar Calendar object
  **/
 static function showForCalendar(Calendar $calendar)
 {
     global $DB, $CFG_GLPI, $LANG;
     $ID = $calendar->getField('id');
     if (!$calendar->can($ID, 'r')) {
         return false;
     }
     $canedit = $calendar->can($ID, 'w');
     $rand = mt_rand();
     echo "<form name='calendarsegment_form{$rand}' id='calendarsegment_form{$rand}' method='post'\n             action='";
     echo getItemTypeFormURL(__CLASS__) . "'>";
     if ($canedit) {
         echo "<div class='spaced'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['calendar'][6] . "</tr>";
         echo "<tr class='tab_bg_2'><td class='center'>" . $LANG['calendar'][7] . "&nbsp;: ";
         echo "<input type='hidden' name='entities_id' value='" . $calendar->fields['entities_id'] . "'>";
         echo "<input type='hidden' name='is_recursive' value='" . $calendar->fields['is_recursive'] . "'>";
         echo "<input type='hidden' name='calendars_id' value='{$ID}'>";
         Dropdown::showFromArray('day', $LANG['calendarDay']);
         echo "</td><td class='center'>" . $LANG['buttons'][33] . "&nbsp;: ";
         Dropdown::showHours("begin", date('H') . ":00");
         echo "</td><td class='center'>" . $LANG['buttons'][32] . "&nbsp;: ";
         Dropdown::showHours("end", date('H') + 1 . ":00");
         echo "</td><td class='center'>";
         echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table></div>";
     }
     echo "<div class='center'><table class='tab_cadre_fixehov'>";
     echo "<tr><th colspan='2'>" . $LANG['calendar'][7] . "</th>";
     echo "<th>" . $LANG['buttons'][33] . "</th>";
     echo "<th>" . $LANG['buttons'][32] . "</th>";
     echo "</tr>";
     $query = "SELECT *\n                FROM `glpi_calendarsegments`\n                WHERE `calendars_id` = '{$ID}'\n                ORDER BY `day`, `begin`, `end`";
     $result = $DB->query($query);
     if ($DB->numrows($result) > 0) {
         while ($data = $DB->fetch_array($result)) {
             echo "<tr class='tab_bg_1'>";
             echo "<td width='10'>";
             if ($canedit) {
                 echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>";
             } else {
                 echo "&nbsp;";
             }
             echo "</td>";
             echo "<td>";
             echo $LANG['calendarDay'][$data['day']];
             echo "</td>";
             echo "<td>" . $data["begin"] . "</td>";
             echo "<td>" . $data["end"] . "</td>";
         }
         echo "</tr>";
     }
     echo "</table></div>";
     if ($canedit) {
         openArrowMassive("calendarsegment_form{$rand}", true);
         closeArrowMassive('delete', $LANG['buttons'][6]);
     }
     echo "</form>";
 }
예제 #12
0
 /**
  * Print the HTML array for infocoms linked
  *
  *@return Nothing (display)
  *
  **/
 function showInfocoms()
 {
     global $DB, $CFG_GLPI, $LANG;
     $instID = $this->fields['id'];
     if (!$this->can($instID, 'r')) {
         return false;
     }
     $query = "SELECT DISTINCT `itemtype`\n                FROM `glpi_infocoms`\n                WHERE `suppliers_id` = '{$instID}'\n                      AND `itemtype` NOT IN ('ConsumableItem', 'CartridgeItem', 'Software')\n                ORDER BY `itemtype`";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     echo "<div class='spaced'><table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>";
     printPagerForm();
     echo "</th><th colspan='3'>";
     if ($DB->numrows($result) == 0) {
         echo $LANG['document'][13];
     } else {
         echo $LANG['document'][19];
     }
     echo "</th></tr>";
     echo "<tr><th>" . $LANG['common'][17] . "</th>";
     echo "<th>" . $LANG['entity'][0] . "</th>";
     echo "<th>" . $LANG['common'][16] . "</th>";
     echo "<th>" . $LANG['common'][19] . "</th>";
     echo "<th>" . $LANG['common'][20] . "</th>";
     echo "</tr>";
     $num = 0;
     for ($i = 0; $i < $number; $i++) {
         $itemtype = $DB->result($result, $i, "itemtype");
         if (!class_exists($itemtype)) {
             continue;
         }
         $item = new $itemtype();
         if ($item->canView()) {
             $linktype = $itemtype;
             $linkfield = 'id';
             $itemtable = getTableForItemType($itemtype);
             $query = "SELECT `glpi_infocoms`.`entities_id`, `name`, `{$itemtable}`.*\n                      FROM `glpi_infocoms`\n                      INNER JOIN `{$itemtable}` ON (`{$itemtable}`.`id` = `glpi_infocoms`.`items_id`) ";
             // Set $linktype for entity restriction AND link to search engine
             if ($itemtype == 'Cartridge') {
                 $query .= "INNER JOIN `glpi_cartridgeitems`\n                            ON (`glpi_cartridgeitems`.`id`=`glpi_cartridges`.`cartridgeitems_id`) ";
                 $linktype = 'CartridgeItem';
                 $linkfield = 'cartridgeitems_id';
             }
             if ($itemtype == 'Consumable') {
                 $query .= "INNER JOIN `glpi_consumableitems`\n                            ON (`glpi_consumableitems`.`id`=`glpi_consumables`.`consumableitems_id`) ";
                 $linktype = 'ConsumableItem';
                 $linkfield = 'consumableitems_id';
             }
             $linktable = getTableForItemType($linktype);
             $query .= "WHERE `glpi_infocoms`.`itemtype` = '{$itemtype}'\n                             AND `glpi_infocoms`.`suppliers_id` = '{$instID}'" . getEntitiesRestrictRequest(" AND", $linktable) . "\n                       ORDER BY `glpi_infocoms`.`entities_id`,\n                                `{$linktable}`.`name`";
             $result_linked = $DB->query($query);
             $nb = $DB->numrows($result_linked);
             // Set $linktype for link to search engine pnly
             if ($itemtype == 'SoftwareLicense' && $nb > $_SESSION['glpilist_limit']) {
                 $linktype = 'Software';
                 $linkfield = 'softwares_id';
             }
             if ($nb > $_SESSION['glpilist_limit']) {
                 echo "<tr class='tab_bg_1'>";
                 echo "<td class='center'>" . $item->getTypeName($nb) . "&nbsp;:&nbsp;{$nb}</td>";
                 echo "<td class='center' colspan='2'>";
                 echo "<a href='" . getItemTypeSearchURL($linktype) . "?" . rawurlencode("contains[0]") . "=" . rawurlencode('$$$$' . $instID) . "&" . rawurlencode("field[0]") . "=53&sort=80&order=ASC&is_deleted=0&start=0" . "'>" . $LANG['reports'][57] . "</a></td>";
                 echo "<td class='center'>-</td><td class='center'>-</td></tr>";
             } else {
                 if ($nb) {
                     for ($prem = true; $data = $DB->fetch_assoc($result_linked); $prem = false) {
                         $ID = "";
                         if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
                             $ID = " (" . $data["id"] . ")";
                         }
                         $link = getItemTypeFormURL($linktype);
                         $name = "<a href=\"" . $link . "?id=" . $data[$linkfield] . "\">" . $data["name"] . "{$ID}</a>";
                         echo "<tr class='tab_bg_1'>";
                         if ($prem) {
                             echo "<td class='center top' rowspan='{$nb}'>" . $item->getTypeName($nb) . ($nb > 1 ? "&nbsp;:&nbsp;{$nb}</td>" : "</td>");
                         }
                         echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data["entities_id"]) . "</td>";
                         echo "<td class='center";
                         echo (isset($data['is_deleted']) && $data['is_deleted'] ? " tab_bg_2_2'" : "'") . ">";
                         echo $name . "</td>";
                         echo "<td class='center'>" . (isset($data["serial"]) ? "" . $data["serial"] . "" : "-") . "</td>";
                         echo "<td class='center'>" . (isset($data["otherserial"]) ? "" . $data["otherserial"] . "" : "-") . "</td>";
                         echo "</tr>";
                     }
                 }
             }
             $num += $nb;
         }
     }
     echo "<tr class='tab_bg_2'>";
     echo "<td class='center'>" . ($num > 0 ? $LANG['common'][33] . "&nbsp;=&nbsp;{$num}" : "&nbsp;") . "</td>";
     echo "<td colspan='4'>&nbsp;</td></tr> ";
     echo "</table></div>";
 }
예제 #13
0
}
$disk = new ComputerDisk();
if (isset($_POST["add"])) {
    $disk->check(-1, 'w', $_POST);
    if ($newID = $disk->add($_POST)) {
        Event::log($_POST['computers_id'], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
    }
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["delete"])) {
        $disk->check($_POST["id"], 'w');
        if ($disk->delete($_POST)) {
            Event::log($disk->fields['computers_id'], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
        }
        $computer = new Computer();
        $computer->getFromDB($disk->fields['computers_id']);
        glpi_header(getItemTypeFormURL('Computer') . '?id=' . $disk->fields['computers_id'] . ($computer->fields['is_template'] ? "&withtemplate=1" : ""));
    } else {
        if (isset($_POST["update"])) {
            $disk->check($_POST["id"], 'w');
            if ($disk->update($_POST)) {
                Event::log($disk->fields['computers_id'], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21] . " " . $_POST["id"]);
            }
            glpi_header($_SERVER['HTTP_REFERER']);
        } else {
            commonHeader($LANG['Menu'][0], $_SERVER['PHP_SELF'], "inventory", "computer");
            $disk->showForm($_GET["id"], array('computers_id' => $_GET["computers_id"]));
            commonFooter();
        }
    }
}
 static function showActivationFormForItem($itemtype, $items_id)
 {
     global $CFG_GLPI, $LANG;
     if (!haveRight("reservation_central", "w")) {
         return false;
     }
     if (class_exists($itemtype)) {
         $item = new $itemtype();
         if (!$item->getFromDB($items_id)) {
             return false;
         }
         // Recursive type case => need entity right
         if ($item->isRecursive()) {
             if (!haveAccessToEntity($item->fields["entities_id"])) {
                 return false;
             }
         }
     } else {
         return false;
     }
     $ri = new ReservationItem();
     echo "<div><form method='post' name=form action='" . getItemTypeFormURL('ReservationItem') . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th>" . $LANG['reservation'][9] . "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     if ($ri->getFromDBbyItem($itemtype, $items_id)) {
         echo "<td class='center'>";
         //Switch reservation state
         echo "<input type='hidden' name='id' value='" . $ri->fields['id'] . "'>";
         if ($ri->fields["is_active"]) {
             echo "<input type='hidden' name='is_active' value='0'>";
             echo "<input type='submit' name='update' value=\"" . $LANG['reservation'][3] . "\"\n                   class='submit'>";
         } else {
             echo "<input type='hidden' name='is_active' value='1'>";
             echo "<input type='submit' name='update' value=\"" . $LANG['reservation'][5] . "\"\n                   class='submit'>";
         }
         echo "<span class='small_space'>";
         echo "<input type='submit' name='delete' value=\"" . $LANG['reservation'][6] . "\"\n               class='submit' " . addConfirmationOnAction(array($LANG['reservation'][38], $LANG['reservation'][39])) . ">";
         echo "</span></td>";
     } else {
         echo "<td class='center'>";
         echo "<input type='hidden' name='items_id' value='{$items_id}'>";
         echo "<input type='hidden' name='itemtype' value='{$itemtype}'>";
         echo "<input type='hidden' name='entities_id' value='" . $item->getEntityID() . "'>";
         echo "<input type='hidden' name='is_recursive' value='" . $item->isRecursive() . "'>";
         echo "<input type='submit' name='add' value=\"" . $LANG['reservation'][7] . "\" class='submit'>";
         echo "</td>";
     }
     echo "</tr></table></form></div>";
 }
예제 #15
0
 /**  Show groups of a user
  *
  * @param $user the user
  **/
 static function showForUser(User $user)
 {
     global $CFG_GLPI, $LANG;
     $ID = $user->fields['id'];
     if (!haveRight("group", "r") || !$user->can($ID, 'r')) {
         return false;
     }
     $canedit = $user->can($ID, 'w');
     $rand = mt_rand();
     $nb_per_line = 3;
     if ($canedit) {
         $headerspan = $nb_per_line * 2;
         echo "<form name='groupuser_form{$rand}' id='groupuser_form{$rand}' method='post'";
         echo " action='" . getItemTypeFormURL('User') . "'>";
     } else {
         $headerspan = $nb_per_line;
     }
     $groups = self::getUserGroups($ID);
     $used = array();
     if (!empty($groups)) {
         foreach ($groups as $data) {
             $used[$data["id"]] = $data["id"];
         }
     }
     if ($canedit) {
         echo "<div class='firstbloc'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='2'>" . $LANG['setup'][604] . "</th></tr>";
         echo "<tr><td class='tab_bg_2 center'>";
         echo "<input type='hidden' name='users_id' value='{$ID}'>";
         // All entities "edited user" have access
         $strict_entities = Profile_User::getUserEntities($ID, true);
         // Keep only entities "connected user" have access
         foreach ($strict_entities as $key => $val) {
             if (!haveAccessToEntity($val)) {
                 unset($strict_entities[$key]);
             }
         }
         if (countElementsInTableForEntity("glpi_groups", $strict_entities) > count($used)) {
             Dropdown::show('Group', array('entity' => $strict_entities, 'used' => $used));
             echo "</td><td class='tab_bg_2 center'>";
             echo "<input type='submit' name='addgroup' value=\"" . $LANG['buttons'][8] . "\"\n                   class='submit'>";
         } else {
             echo $LANG['common'][49];
         }
         echo "</td></tr>";
         echo "</table></div>";
     }
     echo "<div class='spaced'>";
     echo "<table class='tab_cadre_fixehov'><tr>";
     echo "<th colspan='{$headerspan}'>" . $LANG['Menu'][36] . "&nbsp;(D=" . $LANG['profiles'][29] . ")</th>";
     echo "</tr>";
     if (!empty($groups)) {
         initNavigateListItems('Group', $user->getTypeName() . " = " . $user->getName());
         $i = 0;
         foreach ($groups as $data) {
             addToNavigateListItems('Group', $data["id"]);
             if ($i % $nb_per_line == 0) {
                 if ($i != 0) {
                     echo "</tr>";
                 }
                 echo "<tr class='tab_bg_1'>";
             }
             if ($canedit) {
                 echo "<td width='10'>";
                 $sel = "";
                 if (isset($_GET["select"]) && $_GET["select"] == "all") {
                     $sel = "checked";
                 }
                 echo "<input type='checkbox' name='item[" . $data["linkID"] . "]' value='1' {$sel}>";
                 echo "</td>";
             }
             echo "<td><a href='" . $CFG_GLPI["root_doc"] . "/front/group.form.php?id=" . $data["id"] . "'>" . $data["name"] . ($_SESSION["glpiis_ids_visible"] ? " (" . $data["id"] . ")" : "") . "</a>";
             echo "&nbsp;";
             if ($data["is_dynamic"]) {
                 echo "<strong>&nbsp;(D)</strong>";
             }
             echo "</td>";
             $i++;
         }
         while ($i % $nb_per_line != 0) {
             if ($canedit) {
                 echo "<td>&nbsp;</td>";
             }
             echo "<td>&nbsp;</td>";
             $i++;
         }
         echo "</tr>";
     } else {
         echo "<tr class='tab_bg_1'>";
         echo "<td colspan='{$headerspan}' class='center'>" . $LANG['common'][49] . "</td></tr>";
     }
     echo "</table>";
     if ($canedit) {
         if (count($used)) {
             openArrowMassive("groupuser_form{$rand}", true);
             closeArrowMassive('deletegroup', $LANG['buttons'][6]);
         }
         echo "</form>";
     }
     echo "</div>";
 }
예제 #16
0
 /**
  * Display a HTML report about systeme information / configuration
  *
  **/
 function showSystemInformations()
 {
     global $DB, $LANG, $CFG_GLPI;
     echo "<div class='center' id='tabsbody'>";
     echo "<form name='form' action=\"" . getItemTypeFormURL(__CLASS__) . "\" method='post'>";
     echo "<input type='hidden' name='id' value='" . $CFG_GLPI["id"] . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . $LANG['setup'][70] . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['setup'][102] . " &nbsp;:</td><td>";
     $values[1] = $LANG['setup'][103];
     $values[2] = $LANG['setup'][104];
     $values[3] = $LANG['setup'][105];
     $values[4] = $LANG['setup'][106];
     $values[5] = $LANG['setup'][107];
     Dropdown::showFromArray('event_loglevel', $values, array('value' => $CFG_GLPI["event_loglevel"]));
     echo "</td><td>" . $LANG['setup'][101] . "&nbsp;:</td><td>";
     Dropdown::showInteger('cron_limit', $CFG_GLPI["cron_limit"], 1, 30);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . $LANG['setup'][185] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("use_log_in_files", $CFG_GLPI["use_log_in_files"]);
     echo "</td><td> " . $LANG['setup'][801] . "&nbsp;:</td><td>";
     $active = DBConnection::isDBSlaveActive();
     Dropdown::showYesNo("_dbslave_status", $active);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan='4' class='center b'>" . $LANG['setup'][306] . ' - ' . $LANG['setup'][400] . "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['common'][52] . "&nbsp;:</td>";
     echo "<td><input type='text' name='proxy_name' value='" . $CFG_GLPI["proxy_name"] . "'></td>";
     echo "<td>" . $LANG['setup'][175] . "&nbsp;:</td>";
     echo "<td><input type='text' name='proxy_port' value='" . $CFG_GLPI["proxy_port"] . "'></td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['login'][6] . "&nbsp;:</td>";
     echo "<td><input type='text' name='proxy_user' value='" . $CFG_GLPI["proxy_user"] . "'></td>";
     echo "<td>" . $LANG['login'][7] . "&nbsp;:</td>";
     echo "<td><input type='password' name='proxy_passwd' value='' autocomplete='off'></td>";
     echo "</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='4' class='center'>";
     echo "<input type='submit' name='update' class='submit' value=\"" . $LANG['buttons'][2] . "\"></td>";
     echo "</tr>";
     echo "</table>";
     echo "</form>";
     $width = 128;
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th>" . $LANG['setup'][721] . "</th></tr>";
     echo "<tr class='tab_bg_1'><td><pre>[code]\n&nbsp;\n";
     $oldlang = $_SESSION['glpilanguage'];
     loadLanguage('en_GB');
     echo "GLPI " . $CFG_GLPI['version'] . " (" . $CFG_GLPI['root_doc'] . " => " . dirname(dirname($_SERVER["SCRIPT_FILENAME"])) . ")\n";
     echo "\n</pre></td></tr>";
     echo "<tr><th>" . $LANG['common'][52] . "</th></tr>\n";
     echo "<tr class='tab_bg_1'><td><pre>\n&nbsp;\n";
     echo wordwrap($LANG['setup'][5] . "&nbsp;: " . php_uname() . "\n", $width, "\n\t");
     $exts = get_loaded_extensions();
     sort($exts);
     echo wordwrap("PHP " . phpversion() . " (" . implode(', ', $exts) . ")\n", $width, "\n\t");
     $msg = $LANG['common'][12] . ": ";
     foreach (array('memory_limit', 'max_execution_time', 'safe_mode', 'session.save_handler', 'post_max_size', 'upload_max_filesize') as $key) {
         $msg .= $key . '="' . ini_get($key) . '" ';
     }
     echo wordwrap($msg . "\n", $width, "\n\t");
     $msg = $LANG['Menu'][4] . ": ";
     if (isset($_SERVER["SERVER_SOFTWARE"])) {
         $msg .= $_SERVER["SERVER_SOFTWARE"];
     }
     if (isset($_SERVER["SERVER_SIGNATURE"])) {
         $msg .= ' (' . html_clean($_SERVER["SERVER_SIGNATURE"]) . ')';
     }
     echo wordwrap($msg . "\n", $width, "\n\t");
     if (isset($_SERVER["HTTP_USER_AGENT"])) {
         echo "\t" . $_SERVER["HTTP_USER_AGENT"] . "\n";
     }
     $version = "???";
     foreach ($DB->request('SELECT VERSION() as ver') as $data) {
         $version = $data['ver'];
     }
     echo "MySQL: {$version} (" . $DB->dbuser . "@" . $DB->dbhost . "/" . $DB->dbdefault . ")\n\n";
     checkWriteAccessToDirs(true);
     foreach ($CFG_GLPI["systeminformations_types"] as $type) {
         $tmp = new $type();
         $tmp->showSystemInformations($width);
     }
     loadLanguage($oldlang);
     echo "\n</pre></td></tr>";
     echo "<tr class='tab_bg_1'><td>[/code]\n</td></tr>";
     echo "<tr class='tab_bg_2'><th>" . $LANG['setup'][722] . "</th></tr>\n";
     echo "</table></div>\n";
 }
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
$notificationtemplate = new NotificationTemplate();
if (isset($_POST["add"])) {
    $notificationtemplate->check(-1, 'w', $_POST);
    $newID = $notificationtemplate->add($_POST);
    Event::log($newID, "notificationtemplates", 4, "notification", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " :  " . $_POST["name"] . ".");
    $language = new NotificationTemplateTranslation();
    $url = getItemTypeFormURL('NotificationTemplateTranslation', true);
    $url .= "?notificationtemplates_id={$newID}";
    glpi_header($url);
} else {
    if (isset($_POST["delete"])) {
        $notificationtemplate->check($_POST["id"], 'd');
        $notificationtemplate->delete($_POST);
        Event::log($_POST["id"], "notificationtemplates", 4, "notification", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        $notificationtemplate->redirectToList();
    } else {
        if (isset($_POST["delete_languages"])) {
            $notificationtemplate->check(-1, 'd');
            $language = new NotificationTemplateTranslation();
            if (isset($_POST['languages'])) {
                foreach ($_POST['languages'] as $key => $val) {
                    if ($val == 'on') {
 /**
  * Print the form for devices linked to a computer or a template
  *
  * @param $computer Computer object
  * @param $withtemplate='' boolean : template or basic computer
  *
  * @return Nothing (display)
  **/
 static function showForComputer(Computer $computer, $withtemplate = '')
 {
     global $DB, $LANG;
     $devtypes = self::getDeviceTypes();
     $ID = $computer->getField('id');
     if (!$computer->can($ID, 'r')) {
         return false;
     }
     $canedit = $withtemplate != 2 && $computer->can($ID, 'w');
     echo "<div class='spaced'>";
     if ($canedit) {
         echo "<form name='form_device_action' action='" . getItemTypeFormURL(__CLASS__) . "' method='post'>";
         echo "<input type='hidden' name='computers_id' value='{$ID}'>";
     }
     echo "<table class='tab_cadre_fixe' >";
     echo "<tr><th colspan='63'>" . $LANG['title'][30] . "</th></tr>";
     $nb = 0;
     $specificity_units = array('DeviceProcessor' => $LANG['setup'][35], 'DeviceMemory' => $LANG['common'][82], 'DeviceHardDrive' => $LANG['common'][82], 'DeviceGraphicCard' => $LANG['common'][82]);
     foreach ($devtypes as $itemtype) {
         initNavigateListItems($itemtype, $computer->getTypeName() . " = " . $computer->getName());
         $device = new $itemtype();
         $specificities = $device->getSpecifityLabel();
         $specif_fields = array_keys($specificities);
         $specif_text = implode(',', $specif_fields);
         if (!empty($specif_text)) {
             $specif_text = " ," . $specif_text . " ";
         }
         $linktable = getTableForItemType('Computer_' . $itemtype);
         $fk = getForeignKeyFieldForTable(getTableForItemType($itemtype));
         $query = "SELECT COUNT(*) AS NB,\n                          `id`,\n                          `{$fk}`\n                          {$specif_text}\n                   FROM `{$linktable}`\n                   WHERE `computers_id` = '{$ID}'\n                   GROUP BY `{$fk}` {$specif_text}";
         $prev = '';
         foreach ($DB->request($query) as $data) {
             addToNavigateListItems($itemtype, $data[$fk]);
             if ($device->getFromDB($data[$fk])) {
                 echo "<tr class='tab_bg_2'>";
                 echo "<td class='center'>";
                 Dropdown::showInteger("quantity_" . $itemtype . "_" . $data['id'], $data['NB']);
                 echo "</td><td>";
                 if ($device->canCreate()) {
                     echo "<a href='" . $device->getSearchURL() . "'>" . $device->getTypeName() . "</a>";
                 } else {
                     echo $device->getTypeName();
                 }
                 echo "</td><td>" . $device->getLink() . "</td>";
                 $spec = $device->getFormData();
                 if (isset($spec['label']) && count($spec['label'])) {
                     $colspan = 60 / count($spec['label']);
                     foreach ($spec['label'] as $i => $label) {
                         if (isset($spec['value'][$i])) {
                             echo "<td colspan='{$colspan}'>" . $spec['label'][$i] . "&nbsp;: ";
                             echo $spec['value'][$i] . "</td>";
                         } else {
                             if ($canedit) {
                                 // Specificity
                                 echo "<td class='right' colspan='{$colspan}'>" . $spec['label'][$i] . "&nbsp;: ";
                                 echo "<input type='text' name='value_" . $itemtype . "_" . $data['id'] . "' value='" . $data['specificity'] . "' size='" . $spec['size'] . "'>";
                                 if (isset($specificity_units[$device->getType()])) {
                                     echo '&nbsp;' . $specificity_units[$device->getType()];
                                 }
                                 echo "</td>";
                             } else {
                                 echo "<td colspan='{$colspan}'>" . $spec['label'][$i] . "&nbsp;: ";
                                 echo $data['specificity'];
                                 if (isset($specificity_units[$device->getType()])) {
                                     echo '&nbsp;' . $specificity_units[$device->getType()];
                                 }
                                 echo "</td>";
                             }
                         }
                     }
                 } else {
                     echo "<td colspan='60'>&nbsp;</td>";
                 }
                 echo "</tr>";
                 $nb++;
             }
         }
     }
     if ($canedit) {
         if ($nb > 0) {
             echo "<tr><td colspan='63' class='tab_bg_1 center'>";
             echo "<input type='submit' class='submit' name='updateall' value='" . $LANG['buttons'][7] . "'></td></tr>";
         }
         echo "<tr><td colspan='63' class='tab_bg_1 center'>";
         echo $LANG['devices'][0] . "&nbsp;: ";
         Dropdown::showAllItems('items_id', '', 0, -1, $devtypes);
         echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
         echo "</tr></table></form>";
     } else {
         echo "</table>";
     }
     echo "</div>";
 }
 /**
  * show defined display preferences for a user
  *
  * @param $users_id integer user ID
  */
 static function showForUser($users_id)
 {
     global $DB, $LANG;
     $url = getItemTypeFormURL(__CLASS__);
     $query = "SELECT `itemtype`, COUNT(*) as nb\n                FROM `glpi_displaypreferences`\n                WHERE `users_id`='{$users_id}'\n                GROUP BY `itemtype`";
     $req = $DB->request($query);
     if ($req->numrows() > 0) {
         echo "<form name='formprefs' id='formprefs' action='{$url}' method='post'>";
         echo "<input type='hidden' name='users_id' value='{$users_id}'>";
         echo "<table class='tab_cadre_fixe'>";
         foreach ($req as $data) {
             echo "<tr class='tab_bg_1'><td width='10'>";
             echo "<input  type='checkbox' name='itemtype[" . $data["itemtype"] . "]' value='1'></td>";
             if (class_exists($data["itemtype"])) {
                 $item = new $data["itemtype"]();
                 $name = $item->getTypeName();
             } else {
                 $name = $data["itemtype"];
             }
             echo "<td>{$name}</td><td class='right'>" . $data['nb'] . "</td>";
             echo "</tr>";
         }
         echo "</table>";
         openArrowMassive('formprefs', true);
         closeArrowMassive('delete_for_user', $LANG['buttons'][6]);
         echo "</form>";
     } else {
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2'><td class='b center'>" . $LANG['search'][15] . "</td></tr>";
         echo "</table>";
     }
 }
예제 #20
0
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.

GLPI 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 GLPI; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// Based on:
// IRMA, Information Resource-Management and Administration
// Christian Bauer
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
if (isset($_GET["itemtype"])) {
    $link = getItemTypeFormURL($_GET["itemtype"]);
    $item = str_replace(".form.php", "", $link);
    $item = str_replace("front/", "", $item);
    commonHeader($LANG['common'][12], $_SERVER['PHP_SELF'], "inventory", $item);
    listTemplates($_GET["itemtype"], $link, $_GET["add"]);
    commonFooter();
}
예제 #21
0
 /**
  * Display content of Tab
  *
  * @param $ID of the item
  * @param $tab number of the tab
  *
  * @return true if handled (for class stack)
  */
 function showTabContent($ID, $tab)
 {
     global $CFG_GLPI;
     if (!$this->isNewID($ID)) {
         switch ($tab) {
             case -1:
                 // All
                 $this->showChildren($ID);
                 EntityData::showStandardOptions($this);
                 Profile_User::showForEntity($this);
                 $collection = new RuleRightCollection();
                 if ($collection->canList()) {
                     $ldaprule = new RuleRight();
                     $ldaprule->showAndAddRuleForm($this);
                 }
                 $collection = new RuleOcsCollection();
                 if ($collection->canList()) {
                     $ocsrule = new RuleOcs();
                     $ocsrule->showAndAddRuleForm($this);
                 }
                 $collection = new RuleMailCollectorCollection();
                 if ($collection->canList()) {
                     $mailcollector = new RuleMailCollector();
                     $mailcollector->showAndAddRuleForm($this);
                 }
                 Document::showAssociated($this);
                 EntityData::showNotificationOptions($this);
                 EntityData::showHelpdeskOptions($this);
                 EntityData::showInventoryOptions($this);
                 Plugin::displayAction($this, $tab);
                 break;
             case 2:
                 EntityData::showStandardOptions($this);
                 break;
             case 3:
                 Profile_User::showForEntity($this);
                 break;
             case 4:
                 $collection = new RuleRightCollection();
                 if ($collection->canList()) {
                     $ldaprule = new RuleRight();
                     $ldaprule->showAndAddRuleForm($this);
                 }
                 $collection = new RuleOcsCollection();
                 if ($collection->canList()) {
                     $ocsrule = new RuleOcs();
                     $ocsrule->showAndAddRuleForm($this);
                 }
                 $collection = new RuleMailCollectorCollection();
                 if ($collection->canList()) {
                     $mailcollector = new RuleMailCollector();
                     $mailcollector->showAndAddRuleForm($this);
                 }
                 break;
             case 5:
                 EntityData::showAdvancedOptions($this);
                 break;
             case 6:
                 Document::showAssociated($this);
                 break;
             case 7:
                 EntityData::showNotificationOptions($this);
                 break;
             case 8:
                 EntityData::showHelpdeskOptions($this);
                 break;
             case 9:
                 EntityData::showInventoryOptions($this);
                 break;
             case 10:
                 showNotesForm(getItemTypeFormURL('EntityData'), 'EntityData', $_POST["id"]);
                 break;
             default:
                 if (!Plugin::displayAction($this, $tab)) {
                     $this->showChildren($ID);
                 }
                 return false;
         }
     }
     return false;
 }
예제 #22
0
 /**
  * Show items links to a document
  *
  * @return nothing (HTML display)
  **/
 function showItems()
 {
     global $DB, $CFG_GLPI, $LANG;
     $instID = $this->fields['id'];
     if (!$this->can($instID, "r")) {
         return false;
     }
     $canedit = $this->can($instID, 'w');
     // for a document,
     // don't show here others documents associated to this one,
     // it's done for both directions in self::showAssociated
     $query = "SELECT DISTINCT `itemtype`\n                FROM `glpi_documents_items`\n                WHERE `glpi_documents_items`.`documents_id` = '{$instID}'\n                      AND `glpi_documents_items`.`itemtype` != 'Document'\n                ORDER BY `itemtype`";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $rand = mt_rand();
     echo "<form method='post' name='document_form{$rand}' id='document_form{$rand}' action='" . $CFG_GLPI["root_doc"] . "/front/document.form.php'>";
     echo "<div class='spaced'><table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='" . ($canedit ? 6 : 5) . "'>";
     if ($DB->numrows($result) == 0) {
         echo $LANG['document'][13];
     } else {
         if ($DB->numrows($result) == 1) {
             echo $LANG['document'][14];
         } else {
             echo $LANG['document'][19];
         }
     }
     echo "</th></tr><tr>";
     if ($canedit) {
         echo "<th>&nbsp;</th>";
     }
     echo "<th>" . $LANG['common'][17] . "</th>";
     echo "<th>" . $LANG['common'][16] . "</th>";
     echo "<th>" . $LANG['entity'][0] . "</th>";
     echo "<th>" . $LANG['common'][19] . "</th>";
     echo "<th>" . $LANG['common'][20] . "</th>";
     echo "</tr>";
     for ($i = 0; $i < $number; $i++) {
         $itemtype = $DB->result($result, $i, "itemtype");
         if (!class_exists($itemtype)) {
             continue;
         }
         $item = new $itemtype();
         if ($item->canView()) {
             $column = "name";
             if ($itemtype == 'Ticket') {
                 $column = "id";
             }
             if ($itemtype == 'KnowbaseItem') {
                 $column = "question";
             }
             $itemtable = getTableForItemType($itemtype);
             $query = "SELECT `{$itemtable}`.*,\n                             `glpi_documents_items`.`id` AS IDD, ";
             if ($itemtype == 'Entity') {
                 // Left join because root entity not storeed
                 $query .= "`glpi_documents_items`.`items_id` AS entity\n                          FROM `glpi_documents_items`\n                          LEFT JOIN `glpi_entities`\n                              ON (`glpi_entities`.`id` = `glpi_documents_items`.`items_id`)\n                          WHERE ";
             } else {
                 $query .= "`glpi_entities`.`id` AS entity\n                          FROM `glpi_documents_items`, `{$itemtable}`\n                          LEFT JOIN `glpi_entities`\n                              ON (`glpi_entities`.`id` = `{$itemtable}`.`entities_id`)\n                          WHERE `{$itemtable}`.`id` = `glpi_documents_items`.`items_id`\n                          AND ";
             }
             $query .= "`glpi_documents_items`.`itemtype` = '{$itemtype}'\n                       AND `glpi_documents_items`.`documents_id` = '{$instID}' " . getEntitiesRestrictRequest(" AND ", $itemtable, '', '', $item->maybeRecursive());
             if ($item->maybeTemplate()) {
                 $query .= " AND `{$itemtable}`.`is_template` = '0'";
             }
             $query .= " ORDER BY `glpi_entities`.`completename`, `{$itemtable}`.`{$column}`";
             if ($itemtype == 'SoftwareLicense') {
                 $soft = new Software();
             }
             if ($result_linked = $DB->query($query)) {
                 if ($DB->numrows($result_linked)) {
                     while ($data = $DB->fetch_assoc($result_linked)) {
                         $ID = "";
                         if ($itemtype == 'Entity' && !$data['entity']) {
                             $data['id'] = 0;
                             $data['name'] = $LANG['entity']['2'];
                         }
                         if ($itemtype == 'Ticket') {
                             $data["name"] = $LANG['job'][38] . " " . $data["id"];
                         }
                         if ($itemtype == 'KnowbaseItem') {
                             $data["name"] = $data["question"];
                         }
                         if ($itemtype == 'SoftwareLicense') {
                             $soft->getFromDB($data['softwares_id']);
                             $data["name"] = $data["name"] . ' - ' . $soft->fields['name'];
                         }
                         if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
                             $ID = " (" . $data["id"] . ")";
                         }
                         $link = getItemTypeFormURL($itemtype);
                         $name = "<a href=\"" . $link . "?id=" . $data["id"] . "\">" . $data["name"] . "{$ID}</a>";
                         echo "<tr class='tab_bg_1'>";
                         if ($canedit) {
                             echo "<td width='10'>";
                             $sel = "";
                             if (isset($_GET["select"]) && $_GET["select"] == "all") {
                                 $sel = "checked";
                             }
                             echo "<input type='checkbox' name='item[" . $data["IDD"] . "]' value='1' {$sel}>";
                             echo "</td>";
                         }
                         echo "<td class='center'>" . $item->getTypeName() . "</td>";
                         echo "<td " . (isset($data['is_deleted']) && $data['is_deleted'] ? "class='tab_bg_2_2'" : "") . ">" . $name . "</td>";
                         echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entity']);
                         echo "</td>";
                         echo "<td class='center'>" . (isset($data["serial"]) ? "" . $data["serial"] . "" : "-") . "</td>";
                         echo "<td class='center'>" . (isset($data["otherserial"]) ? "" . $data["otherserial"] . "" : "-") . "</td>";
                         echo "</tr>";
                     }
                 }
             }
         }
     }
     if ($canedit) {
         echo "<tr class='tab_bg_1'><td colspan='4' class='center'>";
         echo "<input type='hidden' name='documents_id' value='{$instID}'>";
         Dropdown::showAllItems("items_id", 0, 0, $this->fields['is_recursive'] ? -1 : $this->fields['entities_id'], $CFG_GLPI["document_types"]);
         echo "</td>";
         echo "<td colspan='2' class='center'>";
         echo "<input type='submit' name='adddocumentitem' value='" . $LANG['buttons'][8] . "' class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         openArrowMassive("document_form{$rand}", true);
         closeArrowMassive('deletedocumentitem', $LANG['buttons'][6]);
     } else {
         echo "</table>";
     }
     echo "</div></form>";
 }
 function showGetMessageForm($ID)
 {
     global $LANG;
     echo "<br><br><div class='center'>";
     echo "<form name='form' method='post' action='" . getItemTypeFormURL(__CLASS__) . "'>";
     echo "<table class='tab_cadre'>";
     echo "<tr class='tab_bg_2'><td class='center'>";
     echo "<input type='submit' name='get_mails' value=\"" . $LANG['mailgate'][2] . "\" class='submit'>";
     echo "<input type='hidden' name='id' value='{$ID}'>";
     echo "</td></tr>";
     echo "</table></form></div>";
 }
 function showSummary(NotificationTemplate $template, $options = array())
 {
     global $DB, $LANG, $CFG_GLPI;
     $nID = $template->getField('id');
     $canedit = haveRight("config", "w");
     if ($canedit) {
         echo "<div class='center'>" . "<a href='" . getItemTypeFormURL('NotificationTemplateTranslation') . "?notificationtemplates_id=" . $nID . "'>" . $LANG['mailing'][124] . "</a></div><br>";
     }
     echo "<div class='center' id='tabsbody'>";
     initNavigateListItems('NotificationTemplateTranslation', $template->getTypeName() . " = " . $template->fields["name"]);
     echo "<form name='form_language' id='form_language' method='post'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'><th></th><th>" . $LANG['setup'][41] . "</th></tr>";
     foreach ($DB->request('glpi_notificationtemplatetranslations', array('notificationtemplates_id' => $nID)) as $data) {
         if ($this->getFromDB($data['id'])) {
             addToNavigateListItems('NotificationTemplateTranslation', $data['id']);
             echo "<tr class='tab_bg_1'><td class='center'>";
             echo "<input type='checkbox' name=\"languages[" . $data['id'] . "]\"></td>";
             echo "<td class='center'>";
             echo "<a href='" . getItemTypeFormURL('NotificationTemplateTranslation') . "?id=" . $data['id'] . "&notificationtemplates_id=" . $nID . "'>";
             if ($data['language'] != '') {
                 echo $CFG_GLPI['languages'][$data['language']][0];
             } else {
                 echo $LANG['mailing'][125];
             }
             echo "</a></td></tr>";
         }
     }
     echo "</table>";
     if ($canedit) {
         openArrowMassive("form_language", true);
         closeArrowMassive("delete_languages", $LANG["buttons"][6]);
     }
 }
 /**
  * @param $notimported  PluginOcsinventoryngNotimportedcomputer object
  **/
 static function showActions(PluginOcsinventoryngNotimportedcomputer $notimported)
 {
     echo "<div class='spaced'>";
     echo "<form name='actions' id='actions' method='post' value='" . getItemTypeFormURL(__CLASS__) . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_2'>";
     echo "<th class='center'>" . __('Actions to be made on the computer', 'ocsinventoryng') . "</th></tr>";
     echo "<tr class='tab_bg_2'><td class='center'>";
     echo "<input type='hidden' name='id' value='" . $notimported->fields['id'] . "'>";
     echo "<input type='hidden' name='action' value='massive'>";
     Dropdown::showForMassiveAction('PluginOcsinventoryngNotimportedcomputer', 0, array('action' => 'massive'));
     echo "</td></tr>";
     echo "</table>";
     Html::closeForm();
     echo "</div>";
 }
예제 #26
0
                Event::log($_POST["id"], "computers", 4, "inventory", sprintf(__('%s restores the item'), $_SESSION["glpiname"]));
            }
            html::redirect(getItemTypeSearchURL('PluginSimcardSimcard'));
        } else {
            if (isset($_REQUEST["purge"])) {
                $simcard->check($_REQUEST['id'], 'd');
                if ($simcard->delete($_REQUEST, 1)) {
                }
                Html::redirect(getItemTypeSearchURL('PluginSimcardSimcard'));
                //update a computer
            } else {
                if (isset($_POST["update"])) {
                    $simcard->check($_POST['id'], 'w');
                    $simcard->update($_POST);
                    Html::back();
                } else {
                    if (isset($_GET["unglobalize"])) {
                        $simcard->check($_GET["id"], 'w');
                        Html::redirect(getItemTypeFormURL('PluginSimcardSimcard') . "?id=" . $_GET["id"]);
                    } else {
                        //print computer information
                        Html::header(PluginSimcardSimcard::getTypeName(2), $_SERVER['PHP_SELF'], "plugins", "simcard", "simcard");
                        //show computer form to add
                        $simcard->showForm($_GET["id"], $_GET);
                        html::footer();
                    }
                }
            }
        }
    }
}
예제 #27
0
/**
 * Print a nice HTML head for every page
 *
 * @param $title title of the page
 * @param $url not used anymore.
 * @param $sector sector in which the page displayed is
 * @param $item item corresponding to the page displayed
 * @param $option option corresponding to the page displayed
 *
**/
function commonHeader($title, $url = '', $sector = "none", $item = "none", $option = "")
{
    global $CFG_GLPI, $LANG, $PLUGIN_HOOKS, $HEADER_LOADED, $DB;
    // Print a nice HTML-head for every page
    if ($HEADER_LOADED) {
        return;
    }
    $HEADER_LOADED = true;
    includeCommonHtmlHeader($title);
    // Body
    echo "<body>";
    // Generate array for menu and check right
    // INVENTORY
    $showstate = false;
    $menu['inventory']['title'] = $LANG['Menu'][38];
    if (haveRight("computer", "r")) {
        $menu['inventory']['default'] = '/front/computer.php';
        $menu['inventory']['content']['computer']['title'] = $LANG['Menu'][0];
        $menu['inventory']['content']['computer']['shortcut'] = 'c';
        $menu['inventory']['content']['computer']['page'] = '/front/computer.php';
        $menu['inventory']['content']['computer']['links']['search'] = '/front/computer.php';
        if (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';
        }
        $showstate = true;
    }
    if (haveRight("monitor", "r")) {
        $menu['inventory']['content']['monitor']['title'] = $LANG['Menu'][3];
        $menu['inventory']['content']['monitor']['shortcut'] = 'm';
        $menu['inventory']['content']['monitor']['page'] = '/front/monitor.php';
        $menu['inventory']['content']['monitor']['links']['search'] = '/front/monitor.php';
        if (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';
        }
        $showstate = true;
    }
    if (haveRight("software", "r")) {
        $menu['inventory']['content']['software']['title'] = $LANG['Menu'][4];
        $menu['inventory']['content']['software']['shortcut'] = 's';
        $menu['inventory']['content']['software']['page'] = '/front/software.php';
        $menu['inventory']['content']['software']['links']['search'] = '/front/software.php';
        if (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';
        }
        $showstate = true;
    }
    if (haveRight("networking", "r")) {
        $menu['inventory']['content']['networking']['title'] = $LANG['Menu'][1];
        $menu['inventory']['content']['networking']['shortcut'] = 'n';
        $menu['inventory']['content']['networking']['page'] = '/front/networkequipment.php';
        $menu['inventory']['content']['networking']['links']['search'] = '/front/networkequipment.php';
        if (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';
        }
        $showstate = true;
    }
    if (haveRight("peripheral", "r")) {
        $menu['inventory']['content']['peripheral']['title'] = $LANG['Menu'][16];
        $menu['inventory']['content']['peripheral']['shortcut'] = 'n';
        $menu['inventory']['content']['peripheral']['page'] = '/front/peripheral.php';
        $menu['inventory']['content']['peripheral']['links']['search'] = '/front/peripheral.php';
        if (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';
        }
        $showstate = true;
    }
    if (haveRight("printer", "r")) {
        $menu['inventory']['content']['printer']['title'] = $LANG['Menu'][2];
        $menu['inventory']['content']['printer']['shortcut'] = 'p';
        $menu['inventory']['content']['printer']['page'] = '/front/printer.php';
        $menu['inventory']['content']['printer']['links']['search'] = '/front/printer.php';
        if (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';
        }
        $showstate = true;
    }
    if (haveRight("cartridge", "r")) {
        $menu['inventory']['content']['cartridge']['title'] = $LANG['Menu'][21];
        $menu['inventory']['content']['cartridge']['shortcut'] = 'c';
        $menu['inventory']['content']['cartridge']['page'] = '/front/cartridgeitem.php';
        $menu['inventory']['content']['cartridge']['links']['search'] = '/front/cartridgeitem.php';
        if (haveRight("cartridge", "w")) {
            $menu['inventory']['content']['cartridge']['links']['add'] = '/front/cartridgeitem.form.php';
        }
    }
    if (haveRight("consumable", "r")) {
        $menu['inventory']['content']['consumable']['title'] = $LANG['Menu'][32];
        $menu['inventory']['content']['consumable']['shortcut'] = 'g';
        $menu['inventory']['content']['consumable']['page'] = '/front/consumableitem.php';
        $menu['inventory']['content']['consumable']['links']['search'] = '/front/consumableitem.php';
        if (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 (haveRight("phone", "r")) {
        $menu['inventory']['content']['phone']['title'] = $LANG['Menu'][34];
        $menu['inventory']['content']['phone']['shortcut'] = 't';
        $menu['inventory']['content']['phone']['page'] = '/front/phone.php';
        $menu['inventory']['content']['phone']['links']['search'] = '/front/phone.php';
        if (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';
        }
        $showstate = true;
    }
    if ($showstate) {
        $menu['inventory']['content']['state']['title'] = $LANG['Menu'][28];
        $menu['inventory']['content']['state']['shortcut'] = 'n';
        $menu['inventory']['content']['state']['page'] = '/front/states.php';
        $menu['inventory']['content']['state']['links']['search'] = '/front/states.php';
        $menu['inventory']['content']['state']['links']['summary'] = '/front/states.php?synthese=yes';
    }
    // ASSISTANCE
    $menu['maintain']['title'] = $LANG['title'][24];
    if (haveRight("observe_ticket", "1") || haveRight("show_all_ticket", "1") || haveRight("create_ticket", "1")) {
        $menu['maintain']['default'] = '/front/ticket.php';
        $menu['maintain']['content']['ticket']['title'] = $LANG['Menu'][5];
        $menu['maintain']['content']['ticket']['shortcut'] = 't';
        $menu['maintain']['content']['ticket']['page'] = '/front/ticket.php';
        $menu['maintain']['content']['ticket']['links']['search'] = '/front/ticket.php';
        $menu['maintain']['content']['ticket']['links']['search'] = '/front/ticket.php';
        if (haveRight('validate_ticket', 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] = getLoginUserID();
            $opt['link'][1] = 'AND';
            $pic_validate = "<img title=\"" . $LANG['validation'][15] . "\" alt=\"" . $LANG['validation'][15] . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png'>";
            $menu['maintain']['content']['ticket']['links'][$pic_validate] = '/front/ticket.php?' . append_params($opt, '&amp;');
        }
    }
    if (haveRight("create_ticket", "1")) {
        $menu['maintain']['content']['ticket']['links']['add'] = '/front/ticket.form.php';
    }
    if (haveRight("show_planning", "1") || haveRight("show_all_planning", "1")) {
        $menu['maintain']['content']['planning']['title'] = $LANG['Menu'][29];
        $menu['maintain']['content']['planning']['shortcut'] = 'l';
        $menu['maintain']['content']['planning']['page'] = '/front/planning.php';
        $menu['maintain']['content']['planning']['links']['search'] = '/front/planning.php';
    }
    if (haveRight("statistic", "1")) {
        $menu['maintain']['content']['stat']['title'] = $LANG['Menu'][13];
        $menu['maintain']['content']['stat']['shortcut'] = '1';
        $menu['maintain']['content']['stat']['page'] = '/front/stat.php';
    }
    // FINANCIAL
    if (haveRight("budget", "r")) {
        $menu['financial']['content']['budget']['title'] = $LANG['financial'][110];
        $menu['financial']['content']['budget']['shortcut'] = 'n';
        $menu['financial']['content']['budget']['page'] = '/front/budget.php';
        $menu['financial']['content']['budget']['links']['search'] = '/front/budget.php';
        if (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';
        }
    }
    $menu['financial']['title'] = $LANG['Menu'][26];
    if (haveRight("contact_enterprise", "r")) {
        $menu['financial']['content']['supplier']['title'] = $LANG['Menu'][23];
        $menu['financial']['content']['supplier']['shortcut'] = 'e';
        $menu['financial']['content']['supplier']['page'] = '/front/supplier.php';
        $menu['financial']['content']['supplier']['links']['search'] = '/front/supplier.php';
        $menu['financial']['default'] = '/front/contact.php';
        $menu['financial']['content']['contact']['title'] = $LANG['Menu'][22];
        $menu['financial']['content']['contact']['shortcut'] = 't';
        $menu['financial']['content']['contact']['page'] = '/front/contact.php';
        $menu['financial']['content']['contact']['links']['search'] = '/front/contact.php';
        if (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 (haveRight("contract", "r")) {
        $menu['financial']['content']['contract']['title'] = $LANG['Menu'][25];
        $menu['financial']['content']['contract']['shortcut'] = 'n';
        $menu['financial']['content']['contract']['page'] = '/front/contract.php';
        $menu['financial']['content']['contract']['links']['search'] = '/front/contract.php';
        if (haveRight("contract", "w")) {
            $menu['financial']['content']['contract']['links']['add'] = '/front/contract.form.php';
        }
    }
    if (haveRight("document", "r")) {
        $menu['financial']['content']['document']['title'] = $LANG['Menu'][27];
        $menu['financial']['content']['document']['shortcut'] = 'd';
        $menu['financial']['content']['document']['page'] = '/front/document.php';
        $menu['financial']['content']['document']['links']['search'] = '/front/document.php';
        if (haveRight("document", "w")) {
            $menu['financial']['content']['document']['links']['add'] = '/front/document.form.php';
        }
    }
    // UTILS
    $menu['utils']['title'] = $LANG['Menu'][18];
    $menu['utils']['default'] = '/front/reminder.php';
    $menu['utils']['content']['reminder']['title'] = $LANG['title'][37];
    $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';
    if (haveRight("knowbase", "r") || haveRight("faq", "r")) {
        if (haveRight("knowbase", "r")) {
            $menu['utils']['content']['knowbase']['title'] = $LANG['Menu'][19];
        } else {
            $menu['utils']['content']['knowbase']['title'] = $LANG['knowbase'][1];
        }
        $menu['utils']['content']['knowbase']['page'] = '/front/knowbaseitem.php';
        $menu['utils']['content']['knowbase']['links']['search'] = '/front/knowbaseitem.php';
        if (haveRight("knowbase", "w") || haveRight("faq", "w")) {
            $menu['utils']['content']['knowbase']['links']['add'] = '/front/knowbaseitem.form.php?id=new';
        }
    }
    if (haveRight("reservation_helpdesk", "1") || haveRight("reservation_central", "r")) {
        $menu['utils']['content']['reservation']['title'] = $LANG['Menu'][17];
        $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 (haveRight("reports", "r")) {
        $menu['utils']['content']['report']['title'] = $LANG['Menu'][6];
        $menu['utils']['content']['report']['page'] = '/front/report.php';
    }
    if ($CFG_GLPI["use_ocs_mode"] && haveRight("ocsng", "w")) {
        $menu['utils']['content']['ocsng']['title'] = $LANG['Menu'][33];
        $menu['utils']['content']['ocsng']['page'] = '/front/ocsng.php';
        $menu['utils']['content']['ocsng']['options']['import']['title'] = $LANG['ocsng'][2];
        $menu['utils']['content']['ocsng']['options']['import']['page'] = '/front/ocsng.import.php';
        $menu['utils']['content']['ocsng']['options']['sync']['title'] = $LANG['ocsng'][1];
        $menu['utils']['content']['ocsng']['options']['sync']['page'] = '/front/ocsng.sync.php';
        $menu['utils']['content']['ocsng']['options']['clean']['title'] = $LANG['ocsng'][3];
        $menu['utils']['content']['ocsng']['options']['clean']['page'] = '/front/ocsng.clean.php';
        $menu['utils']['content']['ocsng']['options']['link']['title'] = $LANG['ocsng'][4];
        $menu['utils']['content']['ocsng']['options']['link']['page'] = '/front/ocsng.link.php';
    }
    // PLUGINS
    if (isset($PLUGIN_HOOKS["menu_entry"]) && count($PLUGIN_HOOKS["menu_entry"])) {
        $menu['plugins']['title'] = $LANG['common'][29];
        $plugins = array();
        foreach ($PLUGIN_HOOKS["menu_entry"] as $plugin => $active) {
            if ($active) {
                // true or a string
                $function = "plugin_version_{$plugin}";
                if (function_exists($function)) {
                    $plugins[$plugin] = $function();
                }
            }
        }
        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'] = $LANG['Menu'][15];
    if (haveRight("user", "r")) {
        $menu['admin']['default'] = '/front/user.php';
        $menu['admin']['content']['user']['title'] = $LANG['Menu'][14];
        $menu['admin']['content']['user']['shortcut'] = 'u';
        $menu['admin']['content']['user']['page'] = '/front/user.php';
        $menu['admin']['content']['user']['links']['search'] = '/front/user.php';
        if (haveRight("user", "w")) {
            $menu['admin']['content']['user']['links']['add'] = "/front/user.form.php";
        }
        $menu['admin']['content']['user']['options']['ldap']['title'] = $LANG['login'][2];
        $menu['admin']['content']['user']['options']['ldap']['page'] = "/front/ldap.php";
    }
    if (haveRight("group", "r")) {
        $menu['admin']['content']['group']['title'] = $LANG['Menu'][36];
        $menu['admin']['content']['group']['shortcut'] = 'g';
        $menu['admin']['content']['group']['page'] = '/front/group.php';
        $menu['admin']['content']['group']['links']['search'] = '/front/group.php';
        if (haveRight("group", "w")) {
            $menu['admin']['content']['group']['links']['add'] = "/front/group.form.php";
            $menu['admin']['content']['group']['options']['ldap']['title'] = $LANG['login'][2];
            $menu['admin']['content']['group']['options']['ldap']['page'] = "/front/ldap.group.php";
        }
    }
    if (haveRight("entity", "r")) {
        $menu['admin']['content']['entity']['title'] = $LANG['Menu'][37];
        $menu['admin']['content']['entity']['shortcut'] = 'z';
        $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 (haveRight("rule_ldap", "r") || haveRight("rule_ocs", "r") || haveRight("entity_rule_ticket", "r") || haveRight("rule_softwarecategories", "r") || haveRight("rule_mailcollector", "r")) {
        $menu['admin']['content']['rule']['title'] = $LANG['rulesengine'][17];
        $menu['admin']['content']['rule']['shortcut'] = 'r';
        $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'] = getItemTypeSearchURL($ruleclassname, false);
                    $menu['admin']['content']['rule']['options'][$rulecollection->menu_option]['links']['search'] = getItemTypeSearchURL($ruleclassname, false);
                    if ($rulecollection->canCreate()) {
                        $menu['admin']['content']['rule']['options'][$rulecollection->menu_option]['links']['add'] = getItemTypeFormURL($ruleclassname, false);
                    }
                }
            }
        }
    }
    if (haveRight("transfer", "r") && isMultiEntitiesMode()) {
        $menu['admin']['content']['rule']['options']['transfer']['title'] = $LANG['transfer'][1];
        $menu['admin']['content']['rule']['options']['transfer']['page'] = "/front/transfer.php";
        $menu['admin']['content']['rule']['options']['transfer']['links']['search'] = "/front/transfer.php";
        if (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 (haveRight("rule_dictionnary_dropdown", "r") || haveRight("rule_dictionnary_software", "r") || haveRight("rule_dictionnary_printer", "r")) {
        $menu['admin']['content']['dictionnary']['title'] = $LANG['rulesengine'][77];
        $menu['admin']['content']['dictionnary']['shortcut'] = 'r';
        $menu['admin']['content']['dictionnary']['page'] = '/front/dictionnary.php';
        if ($sector == 'admin' && $item == 'dictionnary') {
            $menu['admin']['content']['dictionnary']['options']['manufacturers']['title'] = $LANG['common'][5];
            $menu['admin']['content']['dictionnary']['options']['manufacturers']['page'] = '/front/ruledictionnarymanufacturer.php';
            $menu['admin']['content']['dictionnary']['options']['manufacturers']['links']['search'] = '/front/ruledictionnarymanufacturer.php';
            if (haveRight("rule_dictionnary_dropdown", "w")) {
                $menu['admin']['content']['dictionnary']['options']['manufacturers']['links']['add'] = '/front/ruledictionnarymanufacturer.form.php';
            }
            $menu['admin']['content']['dictionnary']['options']['software']['title'] = $LANG['Menu'][4];
            $menu['admin']['content']['dictionnary']['options']['software']['page'] = '/front/ruledictionnarysoftware.php';
            $menu['admin']['content']['dictionnary']['options']['software']['links']['search'] = '/front/ruledictionnarysoftware.php';
            if (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'] = $LANG['setup'][91];
            $menu['admin']['content']['dictionnary']['options']['model.computer']['page'] = '/front/ruledictionnarycomputermodel.php';
            $menu['admin']['content']['dictionnary']['options']['model.computer']['links']['search'] = '/front/ruledictionnarycomputermodel.php';
            if (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'] = $LANG['setup'][94];
            $menu['admin']['content']['dictionnary']['options']['model.monitor']['page'] = '/front/ruledictionnarymonitormodel.php';
            $menu['admin']['content']['dictionnary']['options']['model.monitor']['links']['search'] = '/front/ruledictionnarymonitormodel.php';
            if (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'] = $LANG['setup'][96];
            $menu['admin']['content']['dictionnary']['options']['model.printer']['page'] = '/front/ruledictionnaryprintermodel.php';
            $menu['admin']['content']['dictionnary']['options']['model.printer']['links']['search'] = '/front/ruledictionnaryprintermodel.php';
            if (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'] = $LANG['setup'][97];
            $menu['admin']['content']['dictionnary']['options']['model.peripheral']['page'] = '/front/ruledictionnaryperipheralmodel.php';
            $menu['admin']['content']['dictionnary']['options']['model.peripheral']['links']['search'] = '/front/ruledictionnaryperipheralmodel.php';
            if (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'] = $LANG['setup'][95];
            $menu['admin']['content']['dictionnary']['options']['model.networking']['page'] = '/front/ruledictionnarynetworkequipmentmodel.php';
            $menu['admin']['content']['dictionnary']['options']['model.networking']['links']['search'] = '/front/ruledictionnarynetworkequipmentmodel.php';
            if (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'] = $LANG['setup'][503];
            $menu['admin']['content']['dictionnary']['options']['model.phone']['page'] = '/front/ruledictionnaryphonemodel.php';
            $menu['admin']['content']['dictionnary']['options']['model.phone']['links']['search'] = '/front/ruledictionnaryphonemodel.php';
            if (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'] = $LANG['setup'][4];
            $menu['admin']['content']['dictionnary']['options']['type.computer']['page'] = '/front/ruledictionnarycomputertype.php';
            $menu['admin']['content']['dictionnary']['options']['type.computer']['links']['search'] = '/front/ruledictionnarycomputertype.php';
            if (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'] = $LANG['setup'][44];
            $menu['admin']['content']['dictionnary']['options']['type.monitor']['page'] = '/front/ruledictionnarymonitortype.php';
            $menu['admin']['content']['dictionnary']['options']['type.monitor']['links']['search'] = '/front/ruledictionnarymonitortype.php';
            if (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'] = $LANG['setup'][43];
            $menu['admin']['content']['dictionnary']['options']['type.printer']['page'] = '/front/ruledictionnaryprintertype.php';
            $menu['admin']['content']['dictionnary']['options']['type.printer']['links']['search'] = '/front/ruledictionnaryprintertype.php';
            if (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'] = $LANG['setup'][69];
            $menu['admin']['content']['dictionnary']['options']['type.peripheral']['page'] = '/front/ruledictionnaryperipheraltype.php';
            $menu['admin']['content']['dictionnary']['options']['type.peripheral']['links']['search'] = '/front/ruledictionnaryperipheraltype.php';
            if (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'] = $LANG['setup'][42];
            $menu['admin']['content']['dictionnary']['options']['type.networking']['page'] = '/front/ruledictionnarynetworkequipmenttype.php';
            $menu['admin']['content']['dictionnary']['options']['type.networking']['links']['search'] = '/front/ruledictionnarynetworkequipmenttype.php';
            if (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'] = $LANG['setup'][504];
            $menu['admin']['content']['dictionnary']['options']['type.phone']['page'] = '/front/ruledictionnaryphonetype.php';
            $menu['admin']['content']['dictionnary']['options']['type.phone']['links']['search'] = '/front/ruledictionnaryphonetype.php';
            if (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'] = $LANG['computers'][9];
            $menu['admin']['content']['dictionnary']['options']['os']['page'] = '/front/ruledictionnaryoperatingsystem.php';
            $menu['admin']['content']['dictionnary']['options']['os']['links']['search'] = '/front/ruledictionnaryoperatingsystem.php';
            if (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'] = $LANG['computers'][53];
            $menu['admin']['content']['dictionnary']['options']['os_sp']['page'] = '/front/ruledictionnaryoperatingsystemservicepack.php';
            $menu['admin']['content']['dictionnary']['options']['os_sp']['links']['search'] = '/front/ruledictionnaryoperatingsystemservicepack.php';
            if (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'] = $LANG['computers'][52];
            $menu['admin']['content']['dictionnary']['options']['os_version']['page'] = '/front/ruledictionnaryoperatingsystemversion.php';
            $menu['admin']['content']['dictionnary']['options']['os_version']['links']['search'] = '/front/ruledictionnaryoperatingsystemversion.php';
            if (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'] = $LANG['rulesengine'][39];
            $menu['admin']['content']['dictionnary']['options']['printer']['page'] = '/front/ruledictionnaryprinter.php';
            $menu['admin']['content']['dictionnary']['options']['printer']['links']['search'] = '/front/ruledictionnaryprinter.php';
            if (haveRight("rule_dictionnary_printer", "w")) {
                $menu['admin']['content']['dictionnary']['options']['printer']['links']['add'] = '/front/ruledictionnaryprinter.form.php';
            }
        }
    }
    if (haveRight("profile", "r")) {
        $menu['admin']['content']['profile']['title'] = $LANG['Menu'][35];
        $menu['admin']['content']['profile']['shortcut'] = 'p';
        $menu['admin']['content']['profile']['page'] = '/front/profile.php';
        $menu['admin']['content']['profile']['links']['search'] = "/front/profile.php";
        if (haveRight("profile", "w")) {
            $menu['admin']['content']['profile']['links']['add'] = "/front/profile.form.php";
        }
    }
    if (haveRight("backup", "w")) {
        $menu['admin']['content']['backup']['title'] = $LANG['Menu'][12];
        $menu['admin']['content']['backup']['shortcut'] = 'b';
        $menu['admin']['content']['backup']['page'] = '/front/backup.php';
    }
    if (haveRight("logs", "r")) {
        $menu['admin']['content']['log']['title'] = $LANG['Menu'][30];
        $menu['admin']['content']['log']['shortcut'] = 'l';
        $menu['admin']['content']['log']['page'] = '/front/event.php';
    }
    /// CONFIG
    $config = array();
    $addconfig = array();
    $menu['config']['title'] = $LANG['common'][12];
    if (haveRight("dropdown", "r") || haveRight("entity_dropdown", "r")) {
        $menu['config']['content']['dropdowns']['title'] = $LANG['setup'][0];
        $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) {
                        $tmp = new $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 (haveRight("device", "w")) {
        $menu['config']['content']['device']['title'] = $LANG['title'][30];
        $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) {
                        $tmp = new $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'] && haveRight("notification", "r") || haveRight("config", "w")) {
        $menu['config']['content']['mailing']['title'] = $LANG['setup'][704];
        $menu['config']['content']['mailing']['page'] = '/front/setup.notification.php';
        $menu['config']['content']['mailing']['options']['notification']['title'] = $LANG['setup'][704];
        $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 (haveRight("sla", "r")) {
        $menu['config']['content']['sla']['title'] = $LANG['Menu'][43];
        $menu['config']['content']['sla']['page'] = '/front/sla.php';
        $menu['config']['content']['sla']['links']['search'] = "/front/sla.php";
        if (haveRight("sla", "w")) {
            $menu['config']['content']['sla']['links']['add'] = "/front/sla.form.php";
        }
    }
    if (haveRight("config", "w")) {
        $menu['config']['content']['config']['title'] = $LANG['setup'][703];
        $menu['config']['content']['config']['page'] = '/front/config.form.php';
        $menu['config']['content']['control']['title'] = $LANG['Menu'][41];
        $menu['config']['content']['control']['page'] = '/front/control.php';
        $menu['config']['content']['control']['options']['FieldUnicity']['title'] = $LANG['setup'][811];
        $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'] = $LANG['crontask'][0];
        $menu['config']['content']['crontask']['page'] = '/front/crontask.php';
        $menu['config']['content']['crontask']['links']['search'] = "/front/crontask.php";
        $menu['config']['content']['mailing']['options']['config']['title'] = $LANG['mailing'][118];
        $menu['config']['content']['mailing']['options']['config']['page'] = '/front/notificationmailsetting.form.php';
        $menu['config']['content']['mailing']['options']['notificationtemplate']['title'] = $LANG['mailing'][113];
        $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'] = $LANG['login'][10];
        $menu['config']['content']['extauth']['page'] = '/front/setup.auth.php';
        $menu['config']['content']['extauth']['options']['ldap']['title'] = $LANG['login'][2];
        $menu['config']['content']['extauth']['options']['ldap']['page'] = '/front/authldap.php';
        $menu['config']['content']['extauth']['options']['imap']['title'] = $LANG['login'][3];
        $menu['config']['content']['extauth']['options']['imap']['page'] = '/front/authmail.php';
        $menu['config']['content']['extauth']['options']['others']['title'] = $LANG['common'][67];
        $menu['config']['content']['extauth']['options']['others']['page'] = '/front/auth.others.php';
        $menu['config']['content']['extauth']['options']['settings']['title'] = $LANG['common'][12];
        $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'] = $LANG['Menu'][39];
        $menu['config']['content']['mailcollector']['page'] = '/front/mailcollector.php';
        if (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 ($CFG_GLPI["use_ocs_mode"] && haveRight("config", "w")) {
        $menu['config']['content']['ocsng']['title'] = $LANG['setup'][134];
        $menu['config']['content']['ocsng']['page'] = '/front/ocsserver.php';
        $menu['config']['content']['ocsng']['links']['search'] = '/front/ocsserver.php';
        $menu['config']['content']['ocsng']['links']['add'] = '/front/ocsserver.form.php';
    }
    if (haveRight("link", "r")) {
        $menu['config']['content']['link']['title'] = $LANG['title'][33];
        $menu['config']['content']['link']['page'] = '/front/link.php';
        $menu['config']['content']['link']['hide'] = true;
        $menu['config']['content']['link']['links']['search'] = '/front/link.php';
        if (haveRight("link", "w")) {
            $menu['config']['content']['link']['links']['add'] = "/front/link.form.php";
        }
    }
    if (haveRight("config", "w")) {
        $menu['config']['content']['plugins']['title'] = $LANG['common'][29];
        $menu['config']['content']['plugins']['page'] = '/front/plugin.php';
    }
    // Special items
    $menu['preference']['title'] = $LANG['Menu'][11];
    $menu['preference']['default'] = '/front/preference.php';
    echo "<div id='header'>";
    echo "<div id='c_logo'>";
    echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/central.php' title=\"" . $LANG['central'][5] . "\"></a>";
    echo "</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=\"" . $LANG['central'][6] . "\">" . $LANG['central'][6] . "</a>";
    // check user id : header used for display messages when session logout
    if (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=\"" . $LANG['central'][7] . "\">" . $LANG['central'][7] . "</a></li>";
    echo "<li><a href='" . $CFG_GLPI["root_doc"] . "/front/preference.php' title=\"" . $LANG['Menu'][11] . "\">" . $LANG['Menu'][11] . "</a></li>";
    echo "</ul>";
    echo "<div class='sep'></div>";
    echo "</div>\n";
    /// Search engine
    echo "<div id='c_recherche' >\n";
    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/ok2.png' value='OK' title=\"" . $LANG['buttons'][2] . "\"  alt=\"" . $LANG['buttons'][2] . "\"></div>";
    echo "<div id='champRecherche'><input size='15' type='text' name='globalsearch' value='" . $LANG['buttons'][0] . "' onfocus=\"this.value='';\"></div>";
    echo "</form>";
    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 (utf8_strlen($data['title']) > 14) {
                $data['title'] = utf8_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($data['shortcut']) && !empty($data['shortcut'])) {
                        echo " accesskey='" . $val['shortcut'] . "'";
                    }
                    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 " accesskey='" . $val['shortcut'] . "'";
                    }
                    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=\"" . $LANG['central'][5] . "\">" . $LANG['central'][5] . "</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 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=\"" . $LANG['buttons'][8] . "\" alt=\"" . $LANG['buttons'][8] . "\"></a>";
        } else {
            echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_add_off.png' title=\"" . $LANG['buttons'][8] . "\" alt=\"" . $LANG['buttons'][8] . "\">";
        }
        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' title=\"" . $LANG['buttons'][0] . "\" alt=\"" . $LANG['buttons'][0] . "\"></a></li>";
        } else {
            echo "<li><img src='" . $CFG_GLPI["root_doc"] . "/pics/menu_search_off.png' title=\"" . $LANG['buttons'][0] . "\" alt=\"" . $LANG['buttons'][0] . "\"></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=\"" . $LANG['common'][8] . "\" alt=\"" . $LANG['common'][8] . "\" 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=\"" . $LANG['buttons'][40] . "\" alt=\"" . $LANG['buttons'][40] . "\" 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=\"" . $LANG['state'][1] . "\" alt=\"" . $LANG['state'][1] . "\" 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=\"" . $LANG['common'][12] . "\" alt=\"" . $LANG['common'][12] . "\" 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=\"" . $LANG['buttons'][52] . " " . $LANG['bookmark'][1] . "\"  alt=\"" . $LANG['buttons'][52] . " " . $LANG['bookmark'][1] . "\">";
    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 (getLoginUserID()) {
        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'>" . $LANG['setup'][809] . "</a>";
        echo "</div>";
    }
    // call function callcron() every 5min
    callCron();
    displayMessageAfterRedirect();
}
예제 #28
0
 static function showHelpdeskOptions(Entity $entity)
 {
     global $LANG, $CFG_GLPI;
     $ID = $entity->getField('id');
     if (!$entity->can($ID, 'r') || !haveRight('entity_helpdesk', 'r')) {
         return false;
     }
     $canedit = haveRight('entity_helpdesk', 'w') && haveAccessToEntity($ID);
     // Get data
     $entdata = new EntityData();
     if (!$entdata->getFromDB($ID)) {
         $entdata->getEmpty();
     }
     echo "<div class='spaced'>";
     if ($canedit) {
         echo "<form method='post' name=form action='" . getItemTypeFormURL(__CLASS__) . "'>";
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['buttons'][15] . "&nbsp;:&nbsp;</td>";
     echo "<td colspan='2'>";
     $options = array('value' => $entdata->fields["calendars_id"], 'emptylabel' => $LANG['common'][102]);
     if ($ID == 0) {
         $options['emptylabel'] = $LANG['sla'][10];
     }
     Dropdown::show('Calendar', $options);
     if ($entdata->fields["calendars_id"] == 0) {
         $calendar = new Calendar();
         if ($calendar->getFromDB(self::getUsedConfig('calendars_id', $ID))) {
             echo " - " . $calendar->getLink();
         }
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][28] . "&nbsp;:&nbsp;</td>";
     echo "<td colspan='2'>";
     $toadd = array();
     if ($ID != 0) {
         $toadd = array(0 => $LANG['common'][102]);
     }
     Ticket::dropdownType('tickettype', $entdata->fields["tickettype"], $toadd);
     if ($entdata->fields["calendars_id"] == 0) {
         $calendar = new Calendar();
         if ($calendar->getFromDB(self::getUsedConfig('calendars_id', $ID))) {
             echo " - " . $calendar->getLink();
         }
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td  colspan='2'>" . $LANG['setup'][52] . "&nbsp;:&nbsp;</td>";
     echo "<td colspan='2'>";
     $autoassign = array(-1 => $LANG['setup'][731], NO_AUTO_ASSIGN => $LANG['choice'][0], AUTO_ASSIGN_HARDWARE_CATEGORY => $LANG['setup'][51], AUTO_ASSIGN_CATEGORY_HARDWARE => $LANG['setup'][50]);
     Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $entdata->fields["auto_assign_mode"]));
     echo "</td></tr>";
     echo "<tr><th colspan='4'>" . $LANG['entity'][17] . "</th></tr>";
     echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][18] . "&nbsp;:&nbsp;</td>";
     echo "<td colspan='2'>";
     Dropdown::showInteger('autoclose_delay', $entdata->fields['autoclose_delay'], 0, 99, 1, array(-1 => $LANG['setup'][731], -10 => $LANG['setup'][307]));
     /*
           Alert::dropdownIntegerNever('autoclose_delay', $entdata->fields['autoclose_delay'],
                                       array('max'            => 99,
                                             'inherit_global' => 1,
                                             'never_value'    => -10,));
     */
     echo "&nbsp;" . $LANG['stats'][31] . "</td></tr>";
     echo "<tr><th colspan='4'>" . $LANG['entity'][19] . "</th></tr>";
     echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][19] . "&nbsp;:&nbsp;</td>";
     echo "<td colspan='2'>";
     /// no inquest case = rate 0
     $typeinquest = array(0 => $LANG['common'][102], 1 => $LANG['satisfaction'][9], 2 => $LANG['satisfaction'][10]);
     // No inherit from parent for root entity
     if ($entdata->fields['entities_id'] == 0) {
         unset($typeinquest[0]);
         if ($entdata->fields['inquest_config'] == 0) {
             $entdata->fields['inquest_config'] = 1;
         }
     }
     $rand = Dropdown::showFromArray('inquest_config', $typeinquest, $options = array('value' => $entdata->fields['inquest_config']));
     echo "</td></tr>\n";
     // Do not display for root entity in inherit case
     if ($entdata->fields['inquest_config'] == 0 && $entdata->fields['entities_id'] != 0) {
         $inquestconfig = self::getUsedConfig('inquest_config', $entdata->fields['entities_id']);
         $inquestrate = self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_rate');
         echo "<tr><td colspan='4' class='green center'>" . $LANG['common'][102] . "&nbsp;:&nbsp;";
         if ($inquestrate == 0) {
             echo $LANG['crontask'][31];
         } else {
             echo $typeinquest[$inquestconfig];
             echo " - " . self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_delay');
             echo "&nbsp;" . $LANG['stats'][31] . " - ";
             echo $inquestrate . "%";
             if ($inquestconfig == 2) {
                 echo " - " . self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_URL');
             }
         }
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_1'><td colspan='4'>";
     $_REQUEST = array('inquest_config' => $entdata->fields['inquest_config'], 'entities_id' => $ID);
     $params = array('inquest_config' => '__VALUE__', 'entities_id' => $ID);
     echo "<div id='inquestconfig'>";
     include GLPI_ROOT . '/ajax/ticketsatisfaction.php';
     echo "</div>\n";
     echo "</td></tr>";
     if ($canedit) {
         echo "<tr>";
         echo "<td class='tab_bg_2 center' colspan='4'>";
         echo "<input type='hidden' name='entities_id' value='{$ID}'>";
         if ($entdata->fields["id"]) {
             echo "<input type='hidden' name='id' value='" . $entdata->fields["id"] . "'>";
             echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\"\n                   class='submit'>";
         } else {
             echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][7] . "\" class='submit'>";
         }
         echo "</td></tr>";
         echo "</table></form>";
     } else {
         echo "</table>";
     }
     echo "</div>";
     ajaxUpdateItemOnSelectEvent("dropdown_inquest_config{$rand}", "inquestconfig", $CFG_GLPI["root_doc"] . "/ajax/ticketsatisfaction.php", $params);
 }
예제 #29
0
 function showForm($ID, $options = array())
 {
     global $DB, $CFG_GLPI, $LANG;
     $canupdate = haveRight('update_ticket', '1');
     $canpriority = haveRight('update_priority', '1');
     $showuserlink = 0;
     if (haveRight('user', 'r')) {
         $showuserlink = 1;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w', $options);
     }
     $this->showTabs($options);
     $canupdate_descr = $canupdate || $this->fields['status'] == 'new' && $this->isUser(self::REQUESTER, getLoginUserID()) && $this->numberOfFollowups() == 0 && $this->numberOfTasks() == 0;
     if (!$ID) {
         //Get all the user's entities
         $all_entities = Profile_User::getUserEntities($options["_users_id_requester"], true);
         $this->userentities = array();
         //For each user's entity, check if the technician which creates the ticket have access to it
         foreach ($all_entities as $tmp => $ID_entity) {
             if (haveAccessToEntity($ID_entity)) {
                 $this->userentities[] = $ID_entity;
             }
         }
         $this->countentitiesforuser = count($this->userentities);
         if ($this->countentitiesforuser > 0 && !in_array($this->fields["entities_id"], $this->userentities)) {
             // If entity is not in the list of user's entities,
             // then use as default value the first value of the user's entites list
             $this->fields["entities_id"] = $this->userentities[0];
         }
     }
     echo "<form method='post' name='form_ticket' enctype='multipart/form-data' action='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'>";
     echo "<div class='spaced' id='tabsbody'>";
     echo "<table class='tab_cadre_fixe'>";
     // Optional line
     $ismultientities = isMultiEntitiesMode();
     echo '<tr><th colspan="4">';
     if ($ID) {
         echo $this->getTypeName() . " - " . $LANG['common'][2] . " {$ID} ";
         if ($ismultientities) {
             echo "(" . Dropdown::getDropdownName('glpi_entities', $this->fields['entities_id']) . ")";
         }
     } else {
         if ($ismultientities) {
             echo $LANG['job'][46] . "&nbsp;:&nbsp;" . Dropdown::getDropdownName("glpi_entities", $this->fields['entities_id']);
         } else {
             echo $LANG['job'][13];
         }
     }
     echo '</th></tr>';
     echo "<tr>";
     echo "<th class='left' colspan='2'>";
     echo "<table>";
     echo "<tr>";
     echo "<td><span class='tracking_small'>" . $LANG['joblist'][11] . "&nbsp;: </span></td>";
     echo "<td>";
     $date = $this->fields["date"];
     if (!$ID) {
         $date = date("Y-m-d H:i:s");
     }
     if ($canupdate) {
         showDateTimeFormItem("date", $date, 1, false);
     } else {
         echo convDateTime($date);
     }
     echo "</td></tr>";
     if ($ID) {
         echo "<tr><td><span class='tracking_small'>" . $LANG['common'][95] . " &nbsp;:</span></td><td>";
         if ($canupdate) {
             User::dropdown(array('name' => 'users_id_recipient', 'value' => $this->fields["users_id_recipient"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
         } else {
             echo getUserName($this->fields["users_id_recipient"], $showuserlink);
         }
         echo "</td></tr>";
     }
     echo "</table>";
     echo "</th>";
     echo "<th class='left' colspan='2'>";
     echo "<table>";
     if ($ID) {
         echo "<tr><td><span class='tracking_small'>" . $LANG['common'][26] . "&nbsp;:</span></td>";
         echo "<td><span class='tracking_small'>" . convDateTime($this->fields["date_mod"]) . "\n";
         if ($this->fields['users_id_lastupdater'] > 0) {
             echo $LANG['common'][95] . "&nbsp;";
             echo getUserName($this->fields["users_id_lastupdater"], $showuserlink);
         }
         echo "</span>";
         echo "</td></tr>";
     }
     // SLA
     echo "<tr>";
     echo "<td><span class='tracking_small'>" . $LANG['sla'][5] . "&nbsp;: </span></td>";
     echo "<td>";
     if ($ID) {
         if ($this->fields["slas_id"] > 0) {
             echo "<span class='tracking_small'>&nbsp;";
             echo convDateTime($this->fields["due_date"]) . "</span>";
             echo "</td></tr><tr><td><span class='tracking_small'>" . $LANG['sla'][1] . "&nbsp;:</span></td>";
             echo "<td><span class='tracking_small'>";
             echo Dropdown::getDropdownName("glpi_slas", $this->fields["slas_id"]);
             $commentsla = "";
             $slalevel = new SlaLevel();
             if ($slalevel->getFromDB($this->fields['slalevels_id'])) {
                 $commentsla .= '<strong>' . $LANG['sla'][6] . "&nbsp;:&nbsp;</strong>" . $slalevel->getName() . '<br><br>';
             }
             $nextaction = new SlaLevel_Ticket();
             if ($nextaction->getFromDBForTicket($this->fields["id"])) {
                 $commentsla .= '<strong>' . $LANG['sla'][8] . "&nbsp;:&nbsp;</strong>" . convDateTime($nextaction->fields['date']) . '<br>';
                 if ($slalevel->getFromDB($nextaction->fields['slalevels_id'])) {
                     $commentsla .= '<strong>' . $LANG['sla'][6] . "&nbsp;:&nbsp;</strong>" . $slalevel->getName() . '<br>';
                 }
             }
             $slaoptions = array();
             if (haveRight('config', 'r')) {
             }
             $slaoptions['link'] = getItemTypeFormURL('SLA') . "?id=" . $this->fields["slas_id"];
             showToolTip($commentsla, $slaoptions);
             if ($canupdate) {
                 echo "&nbsp;<input type='submit' class='submit' name='sla_delete' value='" . $LANG['sla'][7] . "'>";
             }
             echo "</span>";
         } else {
             showDateTimeFormItem("due_date", $this->fields["due_date"], 1, false, $canupdate);
         }
     } else {
         // New Ticket
         if ($this->fields["due_date"] == 'NULL') {
             $this->fields["due_date"] = '';
         }
         showDateTimeFormItem("due_date", $this->fields["due_date"], 1, false, $canupdate);
         /*         echo $LANG['choice'][2]." ".$LANG['sla'][1]." : ";
                  Dropdown::show('Sla',array('entity' => $this->fields["entities_id"],
                                             'value' =>$this->fields["slas_id"]));*/
     }
     echo "</td></tr>";
     if ($ID) {
         switch ($this->fields["status"]) {
             case 'closed':
                 echo "<tr>";
                 echo "<td><span class='tracking_small'>" . $LANG['joblist'][12] . "&nbsp;: </span></td>";
                 echo "<td>";
                 showDateTimeFormItem("closedate", $this->fields["closedate"], 1, false, $canupdate);
                 echo "</td></tr>";
                 break;
             case 'solved':
                 echo "<tr>";
                 echo "<td><span class='tracking_small'>" . $LANG['joblist'][14] . "&nbsp;: </span></td>";
                 echo "<td>";
                 showDateTimeFormItem("solvedate", $this->fields["solvedate"], 1, false, $canupdate);
                 echo "</td></tr>";
                 break;
         }
     }
     echo "</table>";
     echo "</th></tr>";
     echo "</table>";
     if (!$ID) {
         $this->showActorsPartForm($ID, $options);
     }
     echo "<table  class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th width='10%'>" . $LANG['joblist'][0] . "&nbsp;: </th>";
     echo "<td width='40%'>";
     if ($canupdate) {
         self::dropdownStatus("status", $this->fields["status"], 2);
         // Allowed status
     } else {
         echo self::getStatus($this->fields["status"]);
     }
     echo "</td>";
     echo "<th>" . $LANG['common'][17] . "&nbsp;: </th>";
     echo "<td >";
     // Permit to set type when creating ticket without update right
     if ($canupdate || !$ID) {
         self::dropdownType('type', $this->fields["type"]);
     } else {
         echo self::getTicketTypeName($this->fields["type"]);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>" . $LANG['joblist'][29] . "&nbsp;: </th>";
     echo "<td>";
     if ($canupdate && $canpriority || !$ID || $canupdate_descr) {
         // Only change during creation OR when allowed to change priority OR when user is the creator
         $idurgency = self::dropdownUrgency("urgency", $this->fields["urgency"]);
     } else {
         $idurgency = "value_urgency" . mt_rand();
         echo "<input id='{$idurgency}' type='hidden' name='urgency' value='" . $this->fields["urgency"] . "'>";
         echo self::getUrgencyName($this->fields["urgency"]);
     }
     echo "</td>";
     echo "<th>" . $LANG['common'][36] . "&nbsp;: </th>";
     echo "<td >";
     // Permit to set category when creating ticket without update right
     if ($canupdate || !$ID || $canupdate_descr) {
         $opt = array('value' => $this->fields["ticketcategories_id"], 'entity' => $this->fields["entities_id"]);
         if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
             $opt['condition'] = '`is_helpdeskvisible`=1';
         }
         if ($ID && $CFG_GLPI["is_ticket_category_mandatory"]) {
             $opt['display_emptychoice'] = false;
         }
         Dropdown::show('TicketCategory', $opt);
     } else {
         echo Dropdown::getDropdownName("glpi_ticketcategories", $this->fields["ticketcategories_id"]);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>" . $LANG['joblist'][30] . "&nbsp;: </th>";
     echo "<td>";
     if ($canupdate) {
         $idimpact = self::dropdownImpact("impact", $this->fields["impact"]);
     } else {
         echo self::getImpactName($this->fields["impact"]);
     }
     echo "</td>";
     echo "<th class='left' rowspan='2'>" . $LANG['document'][14] . "&nbsp;: </th>";
     echo "<td rowspan='2'>";
     // Select hardware on creation or if have update right
     if ($canupdate || !$ID || $canupdate_descr) {
         if ($ID) {
             if ($this->fields['itemtype'] && class_exists($this->fields['itemtype']) && $this->fields["items_id"]) {
                 $item = new $this->fields['itemtype']();
                 if ($item->can($this->fields["items_id"], 'r')) {
                     echo $item->getTypeName() . " - " . $item->getLink(true);
                 } else {
                     echo $item->getTypeName() . " " . $item->getNameID();
                 }
             }
         }
         $dev_user_id = 0;
         if (!$ID) {
             $dev_user_id = $options['_users_id_requester'];
         } else {
             if (isset($this->users[self::REQUESTER]) && count($this->users[self::REQUESTER]) == 1) {
                 foreach ($this->users[self::REQUESTER] as $user_id_single) {
                     $dev_user_id = $user_id_single['users_id'];
                 }
             }
         }
         if ($dev_user_id > 0) {
             self::dropdownMyDevices($dev_user_id, $this->fields["entities_id"], $this->fields["itemtype"], $this->fields["items_id"]);
         }
         self::dropdownAllDevices("itemtype", $this->fields["itemtype"], $this->fields["items_id"], 1, $this->fields["entities_id"]);
     } else {
         if ($ID && $this->fields['itemtype'] && class_exists($this->fields['itemtype'])) {
             $item = new $this->fields['itemtype']();
             $item->getFromDB($this->fields['items_id']);
             echo $item->getTypeName() . " - " . $item->getNameID();
         } else {
             echo $LANG['help'][30];
         }
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th class='left'>" . $LANG['joblist'][2] . "&nbsp;: </th>";
     echo "<td>";
     if ($canupdate && $canpriority) {
         $idpriority = self::dropdownPriority("priority", $this->fields["priority"], false, true);
         $idajax = 'change_priority_' . mt_rand();
         echo "&nbsp;<span id='{$idajax}' style='display:none'></span>";
     } else {
         $idajax = 'change_priority_' . mt_rand();
         $idpriority = 0;
         echo "<span id='{$idajax}'>" . self::getPriorityName($this->fields["priority"]) . "</span>";
     }
     if ($canupdate) {
         $params = array('urgency' => '__VALUE0__', 'impact' => '__VALUE1__', 'priority' => $idpriority);
         ajaxUpdateItemOnSelectEvent(array($idurgency, $idimpact), $idajax, $CFG_GLPI["root_doc"] . "/ajax/priority.php", $params);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th class='left'>" . $LANG['job'][44] . "&nbsp;: </th>";
     echo "<td>";
     if ($canupdate) {
         Dropdown::show('RequestType', array('value' => $this->fields["requesttypes_id"]));
     } else {
         echo Dropdown::getDropdownName('glpi_requesttypes', $this->fields["requesttypes_id"]);
     }
     echo "</td>";
     // Display validation state
     echo "<th>";
     if (!$ID) {
         echo $LANG['validation'][26] . "&nbsp;:&nbsp;";
     } else {
         echo $LANG['validation'][0] . "&nbsp;:&nbsp;";
     }
     echo "</th>";
     echo "<td>";
     if (!$ID) {
         User::dropdown(array('name' => "_add_validation", 'entity' => $this->fields['entities_id'], 'right' => 'validate_ticket'));
     } else {
         if ($canupdate) {
             TicketValidation::dropdownStatus('global_validation', array('global' => true, 'value' => $this->fields['global_validation']));
         } else {
             echo TicketValidation::getStatus($this->fields['global_validation']);
         }
     }
     echo "</td></tr>";
     // Need comment right to add a followup with the actiontime
     if (!$ID && haveRight("global_add_followups", "1")) {
         echo "<tr class='tab_bg_1'>";
         echo "<th>" . $LANG['job'][20] . "&nbsp;: </th>";
         echo "<td class='left' colspan='3'>";
         Dropdown::showInteger('hour', $options['hour'], 0, 100);
         echo "&nbsp;" . $LANG['job'][21] . "&nbsp;&nbsp;";
         Dropdown::showInteger('minute', $options['minute'], 0, 59);
         echo "&nbsp;" . $LANG['job'][22] . "&nbsp;&nbsp;";
         echo "</td>";
         echo "</tr>";
     }
     echo '</table>';
     if ($ID) {
         $this->showActorsPartForm($ID, $options);
     }
     echo "<table  class='tab_cadre_fixe'>";
     $view_linked_tickets = $ID || $canupdate;
     echo "<tr class='tab_bg_1'>";
     echo "<th width='10%'>" . $LANG['common'][57] . "&nbsp;:</th>";
     echo "<td width='50%'>";
     if (!$ID || $canupdate_descr) {
         $rand = mt_rand();
         echo "<script type='text/javascript' >\n";
         echo "function showName{$rand}() {\n";
         echo "Ext.get('name{$rand}').setDisplayed('none');";
         $params = array('maxlength' => 250, 'size' => 60, 'name' => 'name', 'data' => rawurlencode($this->fields["name"]));
         ajaxUpdateItemJsCode("viewname{$rand}", $CFG_GLPI["root_doc"] . "/ajax/inputtext.php", $params, false);
         echo "}";
         echo "</script>\n";
         echo "<div id='name{$rand}' class='tracking left' onClick='showName{$rand}()'>\n";
         if (empty($this->fields["name"])) {
             echo $LANG['reminder'][15];
         } else {
             echo $this->fields["name"];
         }
         echo "</div>\n";
         echo "<div id='viewname{$rand}'>\n";
         echo "</div>\n";
         if (!$ID) {
             echo "<script type='text/javascript' >\n\n            showName{$rand}();\n            </script>";
         }
     } else {
         if (empty($this->fields["name"])) {
             echo $LANG['reminder'][15];
         } else {
             echo $this->fields["name"];
         }
     }
     echo "</td>";
     // Permit to add doc when creating a ticket
     if (!$ID) {
         echo "<th>" . $LANG['document'][2] . " (" . Document::getMaxUploadSize() . ")&nbsp;:";
         echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/aide.png' class='pointer' alt=\"" . $LANG['central'][7] . "\" onclick=\"window.open('" . $CFG_GLPI["root_doc"] . "/front/documenttype.list.php','Help','scrollbars=1,resizable=1,width=1000,height=800')\">";
         echo "</th>";
         echo "<td>";
         echo "<input type='file' name='filename' value=\"\" size='25'></td>";
     } else {
         echo "<th colspan='2'>";
         echo $LANG['document'][20] . '&nbsp;: ' . Document_Item::countForItem($this);
         echo "</th>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th width='10%'>" . $LANG['joblist'][6] . "&nbsp;:&nbsp;</th>";
     echo "<td width='50%'>";
     if (!$ID || $canupdate_descr) {
         // Admin =oui on autorise la modification de la description
         $rand = mt_rand();
         echo "<script type='text/javascript' >\n";
         echo "function showDesc{$rand}() {\n";
         echo "Ext.get('desc{$rand}').setDisplayed('none');";
         $params = array('rows' => 6, 'cols' => 60, 'name' => 'content', 'data' => rawurlencode($this->fields["content"]));
         ajaxUpdateItemJsCode("viewdesc{$rand}", $CFG_GLPI["root_doc"] . "/ajax/textarea.php", $params, false);
         echo "}";
         echo "</script>\n";
         echo "<div id='desc{$rand}' class='tracking' onClick='showDesc{$rand}()'>\n";
         if (!empty($this->fields["content"])) {
             echo nl2br($this->fields["content"]);
         } else {
             echo $LANG['job'][33];
         }
         echo "</div>\n";
         echo "<div id='viewdesc{$rand}'></div>\n";
         if (!$ID) {
             echo "<script type='text/javascript' >\n\n            showDesc{$rand}();\n            </script>";
         }
     } else {
         echo nl2br($this->fields["content"]);
     }
     echo "</td>";
     if ($view_linked_tickets) {
         echo "<th width='10%'>";
         echo $LANG['job'][55];
         if ($canupdate) {
             $rand_linked_ticket = mt_rand();
             echo "&nbsp;&nbsp;<a class='tracking'\n                  onClick=\"Ext.get('linkedticket{$rand_linked_ticket}').setDisplayed('block')\">\n";
             echo $LANG['buttons'][8];
             echo "</a>\n";
         }
         echo '</th>';
         echo "<td>";
         Ticket_Ticket::displayLinkedTicketsTo($ID);
         if ($canupdate) {
             echo "<div style='display:none' id='linkedticket{$rand_linked_ticket}'>";
             Ticket_Ticket::dropdownLinks('_link[link]');
             echo "&nbsp;" . $LANG['job'][38] . "&nbsp;" . $LANG['common'][2] . "&nbsp;:&nbsp;";
             echo "<input type='hidden' name='_link[tickets_id_1]' value='{$ID}'>\n";
             echo "<input type='text' name='_link[tickets_id_2]' value='' size='10'>\n";
             echo "&nbsp;";
             echo "</div>";
         }
         echo "</td>";
     }
     echo "</tr>";
     if (!$ID || $canupdate || $canupdate_descr || haveRight("assign_ticket", "1") || haveRight("steal_ticket", "1")) {
         echo "<tr class='tab_bg_1'>";
         if ($ID) {
             if (haveRight('delete_ticket', 1)) {
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='submit' class='submit' name='update' value='" . $LANG['buttons'][7] . "'></td>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='submit' class='submit' name='delete' value='" . $LANG['buttons'][22] . "'" . addConfirmationOnAction($LANG['common'][50]) . ">";
             } else {
                 echo "<td class='tab_bg_2 center' colspan='4'>";
                 echo "<input type='submit' class='submit' name='update' value='" . $LANG['buttons'][7] . "'>";
             }
         } else {
             echo "<td class='tab_bg_2 center' colspan='2'>";
             echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
             echo "</td><td class='tab_bg_2 center' colspan='2'>";
             echo "<input type='button' value=\"" . $LANG['buttons'][16] . "\" class='submit'\n                   onclick=\"window.location='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'\">";
         }
         echo "</td></tr>";
     }
     echo "</table>";
     echo "<input type='hidden' name='id' value='{$ID}'>";
     echo "</div>";
     echo "</form>";
     $this->addDivForTabs();
     return true;
 }
예제 #30
0
*/
// ----------------------------------------------------------------------
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
if (empty($_GET["id"])) {
    $_GET["id"] = "";
}
$link = new Link();
if (isset($_POST["add"])) {
    $link->check(-1, 'w');
    $newID = $link->add($_POST);
    Event::log($newID, "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][20] . " " . $_POST["name"] . ".");
    glpi_header(getItemTypeFormURL('Link') . "?id=" . $newID);
} else {
    if (isset($_POST["delete"])) {
        $link->check($_GET["id"], 'w');
        $link->delete($_POST);
        Event::log($_GET["id"], "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][22]);
        $link->redirectToList();
    } else {
        if (isset($_POST["update"])) {
            $link->check($_GET["id"], 'w');
            $link->update($_POST);
            Event::log($_GET["id"], "links", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
            glpi_header($_SERVER['HTTP_REFERER']);
        } else {
            commonHeader($LANG['title'][33], $_SERVER['PHP_SELF'], "config", "link");
            $link->showForm($_GET["id"]);