0) { $where[] = 'd.device_type_id = ?'; $types .= 'i'; $params[] = $typeId; } if ($floorId > 0) { $where[] = 'f.id = ?'; $types .= 'i'; $params[] = $floorId; } if ($rackId > 0) { $where[] = 'd.rack_id = ?'; $types .= 'i'; $params[] = $rackId; } $whereSql = $where ? 'WHERE ' . implode(' AND ', $where) : ''; // ========================= // Geraete laden // ========================= $devices = $sql->get( " SELECT d.id, d.name, d.serial_number, d.rack_position_he, d.rack_height_he, d.web_config_url, dt.name AS device_type, dt.image_path, f.name AS floor_name, r.name AS rack_name, ( SELECT COUNT(*) FROM device_ports dp WHERE dp.device_id = d.id ) AS port_count, ( SELECT COUNT(*) FROM device_ports dp WHERE dp.device_id = d.id AND dp.status = 'active' ) AS active_port_count, ( SELECT COUNT(*) FROM device_ports dp WHERE dp.device_id = d.id AND dp.status = 'disabled' ) AS disabled_port_count, ( SELECT COUNT(*) FROM device_ports dp WHERE dp.device_id = d.id AND dp.vlan_config IS NOT NULL AND dp.vlan_config <> '[]' ) AS vlan_port_count, ( SELECT COUNT(*) FROM device_port_modules dpm JOIN device_ports dp2 ON dp2.id = dpm.device_port_id WHERE dp2.device_id = d.id ) AS module_count, ( SELECT COUNT(*) FROM connections c WHERE ((c.port_a_type = 'device' OR c.port_a_type = 'device_ports') AND c.port_a_id IN ( SELECT dp3.id FROM device_ports dp3 WHERE dp3.device_id = d.id )) OR ((c.port_b_type = 'device' OR c.port_b_type = 'device_ports') AND c.port_b_id IN ( SELECT dp4.id FROM device_ports dp4 WHERE dp4.device_id = d.id )) ) AS connection_count 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 $whereSql ORDER BY f.name, 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', '', []); $floors = $sql->get('SELECT id, name FROM floors ORDER BY name', '', []); $racks = $sql->get('SELECT id, name FROM racks ORDER BY name', '', []); ?>
Gefundene Geraete:
| Name | Typ | Stockwerk | Rack | Position (HE) | Ports | Seriennummer | Webconfig | Aktionen |
|---|---|---|---|---|---|---|---|---|
|
gesamt aktiv / inaktiv VLAN gesetzt: |
Webconfig - | Bearbeiten Loeschen |
Keine Geraete gefunden.