%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
/**
* Halaman publik: daftar Berita.
*/
require_once __DIR__ . '/config/config.php';
require_once __DIR__ . '/includes/queries.php';
$page = max(1, (int) get_param('page', '1'));
$perPage = 9;
$offset = ($page - 1) * $perPage;
$total = (int) db()->query("SELECT COUNT(*) FROM berita WHERE status = 'publish'")->fetchColumn();
$totalPages = max(1, (int) ceil($total / $perPage));
$stmt = db()->prepare(
"SELECT id, judul, slug, ringkasan, gambar, views, COALESCE(published_at, created_at) AS tanggal
FROM berita WHERE status = 'publish'
ORDER BY COALESCE(published_at, created_at) DESC LIMIT :limit OFFSET :offset"
);
$stmt->bindValue(':limit', $perPage, PDO::PARAM_INT);
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
$stmt->execute();
$berita = $stmt->fetchAll();
$pageTitle = t('Berita') . ' — ' . APP_NAME_SHORT;
$activeNav = 'berita';
require __DIR__ . '/partials/head.php';
require __DIR__ . '/partials/navbar.php';
?>
<section class="relative overflow-hidden bg-gradient-to-br from-mateng-green to-mateng-blue text-white py-14">
<?php require __DIR__ . '/partials/sekda-header.php'; ?>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<nav class="text-sm text-green-100 mb-3">
<a href="<?= e(url('index.php')) ?>" class="hover:underline"><?= e(t('Beranda')) ?></a><span class="mx-2">/</span><span><?= e(t('Berita')) ?></span>
</nav>
<h1 class="text-3xl md:text-4xl font-extrabold mb-2"><?= e(t('Berita Terkini')) ?></h1>
<p class="text-green-50 max-w-2xl"><?= e(t('Kabar & informasi terbaru seputar layanan publik Kabupaten Mamuju Tengah.')) ?></p>
</div>
</section>
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-10 w-full">
<?php if (empty($berita)): ?>
<div class="text-center py-20 bg-white rounded-2xl border border-slate-100">
<i class="fas fa-newspaper text-5xl text-slate-300 mb-4"></i>
<p class="text-slate-500 font-medium"><?= e(t('Belum ada berita yang dipublikasikan.')) ?></p>
</div>
<?php else: ?>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<?php foreach ($berita as $b):
$img = !empty($b['gambar']) && is_file(UPLOAD_PATH . '/berita/' . $b['gambar'])
? UPLOAD_URL . '/berita/' . $b['gambar'] : null; ?>
<a href="<?= e(url('berita-detail.php?slug=' . urlencode($b['slug']))) ?>" class="group bg-white rounded-2xl overflow-hidden ring-1 ring-slate-100 shadow-lg shadow-slate-200/40 hover:-translate-y-1.5 hover:shadow-2xl transition-all duration-300 flex flex-col">
<div class="aspect-[16/9] bg-gradient-to-br from-mateng-green/10 to-mateng-blue/10 overflow-hidden">
<?php if ($img): ?>
<img src="<?= e($img) ?>" alt="<?= e($b['judul']) ?>" class="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300">
<?php else: ?>
<div class="w-full h-full flex items-center justify-center text-mateng-green/40"><i class="fas fa-newspaper text-4xl"></i></div>
<?php endif; ?>
</div>
<div class="p-5 flex flex-col flex-grow">
<p class="text-xs text-slate-400 mb-2"><i class="far fa-calendar mr-1"></i><?= e(tanggal_id($b['tanggal'])) ?></p>
<h3 class="font-bold text-slate-800 leading-snug mb-2 group-hover:text-mateng-green transition-colors"><?= e($b['judul']) ?></h3>
<p class="text-sm text-slate-500 flex-grow"><?= e(excerpt($b['ringkasan'] ?: '', 110)) ?></p>
<span class="inline-flex items-center gap-1.5 text-sm font-semibold text-mateng-green mt-4"><?= e(t('Baca selengkapnya')) ?> <i class="fas fa-arrow-right text-xs group-hover:translate-x-1 transition-transform"></i></span>
</div>
</a>
<?php endforeach; ?>
</div>
<?php if ($totalPages > 1): ?>
<div class="flex justify-center items-center gap-2 mt-10">
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
<a href="<?= e(url('berita.php?page=' . $i)) ?>" class="px-4 py-2 rounded-lg border text-sm font-medium <?= $i === $page ? 'bg-mateng-green text-white border-mateng-green' : 'bg-white text-slate-600 border-slate-200 hover:border-mateng-green' ?>"><?= $i ?></a>
<?php endfor; ?>
</div>
<?php endif; ?>
<?php endif; ?>
</main>
<?php require __DIR__ . '/partials/footer.php'; ?>