This commit is contained in:
Flatlogic Bot 2026-04-09 02:54:28 +00:00
parent 2944f9f509
commit ac0f445252

View File

@ -133,9 +133,14 @@ $search_per_page = 10;
$search_results = []; $search_results = [];
$search_total_results = 0; $search_total_results = 0;
$search_total_pages = 0; $search_total_pages = 0;
$configured_matches = [];
if ($search !== '') { if ($search !== '') {
$search_where = "FROM tbl_scobjs WHERE cl_scobjs_name LIKE :search AND cl_scobjs_id NOT IN (SELECT cl_scmining_obj_id FROM tbl_scmining)"; $stmt_configured = $db->prepare("SELECT o.* FROM tbl_scobjs o JOIN tbl_scmining m ON m.cl_scmining_obj_id = o.cl_scobjs_id WHERE o.cl_scobjs_name LIKE :search ORDER BY o.cl_scobjs_name ASC, o.cl_scobjs_id ASC");
$stmt_configured->execute(['search' => "%$search%"]);
$configured_matches = $stmt_configured->fetchAll();
$search_where = "FROM tbl_scobjs o WHERE o.cl_scobjs_name LIKE :search AND o.cl_scobjs_id NOT IN (SELECT cl_scmining_obj_id FROM tbl_scmining)";
$stmt_search_count = $db->prepare("SELECT COUNT(*) " . $search_where); $stmt_search_count = $db->prepare("SELECT COUNT(*) " . $search_where);
$stmt_search_count->execute(['search' => "%$search%"]); $stmt_search_count->execute(['search' => "%$search%"]);
@ -144,7 +149,7 @@ if ($search !== '') {
$search_page = min($search_page, $search_total_pages); $search_page = min($search_page, $search_total_pages);
$search_offset = ($search_page - 1) * $search_per_page; $search_offset = ($search_page - 1) * $search_per_page;
$stmt_search = $db->prepare("SELECT * " . $search_where . " ORDER BY cl_scobjs_name ASC, cl_scobjs_id ASC LIMIT :limit OFFSET :offset"); $stmt_search = $db->prepare("SELECT o.* " . $search_where . " ORDER BY o.cl_scobjs_name ASC, o.cl_scobjs_id ASC LIMIT :limit OFFSET :offset");
$stmt_search->bindValue(':search', "%$search%", PDO::PARAM_STR); $stmt_search->bindValue(':search', "%$search%", PDO::PARAM_STR);
$stmt_search->bindValue(':limit', $search_per_page, PDO::PARAM_INT); $stmt_search->bindValue(':limit', $search_per_page, PDO::PARAM_INT);
$stmt_search->bindValue(':offset', $search_offset, PDO::PARAM_INT); $stmt_search->bindValue(':offset', $search_offset, PDO::PARAM_INT);
@ -153,7 +158,7 @@ if ($search !== '') {
} }
// Fetch current mining list // Fetch current mining list
$sql_list = "SELECT m.*, o.cl_scobjs_name, o.cl_scobjs_uuid, o.cl_scobjs_type, o.cl_scobjs_subtype, o.cl_scobjs_rarity $sql_list = "SELECT m.*, o.cl_scobjs_name, o.cl_scobjs_uuid, o.cl_scobjs_type, o.cl_scobjs_subtype, o.cl_scobjs_rarity
FROM tbl_scmining m FROM tbl_scmining m
JOIN tbl_scobjs o ON m.cl_scmining_obj_id = o.cl_scobjs_id JOIN tbl_scobjs o ON m.cl_scmining_obj_id = o.cl_scobjs_id
ORDER BY o.cl_scobjs_name ASC"; ORDER BY o.cl_scobjs_name ASC";
@ -361,7 +366,33 @@ $current_session_user = $_SESSION['user'] ?? '';
.search-result-info { flex: 1; } .search-result-info { flex: 1; }
.search-result-name { display: block; color: var(--primary); font-weight: bold; } .search-result-name { display: block; color: var(--primary); font-weight: bold; }
.search-result-uuid { display: block; font-size: 0.75rem; color: #777; font-family: monospace; word-break: break-all; margin-top: 2px; }
.search-result-meta { display: block; font-size: 0.75rem; color: #888; } .search-result-meta { display: block; font-size: 0.75rem; color: #888; }
.search-results-section { margin-bottom: 1.25rem; }
.search-results-caption {
margin: 0 0 0.75rem;
font-size: 0.78rem;
color: #9a9a9a;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.search-result-item.is-configured {
border-color: rgba(162, 155, 120, 0.35);
background: rgba(162, 155, 120, 0.08);
}
.search-result-badge {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.35rem 0.65rem;
border-radius: 999px;
border: 1px solid rgba(162, 155, 120, 0.35);
color: var(--primary);
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.04em;
white-space: nowrap;
}
.search-results-summary { .search-results-summary {
margin-bottom: 1rem; margin-bottom: 1rem;
font-size: 0.8rem; font-size: 0.8rem;
@ -457,6 +488,27 @@ $current_session_user = $_SESSION['user'] ?? '';
<?php if ($search !== ''): ?> <?php if ($search !== ''): ?>
<div class="search-results"> <div class="search-results">
<?php if (!empty($configured_matches)): ?>
<div class="search-results-section">
<div class="search-results-caption">Déjà configuré<?php echo count($configured_matches) > 1 ? 's' : ''; ?> pour cette recherche</div>
<?php foreach ($configured_matches as $configured):
if (is_array($configured) && isset($configured['cl_scobjs_uuid']) && isset($configured['cl_scobjs_name']) && isset($configured['cl_scobjs_type']) && isset($configured['cl_scobjs_subtype'])) {
$configured_rarity_code = $configured['cl_scobjs_rarity'] ?? '';
$configured_rarity_class = sc_rarity_class($configured_rarity_code);
?>
<div class="search-result-item is-configured">
<img src="https://cstone.space/uifimages/<?php echo $configured['cl_scobjs_uuid']; ?>.png" class="item-preview" alt="">
<div class="search-result-info">
<span class="search-result-name <?php echo htmlspecialchars($configured_rarity_class); ?>" style="<?php echo htmlspecialchars(sc_rarity_style($configured_rarity_code)); ?>"><?php echo htmlspecialchars($configured['cl_scobjs_name']); ?></span>
<span class="search-result-uuid">UUID: <?php echo htmlspecialchars($configured['cl_scobjs_uuid']); ?></span>
<span class="search-result-meta"><?php echo htmlspecialchars($configured['cl_scobjs_type']); ?> / <?php echo htmlspecialchars($configured['cl_scobjs_subtype']); ?> — déjà présent dans Configuration Minerais</span>
</div>
<span class="search-result-badge">Déjà configuré</span>
</div>
<?php } endforeach; ?>
</div>
<?php endif; ?>
<?php if (empty($search_results)): ?> <?php if (empty($search_results)): ?>
<p style="text-align: center; color: #666;">Aucun objet non listé trouvé.</p> <p style="text-align: center; color: #666;">Aucun objet non listé trouvé.</p>
<?php else: ?> <?php else: ?>
@ -474,6 +526,7 @@ $current_session_user = $_SESSION['user'] ?? '';
<img src="https://cstone.space/uifimages/<?php echo $res['cl_scobjs_uuid']; ?>.png" class="item-preview" alt=""> <img src="https://cstone.space/uifimages/<?php echo $res['cl_scobjs_uuid']; ?>.png" class="item-preview" alt="">
<div class="search-result-info"> <div class="search-result-info">
<span class="search-result-name <?php echo htmlspecialchars($rarity_class); ?>" style="<?php echo htmlspecialchars(sc_rarity_style($rarity_code)); ?>"><?php echo htmlspecialchars($res['cl_scobjs_name']); ?></span> <span class="search-result-name <?php echo htmlspecialchars($rarity_class); ?>" style="<?php echo htmlspecialchars(sc_rarity_style($rarity_code)); ?>"><?php echo htmlspecialchars($res['cl_scobjs_name']); ?></span>
<span class="search-result-uuid">UUID: <?php echo htmlspecialchars($res['cl_scobjs_uuid']); ?></span>
<span class="search-result-meta"><?php echo htmlspecialchars($res['cl_scobjs_type']); ?> / <?php echo htmlspecialchars($res['cl_scobjs_subtype']); ?></span> <span class="search-result-meta"><?php echo htmlspecialchars($res['cl_scobjs_type']); ?> / <?php echo htmlspecialchars($res['cl_scobjs_subtype']); ?></span>
</div> </div>
<form method="post"> <form method="post">