2011-05-05 14:06:39 +00:00
<? php
2017-10-15 16:26:01 +02:00
echo '<table class="table table-hover table-condensed">
<thead>
<tr>
<th>Local Port</th>
<th>Remote Device</th>
<th>Remote Port</th>
<th>Protocol</th>
</tr>
</thead>' ;
2011-04-23 15:59:06 +00:00
2015-07-13 20:10:26 +02:00
foreach ( dbFetchRows ( 'SELECT * FROM links AS L, ports AS I WHERE I.device_id = ? AND I.port_id = L.local_port_id' , array ( $device [ 'device_id' ])) as $neighbour ) {
2017-04-04 08:08:23 +01:00
$neighbour = cleanPort ( $neighbour );
2017-10-15 16:26:01 +02:00
echo '<td>' . generate_port_link ( $neighbour ) . '<br>' . $neighbour [ 'ifAlias' ] . '</td>' ;
2015-07-10 13:36:21 +02:00
if ( is_numeric ( $neighbour [ 'remote_port_id' ]) && $neighbour [ 'remote_port_id' ]) {
2017-10-15 16:26:01 +02:00
$remote_port = cleanPort ( get_port_by_id ( $neighbour [ 'remote_port_id' ]));
2015-07-10 13:36:21 +02:00
$remote_device = device_by_id_cache ( $remote_port [ 'device_id' ]);
2017-10-15 16:26:01 +02:00
echo '<td>' . generate_device_link ( $remote_device ) . '<br>' . $remote_device [ 'hardware' ] . '</td>
<td>' . generate_port_link ( $remote_port ) . '<br>' . $remote_port [ 'ifAlias' ] . '</td>' ;
2016-08-18 20:28:22 -05:00
} else {
2017-10-15 16:26:01 +02:00
echo '<td>' . $neighbour [ 'remote_hostname' ] . '<br>' . $neighbour [ 'remote_platform' ] . '</td>
<td>' . $neighbour [ 'remote_port' ] . '</td>' ;
2015-07-10 13:36:21 +02:00
}
2017-10-15 16:26:01 +02:00
echo '<td>' . strtoupper ( $neighbour [ 'protocol' ]) . '</td></tr>' ;
}
2015-07-10 13:36:21 +02:00
echo '</table>' ;