prepare("SELECT cl_scobjs_id FROM tbl_scobjs WHERE cl_scobjs_uuid = :uuid"); $stmt_insert = $db->prepare("INSERT INTO tbl_scobjs (cl_scobjs_name, cl_scobjs_type, cl_scobjs_subtype, cl_scobjs_uuid, cl_scobjs_rarity, cl_scobjs_about) VALUES (:name, :type, :subtype, :uuid, '', :about)"); $stmt_update = $db->prepare("UPDATE tbl_scobjs SET cl_scobjs_name = :name, cl_scobjs_type = :type, cl_scobjs_subtype = :subtype, cl_scobjs_about = :about WHERE cl_scobjs_uuid = :uuid"); foreach ($items as $item) { $uuid = $item['reference'] ?? ($item['stdItem']['UUID'] ?? ''); if (!$uuid) continue; $manufacturer = $item['manufacturer'] ?? ($item['stdItem']['Manufacturer']['Code'] ?? ''); $raw_name = $item['stdItem']['Name'] ?? ''; $name = ($manufacturer && strpos($raw_name, $manufacturer) === false) ? "[$manufacturer] $raw_name" : $raw_name; $type = $item['type'] ?? ''; $subtype = $item['subType'] ?? ''; $about = $item['stdItem']['Description'] ?? ''; $stmt_check->execute(['uuid' => $uuid]); if ($stmt_check->fetch()) { $stmt_update->execute([ 'name' => $name, 'type' => $type, 'subtype' => $subtype, 'about' => $about, 'uuid' => $uuid ]); $count_updated++; } else { $stmt_insert->execute([ 'name' => $name, 'type' => $type, 'subtype' => $subtype, 'uuid' => $uuid, 'about' => $about ]); $count_new++; } } auth_flash_set('success', "Importation terminée : $count_new nouveaux, $count_updated mis à jour."); } } header('Location: scitems.php'); exit; } if ($action === 'update_item') { $id = (int)$_POST['id']; $rarity = trim($_POST['rarity'] ?? ''); $about = trim($_POST['about'] ?? ''); $stmt = $db->prepare("UPDATE tbl_scobjs SET cl_scobjs_rarity = :rarity, cl_scobjs_about = :about WHERE cl_scobjs_id = :id"); $stmt->execute(['rarity' => $rarity, 'about' => $about, 'id' => $id]); auth_flash_set('success', 'Objet mis à jour.'); header('Location: scitems.php?page=' . $page . '&search=' . urlencode($search)); exit; } } // Fetch data $stmt_count = $db->prepare("SELECT COUNT(*) FROM tbl_scobjs WHERE $where"); $stmt_count->execute($params); $total_items = $stmt_count->fetchColumn(); $total_pages = ceil($total_items / $limit); $stmt_list = $db->prepare("SELECT * FROM tbl_scobjs WHERE $where ORDER BY cl_scobjs_id DESC LIMIT $limit OFFSET $offset"); $stmt_list->execute($params); $items_list = $stmt_list->fetchAll(); $edit_item = null; if (isset($_GET['edit'])) { $stmt_edit = $db->prepare("SELECT * FROM tbl_scobjs WHERE cl_scobjs_id = :id"); $stmt_edit->execute(['id' => (int)$_GET['edit']]); $edit_item = $stmt_edit->fetch(); } $current_session_user = $_SESSION['user_name'] ?? 'Admin'; ?> Admin - Base d'Objets

R.E.A.C.T. Objects Control

Niveau d'accès : Administrateur | Session :

Importation JSON

Editer Objet

X

Base de Données d'Objets entrées

Reset
Aperçu Nom / UUID / Type About Actions
Aucun objet trouvé.
Edit
1): ?>