CrestRoad/website/sessions-list.php

51 lines
2.7 KiB
PHP

<?php
require_once __DIR__ . '/includes/data.php';
$pageTitle = 'Events | CREST';
$metaDescription = 'Browse all current and upcoming CREST sessions with dates, venues, and registration links.';
$sessions = get_sessions();
include __DIR__ . '/includes/site-header.php';
?>
<main>
<section class="py-5 bg-light">
<div class="container">
<div class="d-flex flex-wrap justify-content-between align-items-center mb-4">
<div>
<p class="text-uppercase text-success fw-bold small mb-1">Events</p>
<h1 class="fw-bold">Current &amp; Upcoming Sessions</h1>
</div>
</div>
<?php if (empty($sessions)): ?>
<p class="text-muted" style="margin-top:16px;">No sessions announced yet. Check back soon.</p>
<?php else: ?>
<div class="row g-3" style="margin-top:16px;">
<?php foreach ($sessions as $session): ?>
<?php
if (!is_array($session)) { continue; }
$number = htmlspecialchars((string)($session['number'] ?? ''), ENT_QUOTES, 'UTF-8');
$startDate = !empty($session['start_date']) ? date('M d, Y', strtotime($session['start_date'])) : '';
$venue = htmlspecialchars((string)($session['venue'] ?? ''), ENT_QUOTES, 'UTF-8');
$code = htmlspecialchars((string)($session['code'] ?? ''), ENT_QUOTES, 'UTF-8');
$regLink = $code ? "https://road.xltr.in/register/{$code}" : '#';
?>
<div class="col-md-4">
<article class="card event-card h-100">
<div class="placeholder-img small"></div>
<div class="chip">Upcoming</div>
<div class="p-3">
<h5 class="fw-bold"><?php echo $number ? 'Session ' . $number : 'Session'; ?></h5>
<?php if ($startDate): ?><p class="text-muted small mb-1">Starts: <?php echo $startDate; ?></p><?php endif; ?>
<?php if ($venue): ?><p class="text-muted small mb-2">Venue: <?php echo $venue; ?></p><?php endif; ?>
<a class="btn btn-outline-success btn-sm" href="<?php echo $regLink; ?>" target="_blank">Register</a>
</div>
</article>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</section>
</main>
<?php include __DIR__ . '/includes/site-footer.php'; ?>