-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathuniversity.php
More file actions
113 lines (106 loc) · 5.23 KB
/
university.php
File metadata and controls
113 lines (106 loc) · 5.23 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
<?php
require_once 'includes/db.php';
require_once 'includes/ui-helpers.php';
$id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT);
$university = null;
$degrees = [];
if ($id) {
$stmt = $conn->prepare('SELECT * FROM universities WHERE id = ? LIMIT 1');
if ($stmt) {
$stmt->bind_param('i', $id);
$stmt->execute();
$result = $stmt->get_result();
if ($result && ($row = $result->fetch_assoc())) {
$university = $row;
}
$stmt->close();
}
}
if ($university) {
$degreeStmt = $conn->prepare('SELECT d.name AS degree_name, d.duration, d.medium, d.description, f.name AS faculty_name FROM degrees d JOIN departments dep ON d.department_id = dep.id JOIN faculties f ON dep.faculty_id = f.id WHERE f.university_id = ? ORDER BY d.name ASC');
if ($degreeStmt) {
$degreeStmt->bind_param('i', $id);
$degreeStmt->execute();
$degrees = $degreeStmt->get_result()->fetch_all(MYSQLI_ASSOC);
$degreeStmt->close();
}
}
include 'includes/header.php';
?>
<?php if ($university): ?>
<section class="page-hero reveal-on-scroll detail-hero">
<div class="container hero-detail">
<div class="hero-text">
<p class="eyebrow">University story</p>
<h1><?php echo htmlspecialchars($university['name']); ?></h1>
<p class="page-hero-meta"><?php echo htmlspecialchars(getUniversityDescription($university, 320)); ?></p>
<div class="breadcrumb">
<a href="/index.php">Home</a>
<span> / </span>
<a href="/universities.php">Universities</a>
<span> / </span>
<span><?php echo htmlspecialchars($university['name']); ?></span>
</div>
<div class="pills">
<span class="pill"><?php echo htmlspecialchars(getUniversityType($university)); ?></span>
<span class="pill"><?php echo htmlspecialchars(getUniversityLocation($university)); ?></span>
</div>
</div>
<div class="hero-media">
<?php $heroImage = getUniversityImagePath($university); ?>
<?php if ($heroImage): ?>
<img src="<?php echo htmlspecialchars($heroImage, ENT_QUOTES, 'UTF-8'); ?>" alt="<?php echo htmlspecialchars($university['name']); ?>" loading="lazy">
<?php else: ?>
<div class="hero-media-placeholder"></div>
<?php endif; ?>
</div>
</div>
</section>
<section class="container reveal-on-scroll">
<div class="glass-panel">
<h2>Overview</h2>
<p><?php echo htmlspecialchars($university['description']); ?></p>
<?php if (!empty($university['website']) || !empty($university['contact']) || !empty($university['established_year'])): ?>
<div class="detail-meta">
<div class="pills">
<?php if (!empty($university['established_year'])): ?><span class="pill">Est. <?php echo htmlspecialchars($university['established_year']); ?></span><?php endif; ?>
<?php if (!empty($university['website'])): ?><span class="pill"><a href="<?php echo htmlspecialchars($university['website']); ?>" target="_blank" rel="noreferrer">Website</a></span><?php endif; ?>
</div>
<?php if (!empty($university['contact'])): ?><p class="helper-text">Contact: <?php echo htmlspecialchars($university['contact']); ?></p><?php endif; ?>
</div>
<?php endif; ?>
</div>
</section>
<section class="container reveal-on-scroll">
<h2>Featured degrees</h2>
<?php if ($degrees): ?>
<div class="finder-results">
<?php foreach ($degrees as $degree): ?>
<article class="finder-card reveal-on-scroll">
<h3><?php echo htmlspecialchars($degree['degree_name']); ?></h3>
<p><strong>Faculty:</strong> <?php echo htmlspecialchars($degree['faculty_name']); ?></p>
<p><strong>Duration:</strong> <?php echo htmlspecialchars($degree['duration']); ?></p>
<p><strong>Medium:</strong> <?php echo htmlspecialchars($degree['medium']); ?></p>
<p><?php echo htmlspecialchars($degree['description']); ?></p>
</article>
<?php endforeach; ?>
</div>
<?php else: ?>
<p class="section-subtitle">No cataloged degrees are visible right now. Check back soon.</p>
<?php endif; ?>
</section>
<?php else: ?>
<section class="page-hero reveal-on-scroll">
<div class="container">
<p class="eyebrow">University not found</p>
<h1>We could not locate that university.</h1>
<p class="page-hero-meta">Return to the directory and continue your exploration.</p>
<div class="breadcrumb">
<a href="/index.php">Home</a>
<span> / </span>
<a href="/universities.php">Universities</a>
</div>
</div>
</section>
<?php endif; ?>
<?php include 'includes/footer.php'; ?>