- Rebuilt the CLI importer to use the official Facebook Graph API instead of HTML scraping.
Main changes: Replaced [scripts/facebook-events-import.php](/Users/tyemeclifford/Documents/GH/MyKeyser/scripts/facebook-events-import.php) with a Graph API client. It now supports --page-id, --pages-file, --event-id, --events-file, and optional area discovery via --discover-pages --center=LAT,LNG --query=.... Uses FACEBOOK_GRAPH_ACCESS_TOKEN or --access-token. Pulls Graph fields for title, description, start/end time, place/location, ticket URI, and cover.source for the main photo. Keeps the existing staged review/import workflow in /admin/event_imports.php. - Implemented event detail pages and clickable event cards. What changed: Added [event.php](/Users/tyemeclifford/Documents/GH/MyKeyser/event.php) for individual event pages. Made event cards clickable from [events.php](/Users/tyemeclifford/Documents/GH/MyKeyser/events.php), [index.php](/Users/tyemeclifford/Documents/GH/MyKeyser/index.php), and legacy [2index.php](/Users/tyemeclifford/Documents/GH/MyKeyser/2index.php). Added large event photo display plus lightbox enlargement in [assets/css/style.css](/Users/tyemeclifford/Documents/GH/MyKeyser/assets/css/style.css) and [assets/js/app.js](/Users/tyemeclifford/Documents/GH/MyKeyser/assets/js/app.js). Added eventUrl() and externalHref() helpers in [includes/functions.php](/Users/tyemeclifford/Documents/GH/MyKeyser/includes/functions.php). Added copy-event-link support on event detail pages. Updated README to list the new route.
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
require_once __DIR__.'/includes/boot.php';
|
||||
|
||||
$id = iget('id');
|
||||
$event = qone("
|
||||
SELECT e.*, u.username AS submitter
|
||||
FROM events e
|
||||
LEFT JOIN users u ON u.id = e.submitted_by
|
||||
WHERE e.id = ? AND (e.status = 'approved' OR ? = 1)
|
||||
", [$id, isAdmin() ? 1 : 0]);
|
||||
|
||||
if (!$event) {
|
||||
flash('Event not found.', 'error');
|
||||
go('/events.php');
|
||||
}
|
||||
|
||||
$activeNav = 'events';
|
||||
$pageTitle = e($event['title']).' - Events in Keyser, WV';
|
||||
|
||||
$dateLabel = fdate($event['event_date'], 'l, F j, Y');
|
||||
$endDateLabel = !empty($event['end_date']) ? fdate($event['end_date'], 'l, F j, Y') : '';
|
||||
$timeLabel = trim((string)($event['event_time'] ?? ''));
|
||||
$endTimeLabel = trim((string)($event['end_time'] ?? ''));
|
||||
$dateRange = $dateLabel;
|
||||
if ($endDateLabel && $endDateLabel !== $dateLabel) $dateRange .= ' through '.$endDateLabel;
|
||||
if ($timeLabel !== '') $dateRange .= ' at '.$timeLabel;
|
||||
if ($endTimeLabel !== '') $dateRange .= ' - '.$endTimeLabel;
|
||||
|
||||
include __DIR__.'/includes/header.php';
|
||||
?>
|
||||
<div class="detail-hdr">
|
||||
<div class="detail-hdr-inner">
|
||||
<div class="breadcrumb">
|
||||
<a href="/index.php">Home</a><span>›</span>
|
||||
<a href="/events.php">Events</a><span>›</span>
|
||||
<?=e($event['title'])?>
|
||||
</div>
|
||||
<div class="cat-badge">COMMUNITY EVENT</div>
|
||||
<h1 style="font-size:clamp(1.9rem,4vw,2.9rem);margin:.4rem 0"><?=e($event['title'])?></h1>
|
||||
<div class="evt-meta" style="font-size:.9rem;margin-top:.65rem">
|
||||
<span><?=e($dateRange)?></span>
|
||||
<?php if (!empty($event['venue'])): ?><span><?=e($event['venue'])?></span><?php endif; ?>
|
||||
<?php if ($event['is_featured']): ?><span class="featured-badge">FEATURED</span><?php endif; ?>
|
||||
<?php if (isAdmin() && $event['status'] !== 'approved'): ?><span class="badge badge-gold"><?=strtoupper(e($event['status']))?></span><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-body">
|
||||
<div>
|
||||
|
||||
<?php if (!empty($event['image_path'])): ?>
|
||||
<div class="event-hero-photo ibox">
|
||||
<button type="button" class="event-photo-btn" data-lightbox-src="<?=e($event['image_path'])?>" data-lightbox-alt="<?=e($event['title'])?>">
|
||||
<img src="<?=e($event['image_path'])?>" alt="<?=e($event['title'])?>">
|
||||
<span>View full image</span>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">ABOUT THIS EVENT</div>
|
||||
<?php if (!empty($event['description'])): ?>
|
||||
<p style="color:var(--text-m);line-height:1.85;white-space:pre-line"><?=e($event['description'])?></p>
|
||||
<?php else: ?>
|
||||
<p style="color:var(--text-d)">No description has been added yet.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($event['address'])): ?>
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">LOCATION</div>
|
||||
<div style="background:var(--bg4);border:1px dashed var(--bdr);border-radius:4px;padding:1.75rem;text-align:center">
|
||||
<?php if (!empty($event['venue'])): ?><h3 style="font-size:1.2rem;margin-bottom:.35rem"><?=e($event['venue'])?></h3><?php endif; ?>
|
||||
<p style="font-size:.9rem;color:var(--text-m);margin-bottom:.9rem"><?=e($event['address'])?></p>
|
||||
<a href="https://maps.google.com/?q=<?=urlencode(trim(($event['venue'] ? $event['venue'].' ' : '').$event['address']))?>" target="_blank" rel="noopener" class="btn btn-outline btn-sm">Open in Google Maps</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="flex-row">
|
||||
<a href="/events.php" class="btn btn-secondary">Back to Events</a>
|
||||
<?php if (isAdmin()): ?><a href="/admin/events.php?edit=<?=(int)$event['id']?>" class="btn btn-outline">Edit Event</a><?php endif; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">EVENT DETAILS</div>
|
||||
<div class="event-detail-date">
|
||||
<div class="evt-date-box">
|
||||
<div class="evt-mon"><?=strtoupper(date('M', strtotime($event['event_date'])))?></div>
|
||||
<div class="evt-day"><?=date('j', strtotime($event['event_date']))?></div>
|
||||
<div class="evt-yr"><?=date('Y', strtotime($event['event_date']))?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div style="font-weight:700;color:var(--text)"><?=e($dateLabel)?></div>
|
||||
<?php if ($timeLabel !== ''): ?><div style="color:var(--text-m);font-size:.9rem"><?=e($timeLabel)?><?= $endTimeLabel !== '' ? ' - '.e($endTimeLabel) : '' ?></div><?php endif; ?>
|
||||
<?php if ($endDateLabel && $endDateLabel !== $dateLabel): ?><div style="color:var(--text-d);font-size:.82rem">Through <?=e($endDateLabel)?></div><?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (!empty($event['venue'])): ?><div class="irow"><span class="irow-i">📍</span><span class="irow-v"><?=e($event['venue'])?></span></div><?php endif; ?>
|
||||
<?php if (!empty($event['address'])): ?><div class="irow"><span class="irow-i">⌖</span><span class="irow-v"><?=e($event['address'])?></span></div><?php endif; ?>
|
||||
<div class="irow"><span class="irow-i">$</span><span class="irow-v"><?=e($event['cost'] ?: 'Free')?></span></div>
|
||||
<?php if (!empty($event['website'])): ?>
|
||||
<div class="irow"><span class="irow-i">↗</span><a href="<?=e(externalHref($event['website']))?>" target="_blank" rel="noopener" class="irow-v" style="color:var(--gold);word-break:break-all"><?=e($event['website'])?></a></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($event['contact_name']) || !empty($event['contact_email']) || !empty($event['contact_phone'])): ?>
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">CONTACT</div>
|
||||
<?php if (!empty($event['contact_name'])): ?><div class="irow"><span class="irow-i">◇</span><span class="irow-v"><?=e($event['contact_name'])?></span></div><?php endif; ?>
|
||||
<?php if (!empty($event['contact_phone'])): ?><div class="irow"><span class="irow-i">☎</span><a href="tel:<?=e($event['contact_phone'])?>" class="irow-v" style="color:var(--gold)"><?=e($event['contact_phone'])?></a></div><?php endif; ?>
|
||||
<?php if (!empty($event['contact_email'])): ?><div class="irow"><span class="irow-i">@</span><a href="mailto:<?=e($event['contact_email'])?>" class="irow-v" style="color:var(--gold);word-break:break-all"><?=e($event['contact_email'])?></a></div><?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="ibox">
|
||||
<div class="ibox-title">SHARE</div>
|
||||
<p style="color:var(--text-m);font-size:.88rem;margin-bottom:.8rem">Send this event page to someone who should know about it.</p>
|
||||
<button type="button" class="btn btn-outline btn-sm" data-copy-url="<?=e(absoluteUrl(eventUrl($event)))?>">Copy Event Link</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include __DIR__.'/includes/footer.php'; ?>
|
||||
Reference in New Issue
Block a user