-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdpt.php
More file actions
446 lines (398 loc) · 16.7 KB
/
dpt.php
File metadata and controls
446 lines (398 loc) · 16.7 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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<?php
session_start();
require_once 'db_connect.php';
// Get department ID from GET parameter
$dept_id = isset($_GET['id']) ? intval($_GET['id']) : 0;
if ($dept_id == 0) {
header("Location: index.php");
exit();
}
// Get department information
$dept_stmt = $conn->prepare("SELECT * FROM departments WHERE depart_id = ?");
$dept_stmt->bind_param("i", $dept_id);
$dept_stmt->execute();
$dept_result = $dept_stmt->get_result();
if ($dept_result->num_rows == 0) {
header("Location: index.php");
exit();
}
$department = $dept_result->fetch_assoc();
$dept_stmt->close();
// Get faculty members in this department
$faculty_query = $conn->prepare("SELECT * FROM faculty WHERE department_id = ? ORDER BY is_focal_person DESC, last_name ASC");
$faculty_query->bind_param("i", $dept_id);
$faculty_query->execute();
$faculty_result = $faculty_query->get_result();
// Get news for this department
$news_query = $conn->prepare("SELECT * FROM news WHERE department_id = ? ORDER BY created_at DESC LIMIT 5");
$news_query->bind_param("i", $dept_id);
$news_query->execute();
$news_result = $news_query->get_result();
// Get notices for this department
$notices_query = $conn->prepare("SELECT * FROM notices WHERE department_id = ? ORDER BY notice_date DESC LIMIT 5");
$notices_query->bind_param("i", $dept_id);
$notices_query->execute();
$notices_result = $notices_query->get_result();
// Get events for this department
$events_query = $conn->prepare("SELECT * FROM events WHERE department_id = ? AND event_date >= CURDATE() ORDER BY event_date ASC LIMIT 5");
$events_query->bind_param("i", $dept_id);
$events_query->execute();
$events_result = $events_query->get_result();
// Get notifications for this department
$notifications_query = $conn->prepare("SELECT * FROM notifications WHERE department_id = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 5");
$notifications_query->bind_param("i", $dept_id);
$notifications_query->execute();
$notifications_result = $notifications_query->get_result();
// Get all departments for navbar
$all_departments = $conn->query("SELECT * FROM departments ORDER BY name");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= htmlspecialchars($department['name']) ?> - Learning Management System</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&family=Playfair+Display:wght@400;600;700&display=swap" rel="stylesheet">
<style>
:root {
--primary-color: #000000;
--accent-color: #fbbf24;
--text-dark: #000000;
--text-light: #4b5563;
--bg-light: #f9fafb;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background: var(--bg-light);
}
/* Navbar */
.navbar {
background: rgba(255, 255, 255, 0.98);
backdrop-filter: blur(10px);
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.navbar-brand {
font-family: 'Playfair Display', serif;
font-size: 1.75rem;
font-weight: 700;
color: var(--primary-color) !important;
}
.nav-link {
color: var(--text-dark) !important;
font-weight: 500;
margin: 0 0.5rem;
transition: all 0.3s ease;
}
.nav-link:hover {
color: var(--accent-color) !important;
}
.dropdown-menu {
border: none;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
border-radius: 12px;
padding: 0.5rem 0;
}
.dropdown-item {
padding: 0.75rem 1.5rem;
transition: all 0.3s ease;
}
.dropdown-item:hover {
background: var(--primary-color);
color: var(--accent-color) !important;
padding-left: 2rem;
}
/* Hero Section */
.dept-hero {
background: linear-gradient(135deg, var(--primary-color), #1a1a1a);
color: white;
padding: 4rem 0;
margin-bottom: 3rem;
}
.dept-hero h1 {
font-family: 'Playfair Display', serif;
font-size: 3rem;
font-weight: 700;
margin-bottom: 1rem;
}
.dept-hero .dept-code {
font-size: 1.25rem;
color: var(--accent-color);
font-weight: 600;
letter-spacing: 2px;
}
/* Content Sections */
.content-section {
margin-bottom: 3rem;
}
.section-card {
background: white;
border-radius: 16px;
padding: 2rem;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 2rem;
transition: all 0.3s ease;
}
.section-card:hover {
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
transform: translateY(-5px);
}
.section-title {
font-family: 'Playfair Display', serif;
font-size: 2rem;
font-weight: 700;
color: var(--text-dark);
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 3px solid var(--accent-color);
}
.faculty-card {
background: var(--bg-light);
border-radius: 12px;
padding: 1.5rem;
margin-bottom: 1rem;
border-left: 4px solid var(--accent-color);
transition: all 0.3s ease;
}
.faculty-card:hover {
background: white;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.focal-badge {
background: var(--accent-color);
color: var(--primary-color);
padding: 0.25rem 0.75rem;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 600;
margin-left: 0.5rem;
}
.news-item, .notice-item, .event-item, .notification-item {
padding: 1rem;
border-left: 3px solid var(--accent-color);
margin-bottom: 1rem;
background: var(--bg-light);
border-radius: 8px;
transition: all 0.3s ease;
}
.news-item:hover, .notice-item:hover, .event-item:hover, .notification-item:hover {
background: white;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transform: translateX(5px);
}
.news-item h5, .notice-item h5, .event-item h5, .notification-item h5 {
color: var(--text-dark);
font-weight: 600;
margin-bottom: 0.5rem;
}
.news-item p, .notice-item p, .event-item p, .notification-item p {
color: var(--text-light);
font-size: 0.9rem;
margin-bottom: 0.5rem;
}
.date-badge {
background: var(--primary-color);
color: white;
padding: 0.25rem 0.75rem;
border-radius: 20px;
font-size: 0.75rem;
display: inline-block;
margin-top: 0.5rem;
}
.empty-state {
text-align: center;
padding: 3rem;
color: var(--text-light);
}
.empty-state i {
font-size: 3rem;
margin-bottom: 1rem;
opacity: 0.3;
}
@media (max-width: 768px) {
.dept-hero h1 {
font-size: 2rem;
}
.section-card {
padding: 1.5rem;
}
}
</style>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light sticky-top">
<div class="container">
<a class="navbar-brand" href="index.php">Learning Management System</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="index.php">Home</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="deptDropdown" role="button" data-bs-toggle="dropdown">
Departments
</a>
<ul class="dropdown-menu" aria-labelledby="deptDropdown">
<?php if ($all_departments && $all_departments->num_rows > 0): ?>
<?php while ($dept = $all_departments->fetch_assoc()): ?>
<li><a class="dropdown-item" href="dpt.php?id=<?= $dept['depart_id'] ?>"><?= htmlspecialchars($dept['name']) ?></a></li>
<?php endwhile; ?>
<?php endif; ?>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="login.php">Login</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Department Hero Section -->
<div class="dept-hero">
<div class="container">
<div class="dept-code"><?= htmlspecialchars($department['depart_code']) ?></div>
<h1><?= htmlspecialchars($department['name']) ?></h1>
<?php if ($department['description']): ?>
<p class="lead"><?= htmlspecialchars($department['description']) ?></p>
<?php endif; ?>
</div>
</div>
<div class="container">
<!-- Faculty Members Section -->
<div class="content-section">
<div class="section-card">
<h2 class="section-title">👨🏫 Faculty Members</h2>
<?php if ($faculty_result->num_rows > 0): ?>
<?php while ($faculty = $faculty_result->fetch_assoc()): ?>
<div class="faculty-card">
<h5>
<?= htmlspecialchars($faculty['first_name'] . ' ' . $faculty['last_name']) ?>
<?php if ($faculty['is_focal_person'] == 1): ?>
<span class="focal-badge">⭐ Focal Person</span>
<?php endif; ?>
</h5>
<p class="mb-1"><strong>Email:</strong> <?= htmlspecialchars($faculty['email']) ?></p>
<?php if ($faculty['phone']): ?>
<p class="mb-1"><strong>Phone:</strong> <?= htmlspecialchars($faculty['phone']) ?></p>
<?php endif; ?>
<?php if ($faculty['bio']): ?>
<p class="mt-2 mb-0"><small><?= htmlspecialchars($faculty['bio']) ?></small></p>
<?php endif; ?>
</div>
<?php endwhile; ?>
<?php else: ?>
<div class="empty-state">
<i>👨🏫</i>
<p>No faculty members found in this department.</p>
</div>
<?php endif; ?>
</div>
</div>
<!-- News Section -->
<div class="content-section">
<div class="section-card">
<h2 class="section-title">📰 News & Updates</h2>
<?php if ($news_result->num_rows > 0): ?>
<?php while ($news = $news_result->fetch_assoc()): ?>
<div class="news-item">
<h5><?= htmlspecialchars($news['title']) ?></h5>
<p><?= htmlspecialchars(substr($news['content'], 0, 200)) ?><?= strlen($news['content']) > 200 ? '...' : '' ?></p>
<span class="date-badge"><?= date('M d, Y', strtotime($news['created_at'])) ?></span>
</div>
<?php endwhile; ?>
<?php else: ?>
<div class="empty-state">
<i>📰</i>
<p>No news available for this department.</p>
</div>
<?php endif; ?>
</div>
</div>
<!-- Notice Board Section -->
<div class="content-section">
<div class="section-card">
<h2 class="section-title">📋 Notice Board</h2>
<?php if ($notices_result->num_rows > 0): ?>
<?php while ($notice = $notices_result->fetch_assoc()): ?>
<div class="notice-item">
<h5><?= htmlspecialchars($notice['title']) ?></h5>
<p><?= htmlspecialchars(substr($notice['content'], 0, 200)) ?><?= strlen($notice['content']) > 200 ? '...' : '' ?></p>
<span class="date-badge">Notice Date: <?= date('M d, Y', strtotime($notice['notice_date'])) ?></span>
</div>
<?php endwhile; ?>
<?php else: ?>
<div class="empty-state">
<i>📋</i>
<p>No notices available for this department.</p>
</div>
<?php endif; ?>
</div>
</div>
<!-- Events Section -->
<div class="content-section">
<div class="section-card">
<h2 class="section-title">🎉 Upcoming Events</h2>
<?php if ($events_result->num_rows > 0): ?>
<?php while ($event = $events_result->fetch_assoc()): ?>
<div class="event-item">
<h5><?= htmlspecialchars($event['title']) ?></h5>
<p><?= htmlspecialchars(substr($event['description'], 0, 200)) ?><?= strlen($event['description']) > 200 ? '...' : '' ?></p>
<p class="mb-1"><strong>Date:</strong> <?= date('M d, Y', strtotime($event['event_date'])) ?></p>
<?php if ($event['event_time']): ?>
<p class="mb-1"><strong>Time:</strong> <?= date('h:i A', strtotime($event['event_time'])) ?></p>
<?php endif; ?>
<?php if ($event['location']): ?>
<p class="mb-1"><strong>Location:</strong> <?= htmlspecialchars($event['location']) ?></p>
<?php endif; ?>
</div>
<?php endwhile; ?>
<?php else: ?>
<div class="empty-state">
<i>🎉</i>
<p>No upcoming events for this department.</p>
</div>
<?php endif; ?>
</div>
</div>
<!-- Notifications Section -->
<div class="content-section">
<div class="section-card">
<h2 class="section-title">🔔 Notifications</h2>
<?php if ($notifications_result->num_rows > 0): ?>
<?php while ($notification = $notifications_result->fetch_assoc()): ?>
<div class="notification-item">
<h5><?= htmlspecialchars($notification['title']) ?></h5>
<p><?= htmlspecialchars(substr($notification['message'], 0, 200)) ?><?= strlen($notification['message']) > 200 ? '...' : '' ?></p>
<span class="date-badge"><?= date('M d, Y', strtotime($notification['created_at'])) ?></span>
</div>
<?php endwhile; ?>
<?php else: ?>
<div class="empty-state">
<i>🔔</i>
<p>No notifications available for this department.</p>
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Footer -->
<footer class="bg-dark text-light text-center py-4 mt-5">
<div class="container">
<p>© <?php echo date("Y"); ?> Learning Management System. All rights reserved.</p>
<p class="text-warning mb-0">Empowering Minds, Shaping Futures</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>