Files
ai-institute/view-project.php
2026-11-19 20:40:34 +05:45

366 lines
20 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
require_once __DIR__ . '/includes/data.php';
$projectId = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$currentProject = null;
foreach ($projects as $project) {
if ((int) ($project['id'] ?? 0) === $projectId) {
$currentProject = $project;
break;
}
}
$activePage = 'student-work';
if ($currentProject === null) {
http_response_code(404);
$pageTitle = 'Project not found | AI Institute';
$pageDescription = 'The requested student project could not be found.';
} else {
$pageTitle = $currentProject['title'] . ' | Student Work | AI Institute';
$pageDescription = $currentProject['description'] ?? 'Explore this illustrative student project concept from AI Institute.';
}
require __DIR__ . '/includes/header.php';
?>
<main id="main-content" class="project-detail">
<?php if ($currentProject === null): ?>
<section class="section project-detail__missing">
<div class="container">
<div class="project-detail__missing-inner reveal">
<span class="eyebrow">Student work</span>
<h1 class="section__title">Project not found</h1>
<p class="section__lead">The project you are looking for may have moved or does not exist.</p>
<a class="btn btn--primary" href="student-work.php#gallery">Back to Projects</a>
</div>
</div>
</section>
<?php else: ?>
<?php
$projectCourse = isset($currentProject['course']) ? (string) $currentProject['course'] : (isset($currentProject['tag']) ? (string) $currentProject['tag'] : '');
$projectStudent = isset($currentProject['student']) ? (string) $currentProject['student'] : '';
$projectBatch = isset($currentProject['batch']) ? (string) $currentProject['batch'] : (isset($currentProject['year']) ? (string) $currentProject['year'] : '');
$projectSkills = [];
if (!empty($currentProject['skills']) && is_array($currentProject['skills'])) {
foreach ($currentProject['skills'] as $skill) {
$projectSkills[] = is_array($skill) ? (string) ($skill['label'] ?? '') : (string) $skill;
}
$projectSkills = array_values(array_filter($projectSkills, static function ($skill) {
return $skill !== '';
}));
}
$skillIcons = !empty($currentProject['skill_icons']) && is_array($currentProject['skill_icons'])
? $currentProject['skill_icons']
: (!empty($currentProject['skills']) && is_array($currentProject['skills']) ? $currentProject['skills'] : []);
$skillIconMap = [];
if (is_array($skillIcons)) {
foreach ($skillIcons as $index => $skillIconEntry) {
if (!is_array($skillIconEntry)) {
continue;
}
$iconLabel = (string) ($skillIconEntry['label'] ?? '');
if ($iconLabel === '') {
$iconLabel = (string) ($projectSkills[$index] ?? '');
}
if ($iconLabel !== '') {
$skillIconMap[$iconLabel] = (string) ($skillIconEntry['icon'] ?? 'sparkles');
}
}
}
$projectSkillItems = [];
foreach ($projectSkills as $skillLabel) {
if (isset($projectSkillItems[$skillLabel])) {
continue;
}
$projectSkillItems[$skillLabel] = [
'label' => $skillLabel,
'icon' => $skillIconMap[$skillLabel] ?? 'sparkles',
];
}
?>
<!-- ===== PROJECT HERO ===== -->
<section class="project-detail__hero cert-hero section">
<div class="container">
<div class="project-detail__hero-inner reveal">
<nav class="breadcrumb project-detail__breadcrumb" aria-label="Breadcrumb">
<ol class="breadcrumb__list">
<li class="breadcrumb__item"><a href="index.php">Home</a></li>
<li class="breadcrumb__item"><a href="student-work.php">Student Work</a></li>
<li class="breadcrumb__item" aria-current="page"><?= e($currentProject['title']) ?></li>
</ol>
</nav>
<?php if ($projectCourse !== ''): ?>
<span class="project-detail__course"><?= e($projectCourse) ?></span>
<?php endif; ?>
<h1 class="project-detail__title"><?= e($currentProject['title']) ?></h1>
<?php if (!empty($currentProject['description'])): ?>
<p class="project-detail__lead"><?= e($currentProject['description']) ?></p>
<?php endif; ?>
</div>
</div>
</section>
<!-- ===== PROJECT INFO ===== -->
<section class="section project-detail__info">
<div class="container">
<div class="project-detail__grid">
<div class="project-detail__main">
<div class="project-detail__disclaimer reveal" role="note">
<span class="project-detail__disclaimer-icon" aria-hidden="true"><?= icon('sparkles') ?></span>
<p>Editable placeholder – not an actual student achievement.</p>
</div>
<?php if (!empty($currentProject['overview'])): ?>
<section class="project-detail__block card reveal">
<div class="project-detail__block-head">
<span class="eyebrow">Project summary</span>
<h2 class="project-detail__block-title">Overview</h2>
</div>
<p class="project-detail__text"><?= e($currentProject['overview']) ?></p>
</section>
<?php endif; ?>
<?php if (!empty($currentProject['built']) && is_array($currentProject['built'])): ?>
<section class="project-detail__block card reveal">
<div class="project-detail__block-head">
<span class="eyebrow">Student work</span>
<h2 class="project-detail__block-title">What the students built</h2>
</div>
<ul class="project-detail__list">
<?php foreach ($currentProject['built'] as $item): ?>
<li class="project-detail__list-item">
<span class="project-detail__list-icon"><?= icon('check-circle') ?></span>
<span><?= e($item) ?></span>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php endif; ?>
<?php if (!empty($projectSkillItems)): ?>
<section class="project-detail__block reveal">
<div class="project-detail__block-head">
<span class="eyebrow">Learning outcomes</span>
<h2 class="project-detail__block-title">Skills learned</h2>
</div>
<ul class="project-detail__skills">
<?php foreach ($projectSkillItems as $skill): ?>
<li class="project-detail__skill card">
<span class="project-detail__skill-icon"><?= icon($skill['icon']) ?></span>
<span class="project-detail__skill-label"><?= e($skill['label']) ?></span>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php endif; ?>
<?php if (!empty($currentProject['brief']) || !empty($currentProject['process']) || !empty($currentProject['reflection'])): ?>
<section class="project-detail__block reveal">
<div class="project-detail__block-head">
<span class="eyebrow">More than the final output</span>
<h2 class="project-detail__block-title">Brief / Process / Reflection</h2>
</div>
<div class="project-detail__thinking-grid">
<?php if (!empty($currentProject['brief'])): ?>
<article class="project-detail__thinking-card card">
<span class="project-detail__thinking-icon"><?= icon('book') ?></span>
<h3 class="project-detail__thinking-title">The brief</h3>
<p class="project-detail__thinking-text"><?= e($currentProject['brief']) ?></p>
</article>
<?php endif; ?>
<?php if (!empty($currentProject['process'])): ?>
<article class="project-detail__thinking-card card">
<span class="project-detail__thinking-icon"><?= icon('layers') ?></span>
<h3 class="project-detail__thinking-title">The process</h3>
<p class="project-detail__thinking-text"><?= e($currentProject['process']) ?></p>
</article>
<?php endif; ?>
<?php if (!empty($currentProject['reflection'])): ?>
<article class="project-detail__thinking-card card">
<span class="project-detail__thinking-icon"><?= icon('sparkles') ?></span>
<h3 class="project-detail__thinking-title">The reflection</h3>
<p class="project-detail__thinking-text"><?= e($currentProject['reflection']) ?></p>
</article>
<?php endif; ?>
</div>
</section>
<?php endif; ?>
</div>
<aside class="project-detail__sidebar reveal">
<div class="project-detail__meta card">
<div class="project-detail__block-head">
<span class="eyebrow">At a glance</span>
<h2 class="project-detail__meta-title">Project details</h2>
</div>
<dl class="project-detail__meta-list">
<?php if ($projectCourse !== ''): ?>
<div class="project-detail__meta-item">
<dt>Course</dt>
<dd><?= e($projectCourse) ?></dd>
</div>
<?php endif; ?>
<?php if ($projectStudent !== ''): ?>
<div class="project-detail__meta-item">
<dt>Student</dt>
<dd><?= e($projectStudent) ?></dd>
</div>
<?php endif; ?>
<?php if ($projectBatch !== ''): ?>
<div class="project-detail__meta-item">
<dt>Batch</dt>
<dd><?= e($projectBatch) ?></dd>
</div>
<?php endif; ?>
<?php if (!empty($projectSkills)): ?>
<div class="project-detail__meta-item">
<dt>Skills</dt>
<dd>
<ul class="project-detail__meta-tools">
<?php foreach ($projectSkills as $skill): ?>
<li><?= e($skill) ?></li>
<?php endforeach; ?>
</ul>
</dd>
</div>
<?php endif; ?>
<?php if (!empty($currentProject['tools']) && is_array($currentProject['tools'])): ?>
<div class="project-detail__meta-item">
<dt>Tools</dt>
<dd>
<ul class="project-detail__meta-tools">
<?php foreach ($currentProject['tools'] as $tool): ?>
<li><?= e($tool) ?></li>
<?php endforeach; ?>
</ul>
</dd>
</div>
<?php endif; ?>
</dl>
</div>
<a class="btn btn--primary project-detail__back-link" href="student-work.php#gallery">Back to all projects</a>
</aside>
</div>
</div>
</section>
<?php
$moreProjects = [];
foreach ($projects as $project) {
if ((int) ($project['id'] ?? 0) === (int) $currentProject['id']) {
continue;
}
$moreProjects[] = $project;
}
$moreProjects = array_slice($moreProjects, 0, 3);
?>
<?php if (!empty($moreProjects)): ?>
<!-- ===== MORE PROJECTS ===== -->
<section class="section section--alt project-detail__more">
<div class="container">
<div class="section__head reveal">
<span class="eyebrow">Keep exploring</span>
<h2 class="section__title">More projects</h2>
<p class="section__lead">Explore more illustrative project concepts from the gallery.</p>
</div>
<div class="student-work__grid student-work__grid--more">
<?php foreach ($moreProjects as $project): ?>
<?php
$course = isset($project['course']) ? (string) $project['course'] : (isset($project['tag']) ? (string) $project['tag'] : '');
$student = isset($project['student']) ? (string) $project['student'] : '';
$batch = isset($project['batch']) ? (string) $project['batch'] : (isset($project['year']) ? (string) $project['year'] : '');
$skillsList = [];
if (!empty($project['skills']) && is_array($project['skills'])) {
foreach ($project['skills'] as $skill) {
$skillsList[] = is_array($skill) ? (string) ($skill['label'] ?? '') : (string) $skill;
}
$skillsList = array_values(array_filter($skillsList, static function ($skill) {
return $skill !== '';
}));
}
$skillsLine = implode(' · ', $skillsList);
$metaParts = [];
if ($student !== '') {
$metaParts[] = $student;
}
if ($batch !== '') {
$metaParts[] = $batch;
}
$metaParts[] = 'Editable placeholders – not an actual student achievement';
$metaLine = implode(' · ', $metaParts);
?>
<article class="student-card card reveal">
<div class="student-card__media">
<img
class="student-card__img"
src="<?= e($project['image']) ?>"
alt="<?= e($project['alt'] ?? $project['title']) ?>"
width="1000"
height="640"
loading="lazy"
>
<span class="student-card__badge">Placeholder project</span>
</div>
<div class="student-card__body">
<?php if ($course !== ''): ?>
<p class="student-card__course"><?= e($course) ?></p>
<?php endif; ?>
<h3 class="student-card__title"><?= e($project['title']) ?></h3>
<?php if (!empty($project['description'])): ?>
<p class="student-card__desc"><?= e($project['description']) ?></p>
<?php endif; ?>
<p class="student-card__meta"><?= e($metaLine) ?></p>
<?php if ($skillsLine !== ''): ?>
<p class="student-card__skills"><?= e($skillsLine) ?></p>
<?php endif; ?>
<div class="student-card__footer">
<span class="student-card__divider" aria-hidden="true"></span>
<a class="student-card__link" href="view-project.php?id=<?= (int) $project['id'] ?>">
View Project <?= icon('arrow-right') ?>
</a>
</div>
</div>
</article>
<?php endforeach; ?>
</div>
</div>
</section>
<?php endif; ?>
<!-- ===== CTA ===== -->
<section class="cta">
<div class="container">
<div class="cta__inner reveal">
<span class="eyebrow">Your next chapter</span>
<h2 class="cta__title">What would you like to build?</h2>
<p class="cta__text">Start with curiosity. Build with purpose. Talk through your goals and find a practical learning path that feels right for you.</p>
<div class="cta__actions">
<a class="btn btn--primary" href="index.php#apply">Apply Now</a>
<a class="btn btn--ghost" href="index.php#contact">Talk to an Advisor</a>
</div>
<p class="student-work__cta-note">Ask for confirmed course details before making a payment.</p>
</div>
</div>
</section>
<?php endif; ?>
</main>
<?php require __DIR__ . '/includes/footer.php'; ?>