403Webshell
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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : D:/bpkd//ikm.php
<?php
/**
 * File: ikm.php (Frontend)
 * Halaman Indeks Kepuasan Masyarakat
 * URL: /ikm
 */

require_once 'includes/init.php';

$page_title = 'Indeks Kepuasan Masyarakat - ' . ($settings['site_title'] ?? 'Website Instansi');
$meta_description = 'Laporan Indeks Kepuasan Masyarakat terhadap pelayanan publik';

// Pagination
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$limit = 12; // Jumlah card per halaman (3x4 grid)
$offset = ($page - 1) * $limit;

// Filter tahun
$tahun_filter = isset($_GET['tahun']) ? (int)$_GET['tahun'] : 0;

// Build query
$where = "WHERE status = 'publish'";
$params = [];
if ($tahun_filter > 0) {
    $where .= " AND tahun = ?";
    $params[] = $tahun_filter;
}

// Count total
$count_sql = "SELECT COUNT(*) as total FROM ikm $where";
if (!empty($params)) {
    $stmt = $conn->prepare($count_sql);
    $stmt->bind_param("i", ...$params);
    $stmt->execute();
    $total_result = $stmt->get_result();
    $total_records = $total_result->fetch_assoc()['total'];
    $stmt->close();
} else {
    $total_result = $conn->query($count_sql);
    $total_records = $total_result->fetch_assoc()['total'];
}
$total_pages = ceil($total_records / $limit);

// Get data
$sql = "SELECT * FROM ikm $where ORDER BY tahun DESC, created_at DESC LIMIT ? OFFSET ?";
if (!empty($params)) {
    $stmt = $conn->prepare($sql);
    $params[] = $limit;
    $params[] = $offset;
    $stmt->bind_param("iii", ...$params);
    $stmt->execute();
    $ikm_list = $stmt->get_result();
    $stmt->close();
} else {
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("ii", $limit, $offset);
    $stmt->execute();
    $ikm_list = $stmt->get_result();
    $stmt->close();
}

// Ambil daftar tahun untuk filter
$tahun_list = $conn->query("SELECT DISTINCT tahun FROM ikm WHERE status = 'publish' ORDER BY tahun DESC");

include 'includes/header.php';
?>

<style>
/* ============================================
   IKM PAGE STYLES
   ============================================ */

.ikm-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
.ikm-header {
    text-align: center;
    margin-bottom: 40px;
}

.ikm-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.ikm-header p {
    color: #64748b;
    font-size: 1rem;
}

.ikm-header-underline {
    width: 80px;
    height: 4px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    margin: 20px auto 0;
    border-radius: 4px;
}

