From b90111a317337d8772ecdea7ecff562f05eb3e13 Mon Sep 17 00:00:00 2001 From: zdienos Date: Thu, 22 Feb 2018 19:08:33 +0800 Subject: [PATCH] membuat calendar jadwal dan event menggunakan fullcalendar --- application/controllers/Jadwal.php | 1 - application/models/M_jadwal.php | 2 +- application/models/M_jadwal_last_good.php | 73 ++ application/views/dashboard/index.php | 2 +- application/views/identifikasi/index.php | 2 +- application/views/jadwal/ajax_scripts.php | 465 ++++--- application/views/jadwal/ajax_scripts_.php | 118 -- .../views/jadwal/ajax_scripts_last_good.php | 216 ++++ application/views/jadwal/ajax_scripts_try.php | 232 ++++ application/views/jadwal/index.php | 26 +- application/views/jadwal/index_.php | 95 -- application/views/jadwal/index_last_good.php | 86 ++ application/views/jadwal/index_try.php | 87 ++ application/views/jadwal/lihat.php | 170 --- application/views/jadwal/selesai.php | 77 -- application/views/permintaan/index.php | 2 +- application/views/template/footer_js.php | 13 +- application/views/template/header.php | 22 +- application/views/template/leftside.php | 2 +- assets/zed/css/bootstrap-colorpicker.min.css | 9 + assets/zed/css/bootstrap-timepicker.min.css | 10 + assets/zed/css/bootstrap.min.css | 5 + assets/zed/css/bootstrapValidator.min.css | 11 + assets/zed/css/custom.css | 41 + assets/zed/css/fullcalendar.css | 1124 +++++++++++++++++ assets/zed/img/alpha-horizontal.png | Bin 0 -> 3635 bytes assets/zed/img/alpha.png | Bin 0 -> 3271 bytes assets/zed/img/hue-horizontal.png | Bin 0 -> 2837 bytes assets/zed/img/hue.png | Bin 0 -> 2972 bytes assets/zed/img/saturation.png | Bin 0 -> 8817 bytes assets/zed/js/bootstrap-colorpicker.min.js | 1 + assets/zed/js/bootstrap-timepicker.min.js | 5 + assets/zed/js/bootstrap.min.js | 6 + assets/zed/js/bootstrapValidator.min.js | 13 + assets/zed/js/fullcalendar.min.js | 4 + assets/zed/js/jquery.min.js | 4 + assets/zed/js/main.js | 221 ++++ assets/zed/js/moment.min.js | 7 + 38 files changed, 2507 insertions(+), 645 deletions(-) create mode 100644 application/models/M_jadwal_last_good.php delete mode 100644 application/views/jadwal/ajax_scripts_.php create mode 100644 application/views/jadwal/ajax_scripts_last_good.php create mode 100644 application/views/jadwal/ajax_scripts_try.php delete mode 100644 application/views/jadwal/index_.php create mode 100644 application/views/jadwal/index_last_good.php create mode 100644 application/views/jadwal/index_try.php delete mode 100644 application/views/jadwal/lihat.php delete mode 100644 application/views/jadwal/selesai.php create mode 100644 assets/zed/css/bootstrap-colorpicker.min.css create mode 100644 assets/zed/css/bootstrap-timepicker.min.css create mode 100644 assets/zed/css/bootstrap.min.css create mode 100644 assets/zed/css/bootstrapValidator.min.css create mode 100644 assets/zed/css/custom.css create mode 100644 assets/zed/css/fullcalendar.css create mode 100644 assets/zed/img/alpha-horizontal.png create mode 100644 assets/zed/img/alpha.png create mode 100644 assets/zed/img/hue-horizontal.png create mode 100644 assets/zed/img/hue.png create mode 100644 assets/zed/img/saturation.png create mode 100644 assets/zed/js/bootstrap-colorpicker.min.js create mode 100644 assets/zed/js/bootstrap-timepicker.min.js create mode 100644 assets/zed/js/bootstrap.min.js create mode 100644 assets/zed/js/bootstrapValidator.min.js create mode 100644 assets/zed/js/fullcalendar.min.js create mode 100644 assets/zed/js/jquery.min.js create mode 100644 assets/zed/js/main.js create mode 100644 assets/zed/js/moment.min.js diff --git a/application/controllers/Jadwal.php b/application/controllers/Jadwal.php index 974e02b..d07aedd 100644 --- a/application/controllers/Jadwal.php +++ b/application/controllers/Jadwal.php @@ -38,7 +38,6 @@ private function _cek_login() $this->load->view('template/header',$d_header); $this->load->view('template/leftside'); $this->load->view('jadwal/index'); - $this->load->view('template/footer_js'); $this->load->view('jadwal/ajax_scripts'); $this->load->view('template/footer'); } diff --git a/application/models/M_jadwal.php b/application/models/M_jadwal.php index 7be52d6..65a8377 100644 --- a/application/models/M_jadwal.php +++ b/application/models/M_jadwal.php @@ -18,7 +18,7 @@ class M_jadwal extends CI_Model { Public function addEvent() { - $sql = "INSERT INTO tb_jadwal (title,tb_jadwal.start,tb_jadwal.end, description, color) VALUES (?,?,?,?,?)"; + $sql = "INSERT INTO tb_jadwal (title,tb_jadwal.start,tb_jadwal.end,description, color) VALUES (?,?,?,?,?)"; $this->db->query($sql, array($_POST['title'], $_POST['start'],$_POST['end'], $_POST['description'], $_POST['color'])); return ($this->db->affected_rows()!=1)?false:true; } diff --git a/application/models/M_jadwal_last_good.php b/application/models/M_jadwal_last_good.php new file mode 100644 index 0000000..8014dac --- /dev/null +++ b/application/models/M_jadwal_last_good.php @@ -0,0 +1,73 @@ +db->query($sql, array($_GET['start'], $_GET['end']))->result(); + + } + + Public function getEventsAllDay() + { + + $sql = "SELECT * FROM tb_jadwal WHERE tb_jadwal.start ORDER BY tb_jadwal.start ASC"; + return $this->db->query($sql)->result(); + + } + +/*Create new events */ + + Public function addEvent() + { + + $sql = "INSERT INTO tb_jadwal (title,tb_jadwal.start,tb_jadwal.end, description, color) VALUES (?,?,?,?,?)"; + $this->db->query($sql, array($_POST['title'], $_POST['start'],$_POST['end'], $_POST['description'], $_POST['color'])); + return ($this->db->affected_rows()!=1)?false:true; + } + + /*Update event */ + + Public function updateEvent() + { + + $sql = "UPDATE tb_jadwal SET title = ?, description = ?, color = ? WHERE id = ?"; + $this->db->query($sql, array($_POST['title'],$_POST['description'], $_POST['color'], $_POST['id'])); + return ($this->db->affected_rows()!=1)?false:true; + } + + + /*Delete event */ + + Public function deleteEvent() + { + + $sql = "DELETE FROM tb_jadwal WHERE id = ?"; + $this->db->query($sql, array($_GET['id'])); + return ($this->db->affected_rows()!=1)?false:true; + } + + /*Update event */ + + Public function dragUpdateEvent() + { + //$date=date('Y-m-d h:i:s',strtotime($_POST['date'])); + + $sql = "UPDATE tb_jadwal SET tb_jadwal.start = ? ,tb_jadwal.end = ? WHERE id = ?"; + $this->db->query($sql, array($_POST['start'],$_POST['end'], $_POST['id'])); + return ($this->db->affected_rows()!=1)?false:true; + + + } + + + + + + +} diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index 385bb31..5ec3399 100755 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -3,7 +3,7 @@

- Dashboard + Dashboard

diff --git a/application/views/identifikasi/index.php b/application/views/identifikasi/index.php index 58049bf..b622761 100644 --- a/application/views/identifikasi/index.php +++ b/application/views/identifikasi/index.php @@ -2,7 +2,7 @@

- Data Identifikasi Pekerjaan + Identifikasi Pekerjaan

diff --git a/application/views/jadwal/ajax_scripts.php b/application/views/jadwal/ajax_scripts.php index 5e05098..7d02234 100644 --- a/application/views/jadwal/ajax_scripts.php +++ b/application/views/jadwal/ajax_scripts.php @@ -1,168 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + -}); + + - -var base_url= ""; // Here i define the base_url - -// page is now ready, initialize the calendar... - -$('#calendar').fullCalendar({ - // put your options and callbacks here - header: { - left: 'prev,next today', - center: 'title', - right: 'month,' - }, - events: base_url+'jadwal/getEvents', - displayEventTime : false, - navLinks: true, // can click day/week names to navigate views - editable: true, - droppable: true, // this allows things to be dropped onto the calendar - eventReceive: function(event){ - start = event.start.format('YYYY-MM-DD HH:mm:ss'); - end = start; - $.post(base_url+'jadwal/addEvent', { - title: event.title, - description: '', - color: event.backgroundColor, - start: start, - end: end - }, function(result){ - swal('Jadwal sudah ditambah', {icon: "success", button:false, timer:1500}); - }); - }, - // Handle Existing Event Click - eventClick: function(calEvent, jsEvent, view) { - // Set currentEvent variable according to the event clicked in the calendar - currentEvent = calEvent; - // Open modal to edit or delete event - modal({ - // Available buttons when editing - buttons: { - delete: { - id: 'delete-event', - css: 'btn-danger', - label: 'Hapus' + + + + + + + + + + + diff --git a/application/views/jadwal/ajax_scripts_.php b/application/views/jadwal/ajax_scripts_.php deleted file mode 100644 index 439424d..0000000 --- a/application/views/jadwal/ajax_scripts_.php +++ /dev/null @@ -1,118 +0,0 @@ - diff --git a/application/views/jadwal/ajax_scripts_last_good.php b/application/views/jadwal/ajax_scripts_last_good.php new file mode 100644 index 0000000..bb645bb --- /dev/null +++ b/application/views/jadwal/ajax_scripts_last_good.php @@ -0,0 +1,216 @@ + diff --git a/application/views/jadwal/ajax_scripts_try.php b/application/views/jadwal/ajax_scripts_try.php new file mode 100644 index 0000000..4a3127c --- /dev/null +++ b/application/views/jadwal/ajax_scripts_try.php @@ -0,0 +1,232 @@ + diff --git a/application/views/jadwal/index.php b/application/views/jadwal/index.php index 9a5c18e..0181528 100644 --- a/application/views/jadwal/index.php +++ b/application/views/jadwal/index.php @@ -3,7 +3,7 @@

- Jadwal Kerja + Jadwal Kerja dan Event

@@ -12,15 +12,16 @@
-
+
-

Drag ke kalender

+

Pilih Item

-
Off
-
PH/Cuti
+
Off
+
PH/Cuti
+
Event
@@ -48,8 +49,7 @@ + @@ -47,9 +43,6 @@ - - - @@ -127,7 +120,7 @@ function isNumber(evt) { //pop up swal({ - title: "Anda yakin ingin menghapus datass?", + title: "Anda yakin ingin menghapus data?", icon: "warning", buttons: ["Tidak", "Ya"], dangerMode: true, diff --git a/application/views/template/header.php b/application/views/template/header.php index f529192..24b354a 100644 --- a/application/views/template/header.php +++ b/application/views/template/header.php @@ -13,9 +13,10 @@ + - - + + @@ -27,6 +28,23 @@