function pp() { must_login(); if (is_pengajar()) { # panggil colorbox $html_js = load_comp_js(array(base_url('assets/comp/colorbox/jquery.colorbox-min.js'), base_url('assets/comp/colorbox/act-pengajar.js'))); $data['comp_js'] = $html_js; $data['comp_css'] = load_comp_css(array(base_url('assets/comp/colorbox/colorbox.css'))); $data['pengajar'] = $this->pengajar_model->retrieve(get_sess_data('user', 'id')); $data['pengajar_login'] = $this->login_model->retrieve(get_sess_data('login', 'id')); $data['status_id'] = get_sess_data('user', 'status_id'); $this->twig->display('pp-pengajar.html', $data); } if (is_siswa()) { $retrieve_siswa = $this->siswa_model->retrieve(get_sess_data('user', 'id')); $retrieve_login = $this->login_model->retrieve(get_sess_data('login', 'id')); $retrieve_all_kelas = $this->kelas_model->retrieve_all_siswa(10, 1, array('siswa_id' => $retrieve_siswa['id'])); $data['siswa'] = $retrieve_siswa; $data['siswa_login'] = $retrieve_login; $data['siswa_kelas'] = $retrieve_all_kelas; $data['status_id'] = get_sess_data('user', 'status_id'); # panggil colorbox $html_js = load_comp_js(array(base_url('assets/comp/colorbox/jquery.colorbox-min.js'), base_url('assets/comp/colorbox/act-siswa.js'))); $data['comp_js'] = $html_js; $data['comp_css'] = load_comp_css(array(base_url('assets/comp/colorbox/colorbox.css'))); $data['show'] = !empty($_GET['show']) ? $_GET['show'] : ''; $this->twig->display('pp-siswa.html', $data); } }
function index() { $this->db->like('id', 'email-template-', 'after'); $results = $this->db->get('pengaturan'); $data = array(); foreach ($results->result_array() as $email) { $email_value = json_decode($email['value'], 1); $data[] = array('id' => $email['id'], 'nama' => $email['nama'], 'subject' => $email_value['subject'], 'body' => $email_value['body']); } $data['template'] = $data; $data['comp_js'] = load_comp_js(array(base_url('assets/comp/datatables/jquery.dataTables.js'), base_url('assets/comp/datatables/datatable-bootstrap2.js'), base_url('assets/comp/datatables/script.js'))); $data['comp_css'] = load_comp_css(array(base_url('assets/comp/datatables/datatable-bootstrap2.css'))); $this->twig->display('list-email-template.html', $data); }
function pp() { must_login(); if (is_pengajar()) { # panggil colorbox $html_js = load_comp_js(array(base_url('assets/comp/colorbox/jquery.colorbox-min.js'), base_url('assets/comp/colorbox/act-pengajar.js'))); $data['comp_js'] = $html_js; $data['comp_css'] = load_comp_css(array(base_url('assets/comp/colorbox/colorbox.css'))); $data['pengajar'] = $this->pengajar_model->retrieve(get_sess_data('user', 'id')); $data['pengajar_login'] = $this->login_model->retrieve(get_sess_data('login', 'id')); $data['status_id'] = get_sess_data('user', 'status_id'); $this->twig->display('pp-pengajar.html', $data); } }
function detail($segment_3 = '') { $msg_id = (int) $segment_3; $retrieve = $this->msg_model->retrieve(get_sess_data('login', 'id'), $msg_id); if (empty($retrieve['retrieve'])) { $this->session->set_flashdata('msg', get_alert('success', 'Pesan tidak ditemukan.')); redirect('message'); } # format data $retrieve['retrieve'] = $this->format_msg($retrieve['retrieve']); foreach ($retrieve['old_related_msg'] as $key => &$val) { $retrieve['old_related_msg'][$key] = $this->format_msg($val); } foreach ($retrieve['new_related_msg'] as $key => &$val) { $retrieve['new_related_msg'][$key] = $this->format_msg($val); } // pr($retrieve);die; $data['r'] = $retrieve['retrieve']; $data['old_related_msg'] = $retrieve['old_related_msg']; $data['new_related_msg'] = $retrieve['new_related_msg']; if ($data['r']['sender_receiver_id'] != get_sess_data('login', 'id')) { $login_receiver = $this->login_model->retrieve($data['r']['sender_receiver_id']); if (!empty($login_receiver['siswa_id'])) { $user_receiver = $this->siswa_model->retrieve($login_receiver['siswa_id']); } elseif (!empty($login_receiver['pengajar_id'])) { $user_receiver = $this->pengajar_model->retrieve($login_receiver['pengajar_id']); } $data['receiver_name'] = $user_receiver['nama'] . " <{$login_receiver['username']}>"; } else { $data['receiver_name'] = $data['r']['profil']['nama'] . " <{$data['r']}[login][username]>"; } $html_js = get_tinymce('content'); $html_js .= load_comp_js(array(base_url('assets/comp/autocomplete/jquery.autocomplete.min.js'), base_url('assets/comp/autocomplete/script.js'), base_url('assets/comp/jquery/get-new-msg.js'))); $data['comp_js'] = $html_js; $data['comp_css'] = load_comp_css(array(base_url('assets/comp/autocomplete/autocomplete.css'))); # update read $this->msg_model->update_read($msg_id); foreach ($data['old_related_msg'] as $old_msg) { $this->msg_model->update_read($old_msg['id']); } foreach ($data['new_related_msg'] as $new_msg) { $this->msg_model->update_read($new_msg['id']); } if (!empty($_GET['confirm']) and $_GET['confirm'] == 1) { $data['confirm_del_all'] = true; } $this->twig->display('detail-pesan.html', $data); }
function manajemen_soal($segment_3 = '', $segment_4 = '') { $tugas_id = (int) $segment_3; $page_no = (int) $segment_4; if (empty($page_no)) { $page_no = 1; } $tugas = $this->tugas_model->retrieve($tugas_id); if (empty($tugas) or $tugas['type_id'] == 1) { redirect('tugas/index'); } # jika sebagai pengajar, cek kepemilikan if (is_pengajar() and $tugas['pengajar_id'] != get_sess_data('user', 'id')) { redirect('tugas'); } $data['tugas'] = $this->formatData($tugas); # panggil colorbox $html_js = load_comp_js(array(base_url('assets/comp/colorbox/jquery.colorbox-min.js'), base_url('assets/comp/colorbox/act-manajamen-soal.js'))); $data['comp_js'] = $html_js; $data['comp_css'] = load_comp_css(array(base_url('assets/comp/colorbox/colorbox.css'))); $retrieve_all = $this->tugas_model->retrieve_all_pertanyaan(20, $page_no, $tugas['id'], 'DESC'); # jika pilihan ganda if ($tugas['type_id'] == 3) { foreach ($retrieve_all['results'] as $key => $val) { $val['pilihan'] = $this->tugas_model->retrieve_all_pilihan($val['id']); $retrieve_all['results'][$key] = $val; } } $data['pertanyaan'] = $retrieve_all['results']; $data['pagination'] = $this->pager->view($retrieve_all, 'tugas/manajemen_soal/' . $tugas['id'] . '/'); $this->twig->display('manajemen-tugas.html', $data); }
function komentar($segment_3 = '', $segment_4 = '') { # panggil datatables dan combobox $data['comp_js'] = load_comp_js(array(base_url('assets/comp/datatables/jquery.dataTables.js'), base_url('assets/comp/datatables/datatable-bootstrap2.js'), base_url('assets/comp/datatables/script.js'))); $data['comp_css'] = load_comp_css(array(base_url('assets/comp/datatables/datatable-bootstrap2.css'))); switch ($segment_3) { case 'laporan': if (!is_admin()) { redirect('materi/komentar'); } $field_id = 'laporkan-komentar'; $retrieve_field = retrieve_field($field_id); if (isset($retrieve_field['value'])) { $field_value = json_decode($retrieve_field['value'], 1); } else { $field_value = array(); } # aksi $get_act = !empty($_GET['act']) ? $_GET['act'] : ''; if (!empty($get_act) and in_array($get_act, array(1, 2))) { $id = (string) $_GET['id']; if (empty($id)) { redirect('materi/komentar/laporan'); } # hapus komentar dan laporan if (!empty($field_value[$id])) { $laporan = $field_value[$id]; if ($get_act == 1) { # hapus komentar $this->komentar_model->delete($laporan['komentar_id']); } # hapus laporan unset($field_value[$id]); update_field($field_id, 'Laporan Komentar', json_encode($field_value)); $this->session->set_flashdata('komentar', get_alert('success', 'Komentar ' . ($get_act == 1 ? 'dan laporan ' : '') . 'berhasil dihapus.')); redirect('materi/komentar/laporan'); } else { redirect('materi/komentar/laporan'); } } # format data $results = array(); foreach ($field_value as $id => $val) { $val['id'] = $id; # cari materi $materi = $this->materi_model->retrieve($val['materi_id']); if (empty($materi)) { # hapus laporan unset($field_value[$id]); update_field($field_id, 'Laporan Komentar', json_encode($field_value)); continue; } $val['materi'] = $materi; $login = $this->get_user_data($val['login_id']); $val['login'] = $login; $komentar = $this->komentar_model->retrieve($val['komentar_id']); if (empty($komentar)) { # hapus laporan unset($field_value[$id]); update_field($field_id, 'Laporan Komentar', json_encode($field_value)); continue; } $val['komentar'] = $komentar; $val['komentar']['login'] = $this->get_user_data($komentar['login_id']); $results[] = $val; } $data['laporan'] = $results; $this->twig->display('list-komentar-laporan.html', $data); break; case 'delete': if (!is_admin()) { redirect('materi/komentar'); } $komentar = $this->komentar_model->retrieve((int) $segment_4); if (empty($komentar)) { show_error('Komentar tidak ditemukan'); } # hapus komentar $this->komentar_model->delete($komentar['id']); $this->session->set_flashdata('komentar', get_alert('success', 'Komentar berhasil dihapus.')); redirect('materi/komentar'); break; default: $login_id = null; if (!is_admin()) { $login_id = get_sess_data('login', 'id'); } $retrieve_all = $this->komentar_model->retrieve_all($no_of_records = "all", $page_no = 1, $login_id, $materi_id = null, $tampil = 1); foreach ($retrieve_all as $key => $val) { $val['materi'] = $this->materi_model->retrieve($val['materi_id']); $retrieve_all[$key] = $this->format_komentar($val); } $data['komentar'] = $retrieve_all; if (is_admin()) { # hitung jumlah laporan $field_id = 'laporkan-komentar'; $retrieve_field = retrieve_field($field_id); if (isset($retrieve_field['value'])) { $field_value = json_decode($retrieve_field['value'], 1); } else { $field_value = array(); } $data['jml_laporan'] = count($field_value); } $this->twig->display('list-komentar.html', $data); break; } }
function kelas($act = 'list', $id = '') { $this->must_login(); $data = array('web_title' => 'Manajemen Kelas | Administrator', 'module_title' => 'Manajemen Kelas', 'comp_css' => load_comp_css(array(base_url('assets/comp/nestedSortable/nestedSortable.css'))), 'comp_js' => load_comp_js(array(base_url('assets/comp/nestedSortable/jquery.mjs.nestedSortable.js'), base_url('assets/comp/nestedSortable/kelas.js')))); switch ($act) { case 'edit': $content_file = 'admin_kelas/edit.html'; $id = (int) $id; $kelas = $this->kelas_model->retrieve($id, true); if (empty($kelas)) { redirect('admin/kelas'); } $data['kelas'] = $kelas; if ($this->form_validation->run('admin/kelas/edit') == TRUE) { $nama = $this->input->post('nama', TRUE); if (empty($kelas['parent_id'])) { $aktif = 1; } else { $aktif = $this->input->post('status', TRUE); if (empty($aktif)) { $aktif = 0; } } //update kelas $this->kelas_model->update($id, $nama, $kelas['parent_id'], $kelas['urutan'], $aktif); $this->session->set_flashdata('kelas', get_alert('success', $kelas['nama'] . ' berhasil di perbaharui')); redirect('admin/kelas'); } break; default: case 'list': $content_file = 'admin_kelas/add.html'; if ($this->form_validation->run() == TRUE) { //insert kelas $nama = $this->input->post('nama', TRUE); $this->kelas_model->create($nama); $this->session->set_flashdata('kelas', get_alert('success', 'Kelas berhasil di tambah')); redirect('admin/kelas'); } break; } $str_kelas = ''; $this->kelas_hirarki($str_kelas); $data['kelas_hirarki'] = $str_kelas; $data = array_merge(default_parser_item(), $data); $this->twig->display($content_file, $data); }
function koreksi($tugas_id = '') { if (is_siswa()) { redirect('tugas'); } $tugas_id = (int) $tugas_id; $tugas = $this->tugas_model->retrieve($tugas_id); if (empty($tugas)) { redirect('tugas'); } # ini essay atau upload if ($tugas['type_id'] == 3) { redirect('tugas'); } $data['tugas'] = $this->formatData($tugas); $data_siswa = array(); # ambil history $retrieve_all_history = $this->tugas_model->retrieve_all_history($tugas_id); foreach ($retrieve_all_history as $history) { # cari siswa_id $split_id = explode('-', $history['id']); $siswa_id = $split_id[2]; # cari tugas_id $history_tugas_id = end($split_id); if ($history_tugas_id != $tugas['id']) { continue; } # cari siswa $siswa = $this->siswa_model->retrieve($siswa_id); # kelas siswa $kelas_siswa = $this->kelas_model->retrieve_siswa(null, array('siswa_id' => $siswa_id, 'aktif' => 1)); $kelas = $this->kelas_model->retrieve($kelas_siswa['kelas_id']); $siswa['kelas_aktif'] = $kelas; $siswa['history'] = $history; # cari nilai $siswa['nilai'] = $this->tugas_model->retrieve_nilai(null, $tugas['id'], $siswa['id']); $data_siswa[] = $siswa; } $data['data_siswa'] = $data_siswa; // pr($data_siswa);die; # panggil datatables dan combobox $data['comp_js'] = load_comp_js(array(base_url('assets/comp/datatables/jquery.dataTables.js'), base_url('assets/comp/datatables/datatable-bootstrap2.js'), base_url('assets/comp/datatables/script.js'), base_url('assets/comp/colorbox/jquery.colorbox-min.js'), base_url('assets/comp/colorbox/act-tugas.js'))); $data['comp_css'] = load_comp_css(array(base_url('assets/comp/datatables/datatable-bootstrap2.css'), base_url('assets/comp/colorbox/colorbox.css'))); $this->twig->display('list-peserta.html', $data); }
function get_plugin() { $plugin_url = 'http://elearningplugin.dokumenary.net/index.php'; $plugin_data = get_url_data($plugin_url); $result_body = json_decode($plugin_data, true); $data['plugins'] = $result_body; # panggil datatables $data['comp_js'] = load_comp_js(array(base_url('assets/comp/datatables/jquery.dataTables.js'), base_url('assets/comp/datatables/datatable-bootstrap2.js'), base_url('assets/comp/datatables/script.js'))); $data['comp_css'] = load_comp_css(array(base_url('assets/comp/datatables/datatable-bootstrap2.css'))); $this->twig->display('get-plugin.html', $data); }
function search() { must_login(); if (empty($_GET['q'])) { redirect('welcome'); } $q = (string) $_GET['q']; $q = urldecode($q); if (is_siswa()) { $kelas_aktif = $this->siswa_kelas_aktif; } # cari siswa $retrieve_all_siswa = $this->siswa_model->retrieve_all_filter($nis = '', $nama = $q, $jenis_kelamin = array(), $tahun_masuk = '', $tempat_lahir = '', $tgl_lahir = '', $bln_lahir = '', $thn_lahir = '', $alamat = '', $agama = array(), $kelas_id = array(), $status_id = is_admin() ? array() : array(1, 2, 3), $username = '', $page_no = 1, $pagination = false); foreach ($retrieve_all_siswa as $key => &$val) { $kelas_siswa = $this->kelas_model->retrieve_siswa(null, array('siswa_id' => $val['id'], 'aktif' => 1)); # kelas aktif if (!empty($kelas_siswa) and $val['status_id'] != 3) { $kelas = $this->kelas_model->retrieve($kelas_siswa['kelas_id']); $val['kelas_aktif'] = $kelas; } $retrieve_all_siswa[$key] = $val; } # cari pengajar $retrieve_all_pengajar = $this->pengajar_model->retrieve_all_filter($nip = '', $nama = $q, $jenis_kelamin = array(), $tempat_lahir = '', $tgl_lahir = '', $bln_lahir = '', $thn_lahir = '', $alamat = '', $status_id = is_admin() ? array() : array(1, 2), $username = '', $is_admin = '', $page_no = 1, $pagination = false); # cari materi $retrieve_all_materi = $this->materi_model->retrieve_all($no_of_records = 10, $page_no = 1, $pengajar_id = array(), $siswa_id = array(), $mapel_id = array(), $judul = $q, $konten = null, $tgl_posting = null, $publish = null, $kelas_id = array(), $type = array(), $pagination = false); # cari tugas $retrieve_all_tugas = $this->tugas_model->retrieve_all($no_of_records = 10, $page_no = 1, $mapel_id = array(), $pengajar_id = is_pengajar() ? array(get_sess_data('user', 'id')) : array(), $type_id = array(), $kelas_id = is_siswa() ? array($kelas_aktif['kelas_id']) : array(), $judul = $q, $info = null, $aktif = array(), $pagination = false); # cari pesan $retrieve_all_pesan = $this->msg_model->retrieve_all(10, $page_no, get_sess_data('login', 'id'), array('content' => $q), false); foreach ($retrieve_all_pesan as $key => &$val) { $retrieve_all_pesan[$key] = $this->format_msg($val); } $results = array('siswa' => $retrieve_all_siswa, 'pengajar' => $retrieve_all_pengajar, 'materi' => $retrieve_all_materi, 'tugas' => $retrieve_all_tugas, 'pesan' => $retrieve_all_pesan); $data['results'] = $results; $data['keyword'] = $q; if (is_admin()) { # panggil colorbox $html_js = load_comp_js(array(base_url('assets/comp/colorbox/jquery.colorbox-min.js'), base_url('assets/comp/colorbox/act-siswa.js'), base_url('assets/comp/colorbox/act-pengajar.js'))); $data['comp_js'] = $html_js; $data['comp_css'] = load_comp_css(array(base_url('assets/comp/colorbox/colorbox.css'))); } $this->twig->display('search-results.html', $data); }
function detail($segment_3 = '', $segment_4 = '') { $status_id = (int) $segment_3; $siswa_id = (int) $segment_4; $retrieve_siswa = $this->siswa_model->retrieve($siswa_id); if (empty($retrieve_siswa)) { redirect('siswa/index/1'); } $retrieve_login = $this->login_model->retrieve(null, null, null, $retrieve_siswa['id']); $retrieve_all_kelas = $this->kelas_model->retrieve_all_siswa(10, 1, array('siswa_id' => $retrieve_siswa['id'])); $data['siswa'] = $retrieve_siswa; $data['siswa_login'] = $retrieve_login; $data['siswa_kelas'] = $retrieve_all_kelas; $data['status_id'] = $status_id; # panggil colorbox $html_js = load_comp_js(array(base_url('assets/comp/colorbox/jquery.colorbox-min.js'), base_url('assets/comp/colorbox/act-siswa.js'))); $data['comp_js'] = $html_js; $data['comp_css'] = load_comp_css(array(base_url('assets/comp/colorbox/colorbox.css'))); $this->twig->display('detail-siswa.html', $data); }
function mapel_kelas($act = 'list', $segment_4 = '', $segment_5 = '', $segment_6 = '', $segment_7 = '') { $data['comp_js'] = load_comp_js(array(base_url('assets/comp/jquery/ajax.js'))); switch ($act) { case 'aktifkan': $parent_id = (int) $segment_4; $kelas_id = (int) $segment_5; $mapel_kelas_id = (int) $segment_6; $uri_back = (string) $segment_7; # ambil parent $parent = $this->kelas_model->retrieve($parent_id); if (empty($parent)) { redirect('kelas/mapel_kelas'); } $kelas = $this->kelas_model->retrieve($kelas_id); if (empty($kelas)) { redirect('kelas/mapel_kelas'); } $mapel_kelas = $this->mapel_model->retrieve_kelas($mapel_kelas_id); if (empty($mapel_kelas)) { redirect('kelas/mapel_kelas'); } if (empty($uri_back)) { $uri_back = site_url('kelas/mapel_kelas/#subkelas-' . $kelas_id); } else { $uri_back = deurl_redirect($uri_back); $uri_back = rtrim($uri_back, '/'); $uri_back = $uri_back . '/#subkelas-' . $kelas_id; } if (!is_demo_app()) { # update $this->mapel_model->update_kelas($mapel_kelas_id, $mapel_kelas['kelas_id'], $mapel_kelas['mapel_id'], 1); } $this->session->set_flashdata('edit-mapel-kelas-' . $kelas['id'], get_alert('success', 'Matapelajaran kelas berhasil diaktifkan.')); redirect($uri_back); break; case 'remove': $parent_id = (int) $segment_4; $kelas_id = (int) $segment_5; $mapel_kelas_id = (int) $segment_6; $uri_back = (string) $segment_7; # ambil parent $parent = $this->kelas_model->retrieve($parent_id); if (empty($parent)) { redirect('kelas/mapel_kelas'); } $kelas = $this->kelas_model->retrieve($kelas_id); if (empty($kelas)) { redirect('kelas/mapel_kelas'); } if (empty($uri_back)) { $uri_back = site_url('kelas/mapel_kelas/#subkelas-' . $kelas_id); } else { $uri_back = deurl_redirect($uri_back); $uri_back = rtrim($uri_back, '/'); $uri_back = $uri_back . '/#subkelas-' . $kelas_id; } if (!is_demo_app()) { # hapus data $this->mapel_model->delete_kelas($mapel_kelas_id); } $this->session->set_flashdata('edit-mapel-kelas-' . $kelas['id'], get_alert('warning', 'Matapelajaran kelas berhasil dihapus.')); redirect($uri_back); break; case 'add': $parent_id = (int) $segment_4; $kelas_id = (int) $segment_5; $uri_back = (string) $segment_6; # ambil parent $parent = $this->kelas_model->retrieve($parent_id); if (empty($parent)) { redirect('kelas/mapel_kelas'); } $kelas = $this->kelas_model->retrieve($kelas_id); if (empty($kelas)) { redirect('kelas/mapel_kelas'); } if (empty($uri_back)) { $uri_back = site_url('kelas/mapel_kelas/add/' . $parent_id . '/' . $kelas_id); } else { $uri_back = deurl_redirect($uri_back); } $data['uri_back'] = $uri_back; $content_file = 'tambah-mapel-kelas.html'; $data['kelas'] = $kelas; $data['parent'] = $parent; # ambil semua matapelajaran $retrieve_all = $this->mapel_model->retrieve_all_mapel(); $data['mapels'] = $retrieve_all; # ambil matapelajaran pada kelas ini $retrieve_all_kelas = $this->mapel_model->retrieve_all_kelas(); $mapel_kelas_id = array(); foreach ($retrieve_all_kelas as $v) { $mapel_kelas_id[] = $v['mapel_id']; } if ($this->form_validation->run('kelas/mapel_kelas/add') == TRUE and !is_demo_app()) { $mapel = $this->input->post('mapel', TRUE); $mapel_post_id = array(); foreach ($mapel as $mapel_id) { if (is_numeric($mapel_id) and $mapel_id > 0) { # cek dulu $check = $this->mapel_model->retrieve_kelas(null, $kelas_id, $mapel_id); if (empty($check)) { $this->mapel_model->create_kelas($kelas_id, $mapel_id); } else { # update aktif jadi 1 $this->mapel_model->update_kelas($check['id'], $kelas_id, $mapel_id, 1); } $mapel_post_id[] = $mapel_id; } } # cari perbedaan if (count($mapel_kelas_id) > count($mapel_post_id)) { $diff_mapel_kelas = array_diff($mapel_kelas_id, $mapel_post_id); foreach ($diff_mapel_kelas as $mapel_id) { # ambil data $retrieve = $this->mapel_model->retrieve_kelas(null, $kelas_id, $mapel_id); if (!empty($retrieve)) { # hapus $this->mapel_model->delete_kelas($retrieve['id']); } } } $this->session->set_flashdata('mapel', get_alert('success', 'Matapelajaran kelas berhasil disimpan.')); redirect('kelas/mapel_kelas/add/' . $parent_id . '/' . $kelas_id . '/' . enurl_redirect($uri_back)); } break; default: case 'list': # detect post if (!empty($_POST)) { $post_parent_id = (int) $this->input->post('parent_kelas', true); $post_sub_id = (int) $this->input->post('sub_kelas', true); redirect('kelas/mapel_kelas/list/' . $post_parent_id . '/' . $post_sub_id); } $content_file = 'list-mapel-kelas.html'; $parent_kelas_id = (int) $segment_4; $sub_kelas_id = (int) $segment_5; $data['filter']['parent_id'] = $parent_kelas_id; $data['filter']['sub_id'] = $sub_kelas_id; if (!empty($parent_kelas_id)) { $data['filter']['result']['parent'] = $this->kelas_model->retrieve($parent_kelas_id); $data['sub_kelas'] = $this->kelas_model->retrieve_all($parent_kelas_id, array('aktif' => 1)); } if (!empty($sub_kelas_id)) { $data['filter']['result']['sub'] = $this->kelas_model->retrieve($sub_kelas_id); } $data['mapel_kelas_hirarki'] = $this->mapel_kelas_hirarki('', array('parent_id' => $parent_kelas_id, 'sub_id' => $sub_kelas_id)); $data['parent_kelas'] = $this->kelas_model->retrieve_all(null, array('aktif' => 1)); break; } $this->twig->display($content_file, $data); }
function koreksi($tugas_id = '', $mode = '') { if (is_siswa()) { redirect('tugas'); } $tugas_id = (int) $tugas_id; $tugas = $this->tugas_model->retrieve($tugas_id); if (empty($tugas)) { redirect('tugas'); } # ini essay atau upload if ($tugas['type_id'] == 3) { redirect('tugas'); } $data['tugas'] = $this->formatData($tugas); $data_siswa = array(); # kelas $kelas_nilai = array(); # ambil history $retrieve_all_history = $this->tugas_model->retrieve_all_history($tugas_id); foreach ($retrieve_all_history as $history) { # cari siswa_id $split_id = explode('-', $history['id']); $siswa_id = $split_id[2]; # cari tugas_id $history_tugas_id = end($split_id); if ($history_tugas_id != $tugas['id']) { continue; } # kondisi untuk versi tugas yang terlanjur dibuat di versi < 1.5 if (!isset($history['pertanyaan_id']) and isset($history['pertanyaan'])) { $history['pertanyaan_id'] = array(); foreach ($history['pertanyaan'] as $key => $p) { $history[$key] = $p['id']; } unset($history['pertanyaan']); } # cari siswa $siswa = $this->siswa_model->retrieve($siswa_id); # kelas siswa $kelas_siswa = $this->kelas_model->retrieve_siswa(null, array('siswa_id' => $siswa_id, 'aktif' => 1)); $kelas = $this->kelas_model->retrieve($kelas_siswa['kelas_id']); $siswa['kelas_aktif'] = $kelas; $siswa['history'] = $history; $siswa['history']['value'] = json_decode($history['value'], 1); if (!isset($kelas_nilai[$kelas['id']])) { $kelas_nilai[$kelas['id']] = $kelas; } # cari nilai $siswa['nilai'] = $this->tugas_model->retrieve_nilai(null, $tugas['id'], $siswa['id']); if (!empty($_POST['kelas_id'])) { if ($_POST['kelas_id'] == 'all' or $kelas['id'] == $_POST['kelas_id']) { $data_siswa[] = $siswa; } } else { $data_siswa[] = $siswa; } } $data['data_siswa'] = $data_siswa; $data['kelas_nilai'] = $kelas_nilai; if ($mode == 'print') { $this->twig->display('print-nilai.html', $data); } elseif ($mode == 'export_excel') { header("Content-type: application/vnd-ms-excel"); header("Content-Disposition: attachment; filename=nilai-" . url_title($data['tugas']['judul'], '-', true) . ".xls"); $this->twig->display('export-excel-nilai.html', $data); } else { # panggil datatables dan combobox $data['comp_js'] = load_comp_js(array(base_url('assets/comp/datatables/jquery.dataTables.js'), base_url('assets/comp/datatables/datatable-bootstrap2.js'), base_url('assets/comp/datatables/script.js'), base_url('assets/comp/colorbox/jquery.colorbox-min.js'), base_url('assets/comp/colorbox/act-tugas.js'))); $data['comp_css'] = load_comp_css(array(base_url('assets/comp/datatables/datatable-bootstrap2.css'), base_url('assets/comp/colorbox/colorbox.css'))); $this->twig->display('list-peserta.html', $data); } }
function edit($segment_3 = '') { # yang bisa edit pengumuman adalah pengajar / admin if (!is_pengajar() and !is_admin()) { redirect('pengumuman/index'); } $id = (int) $segment_3; $pengumuman = $this->pengumuman_model->retrieve(array('id' => $id)); if (empty($pengumuman)) { $this->session->set_flashdata('pengumuman', get_alert('warning', 'Pengumuman tidak ditemukan.')); redirect('pengumuman/index/1'); } $allow_action = $this->get_allow_action($pengumuman); if (!in_array('edit', $allow_action)) { $this->session->set_flashdata('pengumuman', get_alert('warning', 'Akses ditolak.')); redirect('pengumuman/index/1'); } $data['p'] = $pengumuman; if ($this->form_validation->run('pengumuman') == true) { $judul = $this->input->post('judul', true); $split = explode(" s/d ", $this->input->post('tgl_tampil', true)); $tgl_tampil = $split[0]; $tgl_tutup = $split[1]; $konten = $this->input->post('konten', true); $tampil_siswa = $this->input->post('tampil_siswa', true); $tampil_pengajar = $this->input->post('tampil_pengajar', true); $this->pengumuman_model->update($pengumuman['id'], $judul, $konten, $tgl_tampil, $tgl_tutup, $tampil_siswa, $tampil_pengajar, $pengumuman['pengajar_id']); $this->session->set_flashdata('pengumuman', get_alert('success', 'Pengumuman berhasil diperbaharui.')); redirect('pengumuman/edit/' . $pengumuman['id']); } # load komponen $html_js = get_tinymce('konten'); $html_js .= load_comp_js(array(base_url('assets/comp/jquery/moment.min.js'), base_url('assets/comp/daterangepicker/jquery.daterangepicker.js'), base_url('assets/comp/daterangepicker/setup.js'))); $data['comp_js'] = $html_js; $data['comp_css'] = load_comp_css(array(base_url('assets/comp/daterangepicker/daterangepicker.css'))); $this->twig->display('edit-pengumuman.html', $data); }