Ejemplo n.º 1
0
 public function rekam($id_sm = null, $ids = null)
 {
     if (!Auth::isAllow(3, Session::get('role'))) {
         header('location:' . URL . 'home');
     }
     if (isset($_POST['submit'])) {
         if ($this->input()) {
             $this->view->success = "Rekam surat keluar berhasil";
         } else {
             $this->view->error = "Rekam surat keluar gagal";
         }
     }
     if (!is_null($id_sm)) {
         //cek id_sm jika panjang=5 maka kode satker
         $length = strlen($id_sm);
         //echo $length . " " . $id_sm;
         if ($length == 8) {
             $this->view->alamat = $id_sm;
             $almt = new Admin_Model();
             $alamat = $almt->getAlamat($id_sm);
             //$this->view->alamat
             foreach ($alamat as $value) {
                 $this->view->alamat .= ' ' . $value['nama_satker'];
             }
             //echo $this->view->alamat;
             if (!is_null($ids)) {
                 $sm = new Suratmasuk_Model();
                 $datasm = $sm->getSuratById($ids);
                 //                    $datasm = $this->model->select('SELECT id_suratmasuk, no_agenda, no_surat FROM suratmasuk WHERE id_suratmasuk=' . $ids);
                 foreach ($datasm as $value) {
                     $this->view->data[0] = $value['id_suratmasuk'];
                     $this->view->data[1] = $value['no_agenda'];
                     $this->view->data[2] = $value['no_surat'];
                 }
             }
         } else {
             $datasm = $this->model->select('SELECT id_suratmasuk, no_agenda, no_surat FROM suratmasuk WHERE id_suratmasuk=' . $id_sm);
             foreach ($datasm as $value) {
                 $this->view->data[0] = $value['id_suratmasuk'];
                 $this->view->data[1] = $value['no_agenda'];
                 $this->view->data[2] = $value['no_surat'];
             }
         }
     }
     $this->view->sifat = $this->model->select('SELECT * FROM sifat_surat');
     $this->view->klas = $this->model->select('SELECT * FROM klasifikasi_surat');
     $this->view->tipe = $this->model->select('SELECT * FROM tipe_naskah');
     $this->view->datas[0] = '--PILIH SIFAT SURAT--';
     $this->view->datak[0] = '--PILIH KLASIFIKASI SURAT--';
     //var_dump($this->view->data);
     $this->view->render('suratkeluar/rekam');
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 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');
 }