function showNetworkEquipmentInformation(CommonDBTM $item, $options)
{
global $DB;
$id = $item->getID();
if (!($data = $this->find("`networkequipments_id`='" . $id . "'", '', 1))) {
// Add in database if not exist
$input = array();
$input['networkequipments_id'] = $id;
$_SESSION['glpi_plugins_fusinvsnmp_table'] = 'glpi_networkequipments';
$ID_tn = $this->add($input);
$this->getFromDB($ID_tn);
} else {
foreach ($data as $datas) {
$this->fields = $datas;
}
}
// Form networking informations
echo "<form name='form' method='post' action='" . $options['target'] . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'>";
echo "<th colspan='4'>";
echo __('SNMP information', 'fusioninventory');
echo "</th>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td align='center' rowspan='4'>";
echo __('Sysdescr', 'fusioninventory') . " :";
echo "</td>";
echo "<td rowspan='4'>";
echo "<textarea name='sysdescr' cols='45' rows='5'>";
echo $this->fields['sysdescr'];
echo "</textarea>";
echo "<td align='center'></td>";
echo "<td align='center'>";
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>" . __('SNMP authentication', 'fusioninventory') . " :</td>";
echo "<td align='center'>";
PluginFusioninventoryConfigSecurity::auth_dropdown($this->fields['plugin_fusioninventory_configsecurities_id']);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>";
echo __('CPU usage (in %)', 'fusioninventory') . " :";
echo "</td>";
echo "<td>";
Html::displayProgressBar(250, $this->fields['cpu'], array('simple' => TRUE));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td align='center'>";
echo __('Memory usage (in %)', 'fusioninventory') . " :";
echo "</td>";
echo "<td>";
$query2 = "SELECT *\n FROM `glpi_networkequipments`\n WHERE `id`='" . $id . "';";
$result2 = $DB->query($query2);
$data2 = $DB->fetch_assoc($result2);
$ram_pourcentage = 0;
if (!empty($data2["ram"]) and !empty($this->fields['memory'])) {
$ram_pourcentage = ceil(100 * ($data2["ram"] - $this->fields['memory']) / $data2["ram"]);
}
if ($data2["ram"] - $this->fields['memory'] < 0 or empty($this->fields['memory'])) {
echo "<center><strong>" . __('Datas not available', 'fusioninventory') . "</strong></center>";
} else {
Html::displayProgressBar(250, $ram_pourcentage, array('title' => " (" . ($data2["ram"] - $this->fields['memory']) . " Mo / " . $data2["ram"] . " Mo)"));
}
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_2 center'>";
echo "<td colspan='4'>";
echo "<input type='hidden' name='id' value='" . $id . "'>";
echo "<input type='submit' name='update' value=\"" . __('Update') . "\" class='submit' >";
echo "</td>";
echo "</tr>";
echo "</table>";
Html::closeForm();
}