本文整理汇总了PHP中IPAddress::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP IPAddress::getName方法的具体用法?PHP IPAddress::getName怎么用?PHP IPAddress::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPAddress
的用法示例。
在下文中一共展示了IPAddress::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForItem
/**
* 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']);
//.........这里部分代码省略.........
示例2: showHardware
//.........这里部分代码省略.........
echo "</table>\n";
break;
case "imported":
$target = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.import.php" . $backValues;
self::checkBox($target);
echo "<form method='post' id='ipdiscover_form' name='ipdiscover_form' action='{$target}'>";
echo "<div class='center' style=\"width=100%\">";
echo "<input type='submit' class='submit' name='deletelink' value=\"" . _sx('button', 'Delete link', 'ocsinventoryng') . "\"></div>";
echo "<table width='100%'class='tab_cadrehov'>\n";
echo Search::showHeaderItem($output_type, __('Item'), $header_num);
echo Search::showHeaderItem($output_type, __('Item type'), $header_num);
echo Search::showHeaderItem($output_type, __('MAC address'), $header_num);
echo Search::showHeaderItem($output_type, __('IP address'), $header_num);
echo Search::showHeaderItem($output_type, __('Location'), $header_num);
echo Search::showHeaderItem($output_type, __('Import date in GLPI', 'ocsinventoryng'), $header_num);
echo Search::showHeaderItem($output_type, __('Subnet'), $header_num);
echo Search::showHeaderItem($output_type, __(' '), $header_num);
echo Search::showEndLine($output_type);
$row_num = 1;
for ($i = $start; $i < $lim + $start; $i++) {
if (isset($hardware[$i])) {
$row_num++;
$item_num = 1;
echo Search::showNewLine($output_type, $row_num % 2);
$class = getItemForItemtype($hardware[$i]["itemtype"]);
$class->getFromDB($hardware[$i]["items_id"]);
$iplist = "";
$ip = new IPAddress();
// Update IPAddress
foreach ($DB->request('glpi_networkports', array('itemtype' => $hardware[$i]["itemtype"], 'items_id' => $hardware[$i]["items_id"])) as $netname) {
foreach ($DB->request('glpi_networknames', array('itemtype' => 'NetworkPort', 'items_id' => $netname['id'])) as $dataname) {
foreach ($DB->request('glpi_ipaddresses', array('itemtype' => 'NetworkName', 'items_id' => $dataname['id'])) as $data) {
$ip->getFromDB($data['id']);
$iplist .= $ip->getName() . "<br>";
}
}
}
echo Search::showItem($output_type, $class->getLink(), $item_num, $row_num);
echo Search::showItem($output_type, $class->getTypeName(), $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["macaddress"], $item_num, $row_num);
echo Search::showItem($output_type, $iplist, $item_num, $row_num);
echo Search::showItem($output_type, Dropdown::getDropdownName("glpi_locations", $class->fields["locations_id"]), $item_num, $row_num);
echo Search::showItem($output_type, Html::convDateTime($hardware[$i]["last_update"]), $item_num, $row_num);
echo Search::showItem($output_type, $hardware[$i]["subnet"], $item_num, $row_num);
echo self::showItem($hardware[$i]["id"], "", "", "", true, "", $i);
echo Search::showEndLine($output_type);
}
}
echo "<tbody style=\"display:none\">";
echo "<tr><td><input type=\"hidden\" name='subnet' value=\"{$ipAdress}\" ></td></tr>";
echo "</tbody>";
echo "</table>\n";
echo "<div class='center' style=\"width=100%\">";
echo "<input type='submit' class='submit' name='deletelink' value=\"" . _sx('button', 'Delete link', 'ocsinventoryng') . "\"></div>";
Html::closeForm();
self::checkBox($target);
break;
case "noninventoried":
$ocsTypes = array("id" => array(Dropdown::EMPTY_VALUE), "name" => array(Dropdown::EMPTY_VALUE));
$link = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.php";
$target = $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ipdiscover.import.php" . $backValues;
$macConstructor = "";
self::getOCSTypes($ocsTypes);
self::checkBox($target);
echo "<form method='post' id='ipdiscover_form' name='ipdiscover_form' action='{$target}'>";
echo "<div class='center' style=\"width=100%\">";