-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent_timetable.php
More file actions
58 lines (52 loc) · 1.59 KB
/
Copy pathstudent_timetable.php
File metadata and controls
58 lines (52 loc) · 1.59 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
<?php
session_start();
require "config.php";
$student = $pdo->query("
SELECT level_id, department_id
FROM students WHERE user_id=".$_SESSION['id']
)->fetch();
$stmt = $pdo->prepare("
SELECT t.*, c.title course, s.subject_title, u.full_name lecturer
FROM timetables t
JOIN courses c ON c.id=t.course_id
JOIN course_subjects s ON s.id=t.subject_id
JOIN users u ON u.id=t.teacher_id
WHERE t.level_id=? AND t.department_id=?
AND CURDATE() BETWEEN t.start_date AND t.end_date
ORDER BY FIELD(day,'Friday','Saturday','Sunday'), start_time
");
$stmt->execute([$student['level_id'],$student['department_id']]);
$data = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html>
<head>
<title>My Timetable</title>
<style>
body{font-family:Segoe UI;background:#fff;padding:30px}
h2{text-align:center}
table{width:100%;border-collapse:collapse;margin-top:20px}
th,td{border:1px solid #000;padding:8px;font-size:14px}
th{background:#f1f1f1}
button{margin:15px 0;padding:10px 16px}
@media print{button{display:none}}
</style>
</head>
<body>
<h2>STUDENT SEMESTER TIMETABLE</h2>
<table>
<tr><th>Day</th><th>Time</th><th>Course</th><th>Subject</th><th>Lecturer</th><th>Venue</th></tr>
<?php foreach($data as $r): ?>
<tr>
<td><?= $r['day'] ?></td>
<td><?= substr($r['start_time'],0,5) ?> - <?= substr($r['end_time'],0,5) ?></td>
<td><?= $r['course'] ?></td>
<td><?= $r['subject_title'] ?></td>
<td><?= $r['lecturer'] ?></td>
<td><?= $r['venue'] ?></td>
</tr>
<?php endforeach; ?>
</table>
<button onclick="window.print()">Download PDF</button>
</body>
</html>