Added discord webhooks, better filtering, and automated ticket creation
This commit is contained in:
@ -26,14 +26,21 @@ $defaultSortColumn = isset($_COOKIE['defaultSortColumn']) ? $_COOKIE['defaultSor
|
||||
$sortDirection = isset($_COOKIE['sortDirection']) ? $_COOKIE['sortDirection'] : 'desc';
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
// Get total number of tickets
|
||||
$totalTicketsQuery = "SELECT COUNT(*) as total FROM tickets";
|
||||
// Get total number of tickets based on current filter
|
||||
$status = isset($_GET['status']) ? $_GET['status'] : 'Open';
|
||||
$statuses = explode(',', $status);
|
||||
$whereClause = "";
|
||||
if (isset($_GET['status']) && !empty($_GET['status'])) {
|
||||
$statuses = explode(',', $_GET['status']);
|
||||
$whereClause = "WHERE status IN ('" . implode("','", $statuses) . "')";
|
||||
}
|
||||
$totalTicketsQuery = "SELECT COUNT(*) as total FROM tickets $whereClause";
|
||||
$totalTicketsResult = $conn->query($totalTicketsQuery);
|
||||
$totalTickets = $totalTicketsResult->fetch_assoc()['total'];
|
||||
$totalPages = ceil($totalTickets / $limit);
|
||||
|
||||
// Modify SQL to use these settings
|
||||
$sql = "SELECT * FROM tickets ORDER BY $defaultSortColumn $sortDirection LIMIT $limit OFFSET $offset";
|
||||
// Modify SQL to use these settings and filter
|
||||
$sql = "SELECT * FROM tickets $whereClause ORDER BY $defaultSortColumn $sortDirection LIMIT $limit OFFSET $offset";
|
||||
$result = $conn->query($sql);
|
||||
?>
|
||||
|
||||
@ -62,18 +69,18 @@ $result = $conn->query($sql);
|
||||
<?php
|
||||
// Previous page button
|
||||
if ($page > 1) {
|
||||
echo "<button onclick='window.location.href=\"?page=" . ($page - 1) . "\"'>«</button>";
|
||||
echo "<button onclick='window.location.href=\"?page=" . ($page - 1) . "&status=$status\"'>«</button>";
|
||||
}
|
||||
|
||||
// Page number buttons
|
||||
for ($i = 1; $i <= $totalPages; $i++) {
|
||||
$activeClass = ($i === $page) ? 'active' : '';
|
||||
echo "<button class='$activeClass' onclick='window.location.href=\"?page=$i\"'>$i</button>";
|
||||
echo "<button class='$activeClass' onclick='window.location.href=\"?page=$i&status=$status\"'>$i</button>";
|
||||
}
|
||||
|
||||
// Next page button
|
||||
if ($page < $totalPages) {
|
||||
echo "<button onclick='window.location.href=\"?page=" . ($page + 1) . "\"'>»</button>";
|
||||
echo "<button onclick='window.location.href=\"?page=" . ($page + 1) . "&status=$status\"'>»</button>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user