public function login() { $user = $_POST['user']; $pass = $_POST['pass']; $pwd = Hash::create('sha1', $pass, HASH_SALT_KEY); $cuser = new User($this->registry); $res = $cuser->login($user, $pwd); if ((int) $res[0] == 1) { $univ = new Universitas($this->registry); $d_univ = array(); $d_jur = array(); $aruniv = $univ->get_univ(); foreach ($aruniv as $v) { if ($v->get_pic() == $res[2]) { $d_univ[] = $v->get_kode_in(); $jur = new Jurusan($this->registry); $arjur = $jur->get_jur_by_univ($v->get_kode_in()); foreach ($arjur as $w) { $d_jur[] = $w->get_kode_jur(); } } } Session::createSession(); Session::set('loggedin', TRUE); Session::set('user', $user); Session::set('role', $res[1]); Session::set('kd_user', $res[3]); Session::set('univ', $d_univ); Session::set('jur', $d_jur); ClassLog::write_log("login", "login", "user " . $user . " role:" . $res[1]); header('location:' . URL); } else { if ((int) $res[0] == 0) { $this->view->error = "user tidak ditemukan!"; $this->view->load('admin/login'); } else { $this->view->error = "database tidak valid!"; $this->view->load('admin/login'); } } }
public function updJurusan() { $jur = new Jurusan($this->registry); $kd_jur = $_POST['kd_jur']; $fak = $_POST['fakultas']; $strata = $_POST['strata']; $nama = $_POST['nama']; $alamat = $_POST['alamat']; $telepon = $_POST['telepon']; $pic_jur = $_POST['pic_jur']; $telp_pic_jur = $_POST['telp_pic_jur']; $status = $_POST['status']; $jur->set_kode_fakul($fak); $jur->set_kode_strata($strata); $jur->set_nama($nama); $jur->set_alamat($alamat); $jur->set_telepon($telepon); $jur->set_pic($pic_jur); $jur->set_telp_pic($telp_pic_jur); $jur->set_status($status); $jur->set_kode_jur($kd_jur); if (!$jur->update_jurusan()) { $fakul = new Fakultas($this->registry); $strata = new Strata(); $this->view->d_ubah = $jur; $this->view->error = $jur->get_error(); $this->view->fakul = $fakul->get_fakul(); $this->view->strata = $strata->get_All(); $this->view->data = $jur->get_jurusan(); $this->view->render('admin/jurusan'); } else { ClassLog::write_log('jurusan', 'ubah', $nama); header('location:' . URL . 'admin/addJurusan'); } }
public function updateUangSkripsi() { if (isset($_POST['ubah_uskripsi'])) { if (isset($_POST['js']) && $_POST['js'] == 1) { header('location:' . URL . 'elemenBeasiswa/viewSkripsi'); } if ($_POST['kd_el'] && $_POST['setuju'] != "" && $_POST['r_elem'] != "" && $_POST['kode_jur'] != "" && $_POST['tahun_masuk'] != "" && $_POST['biaya_skripsi'] != "" && $_POST['total_bayar'] != "") { $elem = new ElemenBeasiswa(); $pb = $_POST['setuju']; $jml_peg = count($pb); $elem->set_kd_d($_POST['kd_el']); $elem->set_jml_peg($jml_peg); $elem->set_kd_r($_POST['r_elem']); $elem->set_kd_jur($_POST['kode_jur']); $elem->set_thn_masuk($_POST['tahun_masuk']); $elem->set_biaya_per_peg(str_replace(',', '', $_POST['biaya_skripsi'])); $elem->set_total_bayar(str_replace(',', '', $_POST['total_bayar'])); $elem->set_no_sp2d($_POST['no_sp2d']); $elem->set_tgl_sp2d(date('Y-m-d', strtotime($_POST['tgl_sp2d']))); //var_dump($elem); //echo $kd_elemen_beasiswa; //exit(); //var_dump($elem); $upload = new Upload(); $upload->init('fupload'); if ($upload->getFileName() != "") { $upload->setDirTo("files/sp2d/"); $nama = array($elem->get_no_sp2d(), $elem->get_tgl_sp2d()); //$upload->uploadFile2("", $nama); if ($upload->uploadFile2("", $nama) == false) { $url = URL . 'elemenBeasiswa/editJadup/' . $elem->get_kd_d(); echo '<script> alert("File gagal diupload.") </script>'; echo '<script language="JavaScript"> window.location.href ="' . $url . '" </script>'; exit; } $elem->set_file_sp2d($upload->getFileTo()); //echo $upload->getFileName(); if ($_POST['fupload_lama'] != "") { $file = "files/sp2d/" . $_POST['fupload_lama']; //echo $file; if (file_exists($file)) { unlink($file); } } //echo $upload->getFileName(); } else { if ($_POST['fupload_lama'] != "") { $elem->set_file_sp2d($_POST['fupload_lama']); //echo $_POST['fupload_lama']; } else { $elem->set_file_sp2d(""); } } $elem->update_elem($elem); $penerima = new PenerimaElemenBeasiswa(); $penerima->delete($elem->get_kd_d()); foreach ($pb as $val) { $penerima_elemen = new PenerimaElemenBeasiswa(); $penerima_elemen->kd_elemen_beasiswa = $elem->get_kd_d(); $penerima_elemen->kd_pb = $val; $penerima_elemen->add($penerima_elemen); } ClassLog::write_log("elemen beasiswa", "ubah uang penelitian", "kd_el." . $elem->get_kd_d()); //$url = URL . 'elemenBeasiswa/editSkripsi/' . $elem->get_kd_d(); $url = URL . 'elemenBeasiswa/viewSkripsi'; echo '<script> alert("Data berhasil disimpan") </script>'; echo '<script language="JavaScript"> window.location.href ="' . $url . '" </script>'; } else { header('location:' . URL . 'elemenBeasiswa/editSkripsi/' . $elem->get_kd_d()); } } else { header('location:' . URL . 'elemenBeasiswa/viewSkripsi'); } }
public function delBiaya($id = null) { if (Session::get('role') != 2) { $this->display(); exit; } if ($id != "") { $biaya = new Biaya(); $data = $biaya->get_by_id($id); $biaya->deleteBiaya($id); ClassLog::write_log("kontrak", "hapus biaya kontrak", "kode biaya " . $id . "kode kontrak" . $data->kd_kontrak); //echo $data->kd_kontrak; } header("Location:" . URL . "kontrak/biaya/" . $data->kd_kontrak); }
public function del_pb_from_st() { if (Session::get('role') != 2) { $this->datast(); } $d = $_POST['param']; $d = explode(",", $d); $pb = new Penerima($this->registry); $pb->set_kd_pb($d[1]); $pb->get_penerima_by_id($pb); $nama = $pb->get_nama(); $nip = $pb->get_nip(); $pb->delete_penerima(); $ref = " pegawai " . $nama . ":" . $nip; ClassLog::write_log('penerima_beasiswa', 'hapus', $ref); header('location:' . URL . 'surattugas/addpb/' . $d[0]); }
public function delpb($id) { if (Session::get('role') != 2) { $this->datapb(); } $pb = new Penerima($this->registry); $pb->set_kd_pb($id); $pb->get_penerima_by_id($pb, $this->kd_user); $file = 'files/' . $pb->get_foto(); $nama = $pb->get_nama(); $nip = $pb->get_nip(); $pb->delete_penerima(); if (file_exists($file)) { unlink($file); } $ref = " pegawai " . $nama . ":" . $nip; ClassLog::write_log('penerima_beasiswa', 'rekam', $ref); header('location:' . URL . 'penerima/datapb'); }
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'); } }