121 lines
5.1 KiB
PHP
121 lines
5.1 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
|
|
$stmt = db()->query('SELECT * FROM students ORDER BY lastName, firstName');
|
|
$students = $stmt->fetchAll();
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Students Management</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="d-flex">
|
|
<!-- Sidebar -->
|
|
<div class="sidebar d-flex flex-column p-3">
|
|
<a href="/" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-white text-decoration-none">
|
|
<i class="bi bi-exclude me-2"></i>
|
|
<span class="fs-4">Admin Panel</span>
|
|
</a>
|
|
<hr>
|
|
<ul class="nav nav-pills flex-column mb-auto">
|
|
<li class="nav-item">
|
|
<a href="index.php" class="nav-link text-white" aria-current="page">
|
|
<i class="bi bi-speedometer2 me-2"></i>
|
|
Dashboard
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="students.php" class="nav-link active">
|
|
<i class="bi bi-people me-2"></i>
|
|
Students
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="#" class="nav-link text-white disabled">
|
|
<i class="bi bi-calendar-event me-2"></i>
|
|
Academic Years
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="#" class="nav-link text-white disabled">
|
|
<i class="bi bi-building me-2"></i>
|
|
Grades & Classrooms
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="#" class="nav-link text-white disabled">
|
|
<i class="bi bi-person-badge me-2"></i>
|
|
Enrollments
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<a href="#" class="nav-link text-white disabled">
|
|
<i class="bi bi-journal-bookmark me-2"></i>
|
|
Subjects
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<hr>
|
|
</div>
|
|
|
|
<!-- Main content -->
|
|
<main class="main-content p-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h3 mb-0 text-gray-800">Students Management</h1>
|
|
<a href="add_student.php" class="btn btn-primary"><i class="bi bi-plus-circle me-2"></i>Add Student</a>
|
|
</div>
|
|
|
|
<?php if (isset($_GET['success'])): ?>
|
|
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
|
Student added successfully!
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<table class="table table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>Student Code</th>
|
|
<th>First Name</th>
|
|
<th>Last Name</th>
|
|
<th>Gender</th>
|
|
<th>Date of Birth</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (empty($students)): ?>
|
|
<tr>
|
|
<td colspan="5" class="text-center">No students found.</td>
|
|
</tr>
|
|
<?php else: ?>
|
|
<?php foreach ($students as $student): ?>
|
|
<tr>
|
|
<td><?= htmlspecialchars($student['studentCode']) ?></td>
|
|
<td><?= htmlspecialchars($student['firstName']) ?></td>
|
|
<td><?= htmlspecialchars($student['lastName']) ?></td>
|
|
<td><?= htmlspecialchars($student['gender']) ?></td>
|
|
<td><?= htmlspecialchars($student['dateOfBirth']) ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|