71 lines
2.5 KiB
PHP
71 lines
2.5 KiB
PHP
<?php
|
|
session_start();
|
|
|
|
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
|
|
header('Location: login.php');
|
|
exit();
|
|
}
|
|
|
|
require_once 'db/config.php';
|
|
$conn = db();
|
|
|
|
// Fetch pending events
|
|
$stmt = $conn->prepare("SELECT events.*, users.name as manager_name FROM events JOIN users ON events.created_by = users.id WHERE events.status = 'pending' ORDER BY events.created_at DESC");
|
|
$stmt->execute();
|
|
$events = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Admin Dashboard - EventPlatform</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<?php require_once './includes/header.php'; ?>
|
|
|
|
<div class="container mt-5">
|
|
<h1 class="mb-4">Admin Dashboard</h1>
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
Pending Events
|
|
</div>
|
|
<div class="card-body">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Event Name</th>
|
|
<th>Manager</th>
|
|
<th>Date</th>
|
|
<th>Location</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($events as $event): ?>
|
|
<tr>
|
|
<td><?php echo htmlspecialchars($event['name']); ?></td>
|
|
<td><?php echo htmlspecialchars($event['manager_name']); ?></td>
|
|
<td><?php echo htmlspecialchars($event['date']); ?></td>
|
|
<td><?php echo htmlspecialchars($event['location']); ?></td>
|
|
<td>
|
|
<a href="update_event_status.php?id=<?php echo $event['id']; ?>&status=accepted" class="btn btn-success btn-sm">Approve</a>
|
|
<a href="update_event_status.php?id=<?php echo $event['id']; ?>&status=rejected" class="btn btn-danger btn-sm">Reject</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|