';
echo '| Vlan ' . $vlan['vlan'] . ' | ';
echo '' . $vlan['vlan_name'] . ' | ';
if ($vlan['state'] == 'blocking') {
$class = 'red';
} elseif ($vlan['state'] == 'forwarding') {
$class = 'green';
} else {
$class = 'none';
}
echo '' . $vlan['cost'] . ' | ' . $vlan['priority'] . " | " . $vlan['state'] . ' | ';
$traverse_ifvlan = true;
$vlan_ports = [];
$otherports = dbFetchRows('SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.port_id = V.port_id', [$device['device_id'], $vlan['vlan']]);
foreach ($otherports as $otherport) {
if ($otherport['untagged']) {
$traverse_ifvlan = false;
}
$vlan_ports[$otherport['ifIndex']] = $otherport;
}
if ($traverse_ifvlan) {
$otherports = dbFetchRows(
'SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?',
[$device['device_id'], $vlan['vlan']]
);
foreach ($otherports as $otherport) {
$vlan_ports[$otherport['ifIndex']] = array_merge($otherport, ['untagged' => '1']);
}
}
ksort($vlan_ports);
echo '';
$vsep = '';
foreach ($vlan_ports as $otherport) {
$otherport = cleanPort($otherport);
echo $vsep . generate_port_link($otherport, makeshortif($otherport['ifDescr']));
if ($otherport['untagged']) {
echo '(U)';
}
$vsep = ', ';
}
echo ' | ';
echo '
';
}//end foreach
echo '';