Re-did everything, Now is modulaar and better bro.

This commit is contained in:
2025-05-16 20:02:49 -04:00
parent 5b50964d06
commit f8ada1d6d1
16 changed files with 1234 additions and 187 deletions

View File

@@ -0,0 +1,30 @@
<?php
require_once 'models/TicketModel.php';
class DashboardController {
private $ticketModel;
public function __construct($conn) {
$this->ticketModel = new TicketModel($conn);
}
public function index() {
// Get query parameters
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$limit = isset($_COOKIE['ticketsPerPage']) ? (int)$_COOKIE['ticketsPerPage'] : 15;
$status = isset($_GET['status']) ? $_GET['status'] : 'Open';
$sortColumn = isset($_COOKIE['defaultSortColumn']) ? $_COOKIE['defaultSortColumn'] : 'ticket_id';
$sortDirection = isset($_COOKIE['sortDirection']) ? $_COOKIE['sortDirection'] : 'desc';
// Get tickets with pagination
$result = $this->ticketModel->getAllTickets($page, $limit, $status, $sortColumn, $sortDirection);
// Extract data for the view
$tickets = $result['tickets'];
$totalTickets = $result['total'];
$totalPages = $result['pages'];
// Load the dashboard view
include 'views/DashboardView.php';
}
}