(int)($f_poe_ins[$save_id] ?? 0), 'poe_out' => (int)($f_poe_outs[$save_id] ?? 0), 'nagios_template' => trim($f_nagios[$save_id] ?? '') ]; if ($save_id >= 10000) { $new['vendor_id'] = (int)($f_vendors[$save_id] ?? 1); $new['model_name'] = trim($f_names[$save_id] ?? ''); } update_record($db_link, "device_models", "id = ?", $new, [$save_id]); } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } if (getPOST("remove")) { $f_ids = getPOST("f_id", null, []); if (!empty($f_ids) && is_array($f_ids)) { $f_ids = array_map('intval', array_filter($f_ids, fn($id) => $id >= 10000)); foreach ($f_ids as $id) { // set default - Unknown computer update_records($db_link, "devices", "device_model_id = ?", ['device_model_id' => 87], [$id]); delete_record($db_link, "device_models", "id = ?", [$id]); } } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } if (getPOST("create")) { $model_name = trim(getPOST("new_model", null, '')); if ($model_name !== '') { $max_record = get_record_sql($db_link, "SELECT MAX(id) AS max_id FROM device_models"); $f_vendor_id = (int)getPOST("new_vendor_id", null, 1); $next_id = (isset($max_record['max_id']) && $max_record['max_id'] >= 10000) ? (int)$max_record['max_id'] + 1 : 10000; $new = [ 'id' => $next_id, 'vendor_id' => (int)($f_vendor_id ?? 1), 'model_name' => $model_name ]; insert_record($db_link, "device_models", $new); } header("Location: " . $_SERVER["REQUEST_URI"]); exit; } unset($_POST); require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php"); print_control_submenu($page_url); ?>

$total) { $page = $total; } if ($page < 1) { $page = 1; } $start = ($page * $displayed) - $displayed; print_navigation($page_url, $page, $displayed, $count_records, $total); $sql = "SELECT * FROM device_models $filter ORDER BY vendor_id, model_name LIMIT ? OFFSET ?"; $params[] = $displayed; $params[] = $start; $t_models = get_records_sql($db_link, $sql, $params); ?>
\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } ?>
Id
"; echo ""; echo "{$row['id']}"; print_vendor_set($db_link, "f_vendor[{$row['id']}]", $row['vendor_id'], $is_system); echo ""; echo ""; echo ""; print_qa_select("f_poe_in[{$row['id']}]", $row['poe_in']); echo ""; print_qa_select("f_poe_out[{$row['id']}]", $row['poe_out']); echo ""; echo ""; echo "
> $r['id'] >= 10000)) echo 'disabled'; ?>>