load->model('m_data'); if($_SESSION['status'] != "mahasiswa_login"){ $this->session->set_flashdata('flash_error', 'Silahkan Login Terlebih dahulu.'); redirect('landing','refresh'); } } //menampilkan view header, index dan footer function index(){ // $data['dhmd'] = $this->m_data->get_data('dhmd')->num_rows(); $this->load->view('mahasiswa/v_dashboard'); } 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('mahasiswa/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('mahasiswa/edit_profile'); } else { $this->session->set_flashdata('flash_error','Password Salah.'); redirect('mahasiswa/edit_profile'); } } } else { $this->load->view('v_profile'); } } // ============================================== FUNGSI MBKM ========================================== function mbkm(){ if($this->input->post()){ $this->db->select('idjk'); $where = array( 'nmkelas' => $this->input->post('kelas',true), 'nmmkind' => $this->input->post('matkul',true) ); $this->db->where($where); $id = $this->db->get('v_jdwl')->result_array(); $idjk = $id[0]['idjk']; $namafile= $_FILES['bukti']['name']; $tempat=$_FILES['bukti']['tmp_name']; $config ['upload_path'] = './mbkm/assets/upload/'; move_uploaded_file($tempat, './mbkm/assets/upload/'.$namafile); $data = array( 'idjk' => $idjk, 'nidu' => $_SESSION['username'], 'nama_dosen' => $this->input->post('nmdsn',true), 'fakultas' => $this->input->post('fakultas',true), 'prodi' => $this->input->post('prodi',true), 'matkul' => $this->input->post('matkul',true), 'sks' => $this->input->post('sks',true), 'jadwal' => $this->input->post('jadwal',true), 'kelas' => $this->input->post('kelas',true), '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' => $namafile ); $this->m_data->insert_data($data,'mbkm'); $this->session->set_flashdata('flash_success','berhasil.'); redirect('mahasiswa/mbkm'); } $this->db->select('nim, nmmhs, asal_prodi'); $this->db->where('nim', $_SESSION['username']); $data['mhs'] = $this->db->get('mahasiswa_mbkm_dalam')->result_array(); $this->load->view('mahasiswa/v_mbkm',$data); } function get_mbkm(){ $data = $this->m_data->get_data('mk_mbkm'); echo json_encode($data->result()); } function get_mbkm_byKDMK($kdprodi){ $where = array( 'kdprodi' => $kdprodi ); $data = $this->m_data->getwhere_data('mk_mbkm',$where); echo json_encode($data->result()); } function insert_pengajuan(){ $this->load->helper('date'); $waktu = time(); $time = mdate('%Y-%m-%d %H:%i:%s', $waktu); // Pengecekan pengajuan dilakukan oleh mahasiswa out atau in $status_mhs = $_SESSION['sub_lvl']; $status_mhs_ = explode("-",$status_mhs); if ($status_mhs_[0] == '01') { //kondisi apabila mahasiswa inbound $data = array( 'idmhs' => $this->input->get('nama').'-'.$_SESSION['username'], 'kdmk' => $this->input->get('kdmk'), 'sks' => $this->input->get('sks'), 'kdprodi' => $this->input->get('kdprodi').'-'.$this->input->get('nmprodi'), 'status' => 'not-acc', 'konversi' => 'belum ada', 'waktu_pengajuan' => $time ); }elseif ($status_mhs_[0] == 'ext') { //kondisi apabila mahasiswa outbound $data = array( 'idmhs' => 'ext-'.$this->input->get('nama').'-'.$_SESSION['username'].'-'.$status_mhs_[1], 'kdmk' => $this->input->get('kdmk'), 'sks' => $this->input->get('sks'), 'kdprodi' => $this->input->get('kdprodi').'-'.$this->input->get('nmprodi'), 'status' => 'not-acc', 'konversi' => 'belum ada', 'waktu_pengajuan' => $time ); } $this->m_data->insert_data('pengajuan_mbkm',$data); return null; } function get_pengajuan_byIdmhs() { $user = $this->input->get('user'); $nama = $this->input->get('nama'); $sub = $this->input->get('sub'); $sub_ = explode("-",$sub); if ($sub_[0] == '01') { //cek inbound $this->db->select('a.*,b.nmmkind'); $this->db->from('pengajuan_mbkm as a'); $this->db->join('mk_mbkm as b', 'b.kdmk = a.kdmk'); $this->db->where('idmhs', $nama.'-'.$user); $data = $this->db->get(); }elseif ($sub_[0] == 'ext') { //cek outbound $this->db->select('a.*,b.nmmkind'); $this->db->from('pengajuan_mbkm as a'); $this->db->join('mk_mbkm as b', 'b.kdmk = a.kdmk'); $this->db->where('idmhs', 'ext-'.$nama.'-'.$user.'-'.$sub_[1]); $data = $this->db->get(); } echo json_encode($data->result()); } // ================================================ END OF MBKM ===================================================================== function get_dhmd_bydosen($where){ $this->db->where('nidu', $where); $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_matkul_byid(){ $idmhs = $this->input->get('idmhs'); $this->db->where('idmhs', $idmhs); $data = $this->db->get('pengajuan_mbkm'); echo json_encode($data->result()); } function get_kelas_bymatkul(){ $matkul = $this->input->get('matkul'); $this->db->where('nmmkind', $matkul); $data = $this->db->get('v_jdwl'); echo json_encode($data->result()); } function get_sks_bymatkul(){ $matkul = $this->input->get('matkul'); $this->db->distinct(); $this->db->where('nmmkind', $matkul); $data = $this->db->get('v_matkulsks'); echo json_encode($data->result()); // echo json_encode($matkul); } function get_mahasiswa_outbound(){ $data = $this->db->get('mahasiswa_mbkm_outbound'); echo json_encode($data->result()); } function get_mahasiswa_outboundbyNIM(){ $id=$this->input->get('id'); $where = array( 'id' => $id ); $hsl=$this->m_data->cek_where('mahasiswa_mbkm_outbound',$where); if($hsl->num_rows()>0){ foreach ($hsl->result() as $i) { $data = array( 'id' => $i->id, 'nim' => $i->nim, 'nama_kegiatan' => $i->nama_kegiatan, 'universitas_tujuan' => $i->universitas_tujuan, 'sks' => $i->sks ); } } echo json_encode($data); } // ============================================== START FUNGSI Status Pengajuan ======================================== function status_pengajuan(){ $this->db->where('nim', $_SESSION['username']); $data['mhs'] = $this->db->get('mahasiswa_mbkm_dalam')->result_array(); $this->load->view('mahasiswa/v_status_pengajuan',$data); } function get_matkulpengajuan(){ $this->db->select('a.kdmk, a.kdprodi, b.nmmkind, a.status, a.waktu_pengajuan, a.idmhs'); $this->db->from('pengajuan_mbkm as a'); $this->db->join('mk_mbkm as b', 'b.kdmk = a.kdmk'); $data = $this->db->get(); echo json_encode($data->result()); } // ============================================== END FUNGSI Status Pengajuan ======================================== // ============================================== START FUNGSI Nilai ======================================== function nilai(){ $this->load->view('mahasiswa/v_nilai'); } function cetak(){ $sub = $_GET['sub']; $user = $_GET['user']; $sub_ = explode("-",$sub); $this->db->select('a.*, b.nmmkind'); $this->db->from('nilai_mbkm as a'); $this->db->join('mk_mbkm as b', 'b.kdmk = a.kdmk'); // $this->db->join('mahasiswa_mbkm_luar as c', 'c.npm = a.nim_mhs'); $this->db->where('a.nim_mhs', $user); $this->db->where('a.status', $sub_[1]); $data['nilai'] = $this->db->get()->result_array(); $this->load->view('mahasiswa/cetak',$data); } function get_nilaimbkm(){ $sub = $_GET['sub']; $user = $_GET['user']; $sub_ = explode("-",$sub); // pengecekan mahasiswa inbound atau outbound karena terdapat perbedaan penulisan status di tabel nilai_mbkm if ($sub_[0] == '01') { //mahasiswa inbound $this->db->select('a.*, b.nmmkind'); $this->db->from('nilai_mbkm as a'); $this->db->join('mk_mbkm as b', 'b.kdmk = a.kdmk'); // $this->db->join('mahasiswa_mbkm_luar as c', 'c.npm = a.nim_mhs'); $this->db->where('a.nim_mhs', $user); $this->db->where('a.status', $sub_[1]); $data = $this->db->get(); }elseif ($sub_[0] == 'ext') { //mahasiswa outbound $this->db->select('a.*, b.nmmkind'); $this->db->from('nilai_mbkm as a'); $this->db->join('mk_mbkm as b', 'b.kdmk = a.kdmk'); // $this->db->join('mahasiswa_mbkm_luar as c', 'c.npm = a.nim_mhs'); $this->db->where('a.nim_mhs', $user); $this->db->where('a.status', 'outbound-'.$sub_[1]); $data = $this->db->get(); } echo json_encode($data->result()); } function get_nilaimbkm_byNimKdmk() { $id=$this->input->get('id'); $kdmk=$this->input->get('kdmk'); $where = array( 'id' => $id, 'kdmk' => $kdmk ); $hsl=$this->m_data->cek_where('nilai_mbkm',$where); if($hsl->num_rows()>0){ foreach ($hsl->result() as $i) { $data = array( 'id' => $i->id, 'nim' => $i->nim_mhs, 'nama' => $i->nama_mhs, 'kdmk' => $i->kdmk, 'stsemester' => $i->stsemester, 'nilai_kehadiran' => $i->nilai_kehadiran, 'tugas' => $i->tugas, 'quiz' => $i->quiz, 'uts' => $i->uts, 'uas' => $i->uas, 'total_nilai' => $i->total_nilai, 'nilai_huruf' => $i->nilai_huruf, 'status' => $i->status ); } } echo json_encode($data); } // ============================================== END FUNGSI Nilai ======================================== 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'); } function cetak2(){ $this->load->view('mahasiswa/cetak2'); } // function mbkmoutbound(){ // $this->load->view('mahasiswa/v_mbkmoutbound'); // } function form_input_mbkm(){ $this->load->helper('date'); $waktu = time(); $time = mdate('%Y-%m-%d %H:%i:%s', $waktu); $data = array( // 'nama_mahasiswa' => $_SESSION['username'], 'nim' => $_SESSION['username'], 'nama_kegiatan' => $this->input->post('namakegiatan',true), 'universitas_tujuan' => $this->input->post('universitas_tujuan',true), 'sks' => $this->input->post('sksmbkm',true), 'created_at' => $time ); $this->m_data->insert_data('mahasiswa_mbkm_outbound',$data); $this->session->set_flashdata('flash_success','berhasil.'); redirect('mahasiswa/mbkmoutbound'); } function input_hasil_mbkm($id){ if($this->input->post()){ $this->load->helper('date'); $waktu = time(); $time = mdate('%Y-%m-%d %H:%i:%s', $waktu); $ntime = mdate('%Y-%m-%d_%H-%i-%s', $waktu); $namafile= $_FILES['filebukti']['name']; $setnamafile= 'BO_'.$_SESSION['username'].'_'.$ntime.'_'.$namafile; $tempat=$_FILES['filebukti']['tmp_name']; $config ['upload_path'] = './mbkm/uploads/'; move_uploaded_file($tempat, './mbkm/uploads/'.$setnamafile); $data = array( // 'nama_mahasiswa' => $_SESSION['username'], 'bukti' => $setnamafile, 'updated_at' => $time ); $this->db->where('id', $id); $this->db->update('mahasiswa_mbkm_outbound', $data); $this->session->set_flashdata('flash_success','berhasil.'); redirect('mahasiswa/mbkmoutbound'); } } } /* End of file Dosen.php */ ?>