/** * @see CommonGLPI::getAdditionalMenuOptions() * * @since version 0.85 **/ static function getAdditionalMenuOptions() { if (static::canView()) { $options['networkport']['title'] = NetworkPort::getTypeName(Session::getPluralNumber()); $options['networkport']['page'] = NetworkPort::getFormURL(false); return $options; } return false; }
/** * @since version 0.84 * * @param $networkport_prefix * @param $networkport_crit * @param $where_crit * @param $order (default '') * @param $field (default '') * @param $extra (default '') **/ static function reportForNetworkInformations($networkport_prefix, $networkport_crit, $where_crit, $order = '', $field = '', $extra = '') { global $DB; // This SQL request matches the NetworkPort, then its NetworkName and IPAddreses. It also // match opposite NetworkPort, then its NetworkName and IPAddresses. // Results are groupes by NetworkPort. Then all IPs are concatenated by comma as separator. $query = "SELECT {$field}\n PORT_1.`itemtype` AS itemtype_1,\n PORT_1.`items_id` AS items_id_1,\n PORT_1.`id` AS id_1,\n PORT_1.`name` AS port_1,\n PORT_1.`mac` AS mac_1,\n GROUP_CONCAT(ADDR_1.`name` SEPARATOR ',') AS ip_1,\n PORT_2.`itemtype` AS itemtype_2,\n PORT_2.`items_id` AS items_id_2,\n PORT_2.`id` AS id_2,\n PORT_2.`name` AS port_2,\n PORT_2.`mac` AS mac_2,\n GROUP_CONCAT(ADDR_2.`name` SEPARATOR ',') AS ip_2\n FROM {$networkport_prefix}\n INNER JOIN `glpi_networkports` AS PORT_1\n ON ({$networkport_crit} AND PORT_1.`is_deleted` = 0)\n LEFT JOIN `glpi_networknames` AS NAME_1\n ON (NAME_1.`itemtype` = 'NetworkPort'\n AND PORT_1.`id` = NAME_1.`items_id`\n AND NAME_1.`is_deleted` = 0)\n LEFT JOIN `glpi_ipaddresses` AS ADDR_1\n ON (ADDR_1.`itemtype` = 'NetworkName'\n AND NAME_1.`id` = ADDR_1.`items_id`\n AND ADDR_1.`is_deleted` = 0)\n LEFT JOIN `glpi_networkports_networkports` AS LINK\n ON (LINK.`networkports_id_1` = PORT_1.`id`\n OR LINK.`networkports_id_2` = PORT_1.`id`)\n LEFT JOIN `glpi_networkports` AS PORT_2\n ON (PORT_2.`id`=IF(LINK.`networkports_id_1`=PORT_1.`id`,\n LINK.`networkports_id_2`,\n LINK.`networkports_id_1`))\n LEFT JOIN `glpi_networknames` AS NAME_2\n ON (NAME_2.`itemtype` = 'NetworkPort'\n AND PORT_2.`id` = NAME_2.`items_id`\n AND NAME_2.`is_deleted` = 0)\n LEFT JOIN `glpi_ipaddresses` AS ADDR_2\n ON (ADDR_2.`itemtype` = 'NetworkName'\n AND NAME_2.`id` = ADDR_2.`items_id`\n AND ADDR_2.`is_deleted` = 0)\n WHERE {$where_crit} GROUP BY PORT_1.`id`"; if (!empty($order)) { $query .= "ORDER BY {$order}"; } $result = $DB->request($query); if ($result->numrows() > 0) { echo "<table class='tab_cadre_fixehov'>"; echo "<tr>"; if (!empty($extra)) { echo "<td> </td>"; } echo "<th colspan='5'>" . __('Device 1') . "</th>"; echo "<th colspan='5'>" . __('Device 2') . "</th>"; echo "</tr>\n"; echo "<tr>"; if (!empty($extra)) { echo "<th>{$extra}</th>"; } echo "<th>" . __('Device type') . "</th>"; echo "<th>" . __('Device name') . "</th>"; echo "<th>" . NetworkPort::getTypeName(1) . "</th>"; echo "<th>" . __('MAC address') . "</th>"; echo "<th>" . IPAddress::getTypeName(0) . "</th>"; echo "<th>" . NetworkPort::getTypeName(1) . "</th>"; echo "<th>" . __('MAC address') . "</th>"; echo "<th>" . IPAddress::getTypeName(0) . "</th>"; echo "<th>" . __('Device type') . "</th>"; echo "<th>" . __('Device name') . "</th>"; echo "</tr>\n"; foreach ($result as $line) { echo "<tr class='tab_bg_1'>"; // To ensure that the NetworkEquipment remain the first item, we test its type if ($line['itemtype_2'] == 'NetworkEquipment') { $idx = 2; } else { $idx = 1; } if (!empty($extra)) { echo "<td>" . (empty($line['extra']) ? NOT_AVAILABLE : $line['extra']) . "</td>"; } $itemtype = $line["itemtype_{$idx}"]; if (!empty($itemtype)) { echo "<td>" . $itemtype::getTypeName(1) . "</td>"; $item_name = ''; if ($item = getItemForItemtype($itemtype)) { if ($item->getFromDB($line["items_id_{$idx}"])) { $item_name = $item->getName(); } } echo "<td>" . (empty($item_name) ? NOT_AVAILABLE : $item_name) . "</td>"; } else { echo "<td> " . NOT_AVAILABLE . " </td>"; echo "<td> " . NOT_AVAILABLE . " </td>"; } echo "<td>" . (empty($line["port_{$idx}"]) ? NOT_AVAILABLE : $line["port_{$idx}"]) . "</td>"; echo "<td>" . (empty($line["mac_{$idx}"]) ? NOT_AVAILABLE : $line["mac_{$idx}"]) . "</td>"; echo "<td>" . (empty($line["ip_{$idx}"]) ? NOT_AVAILABLE : $line["ip_{$idx}"]) . "</td>"; if ($idx == 1) { $idx = 2; } else { $idx = 1; } echo "<td>" . (empty($line["port_{$idx}"]) ? NOT_AVAILABLE : $line["port_{$idx}"]) . "</td>"; echo "<td>" . (empty($line["mac_{$idx}"]) ? NOT_AVAILABLE : $line["mac_{$idx}"]) . "</td>"; echo "<td>" . (empty($line["ip_{$idx}"]) ? NOT_AVAILABLE : $line["ip_{$idx}"]) . "</td>"; $itemtype = $line["itemtype_{$idx}"]; if (!empty($itemtype)) { echo "<td>" . $itemtype::getTypeName(1) . "</td>"; $item_name = ''; if ($item = getItemForItemtype($itemtype)) { if ($item->getFromDB($line["items_id_{$idx}"])) { $item_name = $item->getName(); } } echo "<td>" . (empty($item_name) ? NOT_AVAILABLE : $item_name) . "</td>"; } else { echo "<td> " . NOT_AVAILABLE . " </td>"; echo "<td> " . NOT_AVAILABLE . " </td>"; } echo "</tr>\n"; } echo "</table><br><hr><br>"; } }
/** * @param $itemtype * @param $base HTMLTableBase object * @param $super HTMLTableSuperHeader object (default NULL) * @param $father HTMLTableHeader object (default NULL) * @param $options array **/ static function getHTMLTableHeader($itemtype, HTMLTableBase $base, HTMLTableSuperHeader $super = NULL, HTMLTableHeader $father = NULL, array $options = array()) { $column_name = __CLASS__; $content = self::getTypeName(); if ($itemtype == 'IPNetwork') { $base->addHeader('Item', _n('Item', 'Items', 1), $super, $father); $base->addHeader('NetworkPort', NetworkPort::getTypeName(0), $super, $father); $base->addHeader('NetworkName', NetworkName::getTypeName(1), $super, $father); $base->addHeader('Entity', Entity::getTypeName(1), $super, $father); } else { if (isset($options['dont_display'][$column_name])) { return; } if (isset($options['column_links'][$column_name])) { $content = "<a href='" . $options['column_links'][$column_name] . "'>{$content}</a>"; } $father = $base->addHeader($column_name, $content, $super, $father); if (isset($options['display_isDynamic']) && $options['display_isDynamic']) { $father = $base->addHeader($column_name . '_dynamic', __('Automatic inventory'), $super, $father); } IPNetwork::getHTMLTableHeader(__CLASS__, $base, $super, $father, $options); } }
/** * Display form to unlock fields and links * * @param CommonDBTM $item the source item **/ static function showForItem(CommonDBTM $item) { global $DB; $ID = $item->getID(); $itemtype = $item->getType(); $header = false; //If user doesn't have write right on the item, lock form must not be displayed if (!$item->canCreate()) { return false; } echo "<div width='50%'>"; echo "<form method='post' id='lock_form'\n name='lock_form' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>"; echo "<input type='hidden' name='id' value='{$ID}'>\n"; echo "<input type='hidden' name='itemtype' value='{$itemtype}'>\n"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='2''>" . __('Locked items') . "</th></tr>"; //Use a hook to allow external inventory tools to manage per field lock $results = Plugin::doHookFunction('display_locked_fields', array('item' => $item, 'header' => $header)); $header |= $results['header']; //Special locks for computers only if ($itemtype == 'Computer') { //Locks for items recorded in glpi_computers_items table $types = array('Monitor', 'Peripheral', 'Printer'); foreach ($types as $type) { $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'computers_id' => $ID, 'itemtype' => $type); $params['FIELDS'] = array('id', 'items_id'); $first = true; foreach ($DB->request('glpi_computers_items', $params) as $line) { $tmp = new $type(); $tmp->getFromDB($line['items_id']); $header = true; if ($first) { echo "<tr><th colspan='2'>" . $type::getTypeName(2) . "</th></tr>\n"; $first = false; } echo "<tr class='tab_bg_1'><td class='center' width='10'>"; echo "<input type='checkbox' name='Computer_Item[" . $line['id'] . "]'></td>"; echo "<td class='left' width='95%'>" . $tmp->getName() . "</td>"; echo "</tr>\n"; } } $types = array('ComputerDisk', 'ComputerVirtualMachine'); foreach ($types as $type) { $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'computers_id' => $ID); $params['FIELDS'] = array('id', 'name'); $first = true; foreach ($DB->request(getTableForItemType($type), $params) as $line) { $header = true; if ($first) { echo "<tr><th colspan='2'>" . $type::getTypeName(2) . "</th></tr>\n"; $first = false; } echo "<tr class='tab_bg_1'><td class='center' width='10'>"; echo "<input type='checkbox' name='" . $type . "[" . $line['id'] . "]'></td>"; echo "<td class='left' width='95%'>" . $line['name'] . "</td>"; echo "</tr>\n"; } } //Software versions $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'computers_id' => $ID); $first = true; $query = "SELECT `csv`.`id` AS `id`,\n `sv`.`name` AS `version`,\n `s`.`name` AS `software`\n FROM `glpi_computers_softwareversions` AS csv\n LEFT JOIN `glpi_softwareversions` AS sv\n ON (`csv`.`softwareversions_id` = `sv`.`id`)\n LEFT JOIN `glpi_softwares` AS s\n ON (`sv`.`softwares_id` = `s`.`id`)\n WHERE `csv`.`is_deleted` = '1'\n AND `csv`.`is_dynamic` = '1'\n AND `csv`.`computers_id` = '{$ID}'"; foreach ($DB->request($query) as $line) { $header = true; if ($first) { echo "<tr><th colspan='2'>" . Software::getTypeName(2) . "</th></tr>\n"; $first = false; } echo "<tr class='tab_bg_1'><td class='center' width='10'>"; echo "<input type='checkbox' name='Computer_SoftwareVersion[" . $line['id'] . "]'></td>"; echo "<td class='left' width='95%'>" . $line['software'] . " " . $line['version'] . "</td>"; echo "</tr>\n"; } //Software licenses $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'computers_id' => $ID); $first = true; $query = "SELECT `csv`.`id` AS `id`,\n `sv`.`name` AS `version`,\n `s`.`name` AS `software`\n FROM `glpi_computers_softwarelicenses` AS csv\n LEFT JOIN `glpi_softwarelicenses` AS sv\n ON (`csv`.`softwarelicenses_id` = `sv`.`id`)\n LEFT JOIN `glpi_softwares` AS s\n ON (`sv`.`softwares_id` = `s`.`id`)\n WHERE `csv`.`is_deleted` = '1'\n AND `csv`.`is_dynamic` = '1'\n AND `csv`.`computers_id` = '{$ID}'"; foreach ($DB->request($query) as $line) { $header = true; if ($first) { echo "<tr><th colspan='2'>" . SoftwareLicense::getTypeName(2) . "</th>" . "</tr>\n"; $first = false; } echo "<tr class='tab_bg_1'><td class='center' width='10'>"; echo "<input type='checkbox' name='Computer_SoftwareLicense[" . $line['id'] . "]'></td>"; echo "<td class='left' width='95%'>" . $line['software'] . " " . $line['version'] . "</td>"; echo "</tr>\n"; } } $first = true; $item = new NetworkPort(); $params = array('is_dynamic' => 1, 'is_deleted' => 1, 'items_id' => $ID, 'itemtype' => $itemtype); $params['FIELDS'] = array('id'); foreach ($DB->request('glpi_networkports', $params) as $line) { $item->getFromDB($line['id']); $header = true; if ($first) { echo "<tr><th colspan='2'>" . NetworkPort::getTypeName(2) . "</th></tr>\n"; $first = false; } echo "<tr class='tab_bg_1'><td class='center' width='10'>"; echo "<input type='checkbox' name='NetworkPort[" . $line['id'] . "]'></td>"; echo "<td class='left' width='95%'>" . $item->getName() . "</td>"; echo "</tr>\n"; } $first = true; $item = new NetworkName(); $params = array('`glpi_networknames`.`is_dynamic`' => 1, '`glpi_networknames`.`is_deleted`' => 1, '`glpi_networknames`.`itemtype`' => 'NetworkPort', '`glpi_networknames`.`items_id`' => '`glpi_networkports`.`id`', '`glpi_networkports`.`items_id`' => $ID, '`glpi_networkports`.`itemtype`' => $itemtype); $params['FIELDS'] = array('glpi_networknames' => 'id'); foreach ($DB->request(array('glpi_networknames', 'glpi_networkports'), $params) as $line) { $item->getFromDB($line['id']); $header = true; if ($first) { echo "<tr><th colspan='2'>" . NetworkName::getTypeName(2) . "</th></tr>\n"; $first = false; } echo "<tr class='tab_bg_1'><td class='center' width='10'>"; echo "<input type='checkbox' name='NetworkName[" . $line['id'] . "]'></td>"; echo "<td class='left' width='95%'>" . $item->getName() . "</td>"; echo "</tr>\n"; } $first = true; $item = new IPAddress(); $params = array('`glpi_ipaddresses`.`is_dynamic`' => 1, '`glpi_ipaddresses`.`is_deleted`' => 1, '`glpi_ipaddresses`.`itemtype`' => 'Networkname', '`glpi_ipaddresses`.`items_id`' => '`glpi_networknames`.`id`', '`glpi_networknames`.`itemtype`' => 'NetworkPort', '`glpi_networknames`.`items_id`' => '`glpi_networkports`.`id`', '`glpi_networkports`.`items_id`' => $ID, '`glpi_networkports`.`itemtype`' => $itemtype); $params['FIELDS'] = array('glpi_ipaddresses' => 'id'); foreach ($DB->request(array('glpi_ipaddresses', 'glpi_networknames', 'glpi_networkports'), $params) as $line) { $item->getFromDB($line['id']); $header = true; if ($first) { echo "<tr><th colspan='2'>" . IPAddress::getTypeName(2) . "</th></tr>\n"; $first = false; } echo "<tr class='tab_bg_1'><td class='center' width='10'>"; echo "<input type='checkbox' name='IPAddress[" . $line['id'] . "]'></td>"; echo "<td class='left' width='95%'>" . $item->getName() . "</td>"; echo "</tr>\n"; } $types = Item_Devices::getDeviceTypes(); $nb = 0; foreach ($types as $old => $type) { $nb += countElementsInTable(getTableForItemType($type), "`items_id`='{$ID}'\n AND `itemtype`='{$itemtype}'\n AND `is_dynamic`='1'\n AND `is_deleted`='1'"); } if ($nb) { $header = true; echo "<tr><th colspan='2'>" . _n('Component', 'Components', 2) . "</th></tr>\n"; foreach ($types as $old => $type) { $associated_type = str_replace('Item_', '', $type); $associated_table = getTableForItemType($associated_type); $fk = getForeignKeyFieldForTable($associated_table); $query = "SELECT `i`.`id`,\n `t`.`designation` AS `name`\n FROM `" . getTableForItemType($type) . "` AS i\n LEFT JOIN `{$associated_table}` AS t\n ON (`t`.`id` = `i`.`{$fk}`)\n WHERE `itemtype` = '{$itemtype}'\n AND `items_id` = '{$ID}'\n AND `is_dynamic` = '1'\n AND `is_deleted` = '1'"; foreach ($DB->request($query) as $data) { echo "<tr class='tab_bg_1'><td class='center' width='10'>"; echo "<input type='checkbox' name='" . $type . "[" . $data['id'] . "]'></td>"; echo "<td class='left' width='95%'>"; printf(__('%1$s: %2$s'), $associated_type::getTypeName(), $data['name']); echo "</td></tr>\n"; } } } if ($header) { echo "</table>"; Html::openArrowMassives('lock_form', true); Html::closeArrowMassives(array('unlock' => _sx('button', 'Unlock'))); } else { echo "<tr class='tab_bg_2'>"; echo "<td class='center' colspan='2'>" . __('No locked item') . "</td></tr>"; echo "</table>"; } Html::closeForm(); echo "</div>\n"; }
Event::log(0, "networkport", 5, "inventory", sprintf(__('%s deletes several network ports'), $_SESSION["glpiname"])); Html::back(); } else { if (isset($_POST["update"])) { $np->check($_POST['id'], PURGE); $networkport = new NetworkPort(); if ($networkport->can($_POST['id'], UPDATE)) { if ($networkport->switchInstantiationType($_POST['transform_to']) !== false) { $instantiation = $networkport->getInstantiation(); $input = $np->fields; $input['networkports_id'] = $input['id']; unset($input['id']); if ($instantiation->add($input)) { $np->delete($_POST); } } else { Session::addMessageAfterRedirect(__('Cannot change a migration network port to an unknown one')); } } else { Session::addMessageAfterRedirect(__('Network port is not available...')); $np->delete($_POST); } Html::redirect($CFG_GLPI["root_doc"] . "/front/networkportmigration.php"); } else { Session::checkRight("networking", UPDATE); Html::header(NetworkPort::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "tools", "migration", "networkportmigration"); $np->display(array('id' => $_GET["id"])); Html::footer(); } } }
$np->updateDependencies(1); Event::log($_POST["id"], "networkport", 4, "inventory", sprintf(__('%s updates an item'), $_SESSION["glpiname"])); Html::back(); } else { if (isset($_POST["disconnect"])) { $nn->check($_POST['id'], 'd'); if (isset($_POST["id"])) { $nn->delete($_POST); } Html::back(); } else { if (empty($_GET["items_id"])) { $_GET["items_id"] = ""; } if (empty($_GET["itemtype"])) { $_GET["itemtype"] = ""; } if (empty($_GET["several"])) { $_GET["several"] = ""; } if (empty($_GET["instantiation_type"])) { $_GET["instantiation_type"] = ""; } Session::checkRight("networking", "w"); Html::header(NetworkPort::getTypeName(2), $_SERVER['PHP_SELF'], 'inventory'); $np->showForm($_GET["id"], $_GET); Html::footer(); } } } }
Event::log(0, "networkport", 5, "inventory", sprintf(__('%s deletes several network ports'), $_SESSION["glpiname"])); Html::back(); } else { if (isset($_POST["update"])) { $np->check($_POST['id'], 'd'); $networkport = new NetworkPort(); if ($networkport->can($_POST['id'], 'w')) { if ($networkport->switchInstantiationType($_POST['transform_to']) !== false) { $instantiation = $networkport->getInstantiation(); $input = $np->fields; $input['networkports_id'] = $input['id']; unset($input['id']); if ($instantiation->add($input)) { $np->delete($_POST); } } else { Session::addMessageAfterRedirect(__('Cannot change a migration network port to an unknown one')); } } else { Session::addMessageAfterRedirect(__('Network port is not available...')); $np->delete($_POST); } Html::redirect($CFG_GLPI["root_doc"] . "/front/networkportmigration.php"); } else { Session::checkRight("networking", "w"); Html::header(NetworkPort::getTypeName(2), $_SERVER['PHP_SELF'], "utils", "migration", "networkportmigration"); $np->showForm($_GET["id"]); Html::footer(); } } }
$np->updateDependencies(1); Event::log($_POST["id"], "networkport", 4, "inventory", sprintf(__('%s updates an item'), $_SESSION["glpiname"])); Html::back(); } else { if (isset($_POST["disconnect"])) { $nn->check($_POST['id'], DELETE); if (isset($_POST["id"])) { $nn->delete($_POST); } Html::back(); } else { if (empty($_GET["items_id"])) { $_GET["items_id"] = ""; } if (empty($_GET["itemtype"])) { $_GET["itemtype"] = ""; } if (empty($_GET["several"])) { $_GET["several"] = ""; } if (empty($_GET["instantiation_type"])) { $_GET["instantiation_type"] = ""; } Session::checkRight("networking", UPDATE); Html::header(NetworkPort::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], 'assets'); $np->display($_GET); Html::footer(); } } } }
function showHosts($componentscatalogs_id, $static) { global $DB, $CFG_GLPI; if ($static == '1') { $this->addHost($componentscatalogs_id); } $rand = mt_rand(); $query = "SELECT * FROM `" . $this->getTable() . "`\n WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscatalogs_id . "'\n AND `is_static`='" . $static . "'"; $result = $DB->query($query); echo "<form method='post' name='componentscatalog_host_form{$rand}' id='componentscatalog_host_form{$rand}' action=\"" . $CFG_GLPI["root_doc"] . "/plugins/monitoring/front/componentscatalog_host.form.php\">"; echo "<table class='tab_cadre_fixe'>"; echo "<tr>"; echo "<th colspan='5'>"; if ($DB->numrows($result) == 0) { echo __('No associated hosts', 'monitoring'); } else { echo __('Associated hosts', 'monitoring'); } echo "</th>"; echo "</tr>"; echo "</table>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr>"; echo "<th width='10'> </th>"; echo "<th>" . __('Type') . "</th>"; echo "<th>" . __('Entity') . "</th>"; echo "<th>" . __('Name') . "</th>"; echo "<th>" . __('Serial number') . "</th>"; echo "<th>" . __('Inventory number') . "</th>"; echo "</tr>"; while ($data = $DB->fetch_array($result)) { $itemtype = $data['itemtype']; $item = new $itemtype(); $display_normal = 1; $networkports = false; if ($itemtype == 'NetworkEquipment') { $querys = "SELECT * FROM `glpi_plugin_monitoring_services`\n WHERE `plugin_monitoring_componentscatalogs_hosts_id`='" . $data['id'] . "'\n AND `networkports_id`='0'"; $results = $DB->query($querys); if ($DB->numrows($results) == 0) { $display_normal = 0; } $querys = "SELECT * FROM `glpi_plugin_monitoring_services`\n WHERE `plugin_monitoring_componentscatalogs_hosts_id`='" . $data['id'] . "'\n AND `networkports_id`!='0'"; $results = $DB->query($querys); if ($DB->numrows($results) > 0) { $networkports = true; } } $item->getFromDB($data['items_id']); if ($display_normal == 1) { echo "<tr>"; echo "<td>"; echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>"; echo "</td>"; echo "<td class='center'>"; echo $item->getTypeName(); echo "</td>"; echo "<td class='center'>"; echo Dropdown::getDropdownName("glpi_entities", $item->fields['entities_id']) . "</td>"; echo "<td class='center" . (isset($item->fields['is_deleted']) && $item->fields['is_deleted'] ? " tab_bg_2_2'" : "'"); echo ">" . $item->getLink() . "</td>"; echo "<td class='center'>" . (isset($item->fields["serial"]) ? "" . $item->fields["serial"] . "" : "-") . "</td>"; echo "<td class='center'>" . (isset($item->fields["otherserial"]) ? "" . $item->fields["otherserial"] . "" : "-") . "</td>"; echo "</tr>"; } if ($networkports) { $itemport = new NetworkPort(); while ($datas = $DB->fetch_array($results)) { $itemport->getFromDB($datas['networkports_id']); echo "<tr>"; echo "<td>"; echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>"; echo "</td>"; echo "<td class='center'>"; echo $itemport->getTypeName(); echo "</td>"; echo "<td class='center'>"; echo Dropdown::getDropdownName("glpi_entities", $item->fields['entities_id']) . "</td>"; echo "<td colspan='3' class='left" . (isset($item->fields['is_deleted']) && $item->fields['is_deleted'] ? " tab_bg_2_2'" : "'"); echo ">" . $itemport->getLink() . " on " . $item->getLink(1) . "</td>"; echo "</tr>"; } } } if ($static == '1') { Html::openArrowMassives("componentscatalog_host_form{$rand}", true); Html::closeArrowMassives(array('deleteitem' => _sx('button', 'Delete permanently'))); Html::closeForm(); } echo "</table>"; }