infrastruktur
This commit is contained in:
57
app/modules/floor_infrastructure/save.php
Normal file
57
app/modules/floor_infrastructure/save.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* app/modules/floor_infrastructure/save.php
|
||||
*
|
||||
* Speichert Patchpanel- und Wandbuchsen-Einträge
|
||||
*/
|
||||
|
||||
$type = $_POST['type'] ?? '';
|
||||
$id = (int)($_POST['id'] ?? 0);
|
||||
|
||||
if ($type === 'patchpanel') {
|
||||
$name = trim($_POST['name'] ?? '');
|
||||
$floorId = (int)($_POST['floor_id'] ?? 0);
|
||||
$posX = (int)($_POST['pos_x'] ?? 0);
|
||||
$posY = (int)($_POST['pos_y'] ?? 0);
|
||||
$width = (int)($_POST['width'] ?? 0);
|
||||
$height = (int)($_POST['height'] ?? 0);
|
||||
$portCount = (int)($_POST['port_count'] ?? 0);
|
||||
$comment = trim($_POST['comment'] ?? '');
|
||||
|
||||
if ($id > 0) {
|
||||
$sql->set(
|
||||
"UPDATE floor_patchpanels SET name = ?, floor_id = ?, pos_x = ?, pos_y = ?, width = ?, height = ?, port_count = ?, comment = ? WHERE id = ?",
|
||||
"siiiiisii",
|
||||
[$name, $floorId, $posX, $posY, $width, $height, $portCount, $comment, $id]
|
||||
);
|
||||
} else {
|
||||
$sql->set(
|
||||
"INSERT INTO floor_patchpanels (name, floor_id, pos_x, pos_y, width, height, port_count, comment) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
||||
"siiiiiss",
|
||||
[$name, $floorId, $posX, $posY, $width, $height, $portCount, $comment]
|
||||
);
|
||||
}
|
||||
} elseif ($type === 'outlet') {
|
||||
$name = trim($_POST['name'] ?? '');
|
||||
$roomId = (int)($_POST['room_id'] ?? 0);
|
||||
$x = (int)($_POST['x'] ?? 0);
|
||||
$y = (int)($_POST['y'] ?? 0);
|
||||
$comment = trim($_POST['comment'] ?? '');
|
||||
|
||||
if ($id > 0) {
|
||||
$sql->set(
|
||||
"UPDATE network_outlets SET name = ?, room_id = ?, x = ?, y = ?, comment = ? WHERE id = ?",
|
||||
"siiisi",
|
||||
[$name, $roomId, $x, $y, $comment, $id]
|
||||
);
|
||||
} else {
|
||||
$sql->set(
|
||||
"INSERT INTO network_outlets (name, room_id, x, y, comment) VALUES (?, ?, ?, ?, ?)",
|
||||
"siiis",
|
||||
[$name, $roomId, $x, $y, $comment]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: ?module=floor_infrastructure&action=list');
|
||||
exit;
|
||||
Reference in New Issue
Block a user