function getSearchOptions() { $tab = parent::getSearchOptions(); $tab[12]['table'] = 'glpi_fqdns'; $tab[12]['field'] = 'fqdn'; $tab[12]['name'] = FQDN::getTypeName(1); $tab[12]['datatype'] = 'string'; $tab[20]['table'] = 'glpi_networknames'; $tab[20]['field'] = 'name'; $tab[20]['name'] = NetworkName::getTypeName(1); $tab[20]['massiveaction'] = false; $tab[20]['datatype'] = 'dropdown'; return $tab; }
/** * @param $networkPortID **/ static function showFormForNetworkPort($networkPortID) { global $DB, $CFG_GLPI; $name = new self(); $number_names = 0; if ($networkPortID > 0) { $query = "SELECT `id`\n FROM `" . $name->getTable() . "`\n WHERE `itemtype` = 'NetworkPort'\n AND `items_id` = '{$networkPortID}'\n AND `is_deleted` = '0'"; $result = $DB->query($query); if ($DB->numrows($result) > 1) { echo "<tr class='tab_bg_1'><th colspan='4'>" . __("Several network names available! Go to the tab 'Network Name' to manage them.") . "</th></tr>\n"; return; } switch ($DB->numrows($result)) { case 1: $nameID = $DB->fetch_assoc($result); $name->getFromDB($nameID['id']); break; case 0: $name->getEmpty(); break; } } else { $name->getEmpty(); } echo "<tr class='tab_bg_1'><th colspan='4'>"; // If the networkname is defined, we must be able to edit it. So we make a link if ($name->getID() > 0) { echo "<a href='" . $name->getLinkURL() . "'>" . self::getTypeName(1) . "</a>"; echo "<input type='hidden' name='NetworkName_id' value='" . $name->getID() . "'> \n"; Html::showSimpleForm($name->getFormURL(), 'unaffect', _sx('button', 'Dissociate'), array('id' => $name->getID()), $CFG_GLPI["root_doc"] . '/pics/sub_dropdown.png'); } else { echo self::getTypeName(1); } echo "</th>\n"; echo "</tr><tr class='tab_bg_1'>"; echo "<td>" . self::getTypeName(1) . "</td><td>\n"; Html::autocompletionTextField($name, "name", array('name' => 'NetworkName_name')); echo "</td>\n"; echo "<td>" . FQDN::getTypeName(1) . "</td><td>"; Dropdown::show(getItemTypeForTable(getTableNameForForeignKeyField("fqdns_id")), array('value' => $name->fields["fqdns_id"], 'name' => 'NetworkName_fqdns_id', 'entity' => $name->getEntityID(), 'displaywith' => array('view'))); echo "</td>\n"; echo "</tr><tr class='tab_bg_1'>\n"; echo "<td>" . IPAddress::getTypeName(Session::getPluralNumber()); IPAddress::showAddChildButtonForItemForm($name, 'NetworkName__ipaddresses'); echo "</td>"; echo "<td>"; IPAddress::showChildsForItemForm($name, 'NetworkName__ipaddresses'); echo "</td>"; // MoYo : really need to display it here ? // make confure because not updatable // echo "<td>".IPNetwork::getTypeName(Session::getPluralNumber())." "; // Html::showToolTip(__('IP network is not included in the database. However, you can see current available networks.')); // echo "</td><td>"; // IPNetwork::showIPNetworkProperties($name->getEntityID()); // echo "</td>\n"; echo "<td colspan='2'> </td>"; echo "</tr>\n"; }