function showForm($target, $ID = '') { global $DB, $CFG_GLPI, $LANG; if ($ID != '') { $this->getFromDB($ID); } else { $this->getEmpty(); } $CommonItem = new CommonItem(); $ptcm = new PluginFusioninventoryConfigModules(); 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='4'>"; echo $LANG['plugin_fusioninventory']["agents"][0]; echo " :</th>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG["common"][16] . " :</td>"; echo "<td align='center'>"; echo "<input type='text' name='name' size='40' value='" . $this->fields["name"] . "'/>"; echo "</td>"; if ($ptcm->getValue('inventoryocs') == "1") { echo "<td>" . $LANG['plugin_fusioninventory']['config'][3] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo("module_inventory", $this->fields["module_inventory"]); echo "</td>"; } else { echo "<td colspan='2'></td>"; } echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_fusioninventory']["agents"][5] . " :</td>"; echo "<td align='center'>"; echo $this->fields["fusioninventory_agent_version"]; echo "</td>"; if ($ptcm->getValue('netdiscovery') == "1") { echo "<td>" . $LANG['plugin_fusioninventory']['config'][4] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo("module_netdiscovery", $this->fields["module_netdiscovery"]); echo "</td>"; } else { echo "<td colspan='2'></td>"; } echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_fusioninventory']["agents"][6] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo("lock", $this->fields["lock"]); echo "</td>"; if ($ptcm->getValue('snmp') == "1") { echo "<td>" . $LANG['plugin_fusioninventory']['config'][7] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo("module_snmpquery", $this->fields["module_snmpquery"]); echo "</td>"; } else { echo "<td colspan='2'></td>"; } echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . $LANG['plugin_fusioninventory']["agents"][23] . " :</td>"; echo "<td align='center'>"; if ($this->fields["on_device"] != "0" and $this->fields["on_device"] != "") { $CommonItem->getFromDB(COMPUTER_TYPE, $this->fields["on_device"]); echo $CommonItem->getLink(1); echo "<input type='hidden' name='on_device' value='" . $this->fields["on_device"] . "'/>"; } else { Computer_Item::dropdownConnect(COMPUTER_TYPE, COMPUTER_TYPE, 'on_device', $_SESSION['glpiactive_entity']); } echo "</td>"; if ($ptcm->getValue('wol') == "1") { echo "<td>" . $LANG['plugin_fusioninventory']['config'][6] . " :</td>"; echo "<td align='center'>"; Dropdown::showYesNo("module_wakeonlan", $this->fields["module_wakeonlan"]); echo "</td>"; } else { echo "<td colspan='2'></td>"; } echo "<tr class='tab_bg_1'>"; echo "<td>Token :</td>"; echo "<td align='center' colspan='3'>"; echo $this->fields["token"]; echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_2'>"; if (PluginFusioninventory::haveRight("agents", "w")) { if ($ID == '') { echo "<td align='center' colspan='4'>"; echo "<div align='center'><input type='submit' name='add' value=\"" . $LANG["buttons"][8] . "\" class='submit' >"; echo "</td>"; } else { echo "<td align='center' colspan='2'>"; echo "<input type='hidden' name='ID' value='" . $ID . "'/>"; echo "<div align='center'><input type='submit' name='update' value=\"" . $LANG["buttons"][7] . "\" class='submit' >"; echo "</td>"; echo "<td align='center' colspan='2'>"; echo "<input type='submit' name='delete' value=\"" . $LANG["buttons"][6] . "\" class='submit'>"; echo "</td>"; } } echo "</tr>"; echo "</table></form></div>"; }
function dropdownNetworkPrinterSNMP($agent_id) { // Dropdown with printer and network devices who have model and auth global $DB, $LANG; $ptcm = new PluginFusioninventoryConfigModules(); $pfia = new PluginFusioninventoryAgents(); $dropdownOptions = ""; $pfia->getFromDB($agent_id); if ($ptcm->getValue("snmp") == '1' and $pfia->fields['module_snmpquery'] == '1') { // Networking $dropdownOptions = "<optgroup label=\"" . $LANG['help'][26] . "\">"; $query = "SELECT `glpi_networking`.`ID` AS `gID`,\n `glpi_networking`.`name` AS `name`, `serial`, `otherserial`,\n `FK_snmp_connection`, `FK_model_infos`\n FROM `glpi_networking`\n LEFT JOIN `glpi_plugin_fusioninventory_networking`\n ON `FK_networking`=`glpi_networking`.`ID`\n INNER join `glpi_plugin_fusioninventory_model_infos`\n ON `FK_model_infos`=`glpi_plugin_fusioninventory_model_infos`.`ID`\n WHERE `glpi_networking`.`deleted`='0'\n AND `FK_model_infos`!='0'\n AND `FK_snmp_connection`!='0'\n GROUP BY FK_networking"; $result = $DB->query($query); while ($data = $DB->fetch_array($result)) { $dropdownOptions .= "<option value='" . NETWORKING_TYPE . "-" . $data['gID'] . "'>" . $data['name'] . " - " . $data['serial'] . " - " . $data['otherserial'] . "</option>"; } $dropdownOptions .= "</optgroup>"; // Printers $dropdownOptions .= "<optgroup label=\"" . $LANG['help'][27] . "\">"; $query = "SELECT `glpi_printers`.`ID` AS `gID`,\n `glpi_printers`.`name` AS `name`, `serial`, `otherserial`,\n `FK_snmp_connection`, `FK_model_infos`\n FROM `glpi_printers`\n LEFT JOIN `glpi_plugin_fusioninventory_printers`\n ON `FK_printers`=`glpi_printers`.`ID`\n LEFT JOIN `glpi_networking_ports`\n ON `on_device`=`glpi_printers`.`ID`\n AND `device_type`='" . PRINTER_TYPE . "'\n INNER join `glpi_plugin_fusioninventory_model_infos`\n ON `FK_model_infos`=`glpi_plugin_fusioninventory_model_infos`.`ID`\n WHERE `glpi_printers`.`deleted`='0'\n AND `FK_model_infos`!='0'\n AND `FK_snmp_connection`!='0'\n GROUP BY FK_printers"; $result = $DB->query($query); while ($data = $DB->fetch_array($result)) { $dropdownOptions .= "<option value='" . NETWORKING_TYPE . "-" . $data['gID'] . "'>" . $data['name'] . " - " . $data['serial'] . " - " . $data['otherserial'] . "</option>"; } $dropdownOptions .= "</optgroup>"; } return $dropdownOptions; }
function plugin_get_headings_fusioninventory($type, $ID, $withtemplate) { global $LANG; $configModules = new PluginFusioninventoryConfigModules(); switch ($type) { case COMPUTER_TYPE: if ($withtemplate) { //? return array(); // Non template case } else { // if ((PluginFusioninventory::haveRight("snmp_networking", "r")) AND ($configModules->getValue("snmp") == "1")) { $array = array(); //return array( if ($configModules->isActivated('remotehttpagent') and PluginFusioninventory::haveRight("remotecontrol", "w")) { $array[1] = $LANG['plugin_fusioninventory']["title"][0]; } //} $array[2] = $LANG['plugin_fusioninventory']["title"][5]; return $array; // } } break; case MONITOR_TYPE: if ($withtemplate) { //? return array(); // Non template case } else { // if ((PluginFusioninventory::haveRight("snmp_networking", "r")) AND ($configModules->getValue("snmp") == "1")) { return array(1 => $LANG['plugin_fusioninventory']["title"][5]); // } } break; case NETWORKING_TYPE: if ($withtemplate) { return array(); // Non template case } else { $array = array(); if (PluginFusioninventory::haveRight("snmp_networking", "r") and $configModules->getValue("snmp") == "1") { $array[1] = $LANG['plugin_fusioninventory']["title"][0]; } $array[2] = $LANG['plugin_fusioninventory']["title"][5]; return $array; } break; case PRINTER_TYPE: // template case if ($withtemplate) { return array(); // Non template case } else { $array = array(); if (PluginFusioninventory::haveRight("snmp_printers", "r") and $configModules->getValue("snmp") == "1") { $array[1] = $LANG['plugin_fusioninventory']["title"][0]; } $array[2] = $LANG['plugin_fusioninventory']["title"][5]; return $array; } break; case PROFILE_TYPE: // template case if ($withtemplate) { return array(); // Non template case } else { return array(1 => $LANG['plugin_fusioninventory']["title"][0]); } break; } return false; }