";
if ($ent['entPhysicalClass'] == 'chassis') {
echo ' ';
} elseif ($ent['entPhysicalClass'] == 'module') {
echo ' ';
} elseif ($ent['entPhysicalClass'] == 'port') {
echo ' ';
} elseif ($ent['entPhysicalClass'] == 'container') {
echo ' ';
} elseif ($ent['entPhysicalClass'] == 'sensor') {
echo ' ';
$sensor = dbFetchRow('SELECT * FROM `sensors` WHERE `device_id` = ? AND (`entPhysicalIndex` = ? OR `sensor_index` = ?)', [$device['device_id'], $ent['entPhysicalIndex'], $ent['entPhysicalIndex']]);
if (count($sensor)) {
$link = "', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\">";
}
} elseif ($ent['entPhysicalClass'] == 'backplane') {
echo ' ';
} elseif ($ent['entPhysicalClass'] == 'stack') {
echo ' ';
} elseif ($ent['entPhysicalClass'] == 'powerSupply') {
echo ' ';
}
if ($ent['entPhysicalParentRelPos'] > '-1') {
echo '' . $ent['entPhysicalParentRelPos'] . '. ';
}
if (isset($link)) {
echo $link;
}
if ($ent['ifIndex']) {
$interface = get_port_by_ifIndex($device['device_id'], $ent['ifIndex']);
$interface = cleanPort($interface);
$ent['entPhysicalName'] = generate_port_link($interface);
}
if ($ent['entPhysicalModelName'] && $ent['entPhysicalName']) {
echo '' . $ent['entPhysicalModelName'] . ' (' . $ent['entPhysicalName'] . ')';
} elseif ($ent['entPhysicalModelName']) {
echo '' . $ent['entPhysicalModelName'] . '';
} elseif (is_numeric($ent['entPhysicalName']) && $ent['entPhysicalVendorType']) {
echo '' . $ent['entPhysicalName'] . ' ' . $ent['entPhysicalVendorType'] . '';
} elseif ($ent['entPhysicalName']) {
echo '' . $ent['entPhysicalName'] . '';
} elseif ($ent['entPhysicalDescr']) {
echo '' . $ent['entPhysicalDescr'] . '';
}
if ($ent['entPhysicalClass'] == 'sensor' && isset($sensor)) {
echo ' ';
echo $sensor['sensor_class'] == 'state' ? get_state_label($sensor) : get_sensor_label_color($sensor);
}
if (isset($link)) {
echo '';
unset($link);
}
// display entity state
$entState = dbFetchRow(
'SELECT * FROM `entityState` WHERE `device_id`=? && `entPhysical_id`=?',
[$device['device_id'], $ent['entPhysical_id']]
);
if (! empty($entState)) {
$display_states = [
// 'entStateAdmin',
'entStateOper',
'entStateUsage',
'entStateStandby',
];
foreach ($display_states as $state_name) {
$value = $entState[$state_name];
$display = parse_entity_state($state_name, $value);
echo " ";
echo $display['text'];
echo ' ';
}
// ignore none and unavailable alarms
if ($entState['entStateAlarm'] != '00' && $entState['entStateAlarm'] != '80') {
$alarms = parse_entity_state_alarm($entState['entStateAlarm']);
echo '
';
echo "Alarms: ";
foreach ($alarms as $alarm) {
echo " {$alarm['text']}";
}
echo '';
}
}
echo "