function displaySearchForm()
{
    global $_SERVER, $_GET, $LANG, $CFG_GLPI;
    echo "<form action='" . $_SERVER["PHP_SELF"] . "' method='post'>";
    echo "<table class='tab_cadre' cellpadding='5'>";
    echo "<tr class='tab_bg_1' align='center'>";
    echo "<td>";
    echo $LANG["financial"][8] . " :";
    $values = array();
    $values["sup"] = ">";
    $values["inf"] = "<";
    $values["equal"] = "=";
    if (isset($_GET["contains"][1])) {
        if (strstr($_GET["contains"][1], "lt;")) {
            $_GET["dropdown_sup_inf"] = "inf";
            $_GET["dropdown_calendar"] = str_replace("lt;", "", $_GET["contains"][1]);
            $_GET["dropdown_calendar"] = str_replace("&", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace("\\", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace("'", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace(" 00:00:00", "", $_GET["dropdown_calendar"]);
            $_GET["contains"][1] = "<" . $_GET["dropdown_calendar"];
        }
        if (strstr($_GET["contains"][1], "gt;")) {
            $_GET["dropdown_sup_inf"] = "sup";
            $_GET["dropdown_calendar"] = str_replace("gt;", "", $_GET["contains"][1]);
            $_GET["dropdown_calendar"] = str_replace("&", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace("\\", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace("'", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace(" 00:00:00", "", $_GET["dropdown_calendar"]);
            $_GET["contains"][1] = ">" . $_GET["dropdown_calendar"];
        }
        if (strstr($_GET["contains"][1], "LIKE")) {
            $_GET["dropdown_sup_inf"] = "equal";
            $_GET["dropdown_calendar"] = str_replace("=", "", $_GET["contains"][1]);
            $_GET["dropdown_calendar"] = str_replace("&", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace("\\", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace("'", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace("%", "", $_GET["dropdown_calendar"]);
            $_GET["dropdown_calendar"] = str_replace("LIKE ", "", $_GET["dropdown_calendar"]);
            $_GET["contains"][1] = "LIKE '" . $_GET["dropdown_calendar"] . "%'";
        }
    }
    Dropdown::showFromArray("dropdown_sup_inf", $values, array('value' => isset($_GET["dropdown_sup_inf"]) ? $_GET["dropdown_sup_inf"] : "sup"));
    echo "</td>\n\t\t<td width='120'>";
    showDateFormItem("dropdown_calendar", isset($_GET["dropdown_calendar"]) ? $_GET["dropdown_calendar"] : 0);
    echo "</td>";
    echo "<td>" . $LANG["common"][15] . "</td>";
    echo "<td>";
    Dropdown::show("Location", array('name' => "location", 'value' => isset($_GET["location"]) ? $_GET["location"] : ""));
    echo "</td>";
    // Display Reset search
    echo "<td>";
    echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/fusioninventory/report/ports_date_connections.php?reset_search=reset_search' ><img title=\"" . $LANG["buttons"][16] . "\" alt=\"" . $LANG["buttons"][16] . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/reset.png' class='calendrier'></a>";
    echo "</td>";
    echo "<td>";
    //Add parameters to uri to be saved as bookmarks
    $_SERVER["REQUEST_URI"] = buildBookmarkUrl($_SERVER["REQUEST_URI"], $_GET);
    showSaveBookmarkButton(BOOKMARK_SEARCH, PLUGIN_FUSIONINVENTORY_SNMP_NETWORKING_PORTS2);
    echo "</td>";
    echo "<td>";
    echo "<input type='submit' value='Valider' class='submit' />";
    echo "</td>";
    echo "</tr>";
    echo "</table>";
    echo "</form>";
}
Example #2
0
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.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
$AJAX_INCLUDE = 1;
include GLPI_ROOT . "/inc/includes.php";
// Send UTF8 Headers
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
checkLoginUser();
if (isset($_POST['value']) && strcmp($_POST['value'], '0') == 0) {
    if ($_POST['withtime']) {
        showDateTimeFormItem($_POST['name'], $_POST['specificvalue']);
    } else {
        showDateFormItem($_POST['name'], $_POST['specificvalue']);
    }
} else {
    echo "<input type='hidden' name='" . $_POST['name'] . "' value='" . $_POST['value'] . "'>";
}
        $INSELECT .= "<option value='{$key}' " . ($key == $_REQUEST["type"] ? "selected" : "") . ">" . $val['title'] . "</option>";
    }
    $INSELECT .= "</optgroup>";
}
echo "<div class='center'><form method='get' name='form' action='stat.tracking.php'>";
echo "<table class='tab_cadre'>";
echo "<tr class='tab_bg_2'><td rowspan='2' class='center'>";
echo "<select name='type'>" . $INSELECT . "</select></td>";
echo "<td class='right'>" . $LANG['search'][8] . "&nbsp;:</td><td>";
showDateFormItem("date1", $_REQUEST["date1"]);
echo "</td>";
echo "<td class='right'>" . $LANG['stats'][7] . "&nbsp;:</td>";
echo "<td rowspan='2' class='center'>";
echo "<input type='submit' class='button' name='submit' value=\"" . $LANG['buttons'][7] . "\"></td></tr>";
echo "<tr class='tab_bg_2'><td class='right'>" . $LANG['search'][9] . "&nbsp;:</td><td>";
showDateFormItem("date2", $_REQUEST["date2"]);
echo "</td><td class='center'>";
Dropdown::showYesNo('showgraph', $_REQUEST['showgraph']);
echo "</td></tr>";
echo "</table></form></div>";
$val = Stat::getItems($_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST["type"]);
$params = array('type' => $_REQUEST["type"], 'date1' => $_REQUEST["date1"], 'date2' => $_REQUEST["date2"], 'start' => $_REQUEST["start"]);
printPager($_REQUEST['start'], count($val), $CFG_GLPI['root_doc'] . '/front/stat.tracking.php', "date1=" . $_REQUEST["date1"] . "&amp;date2=" . $_REQUEST["date2"] . "&amp;type=" . $_REQUEST["type"] . "&amp;showgraph=" . $_REQUEST["showgraph"], 'Stat', $params);
if (!$_REQUEST['showgraph']) {
    Stat::show($_REQUEST["type"], $_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST['start'], $val);
} else {
    $data = Stat::getDatas($_REQUEST["type"], $_REQUEST["date1"], $_REQUEST["date2"], $_REQUEST['start'], $val);
    if (isset($data['opened']) && is_array($data['opened'])) {
        foreach ($data['opened'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
    $_POST["date1"] = date("Y-m-d", mktime(1, 0, 0, date("m"), date("d"), $year));
    $_POST["date2"] = date("Y-m-d");
}
if (!empty($_POST["date1"]) && !empty($_POST["date2"]) && strcmp($_POST["date2"], $_POST["date1"]) < 0) {
    $tmp = $_POST["date1"];
    $_POST["date1"] = $_POST["date2"];
    $_POST["date2"] = $tmp;
}
echo "<div class='center'><form method='post' name='form' action='" . $_SERVER['PHP_SELF'] . "'>";
echo "<table class='tab_cadre'><tr class='tab_bg_2'>";
echo "<td class='right'>" . $LANG['search'][8] . "&nbsp;:&nbsp;</td><td>";
showDateFormItem("date1", $_POST["date1"]);
echo "</td><td rowspan='2' class='center'>";
echo "<input type='submit' class='button' name='submit' value=\"" . $LANG['buttons'][7] . "\"></td></tr>";
echo "<tr class='tab_bg_2'><td class='right'>" . $LANG['search'][9] . "&nbsp;:&nbsp;</td><td>";
showDateFormItem("date2", $_POST["date2"]);
echo "</td></tr>";
echo "</table></form></div>";
$valeurtot = 0;
$valeurnettetot = 0;
$valeurnettegraphtot = array();
$valeurgraphtot = array();
/** Display an infocom report
 *
 * @param $itemtype item type
 * @param $begin begin date
 * @param $end end date
**/
function display_infocoms_report($itemtype, $begin, $end)
{
    global $DB, $valeurtot, $valeurnettetot, $valeurnettegraphtot, $valeurgraphtot, $LANG, $CFG_GLPI;
 /**
  * Show the planning selection form
  *
  *
  * @param $type planning type : can be day, week, month
  * @param $date working date
  * @param $usertype type of planning to view : can be user or group
  * @param $uID ID of the user
  * @param $gID ID of the group
  *
  * @return Display form
  **/
 static function showSelectionForm($type, $date, $usertype, $uID, $gID)
 {
     global $LANG, $CFG_GLPI;
     switch ($type) {
         case "month":
             $split = explode("-", $date);
             $year_next = $split[0];
             $month_next = $split[1] + 1;
             if ($month_next > 12) {
                 $year_next++;
                 $month_next -= 12;
             }
             $year_prev = $split[0];
             $month_prev = $split[1] - 1;
             if ($month_prev == 0) {
                 $year_prev--;
                 $month_prev += 12;
             }
             $next = $year_next . "-" . sprintf("%02u", $month_next) . "-" . $split[2];
             $prev = $year_prev . "-" . sprintf("%02u", $month_prev) . "-" . $split[2];
             break;
         default:
             $time = strtotime($date);
             $step = 0;
             switch ($type) {
                 case "week":
                     $step = WEEK_TIMESTAMP;
                     break;
                 case "day":
                     $step = DAY_TIMESTAMP;
                     break;
             }
             $next = $time + $step + 10;
             $prev = $time - $step;
             $next = strftime("%Y-%m-%d", $next);
             $prev = strftime("%Y-%m-%d", $prev);
             break;
     }
     echo "<div class='center'><form method='get' name='form' action='planning.php'>\n";
     echo "<table class='tab_cadre'><tr class='tab_bg_1'>";
     echo "<td>";
     echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/planning.php?type=" . $type . "&amp;uID=" . $uID . "&amp;date={$prev}&amp;usertype={$usertype}&amp;gID={$gID}\">";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . $LANG['buttons'][12] . "\"\n             title=\"" . $LANG['buttons'][12] . "\"></a>";
     echo "</td>";
     echo "<td>";
     if (haveRight("show_all_planning", "1")) {
         echo "<input type='radio' id='radio_user' name='usertype' value='user' " . ($usertype == "user" ? "checked" : "") . ">";
         $rand_user = User::dropdown(array('name' => 'uID', 'value' => $uID, 'right' => 'interface', 'all' => 1, 'entity' => $_SESSION["glpiactive_entity"]));
         echo "\n<hr>";
         echo "<input type='radio' id='radio_group' name='usertype' value='group' " . ($usertype == "group" ? "checked" : "") . ">";
         $rand_group = Dropdown::show('Group', array('value' => $gID, 'name' => 'gID', 'entity' => $_SESSION["glpiactive_entity"]));
         echo "\n<hr>";
         echo "<input type='radio' id='radio_user_group' name='usertype' value='user_group' " . ($usertype == "user_group" ? "checked" : "") . ">";
         echo $LANG['joblist'][3];
         echo "\n<script type='text/javascript'>";
         echo "Ext.onReady(function() {";
         echo "   Ext.get('dropdown_uID" . $rand_user . "').on('change',function() {";
         echo "      window.document.getElementById('radio_user').checked=true;});";
         echo "   Ext.get('dropdown_gID" . $rand_group . "').on('change',function() {";
         echo "      window.document.getElementById('radio_group').checked=true;});";
         echo "});";
         echo "</script>\n";
     } else {
         if (haveRight("show_group_planning", "1")) {
             echo "<select name='usertype'>";
             echo "<option value='user' " . ($usertype == 'user' ? 'selected' : '') . ">" . $LANG['joblist'][1];
             echo "</option>";
             echo "<option value='user_group' " . ($usertype == 'user_group' ? 'selected' : '') . ">" . $LANG['joblist'][3] . "</option>";
             echo "</select>";
         }
     }
     echo "</td>";
     echo "<td>";
     showDateFormItem("date", $date, false);
     echo "</td>\n";
     echo "<td><select name='type'>";
     echo "<option value='day' " . ($type == "day" ? " selected " : "") . ">" . $LANG['planning'][5] . "</option>";
     echo "<option value='week' " . ($type == "week" ? " selected " : "") . ">" . $LANG['planning'][6] . "</option>";
     echo "<option value='month' " . ($type == "month" ? " selected " : "") . ">" . $LANG['planning'][14] . "</option>";
     echo "</select></td>\n";
     echo "<td rowspan='2' class='center'>";
     echo "<input type='submit' class='button' name='submit' value=\"" . $LANG['buttons'][7] . "\">";
     echo "</td>\n";
     echo "<td>";
     echo "<a target='_blank'\n            href=\"" . $CFG_GLPI["root_doc"] . "/front/planning.php?genical=1&amp;uID=" . $uID . "&amp;gID=" . $gID . "&amp;usertype=" . $usertype . "\"\n            title=\"" . $LANG['planning'][12] . "\">" . "<span style='font-size:10px'>-" . $LANG['planning'][10] . "</span></a>";
     echo "<br>";
     // Todo recup l'url complete de glpi proprement, ? nouveau champs table config ?
     echo "<a target='_blank' href=\"webcal://" . $_SERVER['HTTP_HOST'] . $CFG_GLPI["root_doc"] . "/front/planning.php?genical=1&amp;uID=" . $uID . "&amp;gID=" . $gID . "&amp;usertype=" . $usertype . "\" title=\"" . $LANG['planning'][13] . "\">";
     echo "<span style='font-size:10px'>-" . $LANG['planning'][11] . "</span></a>";
     echo "</td>\n";
     echo "<td>";
     echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/planning.php?type=" . $type . "&amp;uID=" . $uID . "&amp;date={$next}&amp;usertype={$usertype}&amp;gID={$gID}\">";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/right.png' alt=\"" . $LANG['buttons'][11] . "\"\n             title=\"" . $LANG['buttons'][11] . "\"></a>";
     echo "</td>";
     echo "</tr>";
     echo "</table></form></div>\n";
 }
Example #6
0
 /**
  * Print the contact form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target for the Form
  *     - withtemplate : template or basic item
  *
  *@return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $LANG;
     if (!haveRight("budget", "r")) {
         return false;
     }
     $use_cache = true;
     $rowspan = 4;
     if ($ID > 0) {
         $rowspan++;
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;: </td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td rowspan='{$rowspan}' class='middle right'>" . $LANG['common'][25] . "&nbsp;: </td>";
     echo "<td class='center middle' rowspan='{$rowspan}'><textarea cols='45' rows='4'\n             name='comment' >" . $this->fields["comment"] . "</textarea></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][21] . "&nbsp;:</td>";
     echo "<td><input type='text' name='value' size='14'\n             value='" . formatNumber($this->fields["value"], true) . "'></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['search'][8] . "&nbsp;: </td>";
     echo "<td>";
     showDateFormItem("begin_date", $this->fields["begin_date"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['search'][9] . "&nbsp;: </td>";
     echo "<td>";
     showDateFormItem("end_date", $this->fields["end_date"]);
     echo "</td></tr>";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['common'][26] . "&nbsp;: </td>";
         echo "<td>";
         echo $this->fields["date_mod"] ? convDateTime($this->fields["date_mod"]) : $LANG['setup'][307];
         echo "</td></tr>";
     }
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 /**
  * Print the Software / license form
  *
  * @param $ID Integer : Id of the version or the template to print
  * @param $options array
  *     - target form target
  *     - softwares_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     $softwares_id = -1;
     if (isset($options['softwares_id'])) {
         $softwares_id = $options['softwares_id'];
     }
     if (!haveRight("software", "w")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
         $this->fields['softwares_id'] = $softwares_id;
         $this->fields['number'] = 1;
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['help'][31] . "&nbsp;:</td>";
     echo "<td>";
     if ($ID > 0) {
         $softwares_id = $this->fields["softwares_id"];
     } else {
         echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
     }
     echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
     echo "</td>";
     echo "<td>" . $LANG['common'][17] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('SoftwareLicenseType', array('value' => $this->fields["softwarelicensetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . $LANG['common'][19] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['software'][1] . "&nbsp;:</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"]));
     echo "</td>";
     echo "<td>" . $LANG['common'][20] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "otherserial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['software'][2] . "&nbsp;:</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"]));
     echo "</td>";
     echo "<td rowspan='" . ($ID > 0 ? '4' : '3') . "' class='middle'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td class='center middle' rowspan='" . ($ID > 0 ? '4' : '3') . "'>";
     echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['tracking'][29] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showInteger("number", $this->fields["number"], 1, 1000, 1, array(-1 => $LANG['software'][4]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['software'][32] . "&nbsp;:</td>";
     echo "<td>";
     showDateFormItem('expire', $this->fields["expire"]);
     Alert::displayLastAlert('SoftwareLicense', $ID);
     echo "</td></tr>\n";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['common'][26] . "&nbsp;: </td>";
         echo "<td>" . ($this->fields["date_mod"] ? convDateTime($this->fields["date_mod"]) : $LANG['setup'][307]);
         echo "</td></tr>";
     }
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 /**
  * Show Infocom form for an item (not a standard showForm)
  *
  * @param $item CommonDBTM object
  * @param $withtemplate integer: template or basic item
  **/
 static function showForItem(CommonDBTM $item, $withtemplate = '')
 {
     global $CFG_GLPI, $LANG;
     // Show Infocom or blank form
     if (!haveRight("infocom", "r")) {
         return false;
     }
     if (!$item) {
         echo "<div class='spaced'>" . $LANG['financial'][85] . "</div>";
     } else {
         $date_tax = $CFG_GLPI["date_tax"];
         $dev_ID = $item->getField('id');
         $ic = new self();
         $option = "";
         if ($withtemplate == 2) {
             $option = " readonly ";
         }
         if (!strpos($_SERVER['PHP_SELF'], "infocoms-show") && in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
             echo "<div class='firstbloc center'>" . $LANG['financial'][84] . "</div>";
         }
         if (!$ic->getFromDBforDevice($item->getType(), $dev_ID)) {
             $input = array('itemtype' => $item->getType(), 'items_id' => $dev_ID, 'entities_id' => $item->getEntityID());
             if ($ic->can(-1, "w", $input) && $withtemplate != 2) {
                 echo "<div class='spaced b'>";
                 echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><th>";
                 echo $item->getTypeName() . " - " . $item->getName() . "</th></tr>";
                 echo "<tr class='tab_bg_1'><td class='center'>";
                 echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php?itemtype=" . $item->getType() . "&amp;items_id={$dev_ID}&amp;add=add'>" . $LANG['financial'][68];
                 echo "</a></td></tr></table></div>";
             }
         } else {
             // getFromDBforDevice
             $canedit = $ic->can($ic->fields['id'], "w") && $withtemplate != 2;
             if ($canedit) {
                 echo "<form name='form_ic' method='post' action='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php'>";
             }
             echo "<div class='spaced'>";
             echo "<table class='tab_cadre" . (!strpos($_SERVER['PHP_SELF'], "infocoms-show") ? "_fixe" : "") . "'>";
             echo "<tr><th colspan='4'>" . $LANG['financial'][3] . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][26] . "&nbsp;:</td>";
             echo "<td>";
             if ($withtemplate == 2) {
                 echo Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]);
             } else {
                 Dropdown::show('Supplier', array('value' => $ic->fields["suppliers_id"], 'entity' => $item->getEntityID()));
             }
             echo "</td>";
             if (haveRight("budget", "r")) {
                 echo "<td>" . $LANG['financial'][87] . "&nbsp;:</td><td >";
                 Dropdown::show('Budget', array('value' => $ic->fields["budgets_id"], 'entity' => $item->getEntityID(), 'comments' => 1));
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             // Can edit calendar ?
             $editcalendar = $withtemplate != 2;
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][18] . "&nbsp;:</td>";
             echo "<td >";
             autocompletionTextField($ic, "order_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][28] . "&nbsp;:</td><td>";
             showDateFormItem("order_date", $ic->fields["order_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][20] . "*&nbsp;:</td>";
             echo "<td>";
             $objectName = autoName($ic->fields["immo_number"], "immo_number", $withtemplate == 2, 'Infocom', $item->getEntityID());
             autocompletionTextField($ic, "immo_number", array('value' => $objectName, 'option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][14] . "&nbsp;:</td><td>";
             showDateFormItem("buy_date", $ic->fields["buy_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][82] . "&nbsp;:</td>";
             echo "<td>";
             autocompletionTextField($ic, "bill", array('option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][27] . "&nbsp;:</td><td>";
             showDateFormItem("delivery_date", $ic->fields["delivery_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][19] . "&nbsp;:</td><td>";
             autocompletionTextField($ic, "delivery_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][76] . "&nbsp;:</td><td>";
             showDateFormItem("use_date", $ic->fields["use_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][21] . "&nbsp;:</td>";
             echo "<td><input type='text' name='value' {$option} value='" . formatNumber($ic->fields["value"], true) . "' size='14'></td>";
             echo "</td>";
             echo "<td>" . $LANG['financial'][114] . "&nbsp;:</td><td>";
             showDateFormItem("inventory_date", $ic->fields["inventory_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][78] . "&nbsp;:</td>";
             echo "<td><input type='text' {$option} name='warranty_value' value='" . formatNumber($ic->fields["warranty_value"], true) . "' size='14'></td>";
             echo "<td rowspan='5'>" . $LANG['common'][25] . "&nbsp;:</td>";
             echo "<td rowspan='5' class='middle'>";
             echo "<textarea cols='45' rows='9' name='comment' >" . $ic->fields["comment"];
             echo "</textarea></td></tr>\n";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][81] . "&nbsp;:</td><td>";
             echo formatNumber(self::Amort($ic->fields["sink_type"], $ic->fields["value"], $ic->fields["sink_time"], $ic->fields["sink_coeff"], $ic->fields["warranty_date"], $ic->fields["use_date"], $date_tax, "n"));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][22] . "&nbsp;:</td><td >";
             if ($withtemplate == 2) {
                 echo self::getAmortTypeName($ic->fields["sink_type"]);
             } else {
                 self::dropdownAmortType("sink_type", $ic->fields["sink_type"]);
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][23] . "&nbsp;:</td><td>";
             if ($withtemplate == 2) {
                 echo $ic->fields["sink_time"];
             } else {
                 Dropdown::showInteger("sink_time", $ic->fields["sink_time"], 0, 15);
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][77] . "&nbsp;:</td>";
             echo "<td>";
             autocompletionTextField($ic, "sink_coeff", array('size' => 14, 'option' => $option));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . $LANG['financial'][89] . "&nbsp;:</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . $LANG['financial'][90] . "&nbsp;:</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"], $ic->fields["warranty_date"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             echo "<tr><th colspan='4'>" . $LANG['financial'][7] . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][29] . "&nbsp;:</td><td>";
             showDateFormItem("warranty_date", $ic->fields["warranty_date"], true, $editcalendar);
             echo "</td>";
             echo "<td>" . $LANG['financial'][15] . "&nbsp;:</td><td>";
             if ($withtemplate == 2) {
                 // -1 = life
                 if ($ic->fields["warranty_duration"] == -1) {
                     echo $LANG['financial'][2];
                 } else {
                     echo $ic->fields["warranty_duration"];
                 }
             } else {
                 Dropdown::showInteger("warranty_duration", $ic->fields["warranty_duration"], 0, 120, 1, array(-1 => $LANG['financial'][2]));
             }
             if ($ic->fields["warranty_duration"] >= 0) {
                 echo " " . $LANG['financial'][57];
             }
             echo "<span class='small_space'>" . $LANG['financial'][88] . "</span>&nbsp;";
             echo getWarrantyExpir($ic->fields["warranty_date"], $ic->fields["warranty_duration"]);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][16] . "&nbsp;:</td>";
             echo "<td >";
             autocompletionTextField($ic, "warranty_info", array('option' => $option));
             echo "</td>";
             if ($CFG_GLPI['use_mailing']) {
                 echo "<td>" . $LANG['setup'][247] . "&nbsp;:</td>";
                 echo "<td>";
                 echo self::dropdownAlert("alert", $ic->fields["alert"]);
                 Alert::displayLastAlert('Infocom', $ic->fields['id']);
                 echo "</td>";
             } else {
                 echo "</td><td colspan='2'>";
             }
             echo "</td></tr>";
             if ($canedit) {
                 echo "<tr>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='hidden' name='id' value='" . $ic->fields['id'] . "'>";
                 echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\"\n                      class='submit'>";
                 echo "</td>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='submit' name='delete' value=\"" . $LANG['buttons'][6] . "\"\n                      class='submit'>";
                 echo "</td></tr>";
                 echo "</table></div></form>";
             } else {
                 echo "</table></div>";
             }
         }
     }
 }
Example #9
0
 /**
  * Print the config form for restrictions
  *
  * @return Nothing (display)
  **/
 function showFormInventory()
 {
     global $DB, $LANG, $CFG_GLPI;
     if (!haveRight("config", "w")) {
         return false;
     }
     echo "<form name='form' action=\"" . getItemTypeFormURL(__CLASS__) . "\" method='post'>";
     echo "<div class='center' id='tabsbody'>";
     echo "<input type='hidden' name='id' value='" . $CFG_GLPI["id"] . "'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>" . $LANG['Menu'][38] . "</th></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . $LANG['setup'][133] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("use_ocs_mode", $CFG_GLPI["use_ocs_mode"]);
     echo "</td><td> " . $LANG['setup'][271] . "&nbsp;:</td>";
     echo "<td>";
     $this->dropdownGlobalManagement("monitors_management_restrict", $CFG_GLPI["monitors_management_restrict"]);
     echo "</td</tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['setup'][8] . "&nbsp;:</td><td>";
     Dropdown::ShowYesNo('auto_create_infocoms', $CFG_GLPI["auto_create_infocoms"]);
     echo "</td></td><td> " . $LANG['setup'][272] . "&nbsp;:</td><td>";
     $this->dropdownGlobalManagement("peripherals_management_restrict", $CFG_GLPI["peripherals_management_restrict"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td>" . $LANG['rulesengine'][86] . "&nbsp;:</td><td>";
     Dropdown::show('SoftwareCategory', array('value' => $CFG_GLPI["softwarecategories_id_ondelete"], 'name' => "softwarecategories_id_ondelete"));
     echo "</td><td> " . $LANG['setup'][273] . "&nbsp;:</td><td>";
     $this->dropdownGlobalManagement("phones_management_restrict", $CFG_GLPI["phones_management_restrict"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['setup'][221] . "&nbsp;:</td><td>";
     showDateFormItem("date_tax", $CFG_GLPI["date_tax"], false, true, '', '', false);
     echo "</td><td> " . $LANG['setup'][275] . "&nbsp;:</td><td>";
     $this->dropdownGlobalManagement("printers_management_restrict", $CFG_GLPI["printers_management_restrict"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td>" . $LANG['setup'][360] . "&nbsp;:</td><td>";
     $tab = array(0 => $LANG['common'][59], 1 => $LANG['entity'][8]);
     Dropdown::showFromArray('use_autoname_by_entity', $tab, array('value' => $CFG_GLPI["use_autoname_by_entity"]));
     echo "</td></td>";
     echo "<td colspan='2'>&nbsp;";
     echo "</td></tr>";
     echo "</table>";
     if (haveRight("transfer", "w") && isMultiEntitiesMode()) {
         echo "<br><table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='2'>" . $LANG['setup'][290] . "</th></tr>";
         echo "<tr class='tab_bg_2'>";
         echo "<td>" . $LANG['setup'][291] . "&nbsp;:</td><td>";
         Dropdown::show('Transfer', array('value' => $CFG_GLPI["transfers_id_auto"], 'name' => "transfers_id_auto", 'emptylabel' => $LANG['setup'][292]));
         echo "</td></td></tr>";
         echo "</table>";
     }
     echo "<br><table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='6'>" . $LANG['setup'][280] . " (" . $LANG['peripherals'][32] . ")</th></tr>";
     echo "<tr><th>&nbsp;</th>";
     echo "<th>" . $LANG['common'][18] . "</th>";
     echo "<th>" . $LANG['common'][34] . "</th>";
     echo "<th>" . $LANG['common'][35] . "</th>";
     echo "<th>" . $LANG['common'][15] . "</th>";
     echo "<th>" . $LANG['state'][0] . "</th>";
     echo "</tr>";
     $fields = array("contact", "group", "location", "user");
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . $LANG['setup'][281] . "&nbsp;:</td>";
     $values[0] = $LANG['setup'][285];
     $values[1] = $LANG['setup'][283];
     foreach ($fields as $field) {
         echo "<td>";
         $fieldname = "is_" . $field . "_autoupdate";
         Dropdown::showFromArray($fieldname, $values, array('value' => $CFG_GLPI[$fieldname]));
         echo "</td>";
     }
     echo "<td>";
     State::dropdownBehaviour("state_autoupdate_mode", $LANG['setup'][197], $CFG_GLPI["state_autoupdate_mode"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td> " . $LANG['setup'][282] . "&nbsp;:</td>";
     $values[0] = $LANG['setup'][286];
     $values[1] = $LANG['setup'][284];
     foreach ($fields as $field) {
         echo "<td>";
         $fieldname = "is_" . $field . "_autoclean";
         Dropdown::showFromArray($fieldname, $values, array('value' => $CFG_GLPI[$fieldname]));
         echo "</td>";
     }
     echo "<td>";
     State::dropdownBehaviour("state_autoclean_mode", $LANG['setup'][196], $CFG_GLPI["state_autoclean_mode"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'>";
     echo "<td colspan='6' class='center'>";
     echo "<input type='submit' name='update' class='submit' value=\"" . $LANG['buttons'][2] . "\">";
     echo "</td></tr>";
     echo "</table></div>";
     echo "</form>";
 }
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     if (!$this->isNewID($ID)) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     $fields = $this->getAdditionalFields();
     $nb = count($fields);
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     echo "<input type='hidden' name='itemtype' value='" . $this->getType() . "'>";
     if ($this instanceof CommonDevice) {
         // Awfull hack for CommonDevice where name is designation
         autocompletionTextField($this, "designation");
     } else {
         autocompletionTextField($this, "name");
     }
     echo "</td>";
     echo "<td rowspan='" . ($nb + 1) . "'>";
     echo $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td rowspan='" . ($nb + 1) . "'>\n            <textarea cols='45' rows='" . ($nb + 2) . "' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td></tr>\n";
     foreach ($fields as $field) {
         echo "<tr class='tab_bg_1'><td>" . $field['label'] . "&nbsp;:</td><td>";
         switch ($field['type']) {
             case 'UserDropdown':
                 User::dropdown(array('name' => $field['name'], 'value' => $this->fields[$field['name']], 'right' => 'interface', 'entity' => $this->fields["entities_id"]));
                 break;
             case 'dropdownValue':
                 Dropdown::show(getItemTypeForTable(getTableNameForForeignKeyField($field['name'])), array('value' => $this->fields[$field['name']], 'name' => $field['name'], 'entity' => $this->getEntityID()));
                 break;
             case 'text':
                 autocompletionTextField($this, $field['name']);
                 break;
             case 'textarea':
                 echo "<textarea name='" . $field['name'] . "' cols='40' rows='3'>" . $this->fields[$field['name']] . "</textarea >";
                 break;
             case 'parent':
                 if ($field['name'] == 'entities_id') {
                     $restrict = -1;
                 } else {
                     $restrict = $this->getEntityID();
                 }
                 Dropdown::show(getItemTypeForTable($this->getTable()), array('value' => $this->fields[$field['name']], 'name' => $field['name'], 'entity' => $restrict, 'used' => $ID > 0 ? getSonsOf($this->getTable(), $ID) : array()));
                 break;
             case 'icon':
                 Dropdown::dropdownIcons($field['name'], $this->fields[$field['name']], GLPI_ROOT . "/pics/icones");
                 if (!empty($this->fields[$field['name']])) {
                     echo "&nbsp;<img style='vertical-align:middle;' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $this->fields[$field['name']] . "'>";
                 }
                 break;
             case 'bool':
                 Dropdown::showYesNo($field['name'], $this->fields[$field['name']]);
                 break;
             case 'date':
                 showDateFormItem($field['name'], $this->fields[$field['name']]);
                 break;
             case 'datetime':
                 showDateTimeFormItem($field['name'], $this->fields[$field['name']]);
                 break;
             case 'password':
                 echo "<input type='password' name='password' value='' size='20' autocomplete='off'>";
                 break;
             default:
                 $this->displaySpecificTypeField($ID, $field);
                 break;
         }
         if (isset($field['unit'])) {
             echo "&nbsp;" . $field['unit'];
         }
         echo "</td></tr>\n";
     }
     if (isset($this->fields['is_protected']) && $this->fields['is_protected']) {
         $options['candel'] = false;
     }
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 /**
  * Show printer graph form
  *
  *@param $p_target
  *@param $p_ID
  *@return nothing (print the form)
  **/
 function showFormPrinter_graph($p_target, $p_ID)
 {
     global $FUSIONINVENTORY_MAPPING, $LANG;
     include_once GLPI_ROOT . "/plugins/fusioninventory/inc_constants/snmp.mapping.constant.php";
     $target = $p_target;
     $where = '';
     $begin = '';
     $end = '';
     $timeUnit = 'date';
     $graphField = 'pages_total';
     $printersComp = array();
     if (isset($_SESSION['glpi_plugin_fusioninventory_graph_begin'])) {
         $begin = $_SESSION['glpi_plugin_fusioninventory_graph_begin'];
     }
     if ($begin == 'NULL' or $begin == '') {
         $begin = date("Y-m-01");
     }
     // first day of current month
     if (isset($_SESSION['glpi_plugin_fusioninventory_graph_end'])) {
         $end = $_SESSION['glpi_plugin_fusioninventory_graph_end'];
     }
     if ($end == 'NULL' or $end == '') {
         $end = date("Y-m-d");
     }
     // today
     if (isset($_SESSION['glpi_plugin_fusioninventory_graph_timeUnit'])) {
         $timeUnit = $_SESSION['glpi_plugin_fusioninventory_graph_timeUnit'];
     }
     if (isset($_SESSION['glpi_plugin_fusioninventory_graph_graphField'])) {
         $graphField = $_SESSION['glpi_plugin_fusioninventory_graph_graphField'];
     }
     if (!isset($_SESSION['glpi_plugin_fusioninventory_graph_printersComp'])) {
         $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'] = array();
     }
     if (isset($_SESSION['glpi_plugin_fusioninventory_graph_printerCompAdd'])) {
         $printerCompAdd = $_SESSION['glpi_plugin_fusioninventory_graph_printerCompAdd'];
         if (!key_exists($printerCompAdd, $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'])) {
             $ci = new CommonItem();
             if ($ci->getFromDB(PRINTER_TYPE, $printerCompAdd)) {
                 $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'][$printerCompAdd] = $ci->getField('name');
             }
         }
     } elseif (isset($_SESSION['glpi_plugin_fusioninventory_graph_printerCompRemove'])) {
         unset($_SESSION['glpi_plugin_fusioninventory_graph_printersComp'][$_SESSION['glpi_plugin_fusioninventory_graph_printerCompRemove']]);
     }
     $printers = $_SESSION['glpi_plugin_fusioninventory_graph_printersComp'];
     $printersView = $printers;
     // printers without the current printer
     if (isset($printersView[$p_ID])) {
         unset($printersView[$p_ID]);
     } else {
         $ci = new CommonItem();
         if ($ci->getFromDB(PRINTER_TYPE, $p_ID)) {
             $printers[$p_ID] = $ci->getField('name');
         }
     }
     $printersList = '';
     foreach ($printers as $printer) {
         if ($printersList != '') {
             $printersList .= '<BR>';
         }
         $printersList .= $printer;
     }
     $printersIds = "";
     foreach (array_keys($printers) as $printerId) {
         if ($printersIds != '') {
             $printersIds .= ', ';
         }
         $printersIds .= $printerId;
     }
     $where = " WHERE `FK_printers` IN(" . $printersIds . ")";
     if ($begin != '' || $end != '') {
         $where .= " AND " . $this->getDateRequest("`date`", $begin, $end);
     }
     switch ($timeUnit) {
         case 'date':
             $group = "GROUP BY `FK_printers`, `year`, `month`, `date`";
             break;
         case 'week':
             $group = "GROUP BY `FK_printers`, `year`, `month`, `week`";
             break;
         case 'month':
             $group = "GROUP BY `FK_printers`, `year`, `month`";
             break;
         case 'year':
             $group = "GROUP BY `FK_printers`, `year`";
             break;
     }
     $query = "SELECT `FK_printers`, `date`, WEEK(`date`) AS `week`,\n                       MONTH(`date`) AS `month`, YEAR(`date`) AS `year`,\n                       SUM(`{$graphField}`) AS `{$graphField}`\n                FROM `glpi_plugin_fusioninventory_printers_history`" . $where . $group . "\n                ORDER BY `date`, `FK_printers`";
     echo "<form method='post' name='printerGraph_form' id='printerGraph_form'\n                  action='" . $p_target . "'>";
     echo "<table class='tab_cadre_fixe' cellpadding='2'>";
     echo "<tr>";
     echo "<th colspan='4'>" . $LANG['plugin_fusioninventory']["prt_history"][20] . "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td class='left'>" . $LANG['plugin_fusioninventory']["prt_history"][30] . "&nbsp;:</td><td class='left' colspan='2'>";
     $elementsField = array('pages_total' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecountertotalpages']['shortname'], 'pages_n_b' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecounterblackpages']['shortname'], 'pages_color' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecountercolorpages']['shortname'], 'pages_recto_verso' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecounterrectoversopages']['shortname'], 'scanned' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecounterscannedpages']['shortname'], 'pages_total_print' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecountertotalpages_print']['shortname'], 'pages_n_b_print' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecounterblackpages_print']['shortname'], 'pages_color_print' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecountercolorpages_print']['shortname'], 'pages_total_copy' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecountertotalpages_copy']['shortname'], 'pages_n_b_copy' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecounterblackpages_copy']['shortname'], 'pages_color_copy' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecountercolorpages_copy']['shortname'], 'pages_total_fax' => $FUSIONINVENTORY_MAPPING[PRINTER_TYPE]['pagecountertotalpages_fax']['shortname']);
     Dropdown::showFromArray('graph_graphField', $elementsField, array('value' => $graphField));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td class='left'>" . $LANG['search'][8] . "&nbsp;:</td>\n                                 <td class='left' colspan='2'>";
     showDateFormItem("graph_begin", $begin);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td class='left'>" . $LANG['search'][9] . "&nbsp;:</td>\n                                 <td class='left' colspan='2'>";
     showDateFormItem("graph_end", $end);
     echo "<tr class='tab_bg_1'><td class='left'>" . $LANG['plugin_fusioninventory']["prt_history"][31] . "&nbsp;:</td>\n                                 <td class='left' colspan='2'>";
     $elementsTime = array('date' => $LANG['plugin_fusioninventory']["prt_history"][34], 'week' => $LANG['plugin_fusioninventory']["prt_history"][35], 'month' => $LANG['plugin_fusioninventory']["prt_history"][36], 'year' => $LANG['plugin_fusioninventory']["prt_history"][37]);
     Dropdown::showFromArray('graph_timeUnit', $elementsTime, array('value' => $timeUnit));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td class='left'>" . $LANG['Menu'][2] . "&nbsp;:</td>\n                                 <td class='left' colspan='2'>";
     echo $printersList;
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td class='center' colspan='3'>\n               <input type='submit' class=\"submit\" name='graph_plugin_fusioninventory_printer_period'\n                      value='" . $LANG["buttons"][7] . "'>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td class='left'>" . $LANG['plugin_fusioninventory']["prt_history"][32] . "&nbsp;:</td><td class='left'>";
     Computer_Item::dropdownConnect(PRINTER_TYPE, PRINTER_TYPE, "graph_printerCompAdd", -1, 0, array_keys($printers));
     echo "</td><td class='left'>\n";
     echo "<input type='submit' value=\"" . $LANG['buttons'][8] . "\" class='submit' name='graph_plugin_fusioninventory_printer_add'>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'><td class='left'>" . $LANG['plugin_fusioninventory']["prt_history"][33] . "&nbsp;:</td>\n                                 <td class='left'>";
     $printersTmp = $printersView;
     $printersTmp[0] = "-----";
     asort($printersTmp);
     Dropdown::showFromArray('graph_printerCompRemove', $printersTmp);
     echo "</td><td class='left'>\n";
     echo "<input type='submit' value=\"" . $LANG['buttons'][6] . "\" class='submit' name='graph_plugin_fusioninventory_printer_remove'>";
     echo "</td></tr>\n";
     echo "</table>";
     echo "</form>";
     echo "<div class=center>";
     $title = $elementsField[$graphField];
     if (count($printers)) {
         $ptg = new PluginFusioninventoryGraph($query, $graphField, $timeUnit, $printers, $title);
     }
     echo '</div>';
 }
 static function printer_calendar($getvalue, $field, $target)
 {
     global $DB, $LANG;
     echo "<div align='center'><form method='post' action='" . $target . "'>";
     echo "<table class='tab_cadre'><tr class='tab_bg_2'><td align='right'>";
     echo $LANG["search"][9] . " :</td><td>";
     showDateFormItem($field, $getvalue, false);
     echo "</td><td rowspan='2' align='center'><input type=\"submit\" class='button' name=\"submit\" Value=\"" . $LANG["buttons"][7] . "\" /></td></tr>";
     echo "</table></form></div>";
 }
             include "dropdownInstallVersion.php";
             break;
     }
     break;
 default:
     // dropdown case
     $plugdisplay = false;
     // Specific plugin Type case
     if (($plug = isPluginItemType($_POST["itemtype"])) || ($plug = isPluginItemType(getItemTypeForTable($search['table'])))) {
         $plugdisplay = doOneHook($plug['plugin'], 'MassiveActionsFieldsDisplay', array('itemtype' => $_POST["itemtype"], 'options' => $search));
     }
     $already_display = false;
     if (isset($search['datatype'])) {
         switch ($search['datatype']) {
             case "date":
                 showDateFormItem($search["field"]);
                 $already_display = true;
                 break;
             case "datetime":
                 showDateTimeFormItem($search["field"]);
                 $already_display = true;
                 break;
             case "bool":
                 Dropdown::showYesNo($search["linkfield"]);
                 $already_display = true;
                 break;
         }
     }
     if (!$plugdisplay && !$already_display) {
         Dropdown::show(getItemTypeForTable($search["table"]), array('name' => $search["linkfield"], 'entity' => $_SESSION['glpiactiveentities']));
     }
 /**
  * Print the contract form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  *@return boolean item found
  *
  **/
 function showForm($ID, $options = array())
 {
     global $LANG;
     // Show Contract or blank form
     if (!haveRight("contract", "r")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $can_edit = $this->can($ID, 'w');
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td><td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . $LANG['financial'][6] . "&nbsp;:</td><td >";
     Dropdown::show('ContractType', array('value' => $this->fields["contracttypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][4] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "num");
     echo "</td>";
     echo "<td colspan='2'></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][5] . "&nbsp;:</td><td>";
     echo "<input type='text' name='cost' value='" . formatNumber($this->fields["cost"], true) . "' size='14'></td>";
     echo "<td>" . $LANG['search'][8] . "&nbsp;:</td>";
     echo "<td>";
     showDateFormItem("begin_date", $this->fields["begin_date"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][8] . "&nbsp;:</td><td>";
     Dropdown::showInteger("duration", $this->fields["duration"], 0, 120);
     echo " " . $LANG['financial'][57];
     if (!empty($this->fields["begin_date"])) {
         echo " -> " . getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"]);
     }
     echo "</td>";
     echo "<td>" . $LANG['financial'][13] . "&nbsp;:</td><td>";
     autocompletionTextField($this, "accounting_number");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][69] . "&nbsp;:</td><td>";
     Dropdown::showInteger("periodicity", $this->fields["periodicity"], 12, 60, 12, array(0 => DROPDOWN_EMPTY_VALUE, 1 => "1", 2 => "2", 3 => "3", 6 => "6"));
     echo " " . $LANG['financial'][57];
     echo "</td>";
     echo "<td>" . $LANG['financial'][10] . "&nbsp;:</td><td>";
     Dropdown::showInteger("notice", $this->fields["notice"], 0, 120);
     echo " " . $LANG['financial'][57];
     if (!empty($this->fields["begin_date"]) && $this->fields["notice"] > 0) {
         echo " -> " . getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], $this->fields["notice"]);
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['financial'][107] . "&nbsp;:</td><td>";
     self::dropdownContractRenewal("renewal", $this->fields["renewal"]);
     echo "</td>";
     echo "<td>" . $LANG['financial'][11] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showInteger("billing", $this->fields["billing"], 12, 60, 12, array(0 => DROPDOWN_EMPTY_VALUE, 1 => "1", 2 => "2", 3 => "3", 6 => "6"));
     echo " " . $LANG['financial'][57];
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['financial'][83] . "&nbsp;:</td><td>";
     Dropdown::showInteger("max_links_allowed", $this->fields["max_links_allowed"], 1, 200, 1, array(0 => $LANG['software'][4]));
     echo "</td>";
     echo "<td>" . $LANG['common'][41] . "</td>";
     echo "<td>";
     self::dropdownAlert("alert", $this->fields["alert"]);
     Alert::displayLastAlert('Contract', $ID);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td class='top'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td class='center' colspan='3'>";
     echo "<textarea cols='50' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td>" . $LANG['financial'][59] . "&nbsp;:</td>";
     echo "<td colspan='3'>&nbsp;</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][60] . "&nbsp;:</td>";
     echo "<td colspan='3'>" . $LANG['buttons'][33] . "&nbsp;:&nbsp;";
     Dropdown::showHours("week_begin_hour", $this->fields["week_begin_hour"]);
     echo "<span class='small_space'>" . $LANG['buttons'][32] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("week_end_hour", $this->fields["week_end_hour"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][61] . "&nbsp;:</td>";
     echo "<td colspan='3'>";
     Dropdown::showYesNo("use_saturday", $this->fields["use_saturday"]);
     echo "<span class='small_space'>" . $LANG['buttons'][33] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("saturday_begin_hour", $this->fields["saturday_begin_hour"]);
     echo "<span class='small_space'>" . $LANG['buttons'][32] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("saturday_end_hour", $this->fields["saturday_end_hour"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][62] . "&nbsp;:</td>";
     echo "<td colspan='3'>";
     Dropdown::showYesNo("use_monday", $this->fields["use_monday"]);
     echo "<span class='small_space'>" . $LANG['buttons'][33] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("monday_begin_hour", $this->fields["monday_begin_hour"]);
     echo "<span class='small_space'>" . $LANG['buttons'][32] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("monday_end_hour", $this->fields["monday_end_hour"]);
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }