-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent_resources.php
More file actions
71 lines (51 loc) · 1.78 KB
/
Copy pathstudent_resources.php
File metadata and controls
71 lines (51 loc) · 1.78 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
<?php
session_start();
require "config.php";
$user_id = $_SESSION['id'];
// Get courses user registered for
$stmt = $pdo->prepare("
SELECT cr.*
FROM course_resources cr
JOIN registrations r
ON cr.course_id = r.course_id
AND cr.level_id = r.level_id
WHERE r.user_id = ?
ORDER BY cr.created_at DESC
");
$stmt->execute([$user_id]);
$resources = $stmt->fetchAll();
?>
<html>
<head>
<link rel="stylesheet" href="resources.css">
</head>
<link rel="stylesheet" href="assets/css/resources.css">
<body>
<div class="page-wrapper">
<h2 class="page-title">📘 My Course Resources</h2>
<div class="resource-grid">
<?php foreach ($resources as $res): ?>
<div class="resource-card">
<h4><?= htmlspecialchars($res['title']) ?></h4>
<div class="resource-meta">
<?= strtoupper($res['file_type']) ?> • Uploaded <?= date("M d, Y", strtotime($res['created_at'])) ?>
</div>
<div class="resource-actions">
<?php if ($res['file_type'] === 'pdf'): ?>
<a href="<?= $res['file_path'] ?>" download>📄 Download PDF</a>
<?php elseif ($res['file_type'] === 'audio'): ?>
<audio controls style="width:100%">
<source src="<?= $res['file_path'] ?>">
</audio>
<?php elseif ($res['file_type'] === 'video'): ?>
<video controls style="width:100%;border-radius:8px">
<source src="<?= $res['file_path'] ?>">
</video>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</body>
</html>