private function cekFilterKey($data = array()) { // var_dump($data); if ($data[0] == 'in') { $this->filter = $data[1]; return true; } else { if ($data[0] == 'after') { $this->after = Tanggal::ubahFormatTanggal($data[1]); return true; } else { if ($data[0] == 'before') { $this->before = Tanggal::ubahFormatTanggal($data[1]); return true; } } } return false; }
public function input() { if (!Auth::isAllow(5, Session::get('role'), 1, Session::get('bagian'))) { header('location:' . URL . 'home'); } $mon = new Monitoring_Model(); $tglagenda = date('Y-m-d'); $asal = trim($_POST['asal_surat']); $asal = explode(' ', $asal); $start = $mon->cekNextDay(date('Y-m-d h:m:s'), true); //jika hari kerja, catat waktu tersebut // $start = /*$this->model->setAgenda($_POST['no_agenda']); $this->model->setTglTerima($tglagenda); $this->model->setTglSurat(Tanggal::ubahFormatTanggal($_POST['tgl_surat'])); $this->model->setNomor($_POST['no_surat']); $this->model->setAlamat($asal[0]); $this->model->setPerihal($_POST['perihal']); $this->model->setSifat($_POST['sifat']); $this->model->setJenis($_POST['jenis']); $this->model->setStatusSurat($_POST['status']); $this->model->setJmlLampiran($_POST['lampiran']); $this->model->setStatus('11'); $this->model->setStart($start);*/ $data = array("no_agenda" => $_POST['no_agenda'], "tgl_terima" => $tglagenda, "tgl_surat" => Tanggal::ubahFormatTanggal($_POST['tgl_surat']), "no_surat" => $_POST['no_surat'], "asal_surat" => $asal[0], "perihal" => $_POST['perihal'], "status" => $_POST['status'], "sifat" => $_POST['sifat'], "jenis" => $_POST['jenis'], "lampiran" => $_POST['lampiran'], "stat" => '11', "start" => $start); if ($this->model->input($data)) { $notif = new Notifikasi(); $datakk = $this->model->select("SELECT id_user FROM user WHERE role=1 AND bagian =1 AND active='Y'"); foreach ($datakk as $val) { $notif->set('id_user', $val['id_user']); } $notif->set('id_surat', $this->model->lastIdInsert()); $notif->set('jenis_surat', 'SM'); $notif->set('role', 1); $notif->set('bagian', 1); $notif->set('stat_notif', 1); //$data1 =array( //'id_surat'=>$id_surat, //'jenis_surat'=>$jenis_surat, //'id_user'=>$kk, //'stat_notif'=>$stat_notif //); //var_dump($data1); $notif->addNotifikasi(); @Session::createSession(); $user = Session::get('user'); $log = new Log(); $log->addLog($user, 'REKAM SM', 'user ' . $user . ' rekam surat masuk agenda ' . $_POST['no_agenda']); unset($log); // die($this->msg(1,"rekam data berhasil")); echo "<div id=success>rekam data berhasil</div>"; // $this->view->agenda = $this->nomor->generateNumber('SM'); // $this->view->success = 'rekam data berhasil'; // $this->view->render('suratmasuk/rekam'); } else { echo "<div id=error>rekam data gagal</div>"; // die($this->msg(1,"rekam data tidak berhasil")); // $this->view->agenda = $this->nomor->generateNumber('SM'); // $this->view->error = 'rekam data tidak berhasil'; // $this->view->render('suratmasuk/rekam'); } //header('location:'.URL.'suratmasuk'); }
public function updst() { if (Session::get('role') != 2) { $this->datast(); } $st = new SuratTugas($this->registry); $kd_st = $_POST['kd_st']; $jur = $_POST['jur']; $jenis = $_POST['jns_st']; $st_lama = $_POST['st_lama']; $nomor = $_POST['no_st']; $tgl_st = $_POST['tgl_st']; $tgl_mulai = $_POST['tgl_mulai']; $tgl_selesai = $_POST['tgl_selesai']; $th_masuk = $_POST['th_masuk']; $pemb = $_POST['pemb']; $data = array('KD_JUR' => $jur, 'KD_PEMB' => $pemb, 'KD_JENIS_ST' => $jenis, 'KD_ST_LAMA' => $st_lama, 'NO_ST' => $nomor, 'TGL_ST' => Tanggal::ubahFormatTanggal($tgl_st), 'TGL_MUL_ST' => Tanggal::ubahFormatTanggal($tgl_mulai), 'TGL_SEL_ST' => Tanggal::ubahFormatTanggal($tgl_selesai), 'THN_MASUK' => $th_masuk); if ($_FILES['fupload']['name'] != '') { // $upload = $this->registry->upload; $this->registry->upload->init('fupload'); $this->registry->upload->setDirTo('files/st/'); $nama = array($nomor, $tgl_st); $this->registry->upload->changeFileName($this->registry->upload->getFileName(), $nama); $data['FILE_ST'] = $this->registry->upload->getFileTo(); if (file_exists('files/st/' . $data['FILE_ST'])) { unlink('files/st/' . $data['FILE_ST']); } $this->registry->upload->uploadFile(); } $st->set_kd_st($kd_st); $st->update_st($data); $ref = " no ST " . $nomor; ClassLog::write_log('surat_tugas', 'ubah', $ref); header('location:' . URL . 'surattugas/datast'); }
public function updprofil() { $pb = new Penerima($this->registry); $st = new SuratTugas($this->registry); $nip = $_POST['nip']; $kd_pb = $_POST['kd_pb']; $kd_st = $_POST['kd_st']; $no_st = $_POST['no_st']; $asal = $_POST['asal']; $alamat = $_POST['alamat']; $email = $_POST['email']; $telp = $_POST['hp']; $bank = $_POST['bank']; $norek = $_POST['rekening']; $pb->set_kd_pb($kd_pb); $pb = $pb->get_penerima_by_id($pb, $this->kd_user); $st->set_kd_st($kd_st); $d_st = $st->get_surat_tugas_by_id($st, $this->kd_user); /* * upload foto */ if ($_FILES['fotoinput']['name'] != '') { $upload_foto = $this->registry->upload; $upload_foto->init('fotoinput'); $upload_foto->setDirTo('files/foto/'); $nm_foto = array($nip); $upload_foto->changeFileName($upload_foto->getFileName(), $nm_foto); $foto = $upload_foto->getFileTo(); $upload_foto->uploadFile(); // var_dump($upload_foto); unset($upload_foto); } else { $foto = $pb->get_foto(); } /* * upload skl */ // var_dump($_FILES['sklinput']); if ($_FILES['sklinput']['name'] != '') { $upload_skl = $this->registry->upload; $upload_skl->init('sklinput'); $upload_skl->setDirTo('files/skl/'); $nm_skl = array('SKL', $no_st, $nip); $upload_skl->changeFileName($upload_skl->getFileName(), $nm_skl); $file_skl = $upload_skl->getFileTo(); $upload_skl->uploadFile(); // var_dump($file_skl); unset($upload_skl); } else { $file_skl = $pb->get_skl(); } $lap_selesai_tb = Tanggal::ubahFormatTanggal($_POST['tgl_lapor']); $tgl_sel_st = $_POST['tgl_sel_st']; if ($_POST['tgl_lapor'] != '') { // $cek = Tanggal::check_before_a_date($lap_selesai_tb, $tgl_sel_st); // if($cek){ // $st->set_kd_st($kd_st); // $d_st = $st->get_surat_tugas_by_id($st,$this->kd_user); $status = $pb->get_status_change_pb($d_st, $lap_selesai_tb, $tgl_sel_st); // } } else { $status = $pb->cek_pb_konek_st_ct($pb, 'all', false, true); /*$st = new SuratTugas($this->registry); $is_child = $st->is_child($kd_st); if($is_child){ $kd_parent = $st->get_st_lama(); if($kd_parent!=''){ $status = 3; }else{ $status = 2; } }else{ $status = 1; } $ct = new Cuti($this->registry); $d_cuti = $ct->get_cuti($this->kd_user, $pb); if(count($d_cuti)>0){ $status = 4; }*/ } // var_dump($upload_skl); /* * upload spmt */ if ($_FILES['spmtinput']['name'] != '') { $upload_spmt = $this->registry->upload; $upload_spmt->init('spmtinput'); $upload_spmt->setDirTo('files/spmt/'); $nm_spmt = array('ST', $nip, $no_st); $upload_spmt->changeFileName($upload_spmt->getFileName(), $nm_spmt); $file_spmt = $upload_spmt->getFileTo(); $upload_spmt->uploadFile(); // var_dump($upload_spmt); var_dump($file_spmt); unset($upload_spmt); } else { $file_spmt = $pb->get_spmt(); } $skripsi = $_POST['skripsi']; $data = array($kd_pb, $nip, $no_st, $alamat, $email, $telp, $bank, $norek, $foto, $file_skl, $lap_selesai_tb, $file_spmt, $skripsi); // var_dump($data); $pb->set_unit_asal($asal); $pb->set_alamat($alamat); $pb->set_email($email); $pb->set_telp($telp); $pb->set_bank($bank); $pb->set_no_rek($norek); $pb->set_foto($foto); $pb->set_tgl_lapor($lap_selesai_tb); $pb->set_skl($file_skl); $pb->set_spmt($file_spmt); $pb->set_skripsi($skripsi); if (isset($status)) { $pb->set_status($status); } if ($pb->update_penerima()) { $ref = " no ST " . $st->get_nomor() . " pegawai " . $pb->get_nama() . ":" . $pb->get_nip(); ClassLog::write_log('penerima_beasiswa', 'rekam', $ref); header('location:' . URL . 'penerima/profil/' . $kd_pb); } else { /* * gagal insert, balikin isian!!! */ $this->view->error = "cek kembali isian anda!"; $this->view->alamat = $alamat; $this->view->email = $email; $this->view->telp = $telp; $this->view->bank = $bank; $this->view->no_rek = $norek; $this->view->tgl_lapor = $lap_selesai_tb; $this->view->skripsi = $skripsi; $this->for_edit_pb($kd_pb); } }
public function editSurat() { $temp = explode(' ', $_POST['tujuan']); $tujuan = $temp[0]; $upload = new Upload('upload'); // cek nomor ada yg sama di db ato gak if ($_POST['nomor'] != '') { $bagian = Session::get('bagian'); $sql = "SELECT kd_bagian FROM r_bagian WHERE id_bagian=" . $bagian; $datab = $this->model->select($sql); foreach ($datab as $val) { $bagian = $val['kd_bagian']; } $nomor = $this->model->cekIfExistNomor($_POST['nomor'], $_POST['tipe'], $bagian); } else { $nomor = $_POST['nomor']; } $data = array("tipe" => $_POST['tipe'], "tgl_surat" => Tanggal::ubahFormatTanggal($_POST['tgl_surat']), "no_surat" => $nomor, "tujuan" => $tujuan, "perihal" => $_POST['perihal'], "sifat" => $_POST['sifat'], "jenis" => $_POST['jenis'], "lampiran" => $_POST['lampiran']); $id = $_POST['id']; $where = "id_suratkeluar = '" . $id . "'"; // var_dump($data); // var_dump($where); // var_dump($_FILES); //echo $where; $update = $this->model->editSurat($data, $where); if ($update) { //status net if ($_POST['nomor'] != '') { $data = array('status' => 22); $this->model->editSurat($data, $where); } echo "<div id=success>Ubah data surat berhasil</div>"; //upload file if (end(explode('.', $upload->getFileName())) == 'pdf') { $upload->setDirTo('arsip/'); } elseif (end(explode('.', $upload->getFileName())) == 'docx' or end(explode('.', $upload->getFileName())) == 'doc') { $upload->setDirTo('arsip/temp/'); } $tipe = 'K'; $satker = substr($_POST['tujuan'], 0, 8); // $id = 0; $sql = "SELECT MAX(id_suratkeluar) as id FROM suratkeluar"; $did = $this->model->select($sql); foreach ($did as $valid) { $id_max = $valid['id']; } //nama baru akan terdiri dari tipe naskah_nomor surat_asal(asal/tetapi asal terlaku kepanjangan) $ubahNama = array($tipe, $id, $satker); $upload->setUbahNama($ubahNama); $upload->changeFileName($upload->getFileName(), $ubahNama); $namafile = $upload->getFileTo(); $where = ' id_suratkeluar=' . $id; $data = array('file' => $namafile); if ($_FILES['upload']['tmp_name'] != '') { $upload->uploadFile(); $this->model->uploadFile($data, $where); } @Session::createSession(); $user = Session::get('user'); $log = new Log(); $log->addLog($user, 'UBAH SK', 'user ' . $user . ' ubah surat keluar tujuan: ' . $id . ' perihal:' . $_POST['perihal']); unset($log); // return true; } else { echo "<div id=error>Ubah data surat gagal</div>"; } }
public function updct() { if (Session::get('role') != 2) { $this->datasc(); } $kd_ct = $_POST['kd_sc']; $jsc = $_POST['jsc']; $kd_pb = $_POST['kd_pb']; $no_sc = $_POST['no_sc']; $tgl_sc = Tanggal::ubahFormatTanggal($_POST['tgl_sc']); $prd_mul = $_POST['sem_mulai'] . " " . $_POST['thn_mulai']; $prd_sel = $_POST['sem_sel'] . " " . $_POST['thn_sel']; $perk_stop = $_POST['bln_stop'] . " " . $_POST['thn_stop']; $perk_go = $_POST['bln_go'] . " " . $_POST['thn_go']; $file = $_FILES['fupload']['name']; $ct = new Cuti($this->registry); $ct->set_kode_cuti($kd_ct); // echo $kd_ct."-".$jsc."-".$kd_pb."-".$no_sc."-".$tgl_sc."-".$prd_mul."-".$prd_sel."-".$perk_stop."-".$perk_go."-".$file; /* * cek eksistensi file */ // var_dump($_FILES['fupload']); $d_ct = $ct->get_cuti_by_id($ct, $this->kd_user); /* * sementara dulu * untuk update status tb, sambil nunggu fungsi yg benar :( */ $pb = new Penerima($this->registry); $kd_pb_ct = $ct->get_pb(); $pb->set_kd_pb($kd_pb_ct); $pb->get_penerima_by_id($pb); $status = $pb->cek_pb_konek_st_ct($pb, 'st', false, true); $pb->set_status($status); // $kd_st = $pb->get_st(); // $st = new SuratTugas($this->registry); // $is_child = $st->is_child($kd_st); // if($is_child){ // $kd_parent = $st->get_st_lama(); // if($kd_parent!=''){ // $pb->set_status(3); // }else{ // $pb->set_status(2); // } // }else{ // $pb->set_status(1); // } $pb->update_penerima(); unset($pb); // unlink($pb); /* * end update status */ $pb = new Penerima($this->registry); $pb->set_kd_pb($kd_pb); $d_pb = $pb->get_penerima_by_id($pb); if ($file != '') { $this->registry->upload->init('fupload'); $this->registry->upload->setDirTo('files/cuti/'); $tmp_prd = explode(" ", $prd_mul); $prd_mulai = $tmp_prd[count($tmp_prd) - 1]; $cname = array('CUTI', $d_pb->get_nip(), $prd_mulai); $this->registry->upload->changeFileName($this->registry->upload->getFileName(), $cname); $file = $this->registry->upload->getFileTo(); if (file_exists('files/cuti/' . $file)) { unlink('files/cuti/' . $file); } $this->registry->upload->uploadFile(); } else { // echo $kd_ct."</br>"; $file = $d_ct->get_file(); if ($kd_pb != $kd_pb_ct) { $tmp = explode("_", $file); $file_baru = $tmp[0] . "_" . $pb->get_nip() . "_" . $tmp[2]; rename("files/cuti/" . $file, "files/cuti/" . $file_baru); $file = $file_baru; } else { $file = $d_ct->get_file(); } // echo $file; } /* * set cuti */ $ct->set_jenis_cuti($jsc); $ct->set_pb($kd_pb); $ct->set_no_surat_cuti($no_sc); $ct->set_tgl_surat_cuti($tgl_sc); $ct->set_prd_mulai($prd_mul); $ct->set_prd_selesai($prd_sel); $ct->set_perk_stop($perk_stop); $ct->set_perk_go($perk_go); $ct->set_file($file); if ($ct->update_cuti()) { $pb->set_status(4); $pb->update_penerima(); $ref = " no SC " . $no_sc; ClassLog::write_log('cuti', 'ubah', $ref); header('location:' . URL . 'cuti/datasc'); } else { $this->view->d_ubah = $ct; $this->view->render('riwayat_tb/data_cuti'); } }
public function addRekamLampiran() { $upload = new Upload('upload'); $upload->setDirTo('arsip/'); $jns = $_POST['jenis']; $tipe = $_POST['tipe']; $nomor = $_POST['nomor']; $asal = $_POST['asal']; //nama baru akan terdiri dari tipe naskah_nomor surat_asal(asal/tetapi asal terlaku kepanjangan) $ubahNama = array($tipe, $nomor); $upload->setUbahNama($ubahNama); $upload->changeFileName($upload->getFileName(), $ubahNama); $namafile = $upload->getFileTo(); //$upload->init('upload'); $data = array('jns_surat' => $jns, 'id_surat' => $_POST['id'], 'tipe' => $tipe, 'nomor' => $nomor, 'tanggal' => Tanggal::ubahFormatTanggal($_POST['tanggal']), 'hal' => $_POST['hal'], 'asal' => $asal, 'keterangan' => $_POST['keterangan'], 'file' => $namafile); //var_dump($data); if ($this->model->addLampiran($data)) { $upload->uploadFile(); echo "<div id=success>Rekam lampiran berhasil</div>"; } else { echo "<div id=error>Rekam lampiran gagal</div>"; } /*if($jns=='SM'){ header('location:'.URL.'suratmasuk/detil/'.$data['id_surat']); }elseif ($jns=='SK') { header('location:'.URL.'suratkeluar/detil/'.$data['id_surat']); }*/ // return true; }
public function find() { // $keyword = $_POST['queryString']; // $this->model->splitKeyword($keyword); $keyword = $_POST['keyword']; $category = $_POST['category']; $before = $_POST['before']; $after = $_POST['after']; $this->model->keyword = $keyword; $this->view->keyword = $this->model->keyword; if ($category != '') { $this->model->filter = $category; } if ($after != '') { $this->model->after = Tanggal::ubahFormatTanggal($after); } if ($before != '') { $this->model->before = Tanggal::ubahFormatTanggal($before); } $count = 0; if ($this->model->filter != null) { if ($this->model->filter == "suratmasuk") { $this->view->hasil = $this->model->findSuratMasuk($this->model->keyword); $this->view->count = count($this->view->hasil); $this->view->load('cari/hasilcari'); } elseif ($this->model->filter == "suratkeluar") { $this->view->hasil = $this->model->findSuratKeluar($this->model->keyword); $this->view->count = count($this->view->hasil); $this->view->load('cari/hasilcari'); } elseif ($this->model->filter == "lampiran") { $this->view->hasil = $this->model->findLampiran($this->model->keyword); $this->view->count = count($this->view->hasil); $this->view->load('cari/hasilcari'); } elseif ($this->model->filter == "all") { $hasil1 = $this->model->findSuratMasuk($this->model->keyword); $hasil2 = $this->model->findSuratKeluar($this->model->keyword); $hasil3 = $this->model->findLampiran($this->model->keyword); $this->view->hasil = array_merge($hasil1, $hasil2, $hasil3); $this->view->count = count($this->view->hasil); $this->view->load('cari/hasilcari'); } else { if ($this->model->filter == "nomor") { $this->view->hasil = $this->model->findByNomor(); $this->view->count = count($this->view->hasil); $this->view->load('cari/hasilcari'); } else { if ($this->model->filter == "alamat") { $this->view->hasil = $this->model->findByAlamat(); $this->view->count = count($this->view->hasil); $this->view->load('cari/hasilcari'); } } } } else { if ($this->model->filter == null and $this->model->before != null and $this->model->after != null) { $this->view->hasil = $this->model->findByDate(); $this->view->count = count($this->view->hasil); $this->view->load('cari/hasilcari'); } } }