コード例 #1
0
ファイル: arsip_model.php プロジェクト: ryderonil/sisurip
 public function isAllowWrite($id, $tipe)
 {
     $file = '';
     switch ($tipe) {
         case 'SM':
             $sm = new Suratmasuk_Model();
             $data = $sm->getSuratById($id);
             $file = $data->getFile();
             break;
         case 'SK':
             $sk = new Suratkeluar_Model();
             $data = $sk->getSuratById($id, 'ubah');
             $file = $data->getFile();
             break;
         default:
             throw new Exception('parameter yang dimasukkan salah!');
             break;
     }
     if ($file == '' or $file == null) {
         return false;
     }
     $ext = end(explode('.', $file));
     if ($ext != 'pdf') {
         return false;
     }
     if (!file_exists('arsip/' . $file)) {
         return false;
     }
     return true;
 }
コード例 #2
0
 public function getDueDate($tipe, $id = null)
 {
     $due_date = 24;
     if ($tipe == 'SM') {
         return 4;
     } elseif ($tipe = 'SK' and !is_null($id)) {
         $sk = new Suratkeluar_Model();
         $data = $sk->getSuratById($id, 'ubah');
         //            foreach ($data as $val){
         if ($data->getRujukan() != 0) {
             return $due_date;
         } else {
             if ($data->getJenis() == 'SS') {
                 return 24;
             } elseif ($data->getJenis() == 'SG') {
                 return 2 * 24;
             } elseif ($data->getJenis() == 'BS') {
                 return 5 * 24;
             }
         }
         //            }
     } elseif ($tipe == 'SK' and is_null($id)) {
         return $due_date;
     }
 }
コード例 #3
0
 public function ubah($id)
 {
     if (!Auth::isAllow(3, Session::get('role'))) {
         header('location:' . URL . 'home');
     }
     if (isset($_POST['submit'])) {
         if ($this->ubahLampiran()) {
             $this->view->success = "Ubah lampiran berhasil";
         } else {
             $this->view->error = "Ubah lampiran surat gagal!";
         }
     }
     $lamp = new Lampiran_Model();
     $data = $this->model->getLampiran($id);
     foreach ($data as $val) {
         $lamp->set('id_lamp', $val['id_lamp']);
         $lamp->set('jns_surat', $val['jns_surat']);
         $lamp->set('id_surat', $val['id_surat']);
         $lamp->set('tipe', $val['tipe']);
         $lamp->set('nomor', $val['nomor']);
         $lamp->set('tanggal', $val['tanggal']);
         $lamp->set('asal', $val['asal']);
         $lamp->set('hal', $val['hal']);
         $lamp->set('keterangan', $val['keterangan']);
         $lamp->set('file', $val['file']);
     }
     if ($lamp->get('jns_surat') == 'SM') {
         $sm = new Suratmasuk_Model();
         $datas = $sm->getSuratById($lamp->get('id_surat'));
         //            foreach ($datas as $value){
         $this->view->data[0] = $datas->getId();
         $this->view->data[1] = $datas->getNomor();
         $admin = new Admin_Model();
         $alamat = $admin->getAlamat($datas->getAlamat());
         foreach ($alamat as $val) {
             $alamat = $val['nama_satker'];
         }
         $this->view->data[2] = $alamat;
         $this->view->data[3] = $datas->getPerihal();
         $this->view->data[4] = 'SK';
         //            }
     } else {
         $sk = new Suratkeluar_Model();
         $datas = $sk->getSuratById($lamp->get('id_surat'), 'ubah');
         //            foreach ($data as $value){
         $this->view->data[0] = $datas->getId();
         $this->view->data[1] = $datas->getNomor();
         $admin = new Admin_Model();
         $alamat = $admin->getAlamat($datas->getAlamat());
         foreach ($alamat as $val) {
             $alamat = $val['nama_satker'];
         }
         $this->view->data[2] = $alamat;
         $this->view->data[3] = $datas->getPerihal();
         $this->view->data[4] = 'SK';
         //            }
     }
     //        $datas = $this->model->select($sql);
     //var_dump($this->view->data);
     $this->view->lamp = $lamp;
     $this->view->tipe = $this->model->getTypeLampiran();
     $this->view->render('lampiran/ubah');
 }