Esempio n. 1
0
 public function pelaporan_periodik()
 {
     $c = new grocery_crud();
     $c->set_table('pelaporan_periodik');
     $permohonan = $this->session->userdata('id_permohonan');
     $c->unset_delete();
     $c->unset_read();
     $c->unset_print();
     $c->unset_export();
     $c->unset_mytools();
     $c->set_field_upload('file_pelaporan_periodik', 'assets/uploads/file_pelaporan_periodik');
     $c->columns('semester', 'file_pelaporan_periodik', 'status_laporan');
     $c->fields('semester', 'id_permohonan', 'file_pelaporan_periodik', 'id_evaluator', 'id_perusahaan', 'status_laporan', 'create_at', 'catatan_evaluator');
     $c->field_type('id_permohonan', 'hidden', $permohonan);
     $c->field_type('id_perusahaan', 'hidden', $this->session->userdata('id_perusahaan'));
     $c->field_type('status_laporan', 'hidden', '1');
     $c->field_type('create_at', 'hidden', strftime('%Y-%m-%d'));
     $c->field_type('catatan_evaluator', 'hidden');
     $c->callback_after_update(function ($post_array, $primary_key) {
         $this->db->update('pelaporan_periodik', array('catatan_evaluator' => NULL), array('id_pelaporan_periodik' => $primary_key));
         return TRUE;
     });
     $c->callback_column('status_laporan', function ($value, $row) {
         if ($value == 1) {
             return 'Diajukan';
         } elseif ($value == 2) {
             return 'Revisi | <a class="link-pilih" title="Edit data" href="' . base_url() . 'perusahaan/pelaporan_periodik/edit/' . $row->id_pelaporan_periodik . '"><img class="mybtn-edit"></a>';
         } elseif ($value == 3) {
             return 'Disetujui';
         } elseif ($value == 4) {
             return 'Ditolak';
         }
     });
     $c->where('id_permohonan', $permohonan);
     $c->set_relation('semester', 'ref_semester', 'semester', array('is_delete' => 0));
     $sl_permohonan = select('user_tujuan', 'disposisi', array('id_permohonan' => $permohonan, 'status_progress' => 8), array('id_disposisi', 'DESC'));
     $smohon = select('*', 'users', array('id_user' => $sl_permohonan->user_tujuan, 'level' => 6));
     //$retVal = ($smohon) ? $smohon->id_user : 0 ;
     $c->field_type('id_evaluator', 'hidden', $smohon->id_user);
     $output = $c->render();
     $this->logs();
     $level = $this->session->userdata('level');
     $status = $this->session->userdata('status_lap_periodik');
     if ($level != NULL) {
         if ($level == 1 && $status == 1) {
             $this->load->view('level1/view_list', $output);
         } else {
             redirect('all_users/dashboard');
         }
     } elseif ($level == NULL) {
         redirect('umum/logout');
     }
     if ($c->getState() != 'add') {
         $c->change_field_type('semester', 'readonly');
         if ($c->getState() == 'success') {
             redirect('perusahaan/pelaporan_periodik');
         }
     }
 }
 public function callback_after_update($callback = null, $override_all = 0)
 {
     if (!$override_all) {
         $this->callback_after_update_ext[] = $callback;
         if ($this->callback_after_update == null) {
             $this->callback_after_update = array($this, 'extended_callback_after_update');
         }
     } else {
         parent::callback_after_update($callback);
     }
     return $this;
 }