load->model('m_data'); // cek session yang login, jika session status tidak sama dengan session admin_login,maka halaman akan di alihkan kembali ke halaman login. if($this->session->userdata('status')!="staff-ext_login"){ $this->session->set_flashdata('flash_error', 'Silahkan Login Terlebih dahulu.'); redirect('landing','refresh'); } } //menampilkan view header, index dan footer function index(){ // $data['user'] = $this->m_data->get_data('user')->num_rows(); $data['user'] = '-'; $data['dosen'] = '-'; $data['matkul'] = '-'; $data['mhs'] = '-'; $data['dhmd'] = '-'; $this->load->view('dosen/v_dashboard',$data); } //Syntax $this->session->sess_destroy(); merupakan fungsi codeigniter untuk menghapus semua session dan akan dialihkan ke halaman login // 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('admin', $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'); } } function logout(){ $this->session->sess_destroy(); redirect(base_url().'landing'); } // ======================================== Start Fungsi Manage Mahasiswa ================================================ function mhs(){ if($this->input->post()){ $this->load->helper('date'); $waktu = time(); $time = mdate('%Y-%m-%d %H:%i:%s', $waktu); $data = array( 'npm' => $this->input->post('npm',true), 'nmmhs' => $this->input->post('nama'), 'jnskelamin' => $this->input->post('jnskelamin',true), 'stsemester' => $this->input->post('stsemester',true), 'universitas' => $this->input->post('universitas',true), 'fakultas' => $this->input->post('fakultas',true), 'prodi' => $this->input->post('prodi',true), 'email' => $this->input->post('email',true), // 'thnmasuk' => $this->input->post('thnmasuk',true), 'status' => 'menunggu', 'created_at' => $time, 'input_by' => $_SESSION['id'] ); $this->db->insert('mahasiswa_mbkm_luar', $data); $this->session->set_flashdata('flash_success',' Mahasiswa ditambahkan.'); redirect('staffx/mhs'); }else{ $this->load->view('staffx/v_mhs'); } } function edit_mhs($idmhs = NULL) { if ($this->input->post() ) { $this->load->helper('date'); $waktu = time(); $time = mdate('%Y-%m-%d %H:%i:%s', $waktu); $update = array( 'nmmhs' => $this->input->post('nmmhs2',true), 'npm' => $this->input->post('npm2',true), 'jnskelamin' => $this->input->post('jnskelamin2',true), 'universitas' => $this->input->post('universitas2',true), 'fakultas' => $this->input->post('fakultas2',true), 'prodi' => $this->input->post('prodi2',true), 'email' => $this->input->post('email',true), // 'status' => $this->input->post('status2',true), 'status' => 'menunggu', 'updated_at' => $time ); // $insert = array( // 'username' => $this->input->post('npm2'), // 'password' => MD5($this->input->post('npm2')), // 'status' => 'mahasiswa', // 'sub_lvl' => '01-'.$this->input->post('universitas2'), // 'created_at' => $time // ); $where = array( 'idmhs' => $idmhs ); // $this->db->insert('user', $insert); $this->m_data->update_data($where,$update,'mahasiswa_mbkm_luar'); $this->session->set_flashdata('flash_success', 'Data User Telah Diperbaharui.'); redirect('staffx/mhs'); } } function delete_mhs($id = NULL) { $this->db->where('idmhs', $id); $this->db->delete('mahasiswa_mbkm_luar'); $this->session->set_flashdata('flash_success','dihapus.'); redirect('staffx/mhs'); } function get_mahasiswa(){ $data = $this->m_data->get_data('mahasiswa_mbkm_luar'); echo json_encode($data->result()); } function get_mahasiswa_byUniv($univ = NULL){ // $univ=$this->input->get('universitas'); $univ_=urldecode($univ); $this->db->where('universitas', $univ_); $this->db->order_by('nmmhs', 'asc'); $data = $this->db->get('mahasiswa_mbkm_luar'); echo json_encode($data->result()); } function get_mhs() { $id=$this->input->get('id'); $where = array( 'idmhs' => $id ); $hsl=$this->m_data->cek_where('mahasiswa_mbkm_luar',$where); if($hsl->num_rows()>0){ foreach ($hsl->result() as $i) { $data = array( 'idmhs' => $i->idmhs, 'npm' => $i->npm, 'nmmhs' => $i->nmmhs, 'jnskelamin' => $i->jnskelamin, 'email' => $i->email, 'stsemester' => $i->stsemester, 'universitas' => $i->universitas, 'fakultas' => $i->fakultas, 'prodi' => $i->prodi, 'alamatuniv' => $i->alamatuniv, 'kotauniv' => $i->kotauniv, 'provinsiuniv' => $i->provinsiuniv, 'kodepos' => $i->kodepos, 'notelpuniv' => $i->notelpuniv, 'notelpuser' => $i->notelpuser, 'status' => $i->status, 'created_at' => $i->created_at, 'updated_at' => $i->updated_at, 'input_by' => $i->input_by ); } } echo json_encode($data); } function get_mahasiswa_byid(){ $id = $this->input->get('idmhs'); $this->db->where('idmhs', $id); $data = $this->db->get('mahasiswa_mbkm_luar'); echo json_encode($data->result()); } // ======================================== End Fungsi Manage Mahasiswa ================================================ // ======================================== Start Fungsi Manage Pengajuan MK 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'] = './assets/upload/'; move_uploaded_file($tempat, './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('staffx/mbkm'); } // $iddosen = $_SESSION['iddsn']; // $where = array( // 'iddsn' => $iddosen // ); // $data['dosen'] = $this->m_data->cek_where('v_dosprodfak',$where)->result_array(); $nidu = $_SESSION['username']; // $this->db->select('nmmkind, nmkelas'); // $this->db->where('nidu', $nidu); // $data['mkkelas'] = $this->db->get('v_jdwl')->result_array(); // $this->db->select('kdmk, jmlsks'); // $data['sks'] = $this->db->get('kurikulum'); $this->load->view('staffx/v_mbkm'); } 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); $data = array( 'idmhs' => $this->input->get('username'), 'kdmk' => $this->input->get('kdmk'), 'sks' => $this->input->get('sks'), 'kdprodi' => $this->input->get('kdprodi').'-'.$this->input->get('nmprodi'), 'status' => 'not-acc', 'waktu_pengajuan' => $time ); $this->m_data->insert_data('pengajuan_mbkm',$data); return null; } function get_pengajuan_byIdmhs() { $nama = $this->input->get('nama'); $nim = $this->input->get('nim'); $univ = $this->input->get('univ'); $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.'-'.$nim.'-'.$univ); $data = $this->db->get(); echo json_encode($data->result()); } // ======================================== END Fungsi Manage Pengajuan MK MBKM ================================================ // ============================================== START FUNGSI Status Pengajuan ======================================== function status_pengajuan(){ $this->load->view('staffx/v_status_pengajuan'); } 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 Laporan Nilai ======================================== function nilai(){ $this->load->view('staffx/v_nilai'); } function cetak($univ = null){ $univ_=urldecode($univ); $this->db->select('a.*, b.nmmkind, c.prodi'); $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.status', 'outbound-'.$univ_); $data['nilai'] = $this->db->get()->result_array(); $this->load->view('staffx/cetak',$data); } function cetak2(){ $this->load->view('staffx/cetak2'); } function get_nilaimbkm($univ = null){ $univ_=urldecode($univ); $this->db->select('a.*, b.nmmkind, c.prodi'); $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.status', 'outbound-'.$univ_); $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 Laporan Nilai ======================================== }