99)) - display 99 neighbours from all device * print_neighbours(array('pagesize' => 10, 'pageno' => 3, 'pagination' => TRUE)) - display 10 neighbours from page 3 with pagination header * print_neighbours(array('pagesize' => 10, 'device' = 4)) - display 10 neighbours for device_id 4 * * @param array $vars * * @return none * */ function print_neighbours($vars) { // Get neighbours array $neighbours = get_neighbours_array($vars); if (!$neighbours['count']) { // There have been no entries returned. Print the warning. print_warning('
'; $string .= ' | ' . generate_device_link($entry, NULL, [ 'tab' => 'ports', 'view' => 'neighbours' ]) . ' | ' . PHP_EOL; } $port = get_port_by_id_cache($entry['port_id']); $string .= '' . generate_port_link($port) . ' ' . escape_html($port['ifAlias']) . ' | ' . PHP_EOL;
$string .= ' ' . PHP_EOL; //$string .= " | "; //r($entry); //r($entry['remote_port']); if ((is_intnum($entry['remote_device_id']) && $entry['remote_device_id']) || is_intnum($entry['remote_port_id'])) { $remote_port = $entry['remote_port_id'] ? get_port_by_id_cache($entry['remote_port_id']) : []; if ($entry['remote_device_id']) { $remote_device = device_by_id_cache($entry['remote_device_id']); } else { $remote_device = device_by_id_cache($remote_port['device_id']); } $remote_info = !safe_empty($remote_device['hardware']) ? ' | ' . generate_device_link($remote_device) . '' . $remote_info . ' | ' . PHP_EOL; if ($remote_port) { $string .= '' . generate_port_link($remote_port) . ' ' . escape_html($remote_port['ifAlias']) . ' | ' . PHP_EOL;
} else {
$string .= ' ' . escape_html($entry['remote_port']) . ' | ' . PHP_EOL; } } else { $remote_ip = !safe_empty($entry['remote_address']) ? ' (' . generate_popup_link('ip', $entry['remote_address']) . ')' : ''; $remote_version = !safe_empty($entry['remote_version']) ? '' . escape_html($entry['remote_hostname']) . $remote_ip . ' '; $string .= escape_html(truncate($entry['remote_platform'], '100')) . $remote_version . PHP_EOL; $string .= ' | ';
$string .= ' ' . escape_html($entry['remote_port']) . ' | ' . PHP_EOL; } if (isset($protocol_classmap[$entry['protocol']])) { $entry['protocol_class'] = 'label-' . $protocol_classmap[$entry['protocol']]; } $string .= '' . strtoupper($entry['protocol']) . ' | ' . PHP_EOL; $string .= '' . format_uptime(get_time() - $entry['last_change_unixtime'], 'shorter') . ' ago | ' . PHP_EOL; if ($_SESSION['userlevel'] > 7) { $string .= '' . generate_popup_link('autodiscovery', $entry['autodiscovery_id']) . ' | ' . PHP_EOL; } $string .= '