本文整理汇总了PHP中IPAddress::getHTMLTableCellsForItem方法的典型用法代码示例。如果您正苦于以下问题:PHP IPAddress::getHTMLTableCellsForItem方法的具体用法?PHP IPAddress::getHTMLTableCellsForItem怎么用?PHP IPAddress::getHTMLTableCellsForItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPAddress
的用法示例。
在下文中一共展示了IPAddress::getHTMLTableCellsForItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHTMLTableCellsForItem
/**
* @since version 0.84
*
* @param $row HTMLTableRow object (default NULL)
* @param $item CommonDBTM object (default NULL)
* @param $father HTMLTableCell object (default NULL)
* @param $options array
**/
static function getHTMLTableCellsForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array())
{
global $DB, $CFG_GLPI;
$column_name = __CLASS__;
if (empty($item)) {
if (empty($father)) {
return;
}
$item = $father->getItem();
}
switch ($item->getType()) {
case 'FQDN':
$JOINS = "";
$ORDER = "`glpi_networknames`.`name`";
if (isset($options['order'])) {
switch ($options['order']) {
case 'name':
break;
case 'ip':
$JOINS = " LEFT JOIN `glpi_ipaddresses`\n ON (`glpi_ipaddresses`.`items_id` = `glpi_networknames`.`id`\n AND `glpi_ipaddresses`.`itemtype` = 'NetworkName'\n AND `glpi_ipaddresses`.`is_deleted` = '0')";
$ORDER = "ISNULL (`glpi_ipaddresses`.`id`),\n `glpi_ipaddresses`.`binary_3`, `glpi_ipaddresses`.`binary_2`,\n `glpi_ipaddresses`.`binary_1`, `glpi_ipaddresses`.`binary_0`";
break;
case 'alias':
$JOINS = " LEFT JOIN `glpi_networkaliases`\n ON (`glpi_networkaliases`.`networknames_id`\n = `glpi_networknames`.`id`)";
$ORDER = "ISNULL(`glpi_networkaliases`.`name`),\n `glpi_networkaliases`.`name`";
break;
}
}
$query = "SELECT `glpi_networknames`.`id`\n FROM `glpi_networknames`\n {$JOINS}\n WHERE `glpi_networknames`.`fqdns_id` = '" . $item->fields["id"] . "'\n AND `glpi_networknames`.`is_deleted` = '0'\n ORDER BY {$ORDER}";
break;
case 'NetworkPort':
$query = "SELECT `id`\n FROM `glpi_networknames`\n WHERE `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'\n AND `glpi_networknames`.`is_deleted` = '0'";
break;
case 'NetworkEquipment':
$query = "SELECT `glpi_networknames`.`id`\n FROM `glpi_networknames`, `glpi_networkports`\n WHERE `glpi_networkports`.`itemtype` = '" . $item->getType() . "'\n AND `glpi_networkports`.`items_id` ='" . $item->getID() . "'\n AND `glpi_networknames`.`itemtype` = 'NetworkPort'\n AND `glpi_networknames`.`items_id` = `glpi_networkports`.`id`\n AND `glpi_networknames`.`is_deleted` = '0'";
break;
}
if (isset($options['SQL_options'])) {
$query .= " " . $options['SQL_options'];
}
$canedit = isset($options['canedit']) && $options['canedit'];
$createRow = isset($options['createRow']) && $options['createRow'];
$options['createRow'] = false;
$address = new self();
foreach ($DB->request($query) as $line) {
if ($address->getFromDB($line["id"])) {
if ($createRow) {
$row = $row->createAnotherRow();
}
if (isset($options['massiveactionnetworkname']) && $options['massiveactionnetworkname']) {
$header = $row->getGroup()->getHeaderByName('Internet', 'delete');
$cell_value = Html::getMassiveActionCheckBox(__CLASS__, $line["id"]);
$delete_cell = $row->addCell($header, $cell_value, $father);
}
$internetName = $address->getInternetName();
if (empty($internetName)) {
$internetName = "(" . $line["id"] . ")";
}
$content = $internetName;
if (Session::haveRight('internet', READ)) {
$content = "<a href='" . $address->getLinkURL() . "'>" . $internetName . "</a>";
}
if (!isset($options['dont_display'][$column_name])) {
$header = $row->getGroup()->getHeaderByName('Internet', $column_name);
$name_cell = $row->addCell($header, $content, $father, $address);
if (isset($options['display_isDynamic']) && $options['display_isDynamic']) {
$dyn_header = $row->getGroup()->getHeaderByName('Internet', $column_name . '_dynamic');
$dynamic_cell = $row->addCell($dyn_header, Dropdown::getYesNo($address->fields['is_dynamic']), $name_cell);
$father_for_children = $dynamic_cell;
} else {
$father_for_children = $name_cell;
}
} else {
$father_for_children = $father;
}
NetworkAlias::getHTMLTableCellsForItem($row, $address, $father_for_children, $options);
IPAddress::getHTMLTableCellsForItem($row, $address, $father_for_children, $options);
}
}
}