CrestRoad/website/resources.php

57 lines
3.3 KiB
PHP

<?php
require_once __DIR__ . '/includes/data.php';
$pageTitle = 'Resources | CREST';
$metaDescription = 'Download CREST respiratory learning resources including tutorials, guides, and video sessions.';
$resources = get_tutorials(false); // reuse tutorials data for resources page
include __DIR__ . '/includes/site-header.php';
?>
<main>
<section class="py-5">
<div class="container">
<p class="text-uppercase text-success fw-bold small mb-1">Resources</p>
<h1 class="fw-bold">Resources for Learning and Research</h1>
<p class="text-muted">Downloadable guides, publications, and toolkits created by our faculty to support your teams.</p>
<?php if (empty($resources)): ?>
<p class="text-muted" style="margin-top:16px;">No resources yet. Check back soon.</p>
<?php else: ?>
<div class="row g-3" style="margin-top:20px;">
<?php foreach ($resources as $resource): ?>
<?php
if (!is_array($resource)) {
continue;
}
$label = htmlspecialchars((string)($resource['label'] ?? ''), ENT_QUOTES, 'UTF-8');
$title = htmlspecialchars((string)($resource['title'] ?? ''), ENT_QUOTES, 'UTF-8');
$summary = htmlspecialchars((string)($resource['description'] ?? ''), ENT_QUOTES, 'UTF-8');
$filePath = isset($resource['file_path']) ? (string)$resource['file_path'] : '';
$videoUrl = isset($resource['video_url']) ? (string)$resource['video_url'] : '';
?>
<div class="col-md-4">
<article class="card h-100 shadow-sm border-0 rounded-4 p-3">
<span class="badge bg-success-subtle text-success fw-semibold mb-2"><?php echo $label ?: 'Resource'; ?></span>
<h3 class="h5 fw-bold"><?php echo $title; ?></h3>
<p class="text-muted small mb-3"><?php echo $summary; ?></p>
<div class="d-flex gap-2 flex-wrap">
<?php if ($filePath): ?>
<a class="btn btn-outline-success btn-sm" href="<?php echo htmlspecialchars(ltrim($filePath, '/'), ENT_QUOTES, 'UTF-8'); ?>" target="_blank">Download</a>
<?php endif; ?>
<?php if ($videoUrl): ?>
<a class="btn btn-success btn-sm text-white" href="<?php echo htmlspecialchars($videoUrl, ENT_QUOTES, 'UTF-8'); ?>" target="_blank">Watch</a>
<?php endif; ?>
<?php if (!$filePath && !$videoUrl): ?>
<span class="text-muted small">No download yet</span>
<?php endif; ?>
</div>
</article>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</section>
</main>
<?php include __DIR__ . '/includes/site-footer.php'; ?>