2011-05-05 14:06:39 +00:00
< ? php
2011-04-23 15:59:06 +00:00
2015-07-10 13:36:21 +02:00
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">' ;
2011-04-23 15:59:06 +00:00
2015-07-10 13:36:21 +02:00
$i = '1' ;
2011-04-23 15:59:06 +00:00
2015-07-10 13:36:21 +02:00
echo ' < tr >< th > Local Port </ th >
2011-04-23 15:59:06 +00:00
< th > Remote Port </ th >
< th > Remote Device </ th >
2011-04-24 00:28:09 +00:00
< th > Protocol </ th >
2015-07-10 13:36:21 +02:00
</ tr > ' ;
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 ) {
2015-07-10 13:36:21 +02:00
if ( $bg_colour == $list_colour_b ) {
$bg_colour = $list_colour_a ;
}
else {
$bg_colour = $list_colour_b ;
}
echo '<tr bgcolor="' . $bg_colour . '">' ;
echo '<td><span style="font-weight: bold;">' . generate_port_link ( $neighbour ) . '</span><br />' . $neighbour [ 'ifAlias' ] . '</td>' ;
if ( is_numeric ( $neighbour [ 'remote_port_id' ]) && $neighbour [ 'remote_port_id' ]) {
$remote_port = get_port_by_id ( $neighbour [ 'remote_port_id' ]);
$remote_device = device_by_id_cache ( $remote_port [ 'device_id' ]);
echo '<td>' . generate_port_link ( $remote_port ) . '<br />' . $remote_port [ 'ifAlias' ] . '</td>' ;
echo '<td>' . generate_device_link ( $remote_device ) . '<br />' . $remote_device [ 'hardware' ] . '</td>' ;
}
else {
echo '<td>' . $neighbour [ 'remote_port' ] . '</td>' ;
echo '<td>' . $neighbour [ 'remote_hostname' ] . '
< br /> '.$neighbour[' remote_platform '].' </ td > ' ;
}
echo '<td>' . strtoupper ( $neighbour [ 'protocol' ]) . '</td>' ;
echo '</tr>' ;
$i ++ ;
} //end foreach
echo '</table>' ;