From bc57a32012d64fe01e85d2dc5ae7ce405ac01927 Mon Sep 17 00:00:00 2001
From: Franciscoken <franciscokenandi@gmail.com>
Date: Thu, 19 Apr 2018 17:11:19 +0700
Subject: [PATCH] added 3 year new end point for a better calendar

---
 getAllMonthlyTanggalKegiatan.php    |  1 -
 getAllTanggalHariBesarTigaTahun.php | 29 +++++++++++++++++++++++++++
 getAllTanggalKegiatanTigaTahun.php  | 31 +++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 getAllTanggalHariBesarTigaTahun.php
 create mode 100644 getAllTanggalKegiatanTigaTahun.php

diff --git a/getAllMonthlyTanggalKegiatan.php b/getAllMonthlyTanggalKegiatan.php
index 92ba0c5..8c50f39 100755
--- a/getAllMonthlyTanggalKegiatan.php
+++ b/getAllMonthlyTanggalKegiatan.php
@@ -12,7 +12,6 @@
 
 require 'dbConnect.php';
 
-$requestedMonth = $_GET['month'];
 $requestedYear = $_GET['year'];
 $stmt = $conn->query(
     "SELECT DAY(`tanggal_kegiatan`) FROM `kegiatan` 
diff --git a/getAllTanggalHariBesarTigaTahun.php b/getAllTanggalHariBesarTigaTahun.php
new file mode 100644
index 0000000..bfed742
--- /dev/null
+++ b/getAllTanggalHariBesarTigaTahun.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * PHP Version 7
+ * Mengambil seluruh konten hari besar dari bulan tertentu.
+ * @category Kalender
+ * @package  Komunitas-PMO
+ * @author   Francisco Kenandi <13515140@std.stei.itb.ac.id>
+ * @license  http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
+ * @link     http://pear.php.net/package/komunitas-pmo
+ */
+
+require 'dbConnect.php';
+
+$requestedMonth = $_GET["month"];
+$requestedYear = $_GET["year"];
+$stmt = $conn->query(
+    "SELECT `tgl` FROM `hari_besar` 
+    WHERE ((YEAR(`tgl`) >= ".$requestedYear-1.") AND (YEAR(`tgl`)<=".$requestedYear+1."))"
+);
+$count = $stmt->num_rows;
+$res = array();
+$fixed = array();
+while ($row = $stmt->fetch_assoc()) {
+    $res[] = $row;
+}
+
+echo json_encode($res);
+$conn->close();
\ No newline at end of file
diff --git a/getAllTanggalKegiatanTigaTahun.php b/getAllTanggalKegiatanTigaTahun.php
new file mode 100644
index 0000000..77ed83d
--- /dev/null
+++ b/getAllTanggalKegiatanTigaTahun.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ * PHP Version 7
+ * Mengambil seluruh konten kegiatan pada tanggal dan bulan tertentu.
+ * @category Kegiatan
+ * @package  Komunitas-PMO
+ * @author   Francisco Kenandi <13515140@std.stei.itb.ac.id>
+ * @license  http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
+ * @link     http://pear.php.net/package/komunitas-pmo
+ */
+
+require 'dbConnect.php';
+
+$requestedYear = $_GET['year'];
+$stmt = $conn->query(
+    "SELECT `tanggal_kegiatan` FROM `kegiatan` 
+    WHERE ((YEAR(`tanggal_kegiatan`)>=".$requestedYear-1.") AND (YEAR(`tanggal_kegiatan`)<=".$requestedYear+1."))"
+);
+$count = $stmt->num_rows;
+$res = array();
+$fixed = array();
+while ($row = $stmt->fetch_assoc()) {
+    $res[] = $row;
+}
+
+// tambahin manager yah
+
+echo json_encode($res);
+
+$conn->close();
\ No newline at end of file
-- 
GitLab