/** * @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; if (empty($item)) { if (empty($father)) { return; } $item = $father->getItem(); } if ($item->getType() != 'NetworkName') { return; } $column_name = __CLASS__; if (isset($options['dont_display'][$column_name])) { return; } $header = $row->getGroup()->getHeaderByName('Internet', $column_name); if (!$header) { return; } $canedit = isset($options['canedit']) && $options['canedit']; $createRow = isset($options['createRow']) && $options['createRow']; $options['createRow'] = false; $query = "SELECT `id`\n FROM `glpi_networkaliases`\n WHERE `networknames_id` = '" . $item->getID() . "'"; $alias = new self(); foreach ($DB->request($query) as $line) { if ($alias->getFromDB($line["id"])) { if ($createRow) { $row = $row->createRow(); } $content = "<a href='" . $alias->getLinkURL() . "'>" . $alias->getInternetName() . "</a>"; $row->addCell($header, $content, $father, $alias); } } }
/** * @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; if (empty($item)) { if (empty($father)) { return; } $item = $father->getItem(); } if ($item->getType() != 'IPAddress') { return; } $column_name = __CLASS__; if (isset($options['dont_display'][$column_name])) { return; } $header = $row->getGroup()->getHeaderByName('Internet', __CLASS__); if (!$header) { return; } $createRow = isset($options['createRow']) && $options['createRow']; $options['createRow'] = false; $network = new self(); foreach (self::searchNetworksContainingIP($item) as $networks_id) { if ($network->getFromDB($networks_id)) { if ($createRow) { $row = $row->createRow(); } //TRANS: %1$s is address, %2$s is netmask $content = sprintf(__('%1$s / %2$s'), $network->getAddress()->getTextual(), $network->getNetmask()->getTextual()); if ($network->fields['addressable'] == 1) { $content = "<span class='b'>" . $content . "</span>"; } $content = sprintf(__('%1$s - %2$s'), $content, $network->getLink()); $this_cell = $row->addCell($header, $content, $father, $network); } } }