Skip to content
Snippets Groups Projects
Commit 7f66b8fa authored by Arya Pradipta's avatar Arya Pradipta
Browse files

changing pengumuman

parent 8271c3a5
Branches
No related merge requests found
Pipeline #4314 passed with stages
in 8 minutes and 27 seconds
...@@ -23,7 +23,6 @@ $status = $stmt->execute(); ...@@ -23,7 +23,6 @@ $status = $stmt->execute();
$stmt->close(); $stmt->close();
$conn->close(); $conn->close();
if ($status) { if ($status) {
echo "Sukses, komentar oleh user id " . $user_id ." pada pengumuman " . $pengumuman_id . " berhasil ditambahkan."; echo "Sukses, komentar oleh user id " . $user_id ." pada pengumuman " . $pengumuman_id . " berhasil ditambahkan.";
} else { } else {
......
...@@ -92,8 +92,10 @@ if ($fileAddr == "null") { ...@@ -92,8 +92,10 @@ if ($fileAddr == "null") {
$stmt->bind_param("siss", $judul, $kegiatan_id, $konten_text, $fileAddr); $stmt->bind_param("siss", $judul, $kegiatan_id, $konten_text, $fileAddr);
$stmt->execute(); $stmt->execute();
$stmt->close(); $stmt->close();
$stmt = $conn->query("SELECT SCOPE_IDENTITY()"); $stmt = $conn->query("SELECT MAX(`id_pengumuman`) as max FROM `pengumuman`");
$row = $stmt->fetch_assoc();
$conn->close(); $conn->close();
// \pmotraining\FirebaseNotif::sendNotif("Ada pengumuman baru", $judul, 1, 1); \pmotraining\FirebaseNotif::sendNotif("Ada pengumuman baru", $judul, 0, $row["max"]);
echo 'Sukses, pengumuman ' . $judul . ' berhasil ditambahkan.'; echo 'Sukses, pengumuman ' . $judul . ' berhasil ditambahkan.' . $row["max"];
...@@ -27,17 +27,23 @@ class FirebaseNotif ...@@ -27,17 +27,23 @@ class FirebaseNotif
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://fcm.googleapis.com/fcm/send"); curl_setopt($ch, CURLOPT_URL, "https://fcm.googleapis.com/fcm/send");
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
$kodeClick = "beritaIntent";
if ($kode == 0) {
// pengumuman
$kodeClick = "pengumumanIntent";
}
$vars = [ $vars = [
"to" => "/topics/all", "to" => "/topics/all",
"notification" => [ "notification" => [
"title" => $title, "title" => $title,
"body" => $body, "body" => $body,
"click_action" => "beritaIntent" "click_action" => $kode
], ],
"data" => [ "data" => [
"id" => 1 "id" => $id
] ]
]; ];
// $cat = $_POST["kategori"]; // $cat = $_POST["kategori"];
// if ($cat == "pengumuman" ) { // if ($cat == "pengumuman" ) {
$vars["notification"]["click_action"] = "mainActivity"; //testing $vars["notification"]["click_action"] = "mainActivity"; //testing
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment