| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/bpkd_29052026/ |
Upload File : |
<?php
/**
* Halaman Laporan / Download
*/
require_once 'includes/init.php';
$page_title = 'Laporan Keuangan Daerah - ' . ($settings['site_title'] ?? 'Website Instansi');
$meta_description = 'Unduh berbagai laporan dan dokumen resmi instansi.';
// Additional CSS for DataTables
$additional_css = ['https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css'];
$additional_scripts = ['https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js', 'https://cdn.datatables.net/1.13.4/js/dataTables.bootstrap5.min.js'];
// Get categories for filter
$categories = $conn->query("
SELECT c.*, COUNT(r.id) as report_count
FROM report_categories c
LEFT JOIN reports r ON c.id = r.category_id AND r.status = 'active'
WHERE c.status = 'active'
GROUP BY c.id
ORDER BY c.name
");
// Get featured reports (top 3 most downloaded)
$featured_reports = $conn->query("
SELECT r.*, m.filename, m.filepath, rc.name as category_name
FROM reports r
LEFT JOIN media m ON r.file_id = m.id
LEFT JOIN report_categories rc ON r.category_id = rc.id
WHERE r.status = 'active'
ORDER BY r.download_count DESC
LIMIT 3
");
// Get all active reports
$reports = $conn->query("
SELECT r.*, m.filename, m.filepath, rc.name as category_name, rc.slug as category_slug
FROM reports r
LEFT JOIN media m ON r.file_id = m.id
LEFT JOIN report_categories rc ON r.category_id = rc.id
WHERE r.status = 'active'
ORDER BY r.report_order ASC, r.created_at DESC
");
// Get statistics
$total_reports = $conn->query("SELECT COUNT(*) as total FROM reports WHERE status = 'active'")->fetch_assoc()['total'];
$total_downloads = $conn->query("SELECT SUM(download_count) as total FROM reports WHERE status = 'active'")->fetch_assoc()['total'];
$total_categories = $conn->query("SELECT COUNT(*) as total FROM report_categories WHERE status = 'active'")->fetch_assoc()['total'];
// Get latest reports (for sidebar)
$latest_reports = $conn->query("
SELECT r.*, rc.name as category_name
FROM reports r
LEFT JOIN report_categories rc ON r.category_id = rc.id
WHERE r.status = 'active'
ORDER BY r.created_at DESC
LIMIT 5
");
include 'includes/header.php';
?>
<!-- Page Header -->
<section class="page-header text-white py-5">
<!-- <div class="container">
<div class="row">
<div class="col-12 text-center">
<h1 class="display-4 fw-bold"><i class="fas fa-download me-3"></i>Laporan Keuangan Daerah</h1>
<p class="lead">Unduh berbagai laporan dan dokumen resmi instansi</p>
</div>
</div>
</div>
-->
</section>
<div class="container">
<div class="row">
<div class="sidebar col-lg-10 mx-auto">
<div class="card mb-3 py-3 mt-5">
<div class="card-body p-4">
<h4 class="text-center">PUBLIKASI LAPORAN KEUANGAN DAERAH</h4>
<br/>
<div class="row" style="overflow: auto">
<div class="card-body">
<!-- Featured Reports Section -->
<?php if ($featured_reports && $featured_reports->num_rows > 0): ?>
<section class="featured-section py-5">
<div class="container">
<div class="section-header text-center mb-5" data-aos="fade-up">
<h2 class="section-title">Laporan Populer</h2>
<p class="section-subtitle">Laporan yang paling banyak diunduh</p>
</div>
<div class="row">
<?php while($featured = $featured_reports->fetch_assoc()): ?>
<div class="col-md-4 mb-4" data-aos="fade-up" data-aos-delay="<?php echo $featured['id'] * 100; ?>">
<div class="card h-100 shadow-sm featured-card">
<div class="card-body text-center">
<div class="report-icon mb-3">
<i class="fas fa-file-pdf fa-4x text-danger"></i>
</div>
<h5 class="card-title"><?php echo htmlspecialchars($featured['title']); ?></h5>
<?php if($featured['category_name']): ?>
<span class="badge bg-info mb-2">
<i class="fas fa-tag me-1"></i><?php echo htmlspecialchars($featured['category_name']); ?>
</span>
<?php endif; ?>
<p class="card-text text-muted small">
<?php echo htmlspecialchars(substr($featured['description'] ?? '', 0, 100)); ?>...
</p>
<div class="report-stats mb-3">
<small class="text-muted">
<i class="fas fa-download me-1"></i> <?php echo number_format($featured['download_count']); ?> kali
</small>
<small class="text-muted ms-2">
<i class="fas fa-file me-1"></i> <?php echo $featured['file_size']; ?>
</small>
</div>
<a href="download.php?id=<?php echo $featured['id']; ?>" class="btn btn-primary">
<i class="fas fa-download me-2"></i>Download
</a>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</section>
<?php endif; ?>
<!-- Main Laporan Section -->
<section class="laporan-section py-5">
<div class="container">
<div class="row">
<!-- Sidebar - Categories & Latest -->
<div class="col-lg-3 mb-4">
<!-- Categories Card -->
<div class="card shadow mb-4">
<div class="card-header bg-primary text-white">
<h5 class="mb-0"><i class="fas fa-tags me-2"></i>Kategori</h5>
</div>
<div class="card-body p-0">
<div class="list-group list-group-flush">
<a href="laporan.php" class="list-group-item list-group-item-action <?php echo !isset($_GET['kategori']) ? 'active' : ''; ?>">
<i class="fas fa-folder-open me-2"></i>Semua Laporan
<span class="badge bg-primary float-end"><?php echo $total_reports; ?></span>
</a>
<?php
$categories->data_seek(0);
while($cat = $categories->fetch_assoc()):
?>
<a href="?kategori=<?php echo $cat['slug']; ?>" class="list-group-item list-group-item-action <?php echo (isset($_GET['kategori']) && $_GET['kategori'] == $cat['slug']) ? 'active' : ''; ?>">
<i class="fas fa-folder me-2"></i><?php echo htmlspecialchars($cat['name']); ?>
<span class="badge bg-primary float-end"><?php echo $cat['report_count']; ?></span>
</a>
<?php endwhile; ?>
</div>
</div>
</div>
<!-- Latest Reports Card -->
<?php if ($latest_reports && $latest_reports->num_rows > 0): ?>
<div class="card shadow">
<div class="card-header bg-secondary text-white">
<h5 class="mb-0"><i class="fas fa-clock me-2"></i>Laporan Terbaru</h5>
</div>
<div class="card-body p-0">
<div class="list-group list-group-flush">
<?php while($latest = $latest_reports->fetch_assoc()): ?>
<a href="download.php?id=<?php echo $latest['id']; ?>" class="list-group-item list-group-item-action">
<div class="d-flex justify-content-between align-items-start">
<div>
<strong><?php echo htmlspecialchars(substr($latest['title'], 0, 40)); ?></strong>
<br>
<small class="text-muted">
<i class="fas fa-calendar me-1"></i><?php echo date('d/m/Y', strtotime($latest['created_at'])); ?>
</small>
</div>
<i class="fas fa-download text-primary"></i>
</div>
<?php if($latest['category_name']): ?>
<small class="text-muted">
<i class="fas fa-tag me-1"></i><?php echo htmlspecialchars($latest['category_name']); ?>
</small>
<?php endif; ?>
</a>
<?php endwhile; ?>
</div>
</div>
</div>
<?php endif; ?>
</div>
<!-- Main Content - Reports Table -->
<div class="col-lg-9">
<!-- Filter Bar -->
<div class="card shadow mb-4">
<div class="card-body">
<div class="row align-items-center">
<div class="col-md-6">
<div class="input-group">
<input type="text" id="searchInput" class="form-control" placeholder="Cari laporan...">
<button class="btn btn-primary" id="searchBtn">
<i class="fas fa-search"></i>
</button>
</div>
</div>
<div class="col-md-6 text-md-end mt-3 mt-md-0">
<div class="btn-group" role="group">
<button type="button" class="btn btn-outline-secondary" id="viewTableBtn">
<i class="fas fa-table"></i> Tabel
</button>
<button type="button" class="btn btn-outline-secondary" id="viewGridBtn">
<i class="fas fa-th-large"></i> Grid
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Table View -->
<div id="tableView" class="card shadow">
<div class="card-body">
<div class="table-responsive">
<table id="reportsTable" class="table table-hover">
<thead>
<tr>
<th>No</th>
<th>Judul Laporan</th>
<th>Kategori</th>
<th>Ukuran</th>
<th>Tanggal</th>
<th>Download</th>
<th>Aksi</th>
</thead>
<tbody>
<?php
$no = 1;
if ($reports && $reports->num_rows > 0):
while($report = $reports->fetch_assoc()):
?>
<tr data-category="<?php echo htmlspecialchars($report['category_name']); ?>">
<td><?php echo $no++; ?></td>
<td>
<strong><?php echo htmlspecialchars($report['title']); ?></strong>
<?php if(!empty($report['description'])): ?>
<br><small class="text-muted"><?php echo htmlspecialchars(substr($report['description'], 0, 80)); ?>...</small>
<?php endif; ?>
</td>
<td>
<?php if($report['category_name']): ?>
<span class="badge bg-info">
<i class="fas fa-tag me-1"></i><?php echo htmlspecialchars($report['category_name']); ?>
</span>
<?php else: ?>
<span class="badge bg-secondary">-</span>
<?php endif; ?>
</td>
<td><?php echo $report['file_size']; ?></td>
<td><?php echo date('d/m/Y', strtotime($report['created_at'])); ?></td>
<td>
<span class="badge bg-primary">
<i class="fas fa-download me-1"></i><?php echo number_format($report['download_count']); ?>
</span>
</td>
<td>
<a href="download.php?id=<?php echo $report['id']; ?>" class="btn btn-sm btn-primary">
<i class="fas fa-download me-1"></i> Download
</a>
</td>
</tr>
<?php
endwhile;
else:
?>
<tr>
<td colspan="7" class="text-center py-5">
<i class="fas fa-folder-open fa-3x text-muted mb-3"></i>
<p class="text-muted">Belum ada laporan yang tersedia</p>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Grid View (Hidden by default) -->
<div id="gridView" class="row" style="display: none;">
<?php
if ($reports && $reports->num_rows > 0):
$reports->data_seek(0);
while($report = $reports->fetch_assoc()):
?>
<div class="col-md-6 col-lg-4 mb-4">
<div class="card h-100 shadow-sm report-grid-card">
<div class="card-body text-center">
<div class="report-icon mb-3">
<i class="fas fa-file-pdf fa-3x text-danger"></i>
</div>
<h6 class="card-title"><?php echo htmlspecialchars(substr($report['title'], 0, 50)); ?></h6>
<?php if($report['category_name']): ?>
<span class="badge bg-info mb-2">
<i class="fas fa-tag me-1"></i><?php echo htmlspecialchars($report['category_name']); ?>
</span>
<?php endif; ?>
<div class="report-stats mb-2">
<small class="text-muted">
<i class="fas fa-download me-1"></i> <?php echo number_format($report['download_count']); ?>
</small>
<small class="text-muted ms-2">
<i class="fas fa-file me-1"></i> <?php echo $report['file_size']; ?>
</small>
</div>
<a href="download.php?id=<?php echo $report['id']; ?>" class="btn btn-sm btn-primary w-100">
<i class="fas fa-download me-1"></i> Download
</a>
</div>
</div>
</div>
<?php
endwhile;
endif;
?>
</div>
</div>
</div>
</div>
</section>
<!-- Statistics Cards -->
<div class="stats-section py-4 bg-light">
<div class="container">
<div class="row">
<div class="col-md-4 mb-3">
<div class="card shadow-sm text-center">
<div class="card-body">
<i class="fas fa-file-alt fa-3x text-primary mb-2"></i>
<h3 class="mb-0"><?php echo number_format($total_reports); ?></h3>
<p class="text-muted mb-0">Total Laporan</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card shadow-sm text-center">
<div class="card-body">
<i class="fas fa-download fa-3x text-success mb-2"></i>
<h3 class="mb-0"><?php echo number_format($total_downloads); ?></h3>
<p class="text-muted mb-0">Total Download</p>
</div>
</div>
</div>
<div class="col-md-4 mb-3">
<div class="card shadow-sm text-center">
<div class="card-body">
<i class="fas fa-tags fa-3x text-info mb-2"></i>
<h3 class="mb-0"><?php echo number_format($total_categories); ?></h3>
<p class="text-muted mb-0">Kategori Laporan</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Info Download -->
<div class="container mb-5">
<div class="alert alert-info">
<i class="fas fa-info-circle me-2"></i>
Untuk pertanyaan lebih lanjut mengenai laporan atau dokumen, silakan hubungi kami melalui <a href="kontak.php" class="alert-link">halaman kontak</a>.
</div>
</div>
<script>
$(document).ready(function() {
// Initialize DataTable
var table = $('#reportsTable').DataTable({
"pageLength": 10,
"language": {
"url": "//cdn.datatables.net/plug-ins/1.13.4/i18n/id.json"
},
"order": [[0, 'asc']],
"columnDefs": [
{ "orderable": false, "targets": [6] }
]
});
// Custom search
$('#searchBtn').on('click', function() {
table.search($('#searchInput').val()).draw();
});
$('#searchInput').on('keyup', function(e) {
if (e.key === 'Enter') {
table.search($(this).val()).draw();
}
});
// Category filter from URL
const urlParams = new URLSearchParams(window.location.search);
const category = urlParams.get('kategori');
if (category) {
table.column(2).search(category).draw();
}
// View toggle
$('#viewTableBtn').on('click', function() {
$('#tableView').show();
$('#gridView').hide();
$(this).addClass('active');
$('#viewGridBtn').removeClass('active');
});
$('#viewGridBtn').on('click', function() {
$('#tableView').hide();
$('#gridView').show();
$(this).addClass('active');
$('#viewTableBtn').removeClass('active');
});
});
</script>
<style>
/* Statistics Cards */
.stats-section .card {
transition: all 0.3s;
border: none;
}
.stats-section .card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0,0,0,0.1) !important;
}
/* Featured Cards */
.featured-card {
transition: all 0.3s;
border: none;
position: relative;
overflow: hidden;
}
.featured-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 5px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.featured-card:hover {
transform: translateY(-10px);
box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}
.report-icon i {
transition: transform 0.3s;
}
.featured-card:hover .report-icon i {
transform: scale(1.1);
}
/* Category Sidebar */
.list-group-item.active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-color: transparent;
}
.list-group-item.active .badge {
background: white;
color: #667eea;
}
/* Grid View Cards */
.report-grid-card {
transition: all 0.3s;
border: none;
}
.report-grid-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.report-grid-card .btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
}
.report-grid-card .btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(102,126,234,0.3);
}
/* DataTables */
.dataTables_wrapper .dataTables_filter {
display: none;
}
.dataTables_wrapper .dataTables_length {
margin-bottom: 1rem;
}
.dataTables_wrapper .dataTables_paginate {
margin-top: 1rem;
}
.table th {
background: #f8f9fc;
border-bottom: 2px solid #e3e6f0;
}
.table td {
vertical-align: middle;
}
/* Responsive */
@media (max-width: 768px) {
.stats-section .col-md-4 {
margin-bottom: 15px;
}
.featured-section .col-md-4 {
margin-bottom: 20px;
}
.btn-group {
width: 100%;
}
.btn-group .btn {
flex: 1;
}
}
</style>
<?php include 'includes/footer.php'; ?>