2007-04-03 14:10:23 +00:00
< ? php
2015-07-13 20:10:26 +02:00
echo '<table border=0 cellspacing=0 cellpadding=2 class=devicetable width=100%>' ;
2007-04-03 14:10:23 +00:00
2015-07-13 20:10:26 +02:00
echo "
2010-07-04 19:14:42 +00:00
< tr bgcolor = '$list_colour_a' >
< th width = '7' ></ th >
< th width = '250' >< span style = 'font-weight: bold;' class = interface > Customer </ span ></ th >
< th width = '150' > Device </ th >
< th width = '100' > Interface </ th >
< th width = '100' > Speed </ th >
< th width = '100' > Circuit </ th >
< th > Notes </ th >
</ tr >
2015-07-13 20:10:26 +02:00
" ;
2007-04-03 14:10:23 +00:00
2010-07-04 19:14:42 +00:00
$i = 1 ;
2015-07-13 20:10:26 +02:00
$pagetitle [] = 'Customers' ;
2011-10-18 14:41:19 +00:00
2015-05-14 00:37:40 +01:00
if ( ! is_array ( $config [ 'customers_descr' ])) {
$config [ 'customers_descr' ] = array ( $config [ 'customers_descr' ]);
}
2015-07-13 20:10:26 +02:00
$descr_type = " ' " . implode ( " ', ' " , $config [ 'customers_descr' ]) . " ' " ;
2011-03-17 00:09:20 +00:00
2015-07-13 20:10:26 +02:00
foreach ( dbFetchRows ( 'SELECT * FROM `ports` WHERE `port_descr_type` IN (?) GROUP BY `port_descr_descr` ORDER BY `port_descr_descr`' , array ( array ( $descr_type ))) as $customer ) {
$i ++ ;
2010-07-04 19:14:42 +00:00
2015-07-13 20:10:26 +02:00
$customer_name = $customer [ 'port_descr_descr' ];
2010-07-04 19:14:42 +00:00
2015-07-13 20:10:26 +02:00
if ( ! is_integer ( $i / 2 )) {
$bg_colour = $list_colour_a ;
}
else {
$bg_colour = $list_colour_b ;
}
foreach ( dbFetchRows ( 'SELECT * FROM `ports` WHERE `port_descr_type` IN (?) AND `port_descr_descr` = ?' , array ( array ( $descr_type ), $customer [ 'port_descr_descr' ])) as $port ) {
2011-03-17 00:09:20 +00:00
$device = device_by_id_cache ( $port [ 'device_id' ]);
2007-04-08 21:27:05 +00:00
2015-07-13 20:10:26 +02:00
unset ( $class );
2007-04-08 21:27:05 +00:00
2015-07-13 20:10:26 +02:00
$ifname = fixifname ( $device [ 'ifDescr' ]);
$ifclass = ifclass ( $port [ 'ifOperStatus' ], $port [ 'ifAdminStatus' ]);
2007-04-03 14:10:23 +00:00
2015-07-13 20:10:26 +02:00
if ( $device [ 'os' ] == 'ios' ) {
if ( $port [ 'ifTrunk' ]) {
$vlan = '<span class=box-desc><span class=red>' . $port [ 'ifTrunk' ] . '</span></span>' ;
}
else if ( $port [ 'ifVlan' ]) {
$vlan = '<span class=box-desc><span class=blue>VLAN ' . $port [ 'ifVlan' ] . '</span></span>' ;
}
else {
$vlan = '' ;
}
}
2007-12-03 16:56:58 +00:00
2015-07-13 20:10:26 +02:00
echo "
2009-05-12 08:44:00 +00:00
< tr bgcolor = '$bg_colour' >
2007-04-03 14:10:23 +00:00
< td width = '7' ></ td >
2010-07-04 19:14:42 +00:00
< td width = '250' >< span style = 'font-weight: bold;' class = interface > " . $customer_name . " </ span ></ td >
2015-07-13 20:10:26 +02:00
< td width = '150' > " .generate_device_link( $device ). " </ td >
< td width = '100' > " .generate_port_link( $port , makeshortif( $port['ifDescr'] )). " </ td >
2010-07-04 19:14:42 +00:00
< td width = '100' > " . $port['port_descr_speed'] . " </ td >
2015-07-13 20:10:26 +02:00
< td width = '100' > " . $port['port_descr_circuit'] .'</td>
< td > '.$port[' port_descr_notes '].' </ td >
2007-04-03 14:10:23 +00:00
</ tr >
2015-07-13 20:10:26 +02:00
' ;
2007-04-03 14:10:23 +00:00
2015-07-13 20:10:26 +02:00
unset ( $customer_name );
}
2007-04-03 14:10:23 +00:00
2015-07-13 20:10:26 +02:00
echo " <tr bgcolor=' $bg_colour '><td></td><td colspan=6> " ;
2011-05-17 19:21:20 +00:00
2015-07-13 20:10:26 +02:00
$graph_array [ 'type' ] = 'customer_bits' ;
$graph_array [ 'height' ] = '100' ;
$graph_array [ 'width' ] = '220' ;
$graph_array [ 'to' ] = $config [ 'time' ][ 'now' ];
$graph_array [ 'id' ] = $customer [ 'port_descr_descr' ];
2011-05-17 19:21:20 +00:00
2015-07-13 20:10:26 +02:00
include 'includes/print-graphrow.inc.php' ;
2011-05-17 19:21:20 +00:00
2015-07-13 20:10:26 +02:00
echo '</tr>' ;
2010-07-04 19:14:42 +00:00
}
2015-07-13 20:10:26 +02:00
echo '</table>' ;