Index: html/includes/print/neighbours.inc.php
===================================================================
--- html/includes/print/neighbours.inc.php (revision 7196)
+++ html/includes/print/neighbours.inc.php (working copy)
@@ -141,6 +141,12 @@
case 'protocol':
$where .= generate_query_values($value, 'protocol');
break;
+ case 'platform':
+ $where .= generate_query_values($value, 'remote_platform');
+ break;
+ case 'version':
+ $where .= generate_query_values($value, 'remote_version');
+ break;
}
}
}
Index: html/pages/neighbours.inc.php
===================================================================
--- html/pages/neighbours.inc.php (revision 7196)
+++ html/pages/neighbours.inc.php (working copy)
@@ -16,6 +16,70 @@
<div class="col-md-12">
<?php
+$where = ' WHERE 1 ';
+$where .= generate_query_permitted(array('port'));
+
+$devices_array = array();
+foreach (dbFetchRows('SELECT `device_id` FROM `neighbours` LEFT JOIN `ports` USING (`port_id`) ' .$where . 'GROUP BY `device_id`;') as $data)
+{
+ $device_id = $data['device_id'];
+ if ($cache['devices']['id'][$device_id]['hostname'])
+ {
+ $devices_array[$device_id] = $cache['devices']['id'][$device_id]['hostname'];
+ }
+}
+natcasesort($devices_array);
+
+$platforms_array = array();
+foreach (dbFetchRows('SELECT `remote_platform` FROM `neighbours` GROUP BY `remote_platform`') as $data)
+{
+ if ($data['remote_platform'])
+ {
+ $platforms_array[$data['remote_platform']] = escape_html($data['remote_platform']);
+ }
+}
+
+$versions_array = array();
+foreach (dbFetchRows('SELECT `remote_version` FROM `neighbours` GROUP BY `remote_version`') as $data)
+{
+ if ($data['remote_version'])
+ {
+ $versions_array[$data['remote_version']] = escape_html($data['remote_version']);
+ }
+}
+
+$search = array();
+//Device field
+$search[] = array('type' => 'multiselect',
+ 'name' => 'Device',
+ 'id' => 'device',
+ 'width' => '150px',
+ 'value' => $vars['device'],
+ 'values' => $devices_array);
+//Protocol field
+$search[] = array('type' => 'select',
+ 'title' => 'Protocol',
+ 'id' => 'protocol',
+ 'width' => '120px',
+ 'value' => $vars['protocol'],
+ 'values' => array('cdp' => 'CDP', 'lldp' => 'LLDP')); // FIXME more protocols possible?
+//Platform field
+$search[] = array('type' => 'select', // FIXME multiselect prefered, but first fix values
+ 'title' => 'Platform',
+ 'id' => 'platform',
+ 'width' => '180px',
+ 'value' => escape_html($vars['platform']),
+ 'values' => $platforms_array);
+//Version field
+$search[] = array('type' => 'select', // FIXME multiselect prefered, but first fix values
+ 'title' => 'Version',
+ 'id' => 'version',
+ 'width' => '180px',
+ 'value' => escape_html($vars['version']),
+ 'values' => $versions_array);
+
+print_search($search, 'Neighbours', NULL, 'neighbours/');
+
$vars['pagination'] = 1;
print_neighbours($vars);