bcast-bridge/web/stat_vlan.php
2006-12-22 00:06:05 +01:00

49 lines
1.2 KiB
PHP

<?php
require_once('include.php');
function show($vlan) {
$view = Input::getVar('view', INP_GET | INP_INT | INP_DEFAULT, 21600);
$mode = Input::getVar('mode', INP_GET | INP_STRING | INP_DEFAULT, 'normal');
switch ($mode) {
case 'overview':
Graphs::vlan($vlan->rrdpath, $vlan->fullname, $view, 60, 400);
break;
default:
case 'normal':
Graphs::vlan($vlan->rrdpath, $vlan->fullname, $view, 120, 800);
break;
}
}
$vlanid = Input::getVar('vlanid', INP_GET | INP_INT | INP_DEFAULT, 0);
if ($vlanid != 0) {
$vlan = Vlan::load($vlanid);
show($vlan);
} else {
$trunkid = Input::getVar('trunkid', INP_GET | INP_INT | INP_DEFAULT, 0);
$view = Input::getVar('view', INP_GET | INP_INT | INP_DEFAULT, 21600);
$trunks = Trunk::getAll();
if ($trunkid == 0) {
foreach ($trunks as $trunk) {
$trunkid = $trunk->id;
break;
}
}
$vlans = Vlan::getAll($trunkid);
$smarty = new MySmarty();
$smarty->assign('vlans', $vlans);
$smarty->assign('trunks', $trunks);
$smarty->assign('view', $view);
$smarty->assign('trunkid', $trunkid);
$smarty->assign('views', array(21600 => "6 hours", 86400 => "1 day", 604800 => "1 week"));
$smarty->displaySite('Statistics: Bridge VLANs', 'stat_vlan.tpl');
}
?>