/* Filter Section */
.ikm-filter {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 40px;
    border: 1px solid #eef2f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.ikm-filter-title {
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ikm-filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.ikm-filter-select {
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.ikm-filter-btn {
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.ikm-filter-btn:hover {
    background: #1d4ed8;
}

.ikm-filter-reset {
    padding: 10px 20px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
}

.ikm-filter-reset:hover {
    background: #e2e8f0;
}

/* Cards Grid */
.ikm-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* Card IKM */
.ikm-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
    border: 1px solid #eef2f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ikm-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px -8px rgba(0, 0, 0, 0.12);
}

.ikm-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px 16px;
    text-align: center;
    position: relative;
}

.ikm-card-header .ikm-card-year {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    margin-bottom: 4px;
}

.ikm-card-header .ikm-card-title {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-weight: 500;
}

.ikm-card-body {
    padding: 16px;
    flex: 1;
}

.ikm-card-desc {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Indeks Styling */
.ikm-card-indeks {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    border-top: 1px solid #eef2f6;
    border-bottom: 1px solid #eef2f6;
    margin-bottom: 10px;
}

.ikm-indeks-label {
    font-size: 0.7rem;
    color: #64748b;
}

.ikm-indeks-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #3b82f6;
}

.ikm-predikat {
    font-size: 0.7rem;
    font-weight: 600;
    color: #15803d;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Card Footer */
.ikm-card-footer {
    text-align: center;
    padding: 0 16px 16px 16px;
}

/* Buttons */
.ikm-btn-pdf {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #ef4444;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.7rem;
    transition: all 0.3s;
    width: 100%;
    justify-content: center;
}

.ikm-btn-pdf:hover {
    background: #dc2626;
    gap: 10px;
    color: white;
}

.ikm-btn-image {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #10b981;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.7rem;
    transition: all 0.3s;
    width: 100%;
    justify-content: center;
}

.ikm-btn-image:hover {
    background: #059669;
    gap: 10px;
    color: white;
}

/* Pagination */
.ikm-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.ikm-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    background: white;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.ikm-pagination a:hover,
.ikm-pagination .ikm-active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.ikm-pagination .ikm-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Empty State */
.ikm-empty {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 16px;
    border: 1px solid #eef2f6;
}

.ikm-empty i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.ikm-empty h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.ikm-empty p {
    color: #64748b;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .ikm-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* Mobile Landscape */
@media (max-width: 768px) {
    .ikm-container {
        padding: 30px 16px;
    }
    
    .ikm-header h1 {
        font-size: 1.5rem;
    }
    
    .ikm-header p {
        font-size: 0.9rem;
    }
    
    .ikm-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .ikm-filter {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ikm-filter-form {
        width: 100%;
        flex-direction: column;
    }
    
    .ikm-filter-select,
    .ikm-filter-btn,
    .ikm-filter-reset {
        width: 100%;
    }
    
    .ikm-card-header {
        padding: 16px 12px;
    }
    
    .ikm-card-header .ikm-card-year {
        font-size: 1.4rem;
    }
}

/* Mobile Portrait */
@media (max-width: 576px) {
    .ikm-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .ikm-card-header {
        padding: 20px 16px;
    }
    
    .ikm-card-header .ikm-card-year {
        font-size: 1.6rem;
    }
    
    .ikm-card-body {
        padding: 14px;
    }
    
    .ikm-indeks-value {
        font-size: 1rem;
    }
    
    .ikm-btn-pdf,
    .ikm-btn-image {
        padding: 8px 12px;
    }
}
</style>

<div class="container py-5">
    
    <!-- Header -->
    <div class="ikm-header">
        <h1><i class="fas fa-chart-line me-2"></i> Indeks Kepuasan Masyarakat</h1>
        <p>Laporan Survei Kepuasan Masyarakat terhadap Pelayanan Publik</p>
        <div class="ikm-header-underline"></div>
    </div>
    
    <!-- Filter Tahun -->
    <div class="ikm-filter">
        <div class="ikm-filter-title">
            <i class="fas fa-filter"></i> Filter Berdasarkan Tahun
        </div>
        <form method="GET" class="ikm-filter-form">
            <select name="tahun" class="ikm-filter-select">
                <option value="">Semua Tahun</option>
                <?php while($t = $tahun_list->fetch_assoc()): ?>
                    <option value="<?php echo $t['tahun']; ?>" <?php echo $tahun_filter == $t['tahun'] ? 'selected' : ''; ?>>
                        <?php echo $t['tahun']; ?>
                    </option>
                <?php endwhile; ?>
            </select>
            <button type="submit" class="ikm-filter-btn">
                <i class="fas fa-search me-1"></i> Tampilkan
            </button>
            <?php if ($tahun_filter > 0): ?>
                <a href="<?php echo BASE_URL; ?>/ikm" class="ikm-filter-reset">
                    <i class="fas fa-times me-1"></i> Reset
                </a>
            <?php endif; ?>
        </form>
    </div>
    
    <!-- Cards Grid -->
    <?php if ($ikm_list && $ikm_list->num_rows > 0): ?>
        <div class="ikm-grid">
            <?php while($row = $ikm_list->fetch_assoc()): 
                // Tentukan tipe file dan path
                $file_ext = strtolower(pathinfo($row['file_pdf'], PATHINFO_EXTENSION));
                $is_image = in_array($file_ext, ['jpg', 'jpeg', 'png', 'gif', 'webp']);
                $file_path = BASE_URL . "/uploads/ikm/" . $row['file_pdf'];
            ?>
                <div class="ikm-card">
                    <div class="ikm-card-header">
                        <div class="ikm-card-year">Tahun <?php echo $row['tahun']; ?></div>
                        <div class="ikm-card-title"><?php echo htmlspecialchars(substr($row['judul'], 0, 50)); ?></div>
                    </div>
                    <div class="ikm-card-body">
                        <?php if(!empty($row['deskripsi'])): ?>
                        <p class="ikm-card-desc"><?php echo htmlspecialchars(substr($row['deskripsi'], 0, 80)); ?>...</p>
                        <?php endif; ?>
                        
                        <?php if($row['indeks'] !== null): ?>
                        <div class="ikm-card-indeks">
                            <span class="ikm-indeks-label">Indeks Kepuasan</span>
                            <span class="ikm-indeks-value"><?php echo number_format($row['indeks'], 2); ?>%</span>
                        </div>
                        <?php endif; ?>
                        
                        <?php if(!empty($row['predikat'])): ?>
                        <div class="ikm-predikat">
                            <i class="fas fa-medal"></i> <?php echo htmlspecialchars($row['predikat']); ?>
                        </div>
                        <?php endif; ?>
                    </div>
                    <div class="ikm-card-footer">
                        <a href="<?php echo $file_path; ?>" target="_blank" class="<?php echo $is_image ? 'ikm-btn-image' : 'ikm-btn-pdf'; ?>">
                            <i class="fas fa-<?php echo $is_image ? 'image' : 'file-pdf'; ?>"></i> 
                            <?php echo $is_image ? 'Lihat Gambar' : 'Baca Selengkapnya'; ?>
                        </a>
                    </div>
                </div>
            <?php endwhile; ?>
        </div>
        
        <!-- Pagination -->
        <?php if ($total_pages > 1): ?>
        <div class="ikm-pagination">
            <a href="?page=<?php echo $page-1; ?>&tahun=<?php echo $tahun_filter; ?>" class="<?php echo $page <= 1 ? 'ikm-disabled' : ''; ?>">
                <i class="fas fa-chevron-left"></i>
            </a>
            
            <?php 
            $start = max(1, $page - 2);
            $end = min($total_pages, $page + 2);
            
            if($start > 1): ?>
                <a href="?page=1&tahun=<?php echo $tahun_filter; ?>">1</a>
                <?php if($start > 2): ?>
                    <span class="px-2">...</span>
                <?php endif; ?>
            <?php endif; ?>
            
            <?php for($i = $start; $i <= $end; $i++): ?>
                <a href="?page=<?php echo $i; ?>&tahun=<?php echo $tahun_filter; ?>" class="<?php echo $i == $page ? 'ikm-active' : ''; ?>">
                    <?php echo $i; ?>
                </a>
            <?php endfor; ?>
            
            <?php if($end < $total_pages): ?>
                <?php if($end < $total_pages - 1): ?>
                    <span class="px-2">...</span>
                <?php endif; ?>
                <a href="?page=<?php echo $total_pages; ?>&tahun=<?php echo $tahun_filter; ?>">
                    <?php echo $total_pages; ?>
                </a>
            <?php endif; ?>
            
            <a href="?page=<?php echo $page+1; ?>&tahun=<?php echo $tahun_filter; ?>" class="<?php echo $page >= $total_pages ? 'ikm-disabled' : ''; ?>">
                <i class="fas fa-chevron-right"></i>
            </a>
        </div>
        <?php endif; ?>
        
    <?php else: ?>
        <div class="ikm-empty">
            <i class="fas fa-folder-open"></i>
            <h3>Belum Ada Data IKM</h3>
            <p>Saat ini belum ada laporan Indeks Kepuasan Masyarakat yang tersedia.</p>
        </div>
    <?php endif; ?>
    
</div>

<?php include 'includes/footer.php'; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit