feat: memisahkan monorepo jadi 2 project (Kemiskinan & Publik)

This commit is contained in:
2026-06-11 14:38:22 +07:00
parent 4cbbd3c718
commit d77596f62b
48 changed files with 7277 additions and 36 deletions

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

+6 -15
View File
@@ -4,26 +4,17 @@
// ============================================================
session_start();
$modul = $_GET['modul'] ?? 'utuh';
$modul = $_GET['modul'] ?? 'bantuan';
// TAHAP 1: Modul publik diizinkan tanpa login
$public_modules = ['spbu', 'tematik', 'digitasi'];
$is_public_access = in_array($modul, $public_modules);
if ($is_public_access) {
// Jika akses publik, berikan role petugas agar pengunjung dapat mengedit data
$currentUser = $_SESSION['username'] ?? 'Pengunjung Kelas';
$currentRole = $_SESSION['role'] ?? 'petugas';
} else {
// Modul privat wajib login
if (!isset($_SESSION['user_id'])) {
// Aplikasi Kemiskinan Wajib Login Sepenuhnya
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit;
}
$currentUser = $_SESSION['username'];
$currentRole = $_SESSION['role'];
}
$currentUser = $_SESSION['username'];
$currentRole = $_SESSION['role'];
include 'koneksi.php';
// Eksekusi ALTER TABLE secara diam-diam jika kolom belum ada
+19 -19
View File
@@ -134,27 +134,27 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
</p>
</div>
<!-- Bottom / Public Shortcuts -->
<div>
<h2 class="mb-3 flex items-center gap-2 text-sm font-bold text-white/90">
<svg viewBox="0 0 24 24" fill="none" class="h-4.5 w-4.5 text-rose-300" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M2 12h4l2-9 5 18 3-10h4"></path>
<!-- Bottom / Features Info -->
<div class="mt-8">
<h2 class="mb-4 flex items-center gap-2 text-sm font-bold text-white/90 uppercase tracking-wider">
<svg viewBox="0 0 24 24" fill="none" class="h-5 w-5 text-rose-300" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
</svg>
Project Kelas (Akses Publik):
Sistem Pengamanan Tertutup
</h2>
<div class="flex flex-col gap-3">
<a href="index.php?modul=spbu" class="group flex items-center gap-3 rounded-xl border border-white/10 bg-white/5 px-4 py-3 text-sm font-bold text-white transition-all hover:-translate-y-0.5 hover:border-white/30 hover:bg-white/20">
<span class="text-xl transition-transform group-hover:scale-110"></span>
Peta Lokasi SPBU
</a>
<a href="index.php?modul=tematik" class="group flex items-center gap-3 rounded-xl border border-white/10 bg-white/5 px-4 py-3 text-sm font-bold text-white transition-all hover:-translate-y-0.5 hover:border-white/30 hover:bg-white/20">
<span class="text-xl transition-transform group-hover:scale-110">🗺️</span>
Peta Tematik
</a>
<a href="index.php?modul=digitasi" class="group flex items-center gap-3 rounded-xl border border-white/10 bg-white/5 px-4 py-3 text-sm font-bold text-white transition-all hover:-translate-y-0.5 hover:border-white/30 hover:bg-white/20">
<span class="text-xl transition-transform group-hover:scale-110">📐</span>
Digitasi Lahan Kota
</a>
<div class="flex flex-col gap-4 text-white/80 text-sm">
<div class="flex items-start gap-3">
<div class="mt-0.5 rounded-full bg-white/20 p-1"><svg class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="3"><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg></div>
<p><strong>Database Terpusat:</strong> Melacak data penduduk miskin berdasarkan NIK secara real-time.</p>
</div>
<div class="flex items-start gap-3">
<div class="mt-0.5 rounded-full bg-white/20 p-1"><svg class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="3"><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg></div>
<p><strong>Tracking Bantuan:</strong> Verifikasi silang penyaluran BLT dan PKH di berbagai wilayah.</p>
</div>
<div class="flex items-start gap-3">
<div class="mt-0.5 rounded-full bg-white/20 p-1"><svg class="h-3 w-3" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="3"><path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg></div>
<p><strong>Analisis Spasial:</strong> Pemetaan kantong kemiskinan untuk kebijakan tepat sasaran.</p>
</div>
</div>
</div>
</div>

Before

Width:  |  Height:  |  Size: 366 KiB

After

Width:  |  Height:  |  Size: 366 KiB

Before

Width:  |  Height:  |  Size: 366 KiB

After

Width:  |  Height:  |  Size: 366 KiB

Before

Width:  |  Height:  |  Size: 374 KiB

After

Width:  |  Height:  |  Size: 374 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1024
View File
File diff suppressed because it is too large Load Diff
+75
View File
@@ -0,0 +1,75 @@
<?php
// ============================================================
// koneksi.php — Database Connection (PDO)
// ============================================================
define('DB_HOST', getenv('DB_HOST') ?: 'localhost');
define('DB_USER', getenv('DB_USER') ?: 'root');
define('DB_PASS', getenv('DB_PASS') !== false ? getenv('DB_PASS') : '');
define('DB_NAME', getenv('DB_NAME') ?: 'webgis');
define('DB_CHARSET', 'utf8mb4');
$dsn = 'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=' . DB_CHARSET;
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
try {
$pdo = new PDO($dsn, DB_USER, DB_PASS, $options);
// ============================================================
// AUTO-MIGRATION SCRIPT (Sesuai Permintaan)
// ============================================================
// 1. Buat tabel users jika belum ada (fallback)
$pdo->exec("CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
role ENUM('admin','petugas','guest') NOT NULL DEFAULT 'guest',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB");
// 2. Cek dan tambahkan kolom baru pada tabel users
$columns = $pdo->query("SHOW COLUMNS FROM users")->fetchAll(PDO::FETCH_COLUMN);
if (!in_array('email', $columns)) {
$pdo->exec("ALTER TABLE users ADD COLUMN email VARCHAR(150) UNIQUE NULL AFTER username");
}
if (!in_array('nama_lengkap', $columns)) {
$pdo->exec("ALTER TABLE users ADD COLUMN nama_lengkap VARCHAR(150) NULL AFTER email");
}
if (!in_array('status', $columns)) {
// Update user lama menjadi active terlebih dahulu jika diperlukan, tapi defaultnya active
$pdo->exec("ALTER TABLE users ADD COLUMN status ENUM('pending', 'active') NOT NULL DEFAULT 'active' AFTER role");
}
if (!in_array('auth_provider', $columns)) {
$pdo->exec("ALTER TABLE users ADD COLUMN auth_provider ENUM('local', 'google') NOT NULL DEFAULT 'local' AFTER status");
}
// 3. Buat tabel settings
$pdo->exec("CREATE TABLE IF NOT EXISTS settings (
setting_key VARCHAR(50) PRIMARY KEY,
setting_value VARCHAR(255) NOT NULL
) ENGINE=InnoDB");
// 4. Masukkan data default settings jika belum ada
$pdo->exec("INSERT IGNORE INTO settings (setting_key, setting_value) VALUES ('show_demo_accounts', '1')");
} catch (PDOException $e) {
http_response_code(500);
die(json_encode([
'status' => 'error',
'message' => 'Koneksi database gagal: ' . $e->getMessage()
]));
}
// Legacy mysqli compatibility (untuk file yang masih menggunakannya)
$conn = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($conn) {
mysqli_set_charset($conn, DB_CHARSET);
}
?>
+1
View File
@@ -0,0 +1 @@
# Gitkeep
Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB