本文整理汇总了PHP中NetworkPort::getLinkURL方法的典型用法代码示例。如果您正苦于以下问题:PHP NetworkPort::getLinkURL方法的具体用法?PHP NetworkPort::getLinkURL怎么用?PHP NetworkPort::getLinkURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkPort
的用法示例。
在下文中一共展示了NetworkPort::getLinkURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
function showForm($ID, $options = array())
{
global $CFG_GLPI, $DB;
if (!self::canView()) {
return false;
}
$this->check($ID, READ);
$recursiveItems = $this->recursivelyGetItems();
if (count($recursiveItems) > 0) {
$lastItem = $recursiveItems[count($recursiveItems) - 1];
$lastItem_entities_id = $lastItem->getField('entities_id');
} else {
$lastItem_entities_id = $_SESSION['glpiactive_entity'];
}
$options['entities_id'] = $lastItem_entities_id;
$this->showFormHeader($options);
$options['canedit'] = false;
$options['candel'] = false;
$number_errors = 0;
foreach (self::getMotives() as $key => $name) {
if ($this->fields[$key] == 1) {
$number_errors++;
}
}
$motives = self::getMotives();
$interface_cell = "td";
$address_cell = "td";
$network_cell = "td";
$gateway_cell = "td";
$address = new IPAddress();
$netmask = new IPNetmask();
$number_real_errors = 0;
if (!$address->setAddressFromString($this->fields['ip']) || !$netmask->setNetmaskFromString($this->fields['netmask'], $address->getVersion())) {
unset($address);
unset($netmask);
} else {
$network = new IPNetwork();
$params = array("address" => $address, "netmask" => $netmask);
if (isset($this->fields["address"])) {
$params["exclude IDs"] = $this->fields["address"];
}
if (isset($this->fields["entities_id"])) {
$entity = $this->fields["entities_id"];
} else {
$entity = -1;
}
$networkports_ids = IPNetwork::searchNetworks("equals", $params, $entity, false);
if (count($networkports_ids) == 0) {
unset($network);
} else {
$network->getFromDB($networkports_ids[0]);
}
}
if ($this->fields['unknown_interface_type'] == 1) {
$options['canedit'] = true;
$number_real_errors++;
$interface_cell = "th";
echo "<tr class='tab_bg_1'><th>" . $motives['unknown_interface_type'] . "</th>\n" . "<td>" . __('Transform this network port to');
echo "</td><td colspan=2>";
Dropdown::showItemTypes('transform_to', NetworkPort::getNetworkPortInstantiations(), array('value' => "NetworkPortEthernet"));
echo "</td></tr>\n";
}
if ($this->fields['invalid_network'] == 1) {
$number_real_errors++;
$network_cell = "th";
$address_cell = "th";
echo "<tr class='tab_bg_1'><th>" . $motives['invalid_network'] . "</th>\n<td colspan=3>";
if (isset($network)) {
printf(__('Network port information conflicting with %s'), $network->getLink());
} else {
if (!isset($address) || !isset($netmask)) {
_e('Invalid address or netmask');
} else {
_e('No conflicting network');
}
echo " <a href='" . Toolbox::getItemTypeFormURL('IPNetwork') . "'>" . __('you may have to add a network') . "</a>";
}
echo "</td></tr>\n";
}
if ($this->fields['invalid_gateway'] == 1) {
$number_real_errors++;
$gateway_cell = "th";
echo "<tr class='tab_bg_1'><th>" . $motives['invalid_gateway'] . "</th>\n<td colspan=3>";
if (isset($network)) {
printf(__('Append a correct gateway to the network %s'), $network->getLink());
} else {
printf(__('%1$s: %2$s'), __('Unknown network'), "<a href='" . Toolbox::getItemTypeFormURL('IPNetwork') . "'>" . __('Add a network') . "\n </a>");
}
echo "</td></tr>\n";
}
if ($this->fields['invalid_address'] == 1) {
$number_real_errors++;
$address_cell = "th";
echo "<tr class='tab_bg_1'><th>" . $motives['invalid_address'] . "</th>\n<td colspan=3>";
$networkPort = new NetworkPort();
if ($networkPort->getFromDB($this->getID())) {
$number_real_errors++;
echo "<a href='" . $networkPort->getLinkURL() . "'>" . __('Add a correct IP to the network port') . "</a>";
} else {
_e('Unknown network port');
//.........这里部分代码省略.........