-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadmin_student_by_batch.php
137 lines (109 loc) · 3.97 KB
/
admin_student_by_batch.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
session_start();
require_once "assets/connect/pdo.php";
if (!isset($_SESSION['Admin_ID'])) {
header("Location: admin_login.php");
return;
}
$no_data = '';
//getting the data by query parameter
if (isset($_GET['batch'])) {
$batch = $_GET['batch'];
$stmt = $pdo->query("SELECT * from Student WHERE Batch = $batch ORDER BY Student_ID");
$infos = $stmt->fetchAll(PDO::FETCH_ASSOC);
// counting
$stmt2 = $pdo->query("SELECT COUNT(Section), Section, Batch from Student WHERE Batch = $batch GROUP BY Section");
$sections = $stmt2->fetchAll(PDO::FETCH_ASSOC);
} else {
$no_data = '<h5 class="alert alert-danger">No data available.</h5>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
//Head Links
require_once 'assets/connect/head.php';
?>
</head>
<body>
<header>
<nav class="navbar navbar-expand-lg navbar-light sticky-top">
<div class="container justify-content-start">
<a class="navbar-brand" href="index.php"><img id="logo" src="assets/images/LuExamHiveLogo.png" height="30px"> LU EXAM HIVE</a>
<a type="button" href="javascript:history.back(1)" class="btn btn-sm btn-outline-dark ml-3"><i class="fas fa-arrow-left"></i> Go Back</a>
</div>
</nav>
</header>
<main>
<div class="container">
<div class="row mt-4">
<div class="col">
<h3 class="display-4">Student Info by Batch</h3>
</div>
</div>
<div class="row mt-4">
<div class="col"></div>
<div class="col-7">
<table class="table text-center">
<thead class="table-dark">
<tr>
<th scope="col" colspan="12">Sort by Section</th>
</tr>
</thead>
<tbody>
<?php foreach ($sections as $sec) {?>
<td><a href="admin_student_by_section.php?batch=<?php echo $sec['Batch']; ?>§ion=<?php echo $sec['Section']; ?>">Sec: <?php echo htmlspecialchars($sec['Section']); ?></a></td>
<?php }?>
</tbody>
</table>
</div>
<div class="col"></div>
</div>
<div class="row">
<div class="col"></div>
<div class="col-xl-10 col-lg-10 col-md-10 col-sm-9 col-xs-6 my-5 table-responsive-sm">
<table class="table table-hover text-center">
<thead class="table-secondary">
<tr class='bg-success text-white'>
<th scope="col">Student Id</th>
<th scope="col">Name</th>
<th scope="col">Section</th>
<th scope="col">Batch</th>
<th scope="col">Email</th>
<th scope="col">Status</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($infos as $info) {?>
<tr onclick="window.location='admin_student_details.php?id=<?php echo $info['Student_ID'] ?>';">
<th scope="row"><?php echo htmlspecialchars($info['Student_ID']); ?></th>
<td><?php echo htmlspecialchars($info['FirstName'] . ' ' . $info['LastName']); ?></td>
<td><?php echo htmlspecialchars($info['Section']); ?></td>
<td><?php echo htmlspecialchars($info['Batch']); ?></td>
<td><?php echo htmlspecialchars($info['Student_Email']); ?></td>
<td><span class="<?php if ($info['Student_Email_Status'] != 'verified') {
$status = 'text-danger';
} else {
$status = 'text-success';
}
echo $status?>"><?php echo htmlspecialchars($info['Student_Email_Status']); ?></span></td>
<td><a href="admin_student_details.php?id=<?php echo $info['Student_ID'] ?>">More info</a></td>
</tr>
<?php }?>
<?php echo $no_data; ?>
</tbody>
</table>
</div>
<div class="col"></div>
</div>
</div>
</main>
<!--footer Start -->
<?php
require_once 'assets/connect/footer.php';
?>
<!--footer End -->
</body>
</html>