-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter.php
More file actions
49 lines (48 loc) · 2.08 KB
/
Copy pathfilter.php
File metadata and controls
49 lines (48 loc) · 2.08 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
<?php
require_once __DIR__ . '/utils/events.php';
require_once __DIR__ . '/utils/dateUtils.php';
require_once __DIR__ . '/utils/output.php';
require_once __DIR__ . '/includes/tags.php';
require_once __DIR__ . '/includes/event_card.php';
date_default_timezone_set(APP_TIMEZONE);
$loadResult = loadEvents();
$events = $loadResult['events'];
$allTypes = eventTypes($events);
$selectedType = isset($_GET['tipo']) && is_string($_GET['tipo']) ? strtolower(trim($_GET['tipo'])) : '';
$filteredEvents = filterEventsByType($events, $selectedType);
$now = new DateTimeImmutable('now', new DateTimeZone(APP_TIMEZONE));
$visibleEvents = array_values(array_filter($filteredEvents, static fn(array $event): bool => $event['end'] >= $now));
$found = count($visibleEvents);
?>
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Elenco eventi · CalendarGo</title>
<link rel="icon" href="favicon.svg" type="image/svg+xml">
<link rel="stylesheet" href="styles/default.css">
<link rel="stylesheet" href="styles/header.css">
<link rel="stylesheet" href="styles/filter.css">
<link rel="stylesheet" href="styles/tags.css">
<link rel="stylesheet" href="styles/modal.css">
<script src="scripts/modal.js" defer></script>
</head>
<body>
<?php include __DIR__ . '/includes/header.php'; ?>
<main class="filter-page">
<h1>Elenco cronologico degli eventi</h1>
<?php if ($loadResult['error'] !== null): ?><p class="status-message" role="status"><?= e($loadResult['error']) ?></p><?php endif; ?>
<?php include __DIR__ . '/includes/filtro_eventi.php'; ?>
<p><strong><?= $found ?></strong> <?= $found === 1 ? 'evento disponibile' : 'eventi disponibili' ?>.</p>
<div class="event-list">
<?php if ($visibleEvents === []): ?>
<p>Nessun evento futuro corrisponde al filtro selezionato.</p>
<?php else: ?>
<?php foreach ($visibleEvents as $event) renderEventCard($event); ?>
<?php endif; ?>
</div>
</main>
<?php include __DIR__ . '/includes/modal.php'; ?>
</body>
</html>