Created At: 2026-06-14T16:16:48Z
Completed At: 2026-06-14T16:16:48Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 3864
Total Bytes: 160295
Showing lines 550 to 585
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.
550:             // B. Cari data global (dari periode mana saja yang tersedia untuk variabel ini)
551:             $stmtGlobal = $db->prepare("
552:                 SELECT f.* FROM future_climate f
553:                 JOIN locations l ON f.location_id = l.id
554:                 JOIN variables v ON f.variable_id = v.id
555:                 WHERE l.name = :location AND v.name = :variable
556:                 ORDER BY 
557:                     CASE WHEN f.image_time_series_url != '' OR f.graph_base_value IS NOT NULL THEN 0 ELSE 1 END ASC,
558:                     f.id ASC
559:             ");
560:             $stmtGlobal->execute([':location' => $location, ':variable' => $variable]);
561:             $globalData = $stmtGlobal->fetch();
562: 
563:             if ($periodData || $globalData) {
564:                 echo json_encode([
565:                     'success' => true,
566:                     'data' => [
567:                         'description' => $periodData ? $periodData['description'] : ($globalData ? $globalData['description'] : ''),
568:                         'imageClimateMap' => $periodData ? $periodData['image_climate_map_url'] : '',
569:                         'imageClimateMap2' => $periodData ? $periodData['image_climate_map_url_2'] : '',
570:                         'imageTimeSeries' => ($periodData && !empty($periodData['image_time_series_url'])) ? $periodData['image_time_series_url'] : ($globalData ? $globalData['image_time_series_url'] : ''),
571:                         'imageClimateStripe' => ($periodData && !empty($periodData['image_climate_stripe_url'])) ? $periodData['image_climate_stripe_url'] : ($globalData ? $globalData['image_climate_stripe_url'] : ''),
572:                         'graphBaseValue' => ($periodData && $periodData['graph_base_value'] !== null) ? $periodData['graph_base_value'] : ($globalData ? $globalData['graph_base_value'] : null),
573:                         'graphUncertainty' => ($periodData && $periodData['graph_uncertainty'] !== null) ? $periodData['graph_uncertainty'] : ($globalData ? $globalData['graph_uncertainty'] : null),
574:                         'graphSSP1Slope' => ($periodData && $periodData['graph_ssp1_slope'] !== null) ? $periodData['graph_ssp1_slope'] : ($globalData ? $globalData['graph_ssp1_slope'] : null),
575:                         'graphSSP2Slope' => ($periodData && $periodData['graph_ssp2_slope'] !== null) ? $periodData['graph_ssp2_slope'] : ($globalData ? $globalData['graph_ssp2_slope'] : null),
576:                         'graphSSP3Slope' => ($periodData && $periodData['graph_ssp3_slope'] !== null) ? $periodData['graph_ssp3_slope'] : ($globalData ? $globalData['graph_ssp3_slope'] : null),
577:                         'graphSSP5Slope' => ($periodData && $periodData['graph_ssp5_slope'] !== null) ? $periodData['graph_ssp5_slope'] : ($globalData ? $globalData['graph_ssp5_slope'] : null),
578:                         'csvData' => ($periodData && !empty($periodData['csv_data'])) ? $periodData['csv_data'] : ($globalData ? $globalData['csv_data'] : null)
579:                     ]
580:                 ]);
581:             } else {
582:                 echo json_encode(['success' => false, 'message' => 'Data tidak ditemukan.']);
583:             }
584:             exit;
585:         }
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.
