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; } }
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; }
<table><tr><td width="50%" valign="top"> <div class="detil"> <div class="divleft"><h2>INFORMASI SURAT :</h2></div> <hr> </br> <div id="table-wrapper"><table class="tableinfo"> <tr><td width="25%"></td><td></td></tr> <?php if ($this->rujukan != 0 and $this->rujukan != '') { ?> <tr><td>NOMOR SURAT MASUK</td><td><?php $mon = new Suratkeluar_Model(); echo $mon->getRujukan($this->rujukan); ?> </td></tr> <?php } ?> <tr><td>TANGGAL/NO SURAT</td><td><?php echo Tanggal::tgl_indo($this->tgl_surat) . '/' . $this->no_surat; ?> </td></tr> <?php if ($this->no_surat != 0 and $this->no_surat != '') { ?> <tr><td>NOMOR SURAT</td><td><?php echo $this->no_surat; ?> </td></tr> <?php }
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'); }