コード例 #1
0
 public function delPemberi($id = null)
 {
     if ($id != null) {
         $pemberi = new PemberiBeasiswa();
         $pemberi->delete($id);
         header('location:' . URL . 'admin/addPemberi');
     } else {
         header('location:' . URL . 'admin/addPemberi');
     }
 }
コード例 #2
0
 public function datast($id = 0, $halaman = 1, $batas = 10)
 {
     $st = new SuratTugas($this->registry);
     if (isset($_POST['sb_add'])) {
         $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'];
         $upload = $this->registry->upload;
         $upload->init('fupload');
         $upload->setDirTo('files/st/');
         $nama = array($nomor, $tgl_st);
         $upload->changeFileName($upload->getFileName(), $nama);
         $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, 'FILE_ST' => $upload->getFileTo());
         $st->add_st($data);
         $upload->uploadFile();
         $ref = " no ST " . $nomor;
         ClassLog::write_log('surat_tugas', 'rekam', $ref);
     }
     $aksi = array();
     if ($id != 0) {
         $st->set_kd_st($id);
         $this->view->d_ubah = $st->get_surat_tugas_by_id($st, $this->kd_user);
         $is_exist_file = $this->view->d_ubah->get_file() != NULL ? true : false;
         $file = array('file_exist' => $is_exist_file);
         $aksi = array('aksi' => 'ubah');
     } else {
         $aksi = array('aksi' => 'rekam');
         $file = array('file_exist' => false);
     }
     $univ = new Universitas($this->registry);
     $jur = new Jurusan($this->registry);
     $pemb = new PemberiBeasiswa();
     $this->view->d_pemb = $pemb->get_All();
     if (Session::get('role') == 2) {
         $this->view->d_st_lama = $st->get_surat_tugas($this->kd_user);
     }
     $this->view->d_jst = $st->get_st_class();
     if (Session::get('role') == 2) {
         $this->view->d_univ = $univ->get_univ($this->kd_user);
     } else {
         $this->view->d_univ = $univ->get_univ();
     }
     $this->view->d_jur = $jur->get_jurusan();
     $this->view->d_th_masuk = $st->get_list_th_masuk(true);
     $this->view->d_th_masuk_input = $st->get_list_th_masuk(false);
     if (Session::get('role') == 2) {
         $this->view->d_st_all = $st->get_surat_tugas($this->kd_user);
     } else {
         $this->view->d_st_all = $st->get_surat_tugas();
     }
     $this->view->aksi = json_encode($aksi);
     $this->view->d_file_exist = json_encode($file);
     if ($id != 0) {
         $jur = $this->view->d_ubah->get_jur();
         $univ = $univ->get_univ_by_jur($jur);
         $this->view->univ = $univ->get_kode_in();
     }
     /**start paging**/
     $url = '';
     if ($id == 0) {
         $url = 'surattugas/datast/0';
     } else {
         $url = 'surattugas/datast/' . $id;
     }
     $this->view->url = $url;
     $this->view->paging = new Paging($url, $batas, $halaman);
     $this->view->jmlData = count($this->view->d_st_all);
     $posisi = $this->view->paging->cari_posisi();
     if (Session::get('role') == 2) {
         $this->view->d_st = $st->get_surat_tugas_limit($posisi, $batas, $this->kd_user);
     } else {
         $this->view->d_st = $st->get_surat_tugas_limit($posisi, $batas);
     }
     /**end paging**/
     $this->view->render('riwayat_tb/data_st');
 }