0) { $where[] = "dt.id = ?"; $types .= "i"; $params[] = $typeId; } if ($locationId > 0) { $where[] = "l.id = ?"; $types .= "i"; $params[] = $locationId; } if ($floorId > 0) { $where[] = "f.id = ?"; $types .= "i"; $params[] = $floorId; } if ($rackId > 0) { $where[] = "r.id = ?"; $types .= "i"; $params[] = $rackId; } $whereSql = $where ? 'WHERE ' . implode(' AND ', $where) : ''; // ========================= // Geräte laden (inkl. Status-Aggregate) // ========================= $devices = $sql->get( " SELECT d.id, d.name, d.serial_number, d.rack_position_he, d.rack_height_he, dt.name AS device_type, dt.image_path, dt.image_type, l.name AS location_name, f.name AS floor_name, r.name AS rack_name, COUNT(dp.id) AS total_ports, SUM(dp.status = 'active') AS active_ports, SUM(c.id IS NOT NULL) AS connected_ports FROM devices d JOIN device_types dt ON dt.id = d.device_type_id LEFT JOIN racks r ON r.id = d.rack_id LEFT JOIN floors f ON f.id = r.floor_id LEFT JOIN buildings b ON b.id = f.building_id LEFT JOIN locations l ON l.id = b.location_id LEFT JOIN device_ports dp ON dp.device_id = d.id LEFT JOIN connections c ON (c.port_a_type = 'device' AND c.port_a_id = dp.id) OR (c.port_b_type = 'device' AND c.port_b_id = dp.id) $whereSql GROUP BY d.id ORDER BY l.name, f.level, r.name, d.rack_position_he, d.name ", $types, $params ); // ========================= // Filter-Daten laden // ========================= $deviceTypes = $sql->get("SELECT id, name FROM device_types ORDER BY name", "", []); $locations = $sql->get("SELECT id, name FROM locations ORDER BY name", "", []); $floors = $sql->get("SELECT id, name FROM floors ORDER BY level", "", []); $racks = $sql->get("SELECT id, name FROM racks ORDER BY name", "", []); ?>

Geräte

+ Neues Gerät
Vorschau Name Typ Standort Rack HE Ports Aktionen


/
frei
Ports Bearbeiten Löschen

Keine Geräte gefunden.