Add multi-announcement management system

- Update inc/announcements.php to support listing, fetching by ID, toggling, and deleting multiple announcements
- Upgrade admin/index.php to an announcement management view with data table, status indicators, and create/edit sub-views
- Add admin table and action styles to styles.css without using inline style blocks
- Update index.php to render all currently active banner and hours announcements dynamically
This commit is contained in:
David Dyer committed 2026-08-29 22:50:19 -04:00
1 parent e4cd4f6cfb
commit bd22299247
4 files changed
+330 -120

No files matched your search

+26 -14
View File
@@ -3,7 +3,7 @@ require __DIR__ . '/config.php';
require __DIR__ . '/inc/facebook-stats.php';
require __DIR__ . '/inc/announcements.php';
$fbStats = fritz_facebook_stats();
$activeAnnouncement = get_active_announcement();
$activeAnnouncements = get_active_announcements();
$siteUrl = rtrim(SITE_URL, '/');
?>
<!doctype html>
@@ -61,14 +61,21 @@ $siteUrl = rtrim(SITE_URL, '/');
</div>
</header>
<?php if ($activeAnnouncement && !empty($activeAnnouncement['show_banner'])): ?>
<div class="announcement-banner banner-<?= htmlspecialchars($activeAnnouncement['type']) ?>" role="region" aria-label="Important Announcement">
<div class="container announcement-inner">
<span class="announcement-tag"><?= htmlspecialchars($activeAnnouncement['headline']) ?></span>
<span class="announcement-sep" aria-hidden="true">·</span>
<span class="announcement-text"><?= htmlspecialchars($activeAnnouncement['message']) ?></span>
<?php
$bannerAnnouncements = array_filter($activeAnnouncements, function($a) {
return !empty($a['show_banner']);
});
?>
<?php if (!empty($bannerAnnouncements)): ?>
<?php foreach ($bannerAnnouncements as $banner): ?>
<div class="announcement-banner banner-<?= htmlspecialchars($banner['type']) ?>" role="region" aria-label="Important Announcement">
<div class="container announcement-inner">
<span class="announcement-tag"><?= htmlspecialchars($banner['headline']) ?></span>
<span class="announcement-sep" aria-hidden="true">·</span>
<span class="announcement-text"><?= htmlspecialchars($banner['message']) ?></span>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<main id="main">
@@ -127,12 +134,17 @@ $siteUrl = rtrim(SITE_URL, '/');
<div class="visit-grid">
<div class="card reveal">
<h3>On Tap Thu–Sat</h3>
<?php if ($activeAnnouncement && !empty($activeAnnouncement['show_in_hours'])): ?>
<div class="hours-alert alert-<?= htmlspecialchars($activeAnnouncement['type']) ?>">
<strong><?= htmlspecialchars($activeAnnouncement['headline']) ?>:</strong>
<span><?= htmlspecialchars($activeAnnouncement['message']) ?></span>
<?php
$hoursAnnouncements = array_filter($activeAnnouncements, function($a) {
return !empty($a['show_in_hours']);
});
?>
<?php foreach ($hoursAnnouncements as $hoursNotice): ?>
<div class="hours-alert alert-<?= htmlspecialchars($hoursNotice['type']) ?>">
<strong><?= htmlspecialchars($hoursNotice['headline']) ?>:</strong>
<span><?= htmlspecialchars($hoursNotice['message']) ?></span>
</div>
<?php endif; ?>
<?php endforeach; ?>
<dl class="hours-list">
<div class="hours-row">
<dt>Thursday</dt>
@@ -283,4 +295,4 @@ $siteUrl = rtrim(SITE_URL, '/');
</script>
</body>
</html>
</html>