function index() { $crud = new grocery_crud(); $crud->set_table('libro'); $crud->set_subject('Libros'); $crud->unset_add(); $crud->unset_edit(); $crud->unset_delete(); $crud->unset_print(); $crud->unset_export(); $crud->columns('clasificacion', 'titulo', 'autor', 'editorial', 'ISBN', 'estado'); $output = $crud->render(); $this->_example_output($output); }
function tabla() { $fecha = date("Y/m/d"); $crud = new grocery_crud(); $crud->set_table('prestamo'); $crud->set_subject('Prestamos'); $crud->required_fields('Fecha_salida', 'Fecha_entrega'); $crud->display_as('idUsuario', 'Nombre de Usuario')->display_as('idLibro', 'Nombre del libro'); $crud->columns('idLibro', 'idUsuario', 'fecha_salida', 'fecha_entrega'); $crud->add_action('Entrega', 'https://cdn3.iconfinder.com/data/icons/musthave/16/Check.png', '', '', array($this, 'redirigir')); $crud->unset_add(); $crud->unset_edit(); $crud->unset_delete(); $crud->unset_print(); $crud->unset_export(); $crud->set_relation('idLibro', 'libro', 'titulo'); $crud->set_relation('idUsuario', 'usuario_biblioteca', '{nombre} {apellidos}'); $crud->field_type('fecha_salida', 'hidden', $fecha); $output = $crud->render(); $this->_example_output($output); }
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 laporan_berkala_kasie() { $this->config->load('grocery_crud'); $this->config->set_item('grocery_crud_dialog_forms', true); $this->config->set_item('grocery_crud_default_per_page', 10); $this->load->config('grocery_crud'); $c = new grocery_crud(); $c->set_table('pelaporan_periodik'); $c->where('id_kasie', $this->session->userdata('id_user')); $c->where('status_laporan', 1); $c->or_where('id_kasie', NULL); $c->or_where('status_laporan', 2); $c->columns('id_perusahaan', 'no_skt', 'bidang_usaha', 'semester', 'file_pelaporan_periodik', 'catatan_evaluator', 'status_laporan', 'aksi'); $c->field_type('id_permohonan', 'hidden'); $c->field_type('id_kasie', 'hidden', $this->session->userdata('id_user')); $c->set_relation('id_perusahaan', 'biodata_perusahaan', 'nama_perusahaan'); $c->set_relation('id_evaluator', 'users', 'nama_lengkap', array('level' => 6)); $c->fields('file_pelaporan_periodik', 'id_permohonan', 'semester', 'id_perusahaan', 'id_kasie', 'id_evaluator'); $c->required_fields('file_pelaporan_periodik', 'id_permohonan', 'semester', 'id_perusahaan', 'id_kasie', 'id_evaluator'); $c->edit_fields('id_evaluator', 'id_kasie', 'skrip'); $c->set_field_upload('file_pelaporan_periodik', 'assets/uploads/file_pelaporan_periodik'); $c->unset_delete(); //$c->unset_edit(); //$c->unset_read(); $c->unset_add(); $c->unset_export(); $c->unset_print(); $c->callback_field('skrip', function ($value, $row) { return '<script> $("#skrip_display_as_box").remove(); $("div.crud-form div.mDiv div.ftitle").remove(); $(".ptogtitle").remove(); $(".pDiv").css("border", "none"); $(".form-div").css("border", "none"); $(".ui-dialog-content").dialog( "option", "height", 250 ); $(".ui-dialog-content").dialog( "option", "width", 650 ); $("#save-and-go-back-button").attr("value", "Submit"); $("#form-button-save").remove(); $("#cancel-button").remove(); </script>'; }); $c->unset_mytools(); $c->callback_column('aksi', function ($value, $row) { return '<div style="text-align:center; margin: 0px !important"><a class="link-pilih edit-anchor edit_button" title="Lihat Catatan Evaluator" href="' . base_url() . 'all_admin/lihat_catatan_evaluator/read/' . $row->id_pelaporan_periodik . '">Detail Evaluasi</a> | <a class="link-pilih edit-anchor edit_button" title="Tugaskan evaluator" href="' . base_url() . 'all_admin/laporan_berkala_kasie/edit/' . $row->id_pelaporan_periodik . '">Tugaskan</a> | <a class="link-pilih" title="Lihat detail laporan" href="' . base_url() . 'all_admin/detail_perusahaan/laporan_berkala_kasie/' . $row->id_permohonan . '">Lihat detail </a><hr style="margin: 6px 0px 6px 0px; border: 0; border-top: 1px solid #BDC3C7;"/> <a class="link-pilih" title="Revisi laporan" href="' . base_url() . 'all_admin/aksi_kasie/revisi/' . $row->id_pelaporan_periodik . '">Revisi</a> | <a class="link-pilih" title="Terima Laporan" href="' . base_url() . 'all_admin/aksi_kasie/terima/' . $row->id_pelaporan_periodik . '">Terima</a> | <a class="link-pilih" title="Tolak Laporan" href="' . base_url() . 'all_admin/aksi_kasie/tolak/' . $row->id_pelaporan_periodik . '">Tolak</a></div>'; }); $c->callback_column('status_laporan', function ($value, $row) { if ($value == 1 && $row->id_evaluator != NULL && $row->catatan_evaluator == NULL) { return '<span style="background-color:#F7CA18; color:#fff; border-radius:3px; padding: 0px 2px 0px 2px;">Belum Dievaluasi</span>'; } elseif ($value == 1 && $row->id_evaluator != NULL && $row->catatan_evaluator != NULL) { return '<span style="background-color:#3498DB; color:#fff; border-radius:3px; padding: 0px 2px 0px 2px;">Sudah Dievaluasi</span>'; } elseif ($value == 2) { return '<span style="background-color:#6C7A89; color:#fff; border-radius:3px; padding: 0px 2px 0px 2px;">Direvisi</span>'; } }); $c->unset_columns('action', 'pilihan'); $c->callback_column('no_skt', function ($value, $row) { $dok_skt = $this->model->select('*', 'dokumen_skt', array('id_permohonan' => $row->id_permohonan)); return $dok_skt->no_dokumen; }); $c->callback_column('bidang_usaha', function ($value, $row) { $permohonan = $this->model->select('*', 'permohonan', array('id_permohonan' => $row->id_permohonan)); $bidang_usaha = select('*', 'ref_bidang_usaha', array('id_bidang_usaha' => $permohonan->bidang_usaha)); $sub_bidang = select('*', 'ref_sub_bidang', array('id_sub_bidang' => $permohonan->sub_bidang)); return $bidang_usaha->bidang_usaha . ' /<br/>' . $sub_bidang->sub_bidang; }); $c->display_as('id_perusahaan', 'Perusahaan'); $c->display_as('bidang_usaha', 'Bidang & Sub Bidang'); $c->display_as('no_skt', 'No SKT'); $c->display_as('file_pelaporan_periodik', 'File Laporan'); $c->display_as('id_evaluator', 'Nama Evaluator'); $c->display_as('catatan_evaluator', 'Hasil Evaluasi'); $c->set_crud_url_path(base_url(strtolower(__CLASS__ . "/" . __FUNCTION__)), base_url(strtolower(__CLASS__ . "/laporan_berkala_kasie"))); $c->set_lang_string('update_success_message', 'Data Anda berhasil disimpan. <script type="text/javascript"> window.location = "' . site_url(strtolower(__CLASS__) . '/' . strtolower(__FUNCTION__)) . '"; </script> <div style="display:none"> '); $output = $c->render(); $this->logs(); if ($c->getState() != 'read') { $c->fields('file_pelaporan_periodik', 'id_permohonan', 'semester', 'id_perusahaan'); } if ($c->getState() != 'edit' && $c->getState() != 'list') { redirect('all_admin/laporan_berkala_kasie'); } else { $this->load->view('level5/laporan_berkala_kasie', $output); } }
public function sertifikasi_tenaga_kerja() { $c = new grocery_crud(); $c->set_table('sertifikasi_tenaga_kerja'); $c->where('sertifikasi_tenaga_kerja.id_perusahaan', $this->session->userdata('id_perusahaan')); $this->load->config('grocery_crud'); $c->required_fields('id_tenaga_kerja', 'judul_pelatihan'); $c->set_crud_url_path(base_url(strtolower(__CLASS__ . "/" . __FUNCTION__)), base_url(strtolower(__CLASS__ . "/data_tenaga_kerja"))); //field type $c->field_type('id_perusahaan', 'hidden', $this->session->userdata('id_perusahaan')); // unset columns $c->unset_add(); $c->unset_print(); $c->unset_export(); $c->unset_columns('id_perusahaan'); $c->display_as('id_tenaga_kerja', 'Nama Tenaga Kerja'); $c->set_field_upload('file_sertifikat', 'assets/uploads/file_sertifikat_tenaga_ahli'); // set relation $c->set_relation('id_tenaga_kerja', 'tenaga_kerja', 'nama_lengkap', array('id_perusahaan' => $this->session->userdata('id_perusahaan'))); $output = $c->render(); $this->logs(); if ($c->getState() != 'list') { $this->data_tenaga_kerja($output); } else { return $output; } }