';
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;
$popTitle = htmlspecialchars($cable['cable_name'], ENT_QUOTES);
$popContent = '
Ports: ' . $cable['port_start'] . '-' . $cable['port_end'];
if (!empty($cable['fiber_start'])) {
$popContent .= '
Fasern: ' . $cable['fiber_start'] . '-' . $cable['fiber_end'];
}
if (!empty($cable['description'])) {
$popContent .= '
' . htmlspecialchars($cable['description'], ENT_QUOTES) . '
';
}
$narrowClass = ($cableWidth < 12) ? 'narrow' : '';
$cellContent .= '
';
$fontSize = ($cableWidth < 10) ? '10px' : 'inherit';
$cellContent .= '
' . $cable['cable_name'] . "";
if (!empty($cable['description'])) {
$descVisibilityClass = ($cableWidth <= 20) ? 'hide-if-narrow' : '';
$cellContent .= '
' . htmlspecialchars($cable['description'], ENT_QUOTES) . '';
}
$rangesVisibilityClass = ($cableWidth <= 5) ? 'hide-if-narrow' : '';
$infoSize = '10px';
$infoGap = '8px';
if ($cableWidth < 8) { $infoSize = '8px'; $infoGap = '1px'; }
elseif ($cableWidth < 15) { $infoSize = '9px'; $infoGap = '3px'; }
$toolStyle = 'font-size: ' . $infoSize . '; white-space: nowrap;';
$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'] = '