?> </td> <td><?php echo $d->asal_surat_masuk; ?> </td> <td><?php echo $d->no_surat_masuk; ?> </td> <td><?php echo tgl_jam_sql($d->tgl_surat_masuk); ?> </td> <td><?php echo gval("t_admin", "id", "nama", $d->pengolah); ?> </td> <td><?php echo tgl_jam_sql($d->tgl_diterima); ?> </td> <td><?php echo $d->keterangan; ?> </td> </tr> <?php } } else { echo "<tr><td colspan='9' style='text-align: center'>Tidak ada data</td></tr>";
public function surat_disposisi() { if ($this->session->userdata('admin_valid') == FALSE && $this->session->userdata('admin_id') == "") { redirect("index.php/admin/login"); } //ambil variabel URL $mau_ke = $this->uri->segment(4); $idu1 = $this->uri->segment(3); $idu2 = $this->uri->segment(5); $cari = addslashes($this->input->post('q')); //ambil variabel Postingan $idp = addslashes($this->input->post('idp')); $id_surat = addslashes($this->input->post('id_surat')); $kpd_yth = addslashes($this->input->post('kpd_yth')); $isi_disposisi = addslashes($this->input->post('isi_disposisi')); $sifat = addslashes($this->input->post('sifat')); $batas_waktu = addslashes($this->input->post('batas_waktu')); $catatan = addslashes($this->input->post('catatan')); $cari = addslashes($this->input->post('q')); /* pagination */ $total_row = $this->db->query("SELECT * FROM t_disposisi WHERE id_surat = '{$idu1}'")->num_rows(); $per_page = 10; $awal = $this->uri->segment(4); $awal = empty($awal) || $awal == 1 ? 0 : $awal; //if (empty($awal) || $awal == 1) { $awal = 0; } { $awal = $awal; } $akhir = $per_page; $a['pagi'] = _page($total_row, $per_page, 4, base_url() . "admin/surat_disposisi/" . $idu1 . "/p"); $a['judul_surat'] = gval("t_surat_masuk", "id", "isi_ringkas", $idu1); if ($mau_ke == "del") { $this->db->query("DELETE FROM t_disposisi WHERE id = '{$idu2}'"); $this->session->set_flashdata("k", "<div class=\"alert alert-success\" id=\"alert\">Data has been deleted </div>"); redirect('index.php/admin/surat_disposisi/' . $idu1); } else { if ($mau_ke == "add") { $a['page'] = "f_surat_disposisi"; } else { if ($mau_ke == "edt") { $a['datpil'] = $this->db->query("SELECT * FROM t_disposisi WHERE id = '{$idu2}'")->row(); $a['page'] = "f_surat_disposisi"; } else { if ($mau_ke == "act_add") { $this->db->query("INSERT INTO t_disposisi VALUES (NULL, '{$id_surat}', '{$kpd_yth}', '{$isi_disposisi}', '{$sifat}', '{$batas_waktu}', '{$catatan}')"); $this->session->set_flashdata("k", "<div class=\"alert alert-success\" id=\"alert\">Data has been added</div>"); redirect('index.php/admin/surat_disposisi/' . $id_surat); } else { if ($mau_ke == "act_edt") { $this->db->query("UPDATE t_disposisi SET kpd_yth = '{$kpd_yth}', isi_disposisi = '{$isi_disposisi}', sifat = '{$sifat}', batas_waktu = '{$batas_waktu}', catatan = '{$catatan}' WHERE id = '{$idp}'"); $this->session->set_flashdata("k", "<div class=\"alert alert-success\" id=\"alert\">Data has been updated</div>"); redirect('index.php/admin/surat_disposisi/' . $id_surat); } else { $a['data'] = $this->db->query("SELECT * FROM t_disposisi WHERE id_surat = '{$idu1}' LIMIT {$awal}, {$akhir} ")->result(); $a['page'] = "l_surat_disposisi"; } } } } } $this->load->view('admin/aaa', $a); }
public function surat_disposisi() { if ($this->session->userdata('admin_valid') == FALSE && $this->session->userdata('admin_id') == "") { $this->session->set_flashdata("k", "<div id=\"alert\" class=\"alert alert-error\">Maaf Anda belum login. Silakan login terlebih dahulu</div>"); redirect("logins/login"); } //ambil variabel URL $act = $this->uri->segment(4); $id_suratu = $this->uri->segment(3); $id_dispu = $this->uri->segment(5); $cari = addslashes($this->input->post('q')); //ambil variabel Postingan $id_disposisi = addslashes($this->input->post('id_disposisi')); $id_surat_masuk = addslashes($this->input->post('id_surat_masuk')); $tujuan_disposisi = addslashes($this->input->post('tujuan_disposisi')); $isi_instruksi = addslashes($this->input->post('isi_instruksi')); $tgl_instruksi = addslashes($this->input->post('tgl_instruksi')); $batas_waktu = addslashes($this->input->post('batas_waktu')); $kini = new DateTime('now'); $kemarin = new DateTime($batas_waktu); $kemarin->diff($kini)->format('%a hari %h jam %i menit % detik'); $datetime1 = new DateTime('now'); $datetime2 = new DateTime($batas_waktu); $difference = $datetime1->diff($datetime2); $waktu_lama_instruksi = $kemarin->diff($kini)->format('%a'); $paraf_kasi = addslashes($this->input->post('paraf_kasi')); $paraf_kajari = addslashes($this->input->post('paraf_kajari')); $tgl_disposisi = addslashes($this->input->post('tgl_disposisi')); $catatan = addslashes($this->input->post('catatan')); if ($paraf_kasi == '1') { $status_disposisi = 1; } else { if ($paraf_kajari == '1') { $status_disposisi = 2; } } $cari = addslashes($this->input->post('q')); /* pagination */ $total_row = $this->db->query("SELECT * FROM disposisi WHERE id_surat_masuk = '{$id_suratu}'")->num_rows(); $per_page = 15000; $awal = $this->uri->segment(4); $awal = empty($awal) || $awal == 1 ? 0 : $awal; //if (empty($awal) || $awal == 1) { $awal = 0; } { $awal = $awal; } $akhir = $per_page; $a['pagi'] = _page($total_row, $per_page, 4, base_url() . "disposisi/surat_disposisi/" . $id_suratu . "/p"); $a['judul_surat'] = gval("surat_masuk", "id_surat_masuk", "perihal_surat_masuk", $id_suratu); if ($act == "del") { $this->db->query("DELETE FROM disposisi WHERE id_disposisi = '{$id_dispu}'"); $this->session->set_flashdata("k", "<div class=\"alert alert-success\" id=\"alert\">Data berhasil dihapus </div>"); redirect('disposisi/surat_disposisi/' . $id_dispu); } else { if ($act == "add") { $a['page'] = "surat_disposisi/f_surat_disposisi"; } else { if ($act == "edt") { $a['datpil'] = $this->db->query("SELECT * FROM disposisi WHERE id_disposisi = '{$id_dispu}'")->row(); $a['page'] = "surat_disposisi/f_surat_disposisi"; } else { if ($act == "act_add") { $this->db->query("INSERT INTO disposisi(\n\t\t\t\t\t\t\t\t\t\t\t\t\t`id_disposisi` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`id_surat_masuk` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`isi_instruksi` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`tgl_instruksi` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`batas_waktu` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`waktu_lama_instruksi` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`paraf_kasi` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`paraf_kajari` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`tujuan_disposisi` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`tgl_disposisi` ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`catatan`\n\t\t\t\t\t\t\t\t\t\t\t\t\t) \n\t\t\t\t\t\tVALUES (NULL, '{$id_surat_masuk}', '{$isi_instruksi}', NOW(),'{$batas_waktu}', '{$waktu_lama_instruksi}', '{$paraf_kasi}', '{$paraf_kajari}', '{$tujuan_disposisi}', NOW() , '{$catatan}')"); $this->session->set_flashdata("k", "<div class=\"alert alert-success\" id=\"alert\">Data berhasil ditambahkan</div>"); redirect('disposisi/surat_disposisi/' . $id_surat_masuk); } else { if ($act == "act_edt") { $this->db->query("UPDATE disposisi SET tujuan_disposisi = '{$tujuan_disposisi}', isi_instruksi = '{$isi_instruksi}', batas_waktu = '{$batas_waktu}', waktu_lama_instruksi = '{$waktu_lama_instruksi}', paraf_kajari = '{$paraf_kajari}', paraf_kasi = '{$paraf_kasi}', catatan = '{$catatan}' WHERE id_disposisi = '{$id_disposisi}'"); $this->session->set_flashdata("k", "<div class=\"alert alert-success\" id=\"alert\">Data berhasil diubah</div>"); redirect('disposisi/surat_disposisi/' . $id_surat_masuk); } else { $a['data'] = $this->db->query("SELECT * FROM disposisi WHERE id_surat_masuk = '{$id_suratu}' LIMIT {$awal}, {$akhir} ")->result(); $a['page'] = "surat_disposisi/l_surat_disposisi"; } } } } } $this->load->view('admin/index', $a); }