* @copyright (C) Adam Armstrong * */ echo(generate_link($descr, $link_array, ['view' => 'macaccounting'])); $graphs = ['bits' => 'Bits', 'pkts' => 'Packets']; $navbar = []; $navbar['class'] = "navbar-narrow"; $navbar['brand'] = 'Mac Accounting'; $subviews = ['details', 'graphs', 'minigraphs', 'top10']; foreach ($subviews as $type) { $navbar['options'][$type]['text'] = nicecase($type); $navbar['options'][$type]['url'] = generate_url($vars, ['subview' => $type]); if ($vars['subview'] == $type) { $navbar['options'][$type]['class'] = "active"; } } foreach ($graphs as $type => $text) { $navbar['options_right'][$type]['text'] = $text; $navbar['options_right'][$type]['url'] = generate_url($link_array, ['view' => 'macaccounting', 'subview' => 'graphs', 'graph' => $type]); if ($vars['graph'] == $type) { $navbar['options_right'][$type]['class'] = "active"; } } print_navbar($navbar); // FIXME - REWRITE! $hostname = $device['hostname']; $hostid = $device['port_id']; $ifname = $port['port_label']; $ifIndex = $port['ifIndex']; $speed = humanspeed($port['ifSpeed']); $ifalias = $port['name']; if ($port['ifPhysAddress']) { $mac = $port['ifPhysAddress']; } $color = "black"; if ($port['ifAdminStatus'] == "down") { $status = "Disabled"; } elseif ($port['ifAdminStatus'] == "up") { if ($port['ifOperStatus'] == "down" || $port['ifOperStatus'] == "lowerLayerDown") { $status = "Enabled / Disconnected"; } else { $status = "Enabled / Connected"; } } $i = 1; echo("
'); } elseif ($vars['sort'] == $sort) { echo(' | ' . $col . ' * | '); } else { echo('' . $col . ' | '); } } echo("|||||
---|---|---|---|---|---|---|---|
" . implode(" ", $ips) . " |
" . $name . " " . $arp_name . " | " . format_bps($acc['bytes_input_rate'] / 8) . " | " . format_bps($acc['bytes_output_rate'] / 8) . " | " . format_number($acc['pkts_input_rate'] / 8) . "pps | " . format_number($acc['pkts_output_rate'] / 8) . "pps | ||
'); print_graph_row($graph_array); echo(" |