2009-08-07 11:53:10 +00:00
< ? php
2009-08-07 16:10:52 +00:00
2011-03-27 10:21:19 +00:00
if ( $_GET [ 'opta' ] == 'graphs' )
2011-03-16 23:10:10 +00:00
{
if ( $_GET [ 'optb' ]) { $graph_type = " port_ " . $_GET [ 'optb' ]; } else { $graph_type = " port_bits " ; }
2009-10-28 15:26:40 +00:00
}
2009-10-02 13:20:24 +00:00
print_optionbar_start ();
2011-04-09 15:20:07 +00:00
$menu_options = array ( 'basic' => 'Basic' ,
'details' => 'Details' ,
'arp' => 'ARP Table' ,
'adsl' => 'ADSL' );
if ( ! $_GET [ 'opta' ]) { $_GET [ 'opta' ] = " basic " ; }
$sep = " " ;
foreach ( $menu_options as $option => $text )
{
echo ( $sep );
if ( $_GET [ 'opta' ] == $option ) { echo ( " <span class='pagemenu-selected'> " ); }
echo ( '<a href="' . $config [ 'base_url' ] . '/device/' . $device [ 'device_id' ] . '/ports/' . $option . ( $_GET [ 'optb' ] ? '/' . $_GET [ 'optb' ] : '' ) . '/">' . $text . '</a>' );
if ( $_GET [ 'opta' ] == $option ) { echo ( " </span> " ); }
$sep = " | " ;
}
unset ( $sep );
echo ( 'Graphs: ' );
2009-10-02 13:20:24 +00:00
2009-10-28 15:26:40 +00:00
$graph_types = array ( " bits " => " Bits " ,
" upkts " => " Unicast Packets " ,
2011-03-16 23:10:10 +00:00
" nupkts " => " Non-Unicast Packets " ,
" errors " => " Errors " ,
2009-10-28 15:26:40 +00:00
" etherlike " => " Etherlike " );
2009-08-07 11:53:10 +00:00
2011-03-16 23:10:10 +00:00
foreach ( $graph_types as $type => $descr )
{
2011-04-09 15:20:07 +00:00
echo ( " $type_sep " );
if ( $_GET [ 'optb' ] == $type && $_GET [ 'optc' ] != " thumbs " ) { echo ( " <span class='pagemenu-selected'> " ); }
echo ( '<a href="' . $config [ 'base_url' ] . '/device/' . $device [ 'device_id' ] . '/ports/graphs/' . $type . '/">' . $descr . '</a>' );
if ( $_GET [ 'optb' ] == $type && $_GET [ 'optc' ] != " thumbs " ) { echo ( " </span> " ); }
echo ( '(' );
if ( $_GET [ 'optb' ] == $type && $_GET [ 'optc' ] == " thumbs " ) { echo ( " <span class='pagemenu-selected'> " ); }
echo ( '<a href="' . $config [ 'base_url' ] . '/device/' . $device [ 'device_id' ] . '/ports/graphs/' . $type . '/thumbs/">Mini</a>' );
if ( $_GET [ 'optb' ] == $type && $_GET [ 'optc' ] == " thumbs " ) { echo ( " </span> " ); }
echo ( ')' );
2009-10-28 15:26:40 +00:00
$type_sep = " | " ;
2009-08-07 11:53:10 +00:00
}
2009-10-28 15:26:40 +00:00
print_optionbar_end ();
2011-03-16 23:10:10 +00:00
if ( $_GET [ 'optc' ] == thumbs )
{
2009-08-07 11:53:10 +00:00
$timeperiods = array ( '-1day' , '-1week' , '-1month' , '-1year' );
$from = '-1day' ;
echo ( " <div style='display: block; clear: both; margin: auto;'> " );
2010-02-20 17:22:22 +00:00
$sql = " select * from ports WHERE device_id = ' " . $device [ 'device_id' ] . " ' ORDER BY ifIndex " ;
2009-08-07 11:53:10 +00:00
$query = mysql_query ( $sql );
unset ( $seperator );
2011-03-16 23:10:10 +00:00
while ( $interface = mysql_fetch_assoc ( $query ))
{
2009-08-07 11:53:10 +00:00
echo ( " <div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>
< div style = 'font-weight: bold;' > " .makeshortif( $interface['ifDescr'] ). " </ div >
2011-04-09 16:08:39 +00:00
< a href = 'device/".$device[' device_id ']."/port/".$interface[' interface_id ']."/' onmouseover = \ " return overlib(' \
2009-08-07 11:53:10 +00:00
< div style = \ 'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device[' hostname ']." - ".$interface[' ifDescr ' ] . " </div> \
" . $interface['ifAlias'] . " \
2011-03-28 09:11:05 +00:00
< img src = \ 'graph.php?type=$graph_type&id=".$interface[' interface_id ' ] . " &from= " . $from . " &to= " . $now . " &width=450&height=150 \ '> \
2009-08-07 11:53:10 +00:00
', CENTER, LEFT, FGCOLOR, ' #e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
2011-03-28 09:11:05 +00:00
" <img src='graph.php?type= $graph_type &id= " . $interface [ 'interface_id' ] . " &from= " . $from . " &to= " . $now . " &width=180&height=45&legend=no'>
2009-08-07 11:53:10 +00:00
</ a >
< div style = 'font-size: 9px;' > " .truncate(short_port_descr( $interface['ifAlias'] ), 32, ''). " </ div >
</ div > " );
}
echo ( " </div> " );
} else {
2011-03-27 10:21:19 +00:00
if ( $_GET [ 'opta' ] == " arp " )
2011-03-16 23:10:10 +00:00
{
2009-09-24 14:38:17 +00:00
include ( " arp.inc.php " );
2011-03-16 23:10:10 +00:00
} elseif ( $_GET [ 'opta' ] == " adsl " ) {
2010-07-18 11:38:38 +00:00
echo ( " <div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%> " );
2010-07-18 12:03:26 +00:00
echo ( " <tr><th>Port</th><th>Traffic</th><th>Sync Speed</th><th>Attainable Speed</th><th>Attenuation</th><th>SNR Margin</th><th>Output Powers</th></tr> " );
2010-07-18 11:38:38 +00:00
$i = " 0 " ;
$interface_query = mysql_query ( " select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = ' " . $device [ 'device_id' ] . " ' AND A.interface_id = P.interface_id AND P.deleted = '0' ORDER BY `ifIndex` ASC " );
2011-03-16 23:10:10 +00:00
while ( $interface = mysql_fetch_assoc ( $interface_query ))
{
2010-07-18 11:38:38 +00:00
include ( " includes/print-interface-adsl.inc.php " );
$i ++ ;
}
echo ( " </table></div> " );
echo ( " <div style='min-height: 150px;'></div> " );
2009-09-18 09:11:52 +00:00
} else {
2011-03-27 10:21:19 +00:00
if ( $_GET [ 'opta' ] == " details " ) { $port_details = 1 ; }
2010-08-01 14:17:06 +00:00
echo ( " <div style='margin: 0px;'><table border=0 cellspacing=0 cellpadding=5 width=100%> " );
2009-09-18 09:11:52 +00:00
$i = " 1 " ;
2010-02-20 17:22:22 +00:00
$interface_query = mysql_query ( " select * from ports WHERE device_id = ' " . $device [ 'device_id' ] . " ' AND deleted = '0' ORDER BY `ifIndex` ASC " );
2011-03-16 23:10:10 +00:00
while ( $interface = mysql_fetch_assoc ( $interface_query ))
{
2009-10-28 13:49:37 +00:00
include ( " includes/print-interface.inc.php " );
2011-03-16 23:10:10 +00:00
$i ++ ;
2009-09-18 09:11:52 +00:00
}
echo ( " </table></div> " );
echo ( " <div style='min-height: 150px;'></div> " );
2009-08-07 11:53:10 +00:00
}
}
2011-04-09 15:20:07 +00:00
?>