load->model('m_data'); if(isset($_SESSION['role'])){ if(in_array("dosen",$_SESSION['role'])){ $this->db_ = $this->load->database('skpv',TRUE); }else{ $this->session->set_flashdata('flash_error', 'Silahkan Login Terlebih dahulu.'); redirect('landing','refresh'); } }else{ $this->session->set_flashdata('flash_error', 'Silahkan Login Terlebih dahulu.'); redirect('landing','refresh'); } // if($_SESSION['status'] != "dosen_login"){ // $this->session->set_flashdata('flash_error', 'Silahkan Login Terlebih dahulu.'); // redirect('landing','refresh'); // }elseif ($this->session->userdata('status')=="dosen_login") { // $this->db_ = $this->load->database('skpv',TRUE); // } } //menampilkan view header, index dan footer function index(){ redirect(base_url().'dashboard'); } // ============================================== FUNGSI DHMD ========================================== function get_data_dosen(){ $nidu = $this->input->get('nidu'); $this->db_->select('nidu, nmdosdgngelar, kdprodi, nmprodi, kdfakultas, nmfakultas'); $this->db_->where('nidu', $nidu); $data = $this->db_->get('v_dosen_cari'); echo json_encode($data->result()); } function get_kdmk_dosen(){ $nidu = $this->input->get('nidu'); $kdstsemester = $this->input->get('stsemester'); $this->db_->select('a.nidu, a.kdmk'); $this->db_->from('jadwalkuliah a'); // $this->db_->join('matakuliah b', 'b.kdmk = a.kdmk',); $this->db_->where('a.kdstsemester', $kdstsemester); $this->db_->where('a.nidu', $nidu); $data = $this->db_->get(); echo json_encode($data->result()); } function dhmd(){ if($this->input->post()){ list($kdmk, $matkul) = explode('.',$this->input->post('matkul',true)); list($idkelas, $kelas) = explode('.',$this->input->post('kelas',true)); list($kdfakultas, $fakultas) = explode('-',$this->input->post('fakultas',true)); list($kdprodi, $prodi) = explode('-',$this->input->post('prodi',true)); $this->db_->select('kdstsemester'); $this->db_->where('idstatus', '1'); $stsemester = $this->db_->get('stsemester')->result_array(); $kdstsemester = $stsemester[0]['kdstsemester']; $this->db_->select('idjk'); $where = array( 'idkelas' => $idkelas, 'kdmk' => $kdmk, 'kdstsemester' => $kdstsemester ); $this->db_->where($where); $id = $this->db_->get('jadwalkuliah')->result_array(); if($id == NULL){ $this->session->set_flashdata('flash_error','Jadwal belum terdaftar. Harap hubungi pihak TU.'); }else{ $idjk = $id[0]['idjk']; // $namafile= $_FILES['bukti']['name']; // $tempat=$_FILES['bukti']['tmp_name']; // move_uploaded_file($tempat, './assets/upload/'.$namafile); $this->load->helper('date'); $waktu = time(); $time = mdate('%Y-%m-%d %H:%i:%s', $waktu); $data = array( 'idjk' => $idjk, 'nidu' => $_SESSION['username'], 'nama_dosen' => $this->input->post('nmdsn',true), 'kdfakultas' => $kdfakultas, 'fakultas' => $fakultas, 'kdprodi' => $kdprodi, 'prodi' => $prodi, 'kdmk' => $kdmk, 'matkul' => $matkul, 'sks' => $this->input->post('sks',true), 'jadwal' => $this->input->post('jadwal',true), 'idkelas' => $idkelas, 'kelas' => $kelas, 'kdstsemester' => $kdstsemester, 'pertemuan' => $this->input->post('pertemuan',true), 'jmlabsen' => $this->input->post('jmlabsen',true), 'hadir' => $this->input->post('hadir',true), 'materi' => $this->input->post('materi',true), 'penjelasan' => $this->input->post('penjelasan',true), 'bukti' => 'GDrive',//$namafile //pathinfo($namafile, PATHINFO_EXTENSION) 'status' => '0', 'created_at' => $time ); $this->m_data->insert_data($data,'dhmd'); $this->session->set_flashdata('flash_success','DHMD berhasil ditambahkan.'); } redirect('dosen/dhmd'); } // get stsemester aktif ===== $this->db_->select('kdstsemester, idstatus'); $this->db_->where('idstatus', '1'); $data['stsemester'] = $this->db_->get('stsemester')->result_array(); // ==================== $nidu = $_SESSION['username']; // get data dosen ===== $this->db_->select('nidu, nmdosdgngelar, kdprodi, nmprodi, kdfakultas, nmfakultas'); $this->db_->where('nidu', $nidu); $data['dosen'] = $this->db_->get('v_dosen_cari')->result_array(); // ==================== // get data kdmk dosen terkait ===== $this->db_->distinct(); $this->db_->select('a.idjk, a.nidu, a.kdmk, a.idkelas, a.idhari, b.nmmkind'); $this->db_->from('jadwalkuliah a'); $this->db_->join('matakuliah b', 'b.kdmk = a.kdmk'); $this->db_->where('nidu', $nidu); $this->db_->where('kdstsemester', $data['stsemester'][0]['kdstsemester']); $data['jadwal'] = $this->db_->get()->result_array(); // ==================== // get link upload GDrive $kdprd = $data['dosen'][0]['kdprodi']; $link = ''; if ($kdprd == '55201') { // Teknik Informatika S1 $link = 'https://drive.google.com/drive/folders/1YGI7pX2ZWqrkz1c6g5cBXPoTbKQVd3Kt?usp=sharing'; } elseif ($kdprd == '20201') { // Teknik Elektro S1 $link = 'https://drive.google.com/drive/folders/1ltggo43QLJWvQu7cJ8jtApH8xcqn6Gqj?usp=sharing'; } elseif ($kdprd == '22201') { // Teknik Sipil S1 $link = 'https://drive.google.com/drive/folders/1HsLRD-opno6ICTPP8w2DFbT3wQcPL02A?usp=sharing'; } elseif ($kdprd == '23201') { // Teknik Arsitektur S1 $link = 'https://drive.google.com/drive/folders/1V5JW6I935b-jek-ukpIW59wxWIw7zHcb?usp=sharing'; } elseif ($kdprd == '26201') { // Teknik Industri S1 $link = 'https://drive.google.com/drive/folders/1JNjqpFqouki_wjrwHeGCdyImR8Sn5GSm?usp=sharing'; } elseif ($kdprd == '55101') { // Teknik Informatika S2 $link = 'https://drive.google.com/drive/folders/1iPsoBBhzOMpCSVjHqhLSRptGsPI5wFlF?usp=sharing'; } elseif ($kdprd == '61101') { // Manajemen S2 $link = 'https://drive.google.com/drive/folders/1I6WmAXC9FlaAAcjkOnA-JVC8di4NR_xF?usp=sharing'; } elseif ($kdprd == '61201') { // Manajemen S1 $link = 'https://drive.google.com/drive/folders/1Rpd4X-1ZB2MRui3vYGNlYFWLvjdAxcSA?usp=sharing'; } elseif ($kdprd == '62201') { // Akuntansi S1 $link = 'https://drive.google.com/drive/folders/1pPBXHlIvVcIgmFgrX8tdmp1pR4qijIPU?usp=sharing'; } elseif ($kdprd == '65101') { // Ilmu Pemerintahan S2 $link = 'https://drive.google.com/drive/folders/1KhzoYclD_zQNl-y6QwxJ3oFUj32p_Fsp?usp=sharing'; } elseif ($kdprd == '65201') { // Ilmu Pemerintahan S1 $link = 'https://drive.google.com/drive/folders/1K9iQnU1OT0tKTt8HK7M9SP_FMOpNWgqW?usp=sharing'; } elseif ($kdprd == '70201') { // Ilmu Komunikasi S1 $link = 'https://drive.google.com/drive/folders/1WWMj3Z2z5dOarh8DJBcSy4rsNgUMu5ZL?usp=sharing'; } elseif ($kdprd == '72201') { // Ilmu Kesejahteraan Sosial S1 $link = 'https://drive.google.com/drive/folders/10LvGOFuV4uaSbUB2BqvlaV9G5CMhkQ-w?usp=sharing'; } elseif ($kdprd == '74101') { // Ilmu Hukum S2 $link = 'https://drive.google.com/drive/folders/1T82xAdmGK_j0YaZBCaAAAPeVODYuRDn3?usp=sharing'; } elseif ($kdprd == '74201') { // Ilmu Hukum S1 $link = 'https://drive.google.com/drive/folders/1AGFpQfpgd4Vaqr3QBPzeToHq_jdvcf4k?usp=sharing'; } elseif ($kdprd == '84202') { // Pendidikan Matematika S1 $link = 'https://drive.google.com/drive/folders/1eOabi8Pu6HXOj6VPJSFoKD3sjbRjSEN9?usp=sharing'; } elseif ($kdprd == '86206') { // PGSD S1 $link = 'https://drive.google.com/drive/folders/1P58SEKKF-e0v--QdPLs7qcR--ZL2Dk4u?usp=sharing'; } elseif ($kdprd == '87203') { // Pendidikan Ekonomi S1 $link = 'https://drive.google.com/drive/folders/1yKmQnFKjw3z2ur_WSXxrn10Hk6-SdqSW?usp=sharing'; } elseif ($kdprd == '95420') { // Kepolisian S1 $link = 'https://drive.google.com/drive/folders/1Zz06pUWtL5iikp6fYhUmu2n5iKqOZzjA?usp=sharing'; } $data['link'] = $link; $this->load->view('dosen/v_dhmd',$data); } function get_jadwal_matkul_bynidu($nidu) { // get stsemester aktif ===== $this->db_->select('kdstsemester, idstatus'); $this->db_->where('idstatus', '1'); $smsteraktif = $this->db_->get('stsemester')->result_array(); // get data kdmk dosen terkait ===== $this->db_->select('a.kdstsemester, a.kdprodi, a.kdmk, a.nidu, a.idkelas, b.nmmkind, c.nmkelas, d.jmlsks, e.idjk, e.idhari, f.darijam, f.sampaijam, g.nmhari, h.idjnsdosen'); $this->db_->from('absendos a'); $this->db_->join('matakuliah b', 'b.kdmk = a.kdmk','left'); $this->db_->join('kelas c', 'c.idkelas = a.idkelas','left'); $this->db_->join('struprog d', '(d.kdmk = a.kdmk AND d.kdstsemester = a.kdstsemester)','left'); $this->db_->join('jadwalkuliah e', '(e.kdmk = a.kdmk AND e.idkelas = a.idkelas AND e.kdstsemester = a.kdstsemester AND e.nidu = a.nidu)','left'); $this->db_->join('jadwalkuliahdet f', 'f.idjk = e.idjk','left'); $this->db_->join('hari g', 'g.idhari = e.idhari','left'); $this->db_->join('struprogdet h','(h.kdmk = a.kdmk AND h.nidu = a.nidu AND h.idkelas = a.idkelas)','left'); $this->db_->where('a.kdstsemester', $smsteraktif[0]['kdstsemester']); $this->db_->where('a.nidu', $nidu); $data = $this->db_->get(); echo json_encode($data->result()); } function get_dosen_1(){ $kdmk = $this->input->get('kdmk'); $idkelas = $this->input->get('idkelas'); $this->db_->select('nidu'); $this->db_->from('struprogdet'); $this->db_->where('kdmk', $kdmk); $this->db_->where('idkelas', $idkelas); $this->db_->where('idjnsdosen', '1'); $data = $this->db_->get(); echo json_encode($data->result()); } function get_jadwal_1(){ $kdmk = $this->input->get('kdmk'); $kdstsemester = $this->input->get('kdstsemester'); $nidu = $this->input->get('nidu'); $idkelas = $this->input->get('idkelas'); // Butuh hari, dari jam, sampai jam $this->db_->select('a.idjk, b.nmhari, c.darijam, c.sampaijam'); $this->db_->from('jadwalkuliah a'); $this->db_->join('hari b', 'b.idhari = a.idhari'); $this->db_->join('jadwalkuliahdet c', 'c.idjk = a.idjk','left'); $this->db_->where('a.kdmk', $kdmk); $this->db_->where('a.kdstsemester', $kdstsemester); $this->db_->where('a.nidu', $nidu); $this->db_->where('a.idkelas', $idkelas); $data = $this->db_->get(); echo json_encode($data->result()); } function get_dhmd_bynidukdmk($nidu,$kdmk){ $this->db->where('nidu', $nidu); $this->db->where('kdmk', $kdmk); $this->db->order_by('pertemuan', 'asc'); $data = $this->db->get('dhmd'); echo json_encode($data->result()); } function get_mhs_absenmhs($kdmk,$kdstsemester,$idkelas) { $this->db_->select('a.nim, b.nmmhs'); $this->db_->from('absenmhs a'); $this->db_->join('mahasiswa b', 'b.nim = a.nim', 'left'); $this->db_->where('a.kdmk', $kdmk); $this->db_->where('a.kdstsemester', $kdstsemester); $this->db_->where('a.idkelas', $idkelas); $data = $this->db_->get(); echo json_encode($data->result()); } public function get_countDhmd_byIDJK() { $idjk = $this->input->get('idjk'); $this->db->where('idjk', $idjk); $data = $this->db->count_all_results('dhmd') + 1; echo json_encode($data); } function get_kelas_bymatkul(){ $nidu = $this->input->get('nidu'); $kdstsemester = $this->input->get('kdstsemester'); $kdmk = $this->input->get('kdmk'); $this->db_->select('a.idjk, a.nidu, a.kdmk, a.idkelas, b.nmkelas'); $this->db_->from('jadwalkuliah a'); $this->db_->join('kelas b', 'b.idkelas = a.idkelas'); $this->db_->where('nidu', $nidu); $this->db_->where('kdstsemester', $kdstsemester); $this->db_->where('kdmk', $kdmk); $data = $this->db_->get(); echo json_encode($data->result()); } function get_hari_byKdmkIdKelas(){ $kdmk = $this->input->get('kdmk'); $idkelas = $this->input->get('idkelas'); $kdstsemester = $this->input->get('kdstsemester'); $this->db_->select('a.kdmk, a.idkelas, a.kdstsemester, a.idhari, b.nmhari'); $this->db_->from('jadwalkuliah a'); $this->db_->join('hari b', 'b.idhari = a.idhari', 'left'); $this->db_->where('kdmk',$kdmk); $this->db_->where('idkelas',$idkelas); $this->db_->where('kdstsemester',$kdstsemester); $data = $this->db_->get(); echo json_encode($data->result()); } function get_sks_byKdmk(){ // dari table kurikulm, bisa juga dari v_matkulsks $kdmk = $this->input->get('kdmk'); $this->db_->select('kdprodi, kdmk, jmlsks, thnmasuk'); $this->db_->where('kdmk', $kdmk); $this->db_->order_by('thnmasuk', 'asc'); $data = $this->db_->get('kurikulum'); echo json_encode($data->result()); } function get_dhmd(){ $data = $this->m_data->get_data('dhmd'); echo json_encode($data->result()); } function get_dhmd_bydosen($where){ $this->db->where('nidu', $where); $data = $this->db->get('dhmd'); echo json_encode($data->result()); } function get_dhmd_clear_bydosen($where){ $this->db->where('nidu', $where); $this->db->where('pertemuan', '16'); $data = $this->db->get('dhmd'); echo json_encode($data->result()); } function get_dhmd_byid(){ $id = $this->input->get('id'); $this->db->where('id', $id); $data = $this->db->get('dhmd'); echo json_encode($data->result()); } function get_countDhmd_byKdmkIdKelas(){ $kdmk = $this->input->get('kdmk'); $idkelas = $this->input->get('idkelas'); $kdstsemester = $this->input->get('kdstsemester'); $where = array( 'kdmk' => $kdmk, 'idkelas' => $idkelas, 'kdstsemester' => $kdstsemester ); $this->db->where($where); $data = $this->db->count_all_results('dhmd') + 1; echo json_encode($data); } // ============================================== FUNGSI MATKUL ======================================== function matkul(){ $this->load->view('dosen/v_matkul'); } function get_matkul_bydosen(){ $nidu = $_SESSION['username']; $wherenidu = array( 'nidu' => $nidu ); $data = $this->m_data->cek_where('v_matkuldosen',$wherenidu); echo json_encode($data->result()); } function get_jadwal_bynidu(){ $nidu = $_SESSION['username']; $this->db->where('nidu', $nidu); $data = $this->db->get('v_jdwl'); echo json_encode($data->result()); } function logout(){ $this->session->sess_destroy(); redirect(base_url().'landing'); } public function edit_profile() { if ($this->input->post()) { $uname = $this->input->post('username', true); $pw = MD5($this->input->post('old_pw')); $npw = MD5($this->input->post('new_pw')); $cpw = MD5($this->input->post('conf')); if ($npw != $cpw) { $this->session->set_flashdata('flash_error','Konfirmasi Password Salah.'); redirect('dosen/edit_profile'); } else { $where = array( 'username' => $uname, 'password' => $pw ); $this->load->model('m_login'); $cek = $this->m_login->cek_login('user', $where); if ($cek > 0) { $value = array( 'password' => $npw ); $this->db->where('id', $_SESSION['id']); $this->db->update('user', $value); $this->session->set_flashdata('flash_success','Password berhasil diperbaharui.'); redirect('dosen/edit_profile'); } else { $this->session->set_flashdata('flash_error','Password Salah.'); redirect('dosen/edit_profile'); } } } else { $this->load->view('v_profile'); } } } /* End of file Dosen.php */ ?>