feat(site): Comunidade section with Instagram posts the gym was tagged in
Per-gym Graph API /tags fetch with file cache and local thumbnails, section after the gallery, navbar link and admin page (Gestão > Site).
This commit is contained in:
1 parent
6ac5213624
commit
e804c52b4e
10 files changed
+491
-3
No files matched your search
@@ -33,13 +33,14 @@ function site_info(PDO $pdo, ?int $gym_id = null): array {
|
||||
function site_section_has_content(array $gym, string $sec): bool {
|
||||
$pdo = $GLOBALS['pdo'] ?? null;
|
||||
$gid = (int) $gym['id'];
|
||||
if (!$pdo && $sec !== 'galeria') return true;
|
||||
if (!$pdo && $sec !== 'galeria' && $sec !== 'comunidade') return true;
|
||||
return match ($sec) {
|
||||
'modalidades' => (bool) site_modalidades($pdo, $gid),
|
||||
'equipa' => (bool) site_team_active($pdo, $gid),
|
||||
'horario' => (bool) site_horario($pdo, '', $gid),
|
||||
'mensalidades' => (bool) site_memberships($pdo, $gid),
|
||||
'galeria' => !empty($gym['gallery_id']) && img_list_dir('uploads/gallery/' . (int) $gym['gallery_id']),
|
||||
'comunidade' => (bool) site_instagram($gym),
|
||||
default => true,
|
||||
};
|
||||
}
|
||||
@@ -54,7 +55,7 @@ function site_team_active(PDO $pdo, ?int $gym_id = null): array {
|
||||
function site_navbar(?array $gym = null): array {
|
||||
$gym = $gym ?? current_gym();
|
||||
$items = ['Home' => ['#home', null]];
|
||||
foreach (['Galeria' => 'galeria', 'Modalidades' => 'modalidades', 'Equipa' => 'equipa', 'Horário' => 'horario',
|
||||
foreach (['Galeria' => 'galeria', 'Comunidade' => 'comunidade', 'Modalidades' => 'modalidades', 'Equipa' => 'equipa', 'Horário' => 'horario',
|
||||
'Mensalidades' => 'mensalidades', 'Contactos' => 'contactos'] as $label => $sec) {
|
||||
if (!gym_section_on($gym, $sec)) continue;
|
||||
// A section with nothing to show isn't rendered, so no link to it either.
|
||||
|
||||
Reference in new issue
Block a user