'success', 'lldp' => 'warning', 'amap' => 'primary', 'mndp' => 'error', 'fdp' => 'delayed', 'edp' => 'suppressed' ]; foreach ($results as $result) { $result_device = device_by_id_cache($result['device_id']); $result_port = get_port_by_id_cache($result['port_id']); $name = truncate($result_device['hostname'], $max_len); if ($result_device['hostname'] != $result_device['sysName'] && $result_device['sysName']) { $name .= ' | ' . truncate($result_device['sysName'], $max_len); } //$num_ports = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ?", array($result['device_id'])); $remote_host = truncate($result['remote_hostname'], $max_len); $remote_host .= ' | '; if ($result['remote_address'] && $result['remote_address'] !== '0.0.0.0') { $remote_host .= $result['remote_address'] . ' | '; } if (strlen($result['remote_port'])) { $remote_host .= $result['remote_port'] . ' | '; } $remote_descr = $result['remote_platform'] . ' | '; if ($len = strlen($result['remote_version'])) { $result['remote_version'] = truncate($result['remote_version'], 35); $remote_descr .= $result['remote_version'] . ' | '; } $protocol_class = isset($protocol_classmap[$result['protocol']]) ? 'label-' . $protocol_classmap[$result['protocol']] : ''; $neighbours_search_results[] = [ 'url' => generate_device_url($result_device, ['tab' => 'ports', 'view' => 'neighbours']), 'name' => $name, 'colour' => $result_device['html_tab_colour'], // FIXME. this colour removed from humanize_device in r6280 'row_class' => $result_device['row_class'], 'html_row_class' => $result_device['html_row_class'], 'icon' => get_device_icon($result_device), 'data' => [ escape_html($result_port['port_label']) . ' ' . strtoupper($result['protocol']) . '', html_highlight(escape_html($remote_host), $queryString), '' . html_highlight(escape_html($remote_descr), $queryString) . '', ], ]; } $search_results['neighbours'] = ['descr' => 'Neighbours found', 'results' => $neighbours_search_results]; // EOF