-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_resources.php
More file actions
60 lines (56 loc) · 1.82 KB
/
Copy pathview_resources.php
File metadata and controls
60 lines (56 loc) · 1.82 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
<?php
session_start();
require "config.php";
if (!isset($_SESSION['id']) || !in_array($_SESSION['role'], ['teacher', 'student'])) {
header("Location: index.php");
exit;
}
$resources = $pdo->query("
SELECT r.*, l.level_name, c.title AS course_title, cs.subject_title
FROM resources r
JOIN levels l ON r.level_id = l.id
JOIN courses c ON r.course_id = c.id
JOIN course_subjects cs ON r.subject_id = cs.id
ORDER BY r.uploaded_at DESC
")->fetchAll();
?>
<!DOCTYPE html>
<html>
<head>
<title>Course Resources</title>
<link rel="stylesheet" href="resources.css">
</head>
<body>
<div class="page-wrapper">
<h2 class="page-title">📚 Course Resources</h2>
<?php if (empty($resources)): ?>
<p>No resources available yet.</p>
<?php else: ?>
<table>
<thead>
<tr>
<th>Level</th>
<th>Course</th>
<th>Subject</th>
<th>File Name</th>
<th>Uploaded At</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($resources as $r): ?>
<tr>
<td><?= htmlspecialchars($r['level_name']) ?></td>
<td><?= htmlspecialchars($r['course_title']) ?></td>
<td><?= htmlspecialchars($r['subject_title']) ?></td>
<td><?= htmlspecialchars($r['filename']) ?></td>
<td><?= htmlspecialchars($r['uploaded_at']) ?></td>
<td><a href="<?= htmlspecialchars($r['filepath']) ?>" download>Download</a></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
</body>
</html>