<?php if (isset($_POST['apa']) && $_POST['apa'] != "") { include 'modules/model/class.weather.php'; $data = new weather(); switch ($_POST['apa']) { case "get-cuaca": $collect = array(); if (isset($_POST['tglAwal']) && $_POST['tglAwal'] != "" && isset($_POST['tglAkhir']) && $_POST['tglAkhir'] != "") { if ($query = $data->get_weather($_POST['tglAwal'], $_POST['tglAkhir'], "%")) { while ($rs = $query->fetch_array()) { if ($rs["event"] == "1") { $event = "Cerah"; } elseif ($rs["event"] == "2") { $event = "Hujan"; } elseif ($rs["event"] == "3") { $event = "Berawan / Badai Petir"; } elseif ($rs["event"] == "4") { $event = "Hujan Disertai Badai Petir"; } else { $event = "Tidak Diketahui"; } $detail = array(); array_push($detail, $rs["date"]); array_push($detail, $event); array_push($detail, "<button type='button' class='btn btn-sm btn-primary' id='btn-show-detail' data-id='" . $rs['id'] . "'>\n\t\t\t\t\t\t\t\t\t\t<i class='fa fa-eye'></i></button>\n\t\t\t\t\t\t\t\t\t\t<button type='button' class='btn btn-sm btn-danger' id='btn-hapus-data' data-id='" . $rs['id'] . "'>\n\t\t\t\t\t\t\t\t\t\t<i class='fa fa-trash-o'></i></button>"); array_push($collect, $detail); unset($detail); } } }