%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
/**
* Admin: daftar & kelola Galeri Kegiatan.
*/
require_once dirname(__DIR__) . '/config/config.php';
require_once dirname(__DIR__) . '/includes/auth.php';
require_once dirname(__DIR__) . '/includes/queries.php';
require_central();
$rows = get_galeri_list();
$pageTitle = 'Galeri Kegiatan — CMS PPID';
$activeMenu = 'galeri';
require __DIR__ . '/partials/head.php';
?>
<div class="flex flex-col md:flex-row md:items-center justify-between mb-6 gap-4">
<div>
<h2 class="text-2xl font-bold text-slate-900">Galeri Kegiatan</h2>
<p class="text-sm text-slate-500 mt-1"><?= count($rows) ?> kegiatan.</p>
</div>
<a href="<?= e(url('admin/galeri-form.php')) ?>" class="bg-mateng-blue hover:bg-sky-700 text-white px-4 py-2.5 rounded-lg text-sm font-semibold transition-colors flex items-center gap-2 shrink-0 self-start">
<i class="fas fa-plus"></i> Tambah Kegiatan
</a>
</div>
<div class="bg-white border border-slate-100 rounded-xl shadow-sm overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse">
<thead>
<tr class="bg-slate-50 text-slate-500 text-xs uppercase tracking-wider">
<th class="px-6 py-4 font-semibold">Kegiatan</th>
<th class="px-6 py-4 font-semibold">Tanggal</th>
<th class="px-6 py-4 font-semibold text-center">Foto</th>
<th class="px-6 py-4 font-semibold text-center">Aksi</th>
</tr>
</thead>
<tbody class="text-sm divide-y divide-slate-100 text-slate-700">
<?php if (empty($rows)): ?>
<tr><td colspan="4" class="px-6 py-12 text-center text-slate-400"><i class="fas fa-images text-3xl mb-2 block"></i>Belum ada galeri kegiatan.</td></tr>
<?php else: foreach ($rows as $r):
$cover = !empty($r['cover']) && is_file(UPLOAD_PATH . '/galeri/' . $r['cover']) ? UPLOAD_URL . '/galeri/' . $r['cover'] : null; ?>
<tr class="hover:bg-slate-50/50 transition-colors">
<td class="px-6 py-4">
<div class="flex items-center gap-3">
<div class="w-12 h-12 rounded-lg bg-slate-100 overflow-hidden shrink-0 flex items-center justify-center">
<?php if ($cover): ?><img src="<?= e($cover) ?>" class="w-full h-full object-cover" alt=""><?php else: ?><i class="fas fa-images text-slate-300"></i><?php endif; ?>
</div>
<div class="font-medium text-slate-800 max-w-md truncate"><?= e($r['judul']) ?></div>
</div>
</td>
<td class="px-6 py-4"><?= e(tanggal_id($r['tanggal'] ?: $r['created_at'])) ?></td>
<td class="px-6 py-4 text-center"><?= (int) $r['jml_foto'] ?></td>
<td class="px-6 py-4">
<div class="flex items-center justify-center gap-1">
<a href="<?= e(url('admin/galeri-form.php?id=' . $r['id'])) ?>" class="p-2 text-mateng-blue hover:bg-blue-50 rounded-lg transition-colors" title="Edit"><i class="fas fa-pen"></i></a>
<form method="post" action="<?= e(url('admin/galeri-hapus.php')) ?>" onsubmit="return confirm('Hapus galeri kegiatan ini beserta seluruh fotonya?');" class="inline">
<?= csrf_field() ?>
<input type="hidden" name="id" value="<?= (int) $r['id'] ?>">
<button type="submit" class="p-2 text-red-500 hover:bg-red-50 rounded-lg transition-colors" title="Hapus"><i class="fas fa-trash"></i></button>
</form>
</div>
</td>
</tr>
<?php endforeach; endif; ?>
</tbody>
</table>
</div>
</div>
<?php require __DIR__ . '/partials/foot.php'; ?>