';
if (!empty($slots['cables'])) {
usort($slots['cables'], function ($a, $b) {
return $a['port_start'] <=> $b['port_start'];
});
$lastPort = 0;
foreach ($slots['cables'] as $cable) {
$freePorts = $cable['port_start'] - $lastPort - 1;
if ($freePorts > 0) {
$freeWidth = ($freePorts / $slots['ports']) * 100;
$cellContent .= '
Ports ' . ($lastPort + 1) . '-' . ($cable['port_start'] - 1) . ' frei
';
}
$portCount = $cable['port_end'] - $cable['port_start'] + 1;
$cableWidth = ($portCount / $slots['ports']) * 100;
$cableTitle = htmlspecialchars($cable['cable_name'] . ' (Ports ' . $cable['port_start'] . '-' . $cable['port_end'] . ')', ENT_QUOTES);
if (!empty($cable['description'])) {
$cableTitle .= ' | ' . htmlspecialchars($cable['description'], ENT_QUOTES);
}
$cellContent .= '
';
$cellContent .= '
' . $cable['cable_name'] . "";
if (!empty($cable['description'])) {
$cellContent .= '
' . htmlspecialchars($cable['description'], ENT_QUOTES) . '';
}
$cellContent .= '
';
$cellContent .= 'P: ' . $cable['port_start'] . '-' . $cable['port_end'] . '';
if (!empty($cable['fiber_start'])) {
$cellContent .= 'F: ' . $cable['fiber_start'] . '-' . $cable['fiber_end'] . "";
}
$cellContent .= '
';
$cellContent .= '
';
$lastPort = $cable['port_end'];
}
$remainingPorts = $slots['ports'] - $lastPort;
if ($remainingPorts > 0) {
$remainingWidth = ($remainingPorts / $slots['ports']) * 100;
$cellContent .= '
P: ' . ($lastPort + 1) . '-' . $slots['ports'] . ' frei
';
}
} else {
$cellContent .= '
Ports ' . '1 -' . $slots['ports'] . ' frei';
}
$cellContent .= '
';
$slots['modulname'] = $cellContent;
$extTextspan = "";
} else if ($slots['type'] == '1') {
$slots['modulname'] = '