Created At: 2026-06-14T15:49:18Z
Completed At: 2026-06-14T15:49:18Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 4761
Total Bytes: 203898
Showing lines 251 to 800
The following code has been modified to include a line number before every line, in the format: <line_number>: <original_line>. Please note that any changes targeting the original code should remove the line number, colon, and leading space.
251:                 variable_id INTEGER NOT NULL,
252:                 period_id INTEGER NOT NULL,
253:                 description TEXT DEFAULT '',
254:                 image_climate_map_url TEXT DEFAULT '',
255:                 image_climate_map_url_2 TEXT DEFAULT '',
256:                 image_time_series_url TEXT DEFAULT '',
257:                 image_climate_stripe_url TEXT DEFAULT '',
258:                 image_stripe_ssp126_url TEXT DEFAULT '',
259:                 image_stripe_ssp245_url TEXT DEFAULT '',
260:                 image_stripe_ssp370_url TEXT DEFAULT '',
261:                 image_stripe_ssp585_url TEXT DEFAULT '',
262:                 csv_data TEXT DEFAULT NULL,
263:                 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
264:                 updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
265:                 FOREIGN KEY (location_id) REFERENCES locations(id) ON DELETE CASCADE,
266:                 FOREIGN KEY (variable_id) REFERENCES variables(id) ON DELETE CASCADE,
267:                 FOREIGN KEY (period_id) REFERENCES periods(id) ON DELETE CASCADE,
268:                 UNIQUE (location_id, variable_id, period_id)
269:             );
270:         ");
271: 
272:         // Seed Data Master Lokasi
273:         $locations = ['Indonesia'];
274:         $stmt = $db->prepare("INSERT OR IGNORE INTO locations (name) VALUES (:name)");
275:         foreach ($locations as $loc) {
276:             $stmt->execute([':name' => $loc]);
277:         }
278: 
279:         // Seed Data Master Variabel
280:         $variables = [
281:             'Precip
<truncated 30605 bytes>
s ORDER BY name ASC")->fetchAll(PDO::FETCH_COLUMN);
765:             $vars = $db->query("
766:                 SELECT name FROM variables 
767:                 WHERE name IN (
768:                     'Precipitation', 'Suhu Udara Rata-rata', 'Suhu Udara Maksimum', 'Suhu Udara Minimum',
769:                     'Kelembaban Relatif', 'Kecepatan Angin', 'Radiasi Matahari', 'Suhu Permukaan Laut',
770:                     'Anomali Tinggi Muka Laut', 'Salinitas Permukaan Laut', 'pH Permukaan Laut'
771:                 )
772:                 ORDER BY CASE name 
773:                     WHEN 'Precipitation' THEN 1
774:                     WHEN 'Suhu Udara Rata-rata' THEN 2
775:                     WHEN 'Suhu Udara Maksimum' THEN 3
776:                     WHEN 'Suhu Udara Minimum' THEN 4
777:                     WHEN 'Kelembaban Relatif' THEN 5
778:                     WHEN 'Kecepatan Angin' THEN 6
779:                     WHEN 'Radiasi Matahari' THEN 7
780:                     WHEN 'Suhu Permukaan Laut' THEN 8
781:                     WHEN 'Anomali Tinggi Muka Laut' THEN 9
782:                     WHEN 'Salinitas Permukaan Laut' THEN 10
783:                     WHEN 'pH Permukaan Laut' THEN 11
784:                     ELSE 12
785:                 END ASC, name ASC
786:             ")->fetchAll(PDO::FETCH_COLUMN);
787:             $pers = $db->query("SELECT range FROM periods ORDER BY range ASC")->fetchAll(PDO::FETCH_COLUMN);
788: 
789:             echo json_encode([
790:                 'success' => true,
791:                 'locations' => $locs,
792:                 'variables' => $vars,
793:                 'periods' => $pers
794:             ]);
795:             exit;
796:         }
797: 
798:         // 6. Tambah Lokasi Baru
799:         if ($action === 'add_location') {
800:             if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
The above content does NOT show the entire file contents. If you need to view any lines of the file which were not shown to complete your task, call this tool again to view those lines.
