load->model('m_data'); $this->load->model('Export_model','export'); $this->load->helper(array('url','html','form')); $data['export_list'] = $this->export->exportList(); // cek session yang login, jika session status tidak sama dengan session admin_login,maka halaman akan di alihkan kembali ke halaman login. if($_SESSION['status'] == "staff-mbkm_login"){ $this->db_ = $this->load->database('skpv',TRUE); }else { $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('staffmbkm/v_dashboard',$data); } 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('staffmbkm/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('staffmbkm/edit_profile'); } else { $this->session->set_flashdata('flash_error','Password Salah.'); redirect('staffmbkm/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()){ // Perlu pengecekan apakah nim tersebut sudah terdaftar apa blm $where = array( 'npm' => $this->input->post('npm') ); $check = $this->db->get_where('mahasiswa_mbkm_luar',$where)->num_rows(); if ($check > 0) { // kondisi nim sudah terdaftar $this->session->set_flashdata('flash_error',' Nim Mahasiswa tersebut sudah didaftarkan.'); redirect('staffmbkm/mhs'); }else{ $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' => 'tervalidasi', 'alamatuniv' => $this->input->post('alamatuniv',true), 'kotauniv' => $this->input->post('kotauniv',true), 'provinsiuniv' => $this->input->post('provinsiuniv',true), 'notelpuniv' => $this->input->post('notelpuniv',true), 'notelpuser' => $this->input->post('notelpuser',true), 'created_at' => $time, 'input_by' => $_SESSION['id'] ); $this->db->insert('mahasiswa_mbkm_luar', $data); $this->session->set_flashdata('flash_success',' Mahasiswa ditambahkan.'); redirect('staffmbkm/mhs'); } }else{ $data['semester'] = $this->db->get('stsemester'); $this->load->view('staffmbkm/v_mhs',$data); } } 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), 'stsemester' => $this->input->post('stsemester2',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), 'alamatuniv' => $this->input->post('alamatuniv2',true), 'kotauniv' => $this->input->post('kotauniv2',true), 'provinsiuniv' => $this->input->post('provinsiuniv2',true), 'notelpuniv' => $this->input->post('notelpuniv2',true), 'notelpuser' => $this->input->post('notelpuser2',true), 'status' => 'tervalidasi', '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('staffmbkm/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('staffmbkm/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'] = './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('staffmbkm/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('staffmbkm/v_mbkm'); } function get_univ_asal(){ $nmmhs = $this->input->get('nmmhs'); $npm = $this->input->get('npm'); $this->db->select('universitas'); $this->db->from('mahasiswa_mbkm_luar'); $this->db->where('nmmhs', $nmmhs); $this->db->where('npm', $npm); $data = $this->db->get(); echo json_encode($data->result()); } 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('staffmbkm/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 INPUT NILAI ======================================== function inputnilai() { if($this->input->post()){ $this->load->helper('date'); $waktu = time(); $time = mdate('%Y-%m-%d %H:%i:%s', $waktu); $data = array( 'nidu_dosen' => $this->input->post('bobot_nidu',true), 'kdmk' => $this->input->post('bobot_kdmk',true), 'bbt_kehadiran' => $this->input->post('bobot_kehadiran',true), 'bbt_tugas' => $this->input->post('bobot_tugas',true), 'bbt_quiz' => $this->input->post('bobot_quiz',true), 'bbt_uts' => $this->input->post('bobot_uts',true), 'bbt_uas' => $this->input->post('bobot_uas',true), 'created_at' => $time, 'created_by' => $_SESSION['username'] ); // cek bobot sudah masuk atau belum $where = array( 'nidu_dosen' => $this->input->post('bobot_nidu',true), 'kdmk' => $this->input->post('bobot_kdmk',true) ); $hsl = $this->m_data->cek_where('nilai_bobot',$where); if($hsl->num_rows() == 0){ // data belum ada $this->m_data->insert_data('nilai_bobot', $data); $this->session->set_flashdata('flash_success','ditambahkan.'); }else{ // data sudah ada $this->m_data->update_data($where, $data, 'nilai_bobot'); $this->session->set_flashdata('flash_success','diperbaharui.'); } redirect('staffmbkm/inputnilai'); } $this->load->view('staffmbkm/v_inputnilai'); } function get_mbkm_byNidu($nidu = null){ // $univ=$this->input->get('universitas'); $nidu_=urldecode($nidu); $this->db->where('nidu', $nidu_); $this->db->order_by('nmmkind', 'asc'); $data = $this->db->get('mk_mbkm'); echo json_encode($data->result()); } function get_nilaibobot_byKdmk($kdmk = null){ // $univ=$this->input->get('universitas'); $kdmk_=urldecode($kdmk); $this->db->where('kdmk', $kdmk_); $data = $this->db->get('nilai_bobot'); echo json_encode($data->result()); } function get_nilaimbkm_byKdmk($kdmk = null){ // $univ=$this->input->get('universitas'); $kdmk_=urldecode($kdmk); $this->db->where('kdmk', $kdmk_); $this->db->order_by('nama_mhs', 'asc'); $data = $this->db->get('nilai_mbkm'); echo json_encode($data->result()); } function edit_nilai($id = NULL) { $this->load->helper('date'); $waktu = time(); $time = mdate('%Y-%m-%d %H:%i:%s', $waktu); $update = array( 'nilai_kehadiran' => $this->input->post('kehadiran', true), 'tugas' => $this->input->post('tugas', true), 'quiz' => $this->input->post('quiz', true), 'uts' => $this->input->post('uts', true), 'uas' => $this->input->post('uas', true), 'total_nilai' => $this->input->post('total', true), 'nilai_huruf' => $this->input->post('nilai_huruf', true), 'updated_at' => $time ); $where = array( 'id' => $id ); // $this->db->insert('user', $insert); $this->m_data->update_data($where,$update,'nilai_mbkm'); $this->session->set_flashdata('flash_success', 'Input Nilai Sukses.'); redirect('Staffmbkm/inputnilai'); } function get_alldosen() { $this->db->select('d.nmdosdgngelar, d.nidu'); $this->db->from('mk_mbkm as d'); $this->db->group_by('d.nidu'); $this->db->order_by('d.nmdosdgngelar', 'asc'); $data = $this->db->get(); echo json_encode($data->result()); } function importFile(){ if ($this->input->post('submit')) { $path = './uploads/'; include APPPATH."/third_party/PHPExcel.php"; $config['upload_path'] = $path; $config['allowed_types'] = 'xlsx|xls|csv'; $config['remove_spaces'] = TRUE; $this->load->library('upload', $config); $this->upload->initialize($config); if (!$this->upload->do_upload('uploadFile')) { $error = array('error' => $this->upload->display_errors()); } else { $data = array('upload_data' => $this->upload->data()); } if(empty($error)){ if (!empty($data['upload_data']['file_name'])) { $import_xls_file = $data['upload_data']['file_name']; } else { $import_xls_file = 0; } $inputFileName = $path . $import_xls_file; try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); $allDataInSheet = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); $flag = true; $i=0; foreach ($allDataInSheet as $value) { if($flag){ $flag =false; continue; } $this->load->helper('date'); $waktu = time(); $time = mdate('%Y-%m-%d %H:%i:%s', $waktu); $inserdata = $value['B']; $inserdata2 = $value['D']; // $inserdata[$i]['nama_mhs'] = $value['B']; // $inserdata[$i]['kdmk'] = $value['C']; // $inserdata[$i]['stsemester'] = $value['D']; // $inserdata[$i]['nilai_kehadiran'] = $value['E']; // $inserdata[$i]['tugas'] = $value['F']; // $inserdata[$i]['quiz'] = $value['G']; // $inserdata[$i]['uts'] = $value['H']; // $inserdata[$i]['uas'] = $value['I']; // $inserdata[$i]['total_nilai'] = $value['J']; // $inserdata[$i]['nilai_huruf'] = $value['K']; // $inserdata[$i]['created_at'] = $time; $value = array( 'nilai_kehadiran' => $value['F'], 'tugas' => $value['G'], 'quiz' => $value['H'], 'uts' => $value['I'], 'uas' => $value['J'], 'total_nilai' => $value['K'], 'nilai_huruf' => $value['L'], 'updated_at' => $time ); $this->db->where('nim_mhs', $inserdata); $this->db->where('kdmk', $inserdata2); $this->db->update('nilai_mbkm', $value); $i++; } $this->session->set_flashdata('flash_success','Data Nilai Telah Diupload.'); redirect('Staffmbkm/inputnilai'); } catch (Exception $e) { $this->session->set_flashdata('flash_success','Data Nilai Telah Diupload.'); redirect('Staffmbkm/inputnilai'); die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' .$e->getMessage()); } }else{ $this->session->set_flashdata('flash_error','Upload data gagal.'); redirect('Staffmbkm/inputnilai'); } } redirect('Staffmbkm/inputnilai'); } public function generateXls($kdmk = null) { include APPPATH.'third_party/PHPExcel.php'; $excel = new PHPExcel(); $excel->getProperties()->setCreator('P3TI') ->setLastModifiedBy('') ->setTitle("Data Mahasiswa") ->setSubject("Mahasiswa") ->setDescription("Laporan Semua Data Mahasiswa") ->setKeywords("Data Mahasiswa"); $style_col = array( 'font' => array('bold' => true), 'alignment' => array( 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER ), 'borders' => array( 'top' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'left' => array('style' => PHPExcel_Style_Border::BORDER_THIN) ) ); $style_row = array( 'alignment' => array( 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT, 'vertical' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER ), 'borders' => array( 'top' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'left' => array('style' => PHPExcel_Style_Border::BORDER_THIN) ) ); $style_row2 = array( 'alignment' => array( 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER ), 'borders' => array( 'top' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'left' => array('style' => PHPExcel_Style_Border::BORDER_THIN) ) ); $excel->setActiveSheetIndex(0)->setCellValue('A1', "DATA MAHASISWA"); $excel->getActiveSheet()->mergeCells('A1:L1'); $excel->getActiveSheet()->getStyle('A1')->getFont()->setBold(TRUE); $excel->getActiveSheet()->getStyle('A1')->getFont()->setSize(15); $excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER); $excel->setActiveSheetIndex(0)->setCellValue('A3', "NO"); $excel->setActiveSheetIndex(0)->setCellValue('B3', "NIM MAHASISWA"); $excel->setActiveSheetIndex(0)->setCellValue('C3', "NAMA MAHASISWA"); $excel->setActiveSheetIndex(0)->setCellValue('D3', "KODE MATAKULIAH"); $excel->setActiveSheetIndex(0)->setCellValue('E3', "STATUS SEMESTER"); $excel->setActiveSheetIndex(0)->setCellValue('F3', "NILAI KEHADIRAN"); $excel->setActiveSheetIndex(0)->setCellValue('G3', "TUGAS"); $excel->setActiveSheetIndex(0)->setCellValue('H3', "QUIZ"); $excel->setActiveSheetIndex(0)->setCellValue('I3', "UTS"); $excel->setActiveSheetIndex(0)->setCellValue('J3', "UAS"); $excel->setActiveSheetIndex(0)->setCellValue('K3', "TOTAL NILAI"); $excel->setActiveSheetIndex(0)->setCellValue('L3', "NILAI HURUF"); $excel->getActiveSheet()->getStyle('A3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('B3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('C3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('D3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('E3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('F3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('G3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('H3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('I3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('J3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('K3')->applyFromArray($style_col); $excel->getActiveSheet()->getStyle('L3')->applyFromArray($style_col); $this->db->where('kdmk', $kdmk); $siswa = $this->db->get('nilai_mbkm')->result(); ; $no = 1; $numrow = 4; foreach($siswa as $data){ $excel->setActiveSheetIndex(0)->setCellValue('A'.$numrow, $no); $excel->setActiveSheetIndex(0)->setCellValue('B'.$numrow, $data->nim_mhs); $excel->setActiveSheetIndex(0)->setCellValue('C'.$numrow, $data->nama_mhs); $excel->setActiveSheetIndex(0)->setCellValue('D'.$numrow, $data->kdmk); $excel->setActiveSheetIndex(0)->setCellValue('E'.$numrow, $data->stsemester); $excel->setActiveSheetIndex(0)->setCellValue('F'.$numrow, $data->nilai_kehadiran); $excel->setActiveSheetIndex(0)->setCellValue('G'.$numrow, $data->tugas); $excel->setActiveSheetIndex(0)->setCellValue('H'.$numrow, $data->quiz); $excel->setActiveSheetIndex(0)->setCellValue('I'.$numrow, $data->uts); $excel->setActiveSheetIndex(0)->setCellValue('J'.$numrow, $data->uas); $excel->setActiveSheetIndex(0)->setCellValue('K'.$numrow, $data->total_nilai); $excel->setActiveSheetIndex(0)->setCellValue('L'.$numrow, $data->nilai_huruf); $excel->getActiveSheet()->getStyle('A'.$numrow)->applyFromArray($style_row); $excel->getActiveSheet()->getStyle('B'.$numrow)->applyFromArray($style_row); $excel->getActiveSheet()->getStyle('C'.$numrow)->applyFromArray($style_row); $excel->getActiveSheet()->getStyle('D'.$numrow)->applyFromArray($style_row); $excel->getActiveSheet()->getStyle('E'.$numrow)->applyFromArray($style_row2); $excel->getActiveSheet()->getStyle('F'.$numrow)->applyFromArray($style_row2); $excel->getActiveSheet()->getStyle('G'.$numrow)->applyFromArray($style_row2); $excel->getActiveSheet()->getStyle('H'.$numrow)->applyFromArray($style_row2); $excel->getActiveSheet()->getStyle('I'.$numrow)->applyFromArray($style_row2); $excel->getActiveSheet()->getStyle('J'.$numrow)->applyFromArray($style_row2); $excel->getActiveSheet()->getStyle('K'.$numrow)->applyFromArray($style_row2); $excel->getActiveSheet()->getStyle('L'.$numrow)->applyFromArray($style_row2); $no++; $numrow++; } $excel->getActiveSheet()->getColumnDimension('A')->setWidth(5); $excel->getActiveSheet()->getColumnDimension('B')->setWidth(15); $excel->getActiveSheet()->getColumnDimension('C')->setWidth(25); $excel->getActiveSheet()->getColumnDimension('D')->setWidth(20); $excel->getActiveSheet()->getColumnDimension('E')->setWidth(30); $excel->getActiveSheet()->getColumnDimension('F')->setWidth(30); $excel->getActiveSheet()->getColumnDimension('G')->setWidth(30); $excel->getActiveSheet()->getColumnDimension('H')->setWidth(30); $excel->getActiveSheet()->getColumnDimension('I')->setWidth(30); $excel->getActiveSheet()->getColumnDimension('J')->setWidth(30); $excel->getActiveSheet()->getColumnDimension('K')->setWidth(30); $excel->getActiveSheet()->getColumnDimension('L')->setWidth(30); $excel->getActiveSheet()->getDefaultRowDimension()->setRowHeight(-1); $excel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); $excel->getActiveSheet(0)->setTitle("Laporan Data Mahasiswa"); $excel->setActiveSheetIndex(0); $filename="datamahasiswa.xls"; $objWriter = PHPExcel_IOFactory::createWriter($excel, 'Excel5'); ob_end_clean(); header('Content-type: application/vnd.ms-excel'); header('Content-Disposition: attachment; filename='.$filename); $objWriter->save('php://output'); } // ============================================== END FUNGSI INPUT NILAI ======================================== // ============================================== START FUNGSI Laporan Nilai ======================================== function nilai(){ $this->load->view('staffmbkm/v_nilai'); } function cetak(){ // $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'); $data['nilai'] = $this->db->get()->result_array(); $this->load->view('staffmbkm/cetak',$data); } function cetak2(){ $this->load->view('staffmbkm/cetak2'); } function cetak3(){ $this->load->view('staffmbkm/cetak3'); } function get_nilaimbkm(){ // $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'); $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 ======================================== function sertifikat(){ $this->load->view('staffmbkm/v_sertifikat'); } function cetaksertifikat($nim){ $this->db->select('a.nim_mhs, a.nama_mhs, a.kdmk, a.total_nilai, a.nilai_huruf, a.status, b.nmmkind, c.isi, c.ttd, c.judul, c.tujuan'); $this->db->from('nilai_mbkm as a'); $this->db->join('mk_mbkm as b', 'b.kdmk = a.kdmk', 'left'); $this->db->join('template as c', 'c.isi=c.isi', 'left'); $this->db->where('a.nim_mhs', $nim); $data['data'] = $this->db->get()->result_array(); $this->load->view('staffmbkm/cetaksertifikat', $data); } }