-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadvisoryClass.php
More file actions
301 lines (261 loc) · 13.4 KB
/
Copy pathadvisoryClass.php
File metadata and controls
301 lines (261 loc) · 13.4 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<?php
session_start();
// Check if the user is logged in (session contains "id")
if (!isset($_SESSION["id"])) {
// Redirect to the login page if not logged in
header("Location: login.php"); // Replace with the actual login page
exit();
}
// Get the user's email from the session
$email = $_SESSION["id"]["email"]; // Assuming "email" is the column name in your database
// Connect to the database
$conn = new mysqli('localhost', 'root', '', 'userdb');
if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error);
}
$stmt = $conn->prepare("SELECT * FROM teachers WHERE email = ?");
$stmt->bind_param("s", $email);
$stmt->execute();
$result = $stmt->get_result();
$userInfo = $result->fetch_assoc();
// Close the database connection
$stmt->close();
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Teachers</title>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Calingatngan NHS</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.png">
<!-- Normalize CSS -->
<link rel="stylesheet" href="css/normalize.css">
<!-- Main CSS -->
<link rel="stylesheet" href="css/main.css">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Fontawesome CSS -->
<link rel="stylesheet" href="css/all.min.css">
<!-- Flaticon CSS -->
<link rel="stylesheet" href="fonts/flaticon.css">
<!-- Full Calender CSS -->
<link rel="stylesheet" href="css/fullcalendar.min.css">
<!-- Animate CSS -->
<link rel="stylesheet" href="css/animate.min.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="style.css">
<!-- Modernize js -->
<script src="js/modernizr-3.6.0.min.js"></script>
<!-- Flaticon added by me-->
<link rel='stylesheet' href='https://cdn-uicons.flaticon.com/uicons-solid-rounded/css/uicons-solid-rounded.css'>
</head>
<body>
<div class="card height-auto">
<div class="card-body">
<div class="heading-layout1">
<div class="item-title">
<h3>My Advisory Class: Grade <?php echo isset($userInfo["advisoryclass"]) ? $userInfo["advisoryclass"] : ''; ?> </h3>
</div>
<div class="dropdown">
<a class="dropdown-toggle" href="#" role="button" data-toggle="dropdown"
aria-expanded="false">...</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#"><i
class="fas fa-times text-orange-red"></i>Close</a>
<a class="dropdown-item" href="#"><i
class="fas fa-cogs text-dark-pastel-green"></i>Edit</a>
<a class="dropdown-item" href="#"><i
class="fas fa-redo-alt text-orange-peel"></i>Refresh</a>
</div>
</div>
</div>
<form class="mg-b-20">
<div class="row gutters-8">
<div class="col-3-xxxl col-xl-3 col-lg-3 col-12 form-group">
<input type="text" placeholder="Search by LRN ..." class="form-control">
</div>
<div class="col-4-xxxl col-xl-4 col-lg-3 col-12 form-group">
<input type="text" placeholder="Search by Name ..." class="form-control">
</div>
<div class="col-4-xxxl col-xl-3 col-lg-3 col-12 form-group">
<input type="text" placeholder="Search by Class ..." class="form-control">
</div>
<div class="col-1-xxxl col-xl-2 col-lg-3 col-12 form-group">
<button type="submit" class="fw-btn-fill btn-gradient-yellow">SEARCH</button>
</div>
</div>
</form>
<div class="container mt-4">
<h2>Students</h2>
<button type="button" class="btn btn-primary mb-2" data-toggle="modal" data-target="#addUserModal">
Add User
</button>
<table class="table table-striped">
<thead>
<tr>
<th>LRN</th>
<th>FirstName</th>
<th>LastName</th>
<th>MidleName</th>
<th>Gender</th>
<th>Birthday</th>
<th>Religion </th>
<th>Grade</th>
<th>Section</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tbody>
<?php
$advisory = ($userInfo["advisoryclass"]) ? $userInfo["advisoryclass"] : '';
// PHP code for displaying admin records here
$conn = new mysqli('localhost', 'root', '', 'userdb');
if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error);
} else {
$result = $conn->query("SELECT * FROM students WHERE grade = $advisory");
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row["lrn"] . "</td>";
echo "<td>" . $row["firstname"] . "</td>";
echo "<td>" . $row["lastname"] . "</td>";
echo "<td>" . $row["middlename"] . "</td>";
echo "<td>" . $row["gender"] . "</td>";
echo "<td>" . $row["dateofbirth"] . "</td>";
echo "<td>" . $row["religion"] . "</td>";
echo "<td>" . $row["grade"] . "</td>";
echo "<td>" . $row["section"] . "</td>";
echo "<td>" . $row["email"] . "</td>";
echo '<td><button class="btn btn-danger delete-user" data-id="' . $row["id"] . '">Delete</button></td>';
echo '<td><button class="btn btn-secondary delete-user" data-id="' . $row["id"] . '">EDIT</button></td>';
echo '<td><button class="btn btn-success delete-primary" data-id="' . $row["id"] . '">Grades</button></td>';
echo "</tr>";
}
}
$conn->close();
}
?>
</tbody>
</table>
</div>
<div class="container mt-5">
<div class="row justify-content-center"> <!-- Center the content horizontally -->
<div class="col-12 text-center"> <!-- Center the button within the column -->
<button class="btn btn-primary" data-toggle="modal" data-target="#modal">ADD Grades</button>
</div>
</div>
<div class="modal" id="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Add Grade</h5>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<!--Add Teacher Forms-->
<div class="container mt-5">
<form>
<div class="form-group">
<input type="text" class="form-control" id="firstName" required>
<label class="form-label" for="firstName">LRN</label>
</div>
<div class="form-group">
<input type="text" class="form-control" id="firstName" required>
<label class="form-label" for="firstName">First Name</label>
</div>
<div class="form-group">
<input type="text" class="form-control" id="lastName" required>
<label class="form-label" for="lastName">Last Name</label>
</div>
<div class="form-group">
<input type="text" class="form-control" id="lastName" required>
<label class="form-label" for="lastName">Middle Name</label>
</div>
<div class="form-group">
<select class="form-control" id="gender" required>
<label class="form-label" for="gender">Grading</label>
<option value="" disabled selected>Grading</option>
<option value="male">1st grading</option>
<option value="female">2nd grading</option>
<option value="other">3rd grading</option>
<option value="other">4th grading</option>
</select>
</div>
</select>
<div class="form-group">
<input type="number" class="form-control" id="firstName" required>
<label class="form-label" for="firstName">Filipino</label>
</div>
<div class="form-group">
<input type="text" class="form-control" id="firstName" required>
<label class="form-label" for="firstName">English</label>
</div>
<div class="form-group">
<input type="text" class="form-control" id="firstName" required>
<label class="form-label" for="firstName">Values Education</label>
</div>
<div class="form-group">
<input type="date" class="form-control" id="firstName" required>
<label class="form-label" for="firstName">T.L.E</label>
</div>
<div class="form-group">
<input type="tel" class="form-control" id="firstName" required>
<label class="form-label" for="firstName">MAPEH</label>
</div>
<div class="form-group">
<input type="email" class="form-control" id="firstName" required>
<label class="form-label" for="firstName">Science</label>
</div>
<!-- Other form fields with labels above -->
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<style>
.form-group {
position: relative;
margin-bottom: 1.5rem; /* Adjust as needed for spacing */
}
.form-label {
position: absolute;
pointer-events: none;
left: 1rem;
top: -0.5rem; /* Adjust to control label positioning */
transition: 0.2s ease all;
color: #aaa;
}
.form-control {
padding-top: 1.5rem; /* Adjust to create space for the label */
}
.form-control:focus + .form-label,
.form-control:not(:placeholder-shown) + .form-label {
top: -1.5rem; /* Adjust based on label positioning */
font-size: 0.8rem;
color: #007BFF;
}
/* Background color for input fields */
.bg-input {
background-color: #f8f9fa; /* Adjust the color as needed */
}
</style>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>f
</body>
</html>