function showForm($target, $ID = '')
 {
     global $DB, $CFG_GLPI, $LANG;
     if ($ID != '') {
         $this->getFromDB($ID);
     } else {
         $this->getEmpty();
     }
     $this->showTabs($ID, "", $_SESSION['glpi_tab']);
     echo "<div align='center'><form method='post' name='' id=''  action=\"" . $target . "\">";
     echo "<table class='tab_cadre' cellpadding='5' width='950'>";
     echo "<tr>";
     echo "<th colspan='2'>";
     echo $LANG['plugin_fusioninventory']["constructdevice"][0];
     echo " :</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][5] . ": \t</td><td>";
     Dropdown::show("Manufacturer", array('name' => "FK_glpi_enterprise", 'value' => $this->fields["FK_glpi_enterprise"]));
     echo "</td>";
     echo "<tr>";
     echo "<td>" . $LANG['setup'][71] . ": \t</td><td>\n";
     Dropdown::show("NetworkEquipmentFirmware", array('name' => "firmware", 'value' => $this->fields["firmware"]));
     echo "</td>";
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][25] . "</td>";
     echo "<td>";
     echo "<textarea name='sysdescr'  cols='110' rows='4' />" . $this->fields["sysdescr"] . "</textarea>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][17] . " :</td>";
     echo "<td>";
     $type_list = array();
     $type_list[] = COMPUTER_TYPE;
     $type_list[] = NETWORKING_TYPE;
     $type_list[] = PRINTER_TYPE;
     $type_list[] = PERIPHERAL_TYPE;
     $type_list[] = PHONE_TYPE;
     // GENERIC OBJECT : Search types in generic object
     $plugin = new Plugin();
     if ($plugin->isActivated('genericobject')) {
         if (TableExists("glpi_plugin_genericobject_types")) {
             $query = "SELECT * FROM `glpi_plugin_genericobject_types`\n                  WHERE `status`='1' ";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_array($result)) {
                     $type_list[] = $data['device_type'];
                 }
             }
         }
     }
     // END GENERIC OBJECT
     Device::dropdownTypes('type', $this->fields["type"], $type_list);
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td align='center' colspan='3'>";
     if ($ID == '') {
         echo "<div align='center'><input type='submit' name='add' value=\"" . $LANG["buttons"][8] . "\" class='submit' >";
     } else {
         echo "<input type='hidden' name='ID' value='" . $ID . "'/>";
         echo "<div align='center'><input type='submit' name='update' value=\"" . $LANG["buttons"][7] . "\" class='submit' >";
         echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='delete' value=\"" . $LANG["buttons"][6] . "\" class='submit'>";
     }
     echo "</td></tr>";
     echo "</table></form></div>";
 }
 function showForm($target, $ID = '')
 {
     global $DB, $CFG_GLPI, $LANG;
     PluginFusioninventoryAuth::checkRight("snmp_networking", "r");
     $CommonItem = new CommonItem();
     if ($ID != '') {
         $this->getFromDB($ID);
     } else {
         $this->getEmpty();
     }
     echo "<div align='center'><form method='post' name='' id=''  action=\"" . $target . "\">";
     echo "<table  class='tab_cadre_fixe'>";
     echo "<tr><th colspan='4'>";
     echo $LANG['plugin_fusioninventory']["menu"][4] . " ( " . $LANG['plugin_fusioninventory']["unknown"][3] . " ";
     $CommonItem->getFromDB(PLUGIN_FUSIONINVENTORY_SNMP_AGENTS, $this->fields["FK_agent"]);
     echo $CommonItem->getLink(1);
     echo ") :</th></tr>";
     $datestring = $LANG["common"][26] . ": ";
     $date = convDateTime($this->fields["date_mod"]);
     echo "<tr>";
     echo "<th align='center' width='450' colspan='2'>";
     echo $LANG["common"][2] . " " . $this->fields["ID"];
     echo "</th>";
     echo "<th align='center' colspan='2' width='50'>";
     echo $datestring . $date;
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'>" . $LANG["common"][16] . " :</td>";
     echo "<td align='center'>";
     echo "<input type='text' name='name' value='" . $this->fields["name"] . "' size='35'/>";
     echo "</td>";
     if (isMultiEntitiesMode()) {
         echo "<td align='center'>" . $LANG['entity'][0] . " : </td>";
         echo "</td>";
         echo "<td align='center'>";
         Dropdown::show("Entity", array('name' => 'FK_entities', 'value' => $this->fields["FK_entities"]));
         echo "</td>";
         echo "</tr>";
         echo "</tr>";
     } else {
         echo "<td align='center'></td>";
         echo "</td>";
         echo "<td align='center'></td>";
         echo "</tr>";
         echo "</tr>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'>" . $LANG['plugin_fusioninventory']["unknown"][0] . " :</td>";
     echo "<td align='center'>";
     echo "<input type='text' name='dnsname' value='" . $this->fields["dnsname"] . "' size='35'/>";
     echo "</td>";
     echo "<td align='center'>" . $LANG['common'][18] . " : </td>";
     echo "</td>";
     echo "<td align='center'>";
     echo "<input type='text' name='contact' value='" . $this->fields["contact"] . "' size='35'/>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'>" . $LANG['common'][17] . " :</td>";
     echo "<td align='center'>";
     $type_list[] = COMPUTER_TYPE;
     $type_list[] = NETWORKING_TYPE;
     $type_list[] = PRINTER_TYPE;
     $type_list[] = PERIPHERAL_TYPE;
     $type_list[] = PHONE_TYPE;
     // GENERIC OBJECT : Search types in generic object
     $plugin = new Plugin();
     if ($plugin->isActivated('genericobject')) {
         if (TableExists("glpi_plugin_genericobject_types")) {
             $query = "SELECT * FROM `glpi_plugin_genericobject_types`\n                  WHERE `status`='1' ";
             if ($result = $DB->query($query)) {
                 while ($data = $DB->fetch_array($result)) {
                     $type_list[] = $data['device_type'];
                 }
             }
         }
     }
     // END GENERIC OBJECT
     Device::dropdownTypes('type', $this->fields["type"], $type_list);
     echo "</td>";
     echo "<td align='center'>" . $LANG['setup'][89] . " : </td>";
     echo "</td>";
     echo "<td align='center'>";
     Dropdown::show("Domain", array('name' => "domain", 'value' => $this->fields["domain"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'>" . $LANG['common'][15] . " :</td>";
     echo "<td align='center'>";
     Dropdown::show("Location", array('name' => "location", 'value' => $this->fields["location"]));
     echo "</td>";
     echo "<td align='center'>" . $LANG['common'][19] . " : </td>";
     echo "</td>";
     echo "<td align='center'>";
     echo "<input type='text' name='serial' value='" . $this->fields["serial"] . "' size='35'/>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'>" . $LANG['plugin_fusioninventory']["unknown"][2] . " :</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo("accepted", $this->fields["accepted"]);
     echo "</td>";
     echo "<td align='center'>" . $LANG['common'][20] . " : </td>";
     echo "</td>";
     echo "<td align='center'>";
     echo "<input type='text' name='otherserial' value='" . $this->fields["otherserial"] . "' size='35'/>";
     echo "</td>";
     echo "</tr>";
     if (!empty($this->fields["ifaddr"]) or !empty($this->fields["ifmac"])) {
         echo "<tr class='tab_bg_1'>";
         echo "<td align='center'>" . $LANG['networking'][14] . " :</td>";
         echo "<td align='center'>";
         echo "<input type='text' name='otherserial' value='" . $this->fields["ifaddr"] . "' size='35'/>";
         echo "</td>";
         echo "<td align='center'>" . $LANG['networking'][15] . " : </td>";
         echo "</td>";
         echo "<td align='center'>";
         echo "<input type='text' name='otherserial' value='" . $this->fields["ifmac"] . "' size='35'/>";
         echo "</td>";
         echo "</tr>";
     }
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'>" . $LANG['plugin_fusioninventory']["functionalities"][3] . " :</td>";
     echo "<td align='center'>";
     Dropdown::showYesNo("snmp", $this->fields["snmp"]);
     echo "</td>";
     if ($this->fields["snmp"] == "1") {
         echo "<td align='center'>" . $LANG['plugin_fusioninventory']["model_info"][4] . " : </td>";
         echo "</td>";
         echo "<td align='center'>";
         Dropdown::show("PluginFusioninventoryModelInfos", array('name' => "FK_model_infos", 'value' => $this->fields["FK_model_infos"]));
         echo "</td>";
         echo "</tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td align='center'>" . $LANG['plugin_fusioninventory']["model_info"][3] . " :</td>";
         echo "<td align='center'>";
         Dropdown::show("PluginFusioninventorySnmpauth", array('name' => "FK_snmp_connection", 'value' => $this->fields["FK_snmp_connection"]));
         echo "</td>";
     }
     echo "<td align='center'>" . $LANG['common'][25] . " : </td>";
     echo "</td>";
     echo "<td align='middle'>";
     echo "<textarea  cols='50' rows='5' name='comments' >" . $this->fields["comments"] . "</textarea>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'>" . $LANG['plugin_fusioninventory']["unknown"][4] . " :</td>";
     echo "<td align='center'>";
     echo Dropdown::getYesNo($this->fields["hub"]);
     echo "</td>";
     echo "<td align='center' colspan='2'></td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td class='tab_bg_2' align='center' colspan='4'>\n";
     echo "<table width='100%'>";
     echo "<tr>";
     echo "<td width='33%' align='center'>";
     echo "<input type='hidden' name='ID' value={$ID}>";
     echo "<input type='submit' name='import' value=\"" . $LANG['buttons'][37] . "\" class='submit'>";
     echo "</td>";
     echo "<td width='33%' align='center'>";
     echo "<input type='hidden' name='ID' value={$ID}>";
     echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\" class='submit'>";
     echo "</td>";
     echo "<td width='33%' align='center'>";
     echo "<input type='hidden' name='ID' value={$ID}>";
     echo "<div class='center'>";
     if (PluginFusioninventory::haveRight("unknowndevices", "w")) {
         if (!$this->fields["deleted"]) {
             echo "<input type='submit' name='delete' value=\"" . $LANG['buttons'][6] . "\" class='submit'>";
         } else {
             echo "<input type='submit' name='restore' value=\"" . $LANG['buttons'][21] . "\" class='submit'>";
             echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' name='purge' value=\"" . $LANG['buttons'][22] . "\" class='submit'>";
         }
     }
     echo "</div>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "</td>";
     echo "</tr>";
     echo "</table></form></div>";
 }
function plugin_fusioninventory_MassiveActionsFieldsDisplay($type, $table, $field, $linkfield)
{
    global $LINK_ID_TABLE, $LANG;
    // Table fields
    //echo $table.".".$field."<br/>";
    switch ($table . "." . $field) {
        case 'glpi_plugin_fusioninventory_snmpauths.name':
            Dropdown::show("PluginFusioninventorySnmpauth", array('name' => $linkfield));
            return true;
            break;
        case 'glpi_plugin_fusioninventory_model_infos.name':
            Dropdown::show("PluginFusioninventoryModelInfos", array('name' => $linkfield, 'comments' => false));
            return true;
            break;
        case 'glpi_plugin_fusioninventory_unknown_device.type':
            $type_list = array();
            $type_list[] = COMPUTER_TYPE;
            $type_list[] = NETWORKING_TYPE;
            $type_list[] = PRINTER_TYPE;
            $type_list[] = PERIPHERAL_TYPE;
            $type_list[] = PHONE_TYPE;
            Device::dropdownTypes('type', $linkfield, $type_list);
            return true;
            break;
        case 'glpi_plugin_fusioninventory_agents.ID':
            Dropdown::show("PluginFusioninventoryAgents", array('name' => $linkfield, 'comments' => false));
            return true;
            break;
        case 'glpi_plugin_fusioninventory_agents.nb_process_query':
            Dropdown::showInteger("nb_process_query", $linkfield, 1, 200);
            return true;
            break;
        case 'glpi_plugin_fusioninventory_agents.nb_process_discovery':
            Dropdown::showInteger("nb_process_discovery", $linkfield, 1, 400);
            return true;
            break;
        case 'glpi_plugin_fusioninventory_agents.logs':
            $ArrayValues[] = $LANG["choice"][0];
            $ArrayValues[] = $LANG["choice"][1];
            $ArrayValues[] = $LANG["setup"][137];
            Dropdown::showFromArray('logs', $ArrayValues, array('value' => $linkfield));
            return true;
            break;
        case 'glpi_plugin_fusioninventory_agents.core_discovery':
            Dropdown::showInteger("core_discovery", $linkfield, 1, 32);
            return true;
            break;
        case 'glpi_plugin_fusioninventory_agents.core_query':
            Dropdown::showInteger("core_query", $linkfield, 1, 32);
            return true;
            break;
        case 'glpi_plugin_fusioninventory_agents.threads_discovery':
            Dropdown::showInteger("threads_discovery", $linkfield, 1, 400);
            return true;
            break;
        case 'glpi_plugin_fusioninventory_agents.threads_query':
            Dropdown::showInteger("threads_query", $linkfield, 1, 400);
            return true;
            break;
        case 'glpi_plugin_fusioninventory_discovery.FK_snmp_connection':
            $plugin_fusioninventory_snmp = new PluginFusioninventorySnmpauth();
            echo $plugin_fusioninventory_snmp->selectbox();
            return true;
            break;
        case 'glpi_plugin_fusioninventory_model_infos.device_type':
            $type_list = array();
            $type_list[] = COMPUTER_TYPE;
            $type_list[] = NETWORKING_TYPE;
            $type_list[] = PRINTER_TYPE;
            $type_list[] = PERIPHERAL_TYPE;
            $type_list[] = PHONE_TYPE;
            Device::dropdownTypes('type', $linkfield, $type_list);
            return true;
            break;
    }
    return false;
}