Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ?php
- defined('BASEPATH') OR exit('No direct script access allowed');
- class Data_akademik extends Backend_Controller {
- protected $id_mhs;
- protected $mata_pelajaran;
- protected $id_mk;
- protected $mk_pd;
- protected $hari;
- protected $id_ptk;
- protected $jadwal_field = array();
- protected $jam_awal;
- public function __construct()
- {
- parent::__construct();
- $this->site->login_status_check();
- }
- public function data_mahasiswa(){
- /*$this->page_on_repair('Data Mahasiswa','fa-users');*/
- $this->site->view('data_mahasiswa');
- }
- public function data_ptk(){
- $this->site->view('data_ptk');
- }
- public function data_kurikulum(){
- $this->page_soon('Data Kurikulum','fa-book');
- }
- public function data_mata_kuliah(){
- $this->site->view('data_mata_kuliah');
- }
- public function data_jadwal_kuliah(){
- $this->site->view('data_jadwal_kuliah');
- }
- public function data_nilai_mhs(){
- $this->site->view('data_nilai_mhs');
- }
- public function data_alumni_do(){
- $this->site->view('data_alumni_do');
- }
- protected function print_nilai(){
- $get = $this->input->get();
- $kelas = $get['kelas'];
- $thn_ajaran = $get['thn_ajaran'];
- $semester = $get['semester'];
- $where = array('kelas' => $kelas, 'thn_ajaran' => $thn_ajaran, 'semester' => $semester);
- $count = $this->nilai_siswa_model->count($where);
- if ($count > 0) {
- $wali = $this->kelas_model->get_by_search(array('kelas' => $kelas), TRUE, array('wali_kelas'));
- $record_mp = $this->mata_pelajaran_model->get_by_search(NULL,FALSE,array('kode_mp','mata_pelajaran'));
- foreach ($record_mp as $key => $value) {
- $replace_space = str_replace(" ", "_", $value->mata_pelajaran);
- $field = strtolower(str_replace(".", "", $replace_space));
- $daftar_mp[] = $field;
- }
- $nilai = $this->nilai_siswa_model->get_by_search($where);
- $data = array(
- 'status' => 'success',
- 'thn_ajaran' => $thn_ajaran,
- 'semester' => $semester,
- 'kelas' => $kelas,
- 'wali_kelas' => $wali->wali_kelas,
- 'daftar_nilai' => $nilai,
- 'daftar_mp' => $daftar_mp,
- 'record_mp' => $record_mp
- );
- }
- else{
- $data = array(
- 'status' => 'not found',
- );
- }
- $this->site->view('print_nilai',$data);
- }
- public function action($param){
- global $Config;
- $result = array();
- if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
- $post = $this->input->post(NULL, TRUE);
- if ($param == 'tambah') {
- if (isset($post['data_mhs'])) {
- $rules = $this->mahasiswa_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $nama_mhs = strtoupper($post['nama']);
- $tmp_lhr = ucwords($post['tmp_lhr']);
- $alamat = ucwords($post['alamat']);
- $dusun = ucwords($post['dusun']);
- $kelurahan = ucwords($post['kelurahan']);
- $kecamatan = ucwords($post['kecamatan']);
- $email = strtolower($post['email']);
- $data_mhs = array(
- 'nisn' => $post['nisn'],
- 'nama' => $nama_mhs,
- 'thn_angkatan' => $post['thn_angkatan'],
- 'id_pd_mhs' => $post['id_pd_mhs'],
- 'jk' => $post['jk'],
- 'tmp_lhr' => $tmp_lhr,
- 'tgl_lhr' => $post['tgl_lhr'],
- 'nik' => $post['nik'],
- 'agama' => $post['agama'],
- 'alamat' => $alamat,
- 'rt' => $post['rt'],
- 'rw' => $post['rw'],
- 'dusun' => $dusun,
- 'kelurahan' => $kelurahan,
- 'kecamatan' => $kecamatan,
- 'kode_pos' => $post['kode_pos'],
- 'jns_tinggal' => $post['jns_tinggal'],
- 'alt_trans' => $post['alt_trans'],
- 'tlp' => $post['tlp'],
- 'hp' => $post['hp'],
- 'email' => $email,
- );
- $save_data_mhs = $this->mahasiswa_model->insert($data_mhs);
- if ($save_data_mhs) {
- $nm_ayah = strtoupper($post['nm_ayah']);
- $nm_ibu = strtoupper($post['nm_ibu']);
- $nm_wali = strtoupper($post['nm_wali']);
- $data_ortu_wali = array(
- 'id_mhs_ortu' => $save_data_mhs,
- 'nm_ayah' => $nm_ayah,
- 'thn_lhr_ayah' => $post['thn_lhr_ayah'],
- 'pendi_ayah' => $post['pendi_ayah'],
- 'pekerjaan_ayah' => $post['pekerjaan_ayah'],
- 'penghasilan_ayah' => $post['penghasilan_ayah'],
- 'nik_ayah' => $post['nik_ayah'],
- 'nm_ibu' => $nm_ibu,
- 'thn_lhr_ibu' => $post['thn_lhr_ibu'],
- 'pendi_ibu' => $post['pendi_ibu'],
- 'pekerjaan_ibu' => $post['pekerjaan_ibu'],
- 'penghasilan_ibu' => $post['penghasilan_ibu'],
- 'nik_ibu' => $post['nik_ibu'],
- 'nm_wali' => $nm_wali,
- 'thn_lhr_wali' => $post['thn_lhr_wali'],
- 'pendi_wali' => $post['pendi_wali'],
- 'pekerjaan_wali' => $post['pekerjaan_wali'],
- 'penghasilan_wali' => $post['penghasilan_wali'],
- 'nik_wali' => $post['nik_wali'],
- );
- $save_data_ortu = $this->ortu_model->insert($data_ortu_wali);
- $password = $this->user_model->password_generate();
- $encrypt_password = bCrypt($password,12);
- $data_user = array(
- 'id_user_detail' => $save_data_mhs,
- 'password' => $encrypt_password,
- 'level_akses' => 'mhs',
- 'active_status' => 1,
- );
- $save_data_user = $this->user_model->insert($data_user);
- if ($save_data_user && $save_data_ortu) {
- $data = 'data_mhs';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in' => $save_data_mhs
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_ptk'])) {
- $rules = $this->ptk_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $nama_ptk = ucwords(strtolower($post['nama_ptk']));
- $tmp_lhr = ucwords($post['tmp_lhr_ptk']);
- $data_ptk = array(
- 'nama_ptk' => $nama_ptk,
- 'nuptk' => $post['nuptk'],
- 'nip' => $post['nip'],
- 'jk_ptk' => $post['jk_ptk'],
- 'tmp_lhr_ptk' => $tmp_lhr,
- 'tgl_lhr_ptk' => $post['tgl_lhr_ptk'],
- 'status_ptk' => $post['status_ptk'],
- 'status_aktif_ptk' =>$post['status_aktif_ptk'],
- 'jenjang' => $post['jenjang'],
- 'jurusan_prodi' => $post['jurusan_prodi'],
- 'nik_ptk' => $post['nik_ptk'],
- 'agama_ptk' => $post['agama_ptk'],
- 'alamat_ptk' => ucwords($post['alamat_ptk']),
- 'rt_ptk' => $post['rt_ptk'],
- 'rw_ptk' => $post['rw_ptk'],
- 'dusun_ptk' => ucwords($post['dusun_ptk']),
- 'kelurahan_ptk' => ucwords($post['kelurahan_ptk']),
- 'kecamatan_ptk' => ucwords($post['kecamatan_ptk']),
- 'kode_pos_ptk' => $post['kode_pos_ptk'],
- 'tlp_ptk' => $post['tlp_ptk'],
- 'hp_ptk' => $post['hp_ptk'],
- 'email_ptk' => $post['email_ptk'],
- );
- $save_data_ptk = $this->ptk_model->insert($data_ptk);
- if ($save_data_ptk) {
- $password = $this->user_model->password_generate();
- $encrypt_password = bCrypt($password,12);
- if (!empty($post['nuptk'])) {
- $data_user = array(
- 'id_user_detail' => $save_data_ptk,
- 'password' => $encrypt_password,
- 'level_akses' => 'ptk',
- 'active_status' => 1,
- );
- }
- else{
- for ($i=0; $i <= 1; $i++) {
- $user = rand(10000000000000,99999999999999).$save_data_ptk;
- $check_user = array('username' => $user);
- $total_rows = $this->user_model->count($check_user);
- if ($total_rows > 0) {
- $i = 0;
- }
- else{
- $i = 1;
- }
- }
- $data_user = array(
- 'id_user_detail' => $save_data_ptk,
- 'password' => $encrypt_password,
- 'level_akses' => 'ptk',
- 'active_status' => 1,
- );
- }
- $save_data_user = $this->user_model->insert($data_user);
- if ($save_data_user) {
- $data = 'data_ptk';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in'=>$save_data_ptk,
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_studi_ptk'])) {
- $rules = $this->ptk_studi_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $in_ptk = $post['id_ptk_studi'];
- $data_studi = array(
- 'id_ptk_studi' => $in_ptk,
- 'nama_pt_studi' => ucwords($post['nama_pt_studi']),
- 'studi_ptk' => ucwords($post['studi_ptk']),
- 'jenjang_studi_ptk' => $post['jenjang_studi_ptk'],
- 'gelar_ak_ptk' => $post['gelar_ak_ptk'],
- 'tgl_ijazah_ptk' => $post['tgl_ijazah_ptk'],
- );
- $save_data_studi = $this->ptk_studi_model->insert($data_studi);
- if ($save_data_studi) {
- $record_studi = array();
- if (isset($post['ptk_detail']) && $in_ptk == $post['ptk_detail']) {
- $data_studi = $this->ptk_studi_model->get_detail_data('get',NULL,NULL,array('id_ptk_studi' => $in_ptk),NULL,array('id_studi AS in_studi','nama_pt_studi','studi_ptk','jenjang_studi_ptk','gelar_ak_ptk','tgl_ijazah_ptk'),NULL,'tgl_ijazah_ptk ASC');
- $record_studi = array();
- foreach ($data_studi as $key) {
- $arr = array('tgl_ijazah_ptk' => date_convert($key->tgl_ijazah_ptk));
- $record_studi[] = array_merge((array)$key,$arr);
- }
- }
- $data = 'data_studi_ptk';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in_ptk' => $in_ptk,
- 'studi_ptk' => $record_studi
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_penelitian_ptk'])) {
- $rules = $this->ptk_penelitian_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $in_ptk = $post['id_ptk_rsch'];
- $data_penelitian = array(
- 'id_ptk_rsch' => $in_ptk,
- 'judul_penelitian' => ucwords($post['judul_penelitian']),
- 'bidang_ilmu' => ucwords($post['bidang_ilmu']),
- 'lembaga' => $post['lembaga'],
- );
- $save_data_penelitian = $this->ptk_penelitian_model->insert($data_penelitian);
- if ($save_data_penelitian) {
- $record_penelitian = array();
- if (isset($post['ptk_detail']) && $in_ptk == $post['ptk_detail']) {
- $record_penelitian = $this->ptk_penelitian_model->get_detail_data('get',NULL,NULL,array('id_ptk_rsch' => $in_ptk),NULL,array('id_penelitian_ptk AS in_research','judul_penelitian','bidang_ilmu','lembaga'));
- }
- $data = 'data_penelitian_ptk';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in_ptk' => $in_ptk,
- 'penelitian_ptk' => $record_penelitian
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_mk'])) {
- if (isset($post['id_pd_mk'])) {
- $this->mk_pd = $post['id_pd_mk'];
- }
- $rules = $this->mata_kuliah_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $data_mk = array(
- 'kode_mk' => strtoupper($post['kode_mk']),
- 'nama_mk' => ucwords($post['nama_mk']),
- 'id_pd_mk' => $post['id_pd_mk'],
- 'jml_sks' => $post['jml_sks'],
- 'jenis_jdl' => $post['jenis_jdl'],
- );
- $save_data_mk = $this->mata_kuliah_model->insert($data_mk);
- if ($save_data_mk) {
- $data = 'data_mata_kuliah';
- $result = array(
- 'status' => 'success',
- 'data' => $data
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_jadwal_kuliah'])) {
- $this->jam_awal = $post['jam_mulai_jdl'];
- $rules = $this->jadwal_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $data_jadwal = array(
- 'id_mk_jdl' => $post['id_mk_jdl'],
- 'id_ptk_jdl' => $post['id_ptk_jdl'],
- 'id_thn_ak_jdl' => $post['id_thn_ak_jdl'],
- 'hari_jdl' => $post['hari_jdl'],
- 'jam_mulai_jdl' => $post['jam_mulai_jdl'],
- 'jam_akhir_jdl' => $post['jam_akhir_jdl'],
- 'semester' => $post['semester'],
- 'kelas' => $post['kelas'],
- 'ruang' => strtoupper($post['ruang']),
- );
- $save_data_jadwal = $this->jadwal_model->insert($data_jadwal);
- if ($save_data_jadwal) {
- $thn= $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','prodi_mk','ptk'),NULL,array('id_thn_ak_jdl' => $post['id_thn_ak_jdl'],'id_mk_jdl' => $post['id_mk_jdl']),NULL,array('id_thn_ak_jdl AS thn_ajaran_jdl','id_pd_mk'),array('thn_ajaran_jdl','id_pd_mk'));
- $data = 'data_jadwal';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'thn' => $thn,
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_mhs_kls'])) {
- if (isset($post['mhs-kelas'])) {
- $status_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $post['kelas_mhs']),TRUE,array('status_jdl'));
- $status = $status_kelas->status_jdl;
- if ($status == 1) {
- foreach ($post['mhs-kelas'] as $key => $value) {
- $count = $this->kelas_model->count(array('id_jdl_kls' => $post['kelas_mhs'], 'id_mhs_kls' => $value));
- if ($count == 0) {
- $batch[] = array(
- 'id_jdl_kls' => $post['kelas_mhs'],
- 'id_mhs_kls' => $value,
- 'status_mhs_kls' => 1
- );
- }
- }
- if (isset($batch)) {
- $insert_mhs = $this->kelas_model->insert($batch,TRUE);
- if ($insert_mhs) {
- $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
- $data_mhs = $this->kelas_model->get_detail_data('get',array('mahasiswa','thn_angkatan'),NULL,array('id_jdl_kls' => $post['kelas_mhs']),NULL,$select_daftar_mhs);
- $result = array(
- 'status' => 'success',
- 'data' => 'data_mhs_kls',
- 'record_mhs' => $data_mhs,
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- $error = array('mhs-kelas' => 'Mahasiswa yang anda masukkan dalam kelas ini sudah ada');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- else{
- $error = array('mhs-kelas' => 'Anda tidak bisa menambah mahasiswa dikelas ini karena tahun akademik kelas ini tidak diterapkan');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- else{
- $error = array('mhs-kelas' => 'Silahkan pilih mahasiswa yang ingin anda masukkan kedalam kelas ini');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- elseif (isset($post['data_alumni'])) {
- if (isset($post['id']) && $post['id'] != '') {
- $rules = $this->alumni_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- foreach ($post['id'] as $key) {
- $data_alumni = $this->mahasiswa_model->get_detail_data('get',array('alumni','mhs_do'),NULL,array('id' => $key),TRUE,array('id_mhs_alni','id_mhs_DO'));
- if (@$data_alumni->id_mhs_alni == NULL && @$data_alumni->id_mhs_DO == NULL) {
- $batch[] = array(
- 'id_mhs_alni' => $key,
- 'tgl_yudisium' => $post['tgl_yudisium'],
- 'tgl_lulus' => $post['tgl_lulus']
- );
- }
- }
- if (isset($batch)) {
- $insert_alumni = $this->alumni_model->insert($batch,TRUE);
- if ($insert_alumni) {
- $result = array(
- 'status' => 'success',
- 'data' => 'data_alumni',
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- if ($data_alumni->id_mhs_alni != NULL) {
- $error = array('alumni' => 'Mahasiswa yang anda pilih sudah ada dalam data alumni');
- }
- elseif ($data_alumni->id_mhs_DO != NULL) {
- $error = array('alumni' => 'Mahasiswa yang anda pilih sudah ada dalam data mahasiswa drop out');
- }
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- else{
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- else{
- $error = array('alumni' => 'Silahkan pilih mahasiswa yang ingin anda masukkan kedalam data alumni');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- elseif (isset($post['data_mhs_do'])) {
- if (isset($post['mhs-data']) && $post['mhs-data'] != '') {
- $rules = $this->mahasiswa_do_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- foreach ($post['mhs-data'] as $key) {
- $data_do = $this->mahasiswa_model->get_detail_data('get',array('alumni','mhs_do'),NULL,array('id' => $key),TRUE,array('id_mhs_alni','id_mhs_DO'));
- if (@$data_do->id_mhs_alni == NULL && @$data_do->id_mhs_DO == NULL) {
- $batch[] = array(
- 'id_mhs_DO' => $key,
- 'tgl_drop_out' => $post['tgl_drop_out'],
- 'drop_out_reason' => $post['drop_out_reason']
- );
- }
- }
- if (isset($batch)) {
- $insert_mhs_do = $this->mahasiswa_do_model->insert($batch,TRUE);
- if ($insert_mhs_do) {
- $result = array(
- 'status' => 'success',
- 'data' => 'data_mhs_do',
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- if ($data_do->id_mhs_alni != NULL) {
- $error = array('mhs-do' => 'Mahasiswa yang anda pilih sudah ada dalam data alumni');
- }
- elseif ($data_do->id_mhs_DO != NULL) {
- $error = array('mhs-do' => 'Mahasiswa yang anda pilih sudah ada dalam data mahasiswa drop out');
- }
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- else{
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- else{
- $error = array('mhs-do' => 'Silahkan pilih mahasiswa yang ingin anda masukkan kedalam data mahasiswa yang drop out');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- else{
- $result = array('status_action' => 'Not find...');
- }
- }
- elseif ($param == 'ambil') {
- if ($post['data']=='data_mhs') {
- $id = array('id' => $post['id']);
- $total_rows = $this->mahasiswa_model->count($id);
- if ($total_rows > 0) {
- $record_mhs = array();
- if (!isset($post['ac'])) {
- $record = $this->mahasiswa_model->get_detail_data('get',array('prodi_mhs','user','ortu','alumni','mhs_do','thn_angkatan'),NULL,array('id' => $post['id'], 'level_akses' => 'mhs'),FALSE,list_fields(array('mahasiswa','ortu_wali'),array('nama_prodi','jenjang_prodi','tahun_angkatan','id_user','last_online','active_status','tgl_lulus','tgl_drop_out')));
- $this->load->helper('file');
- foreach ($record as $key) {
- $photo = photo_u();
- if ($key->photo_mhs != '') {
- $check_file = get_file_info('uploads/mhs-photo/'.$key->photo_mhs);
- if ($check_file != FALSE) {
- $check_file = TRUE;
- $photo = photo_u('mhs',$key->photo_mhs.'?n_img='.rand_val(20));
- }
- else{
- $check_file = FALSE;
- }
- }
- $arr = array(
- 'tgl_lulus' => date_convert($key->tgl_lulus),
- 'tgl_drop_out' => date_convert($key->tgl_drop_out),
- 'id_user' => md5($key->id_user),
- 'in_user' => md5($key->id),
- 'tgl_lhr' => date_convert($key->tgl_lhr),
- 'photo_mhs' => $photo,
- 'check_file' => @$check_file
- );
- $record_mhs[] = array_merge((array)$key,$arr);
- }
- }
- else{
- $record = $this->mahasiswa_model->get_detail_data('get',array('prodi_mhs','ortu','thn_angkatan'),NULL,$id);
- $this->load->helper('file');
- foreach ($record as $key) {
- $photo = photo_u();
- if ($key->photo_mhs != '') {
- $check_file = get_file_info('uploads/mhs-photo/'.$key->photo_mhs);
- if ($check_file != FALSE) {
- $check_file = TRUE;
- $photo = photo_u('mhs',$key->photo_mhs.'?n_img='.rand_val(20));
- }
- else{
- $check_file = FALSE;
- }
- }
- $arr = array(
- 'file_name' => $key->photo_mhs,
- 'photo_mhs' => $photo,
- 'check_file' => @$check_file
- );
- $record_mhs[] = array_merge((array)$key,$arr);
- }
- }
- $result = array(
- 'total_rows' => $total_rows,
- 'record_mhs' => $record_mhs,
- );
- }
- else{
- $result = array(
- 'total_rows' => $total_rows,
- );
- }
- }
- elseif ($post['data']=='data_ptk') {
- $id = array('id_ptk' => $post['id_ptk']);
- $total_rows = $this->ptk_model->count($id);
- if ($total_rows > 0) {
- if (!isset($post['ac'])) {
- $data = $this->ptk_model->get_detail_data('get',array('prodi_ptk','user'),NULL,array('id_ptk' => $post['id_ptk'], 'level_akses' => 'ptk'),FALSE,list_fields(array('ptk'),array('nama_prodi','jenjang_prodi','id_user','last_online','active_status')));
- $record = array();
- $this->load->helper('file');
- foreach ($data as $key) {
- $photo = photo_u();
- if ($key->photo_ptk != '') {
- $check_file = get_file_info('uploads/ptk-photo/'.$key->photo_ptk);
- if ($check_file != FALSE) {
- $check_file = TRUE;
- $photo = photo_u('ptk',$key->photo_ptk.'?n_img='.rand_val(20));
- }
- else{
- $check_file = FALSE;
- }
- }
- $arr = array(
- 'id_user' => md5($key->id_user),
- 'in_user' => md5($key->id_ptk),
- 'tgl_lhr_ptk' => date_convert($key->tgl_lhr_ptk),
- 'agama_ptk' => select_conv_value($key->agama_ptk,'ptk','agama_ptk'),
- 'status_ptk' => select_conv_value($key->status_ptk,'ptk','status_ptk'),
- 'status_aktif_ptk' => select_conv_value($key->status_aktif_ptk,'ptk','status_aktif_ptk'),
- 'jenjang' => select_conv_value($key->jenjang,'ptk','jenjang'),
- 'photo_ptk' => $photo,
- 'check_file' => @$check_file
- );
- $record[] = array_merge((array)$key,$arr);
- }
- }
- else{
- $data = $this->ptk_model->get_by_search(array('id_ptk' => $post['id_ptk']));
- $record = array();
- foreach ($data as $key) {
- $photo = '';
- if ($key->photo_ptk != '') {
- $photo = $key->photo_ptk.'?n_img='.rand_val(20);
- }
- $select = array('id_prodi','nama_prodi','jenjang_prodi');
- $ptk_detail = $this->ptk_model->get_detail_data('get',array('prodi_ptk'),NULL,array('id_ptk' => $post['id_ptk']),TRUE,$select);
- $arr = array(
- 'photo_ptk' => $photo,
- );
- $record[] = array_merge((array)$key,$arr,(array)$ptk_detail);
- }
- }
- $result = array(
- 'total_rows' => $total_rows,
- 'record_ptk' => $record,
- );
- }
- else{
- $result = array(
- 'total_rows' => $total_rows,
- );
- }
- }
- elseif ($post['data']=='data_studi_ptk') {
- $id = array('id_studi' => $post['id_studi']);
- $record_studi = $this->ptk_studi_model->get_detail_data('get',array('ptk'),NULL,$id,FALSE,array('id_studi','id_ptk_studi','nuptk AS nidn','nama_ptk AS nama','nama_pt_studi','studi_ptk','jenjang_studi_ptk','gelar_ak_ptk','tgl_ijazah_ptk'));
- $result = array(
- 'total_rows' => count($record_studi),
- 'studi_ptk' => $record_studi,
- );
- }
- elseif ($post['data']=='data_penelitian_ptk') {
- $id = array('id_penelitian_ptk' => $post['id_penelitian_ptk']);
- $record_penelitian = $this->ptk_penelitian_model->get_detail_data('get',array('ptk'),NULL,$id,FALSE,array('id_penelitian_ptk','id_ptk_rsch','nuptk AS nidn','nama_ptk AS nama','judul_penelitian','bidang_ilmu','lembaga'));
- $result = array(
- 'total_rows' => count($record_penelitian),
- 'penelitian_ptk' => $record_penelitian,
- );
- }
- elseif ($post['data']=='data_mk') {
- $id = array('id_mk' => $post['id_mk']);
- $total_rows = $this->mata_kuliah_model->count($id);
- $record_mk = $this->mata_kuliah_model->get_detail_data('get',array('prodi_mk'),NULL,$id,FALSE,Array('id_mk','id_pd_mk','nama_prodi','jenjang_prodi','kode_mk','nama_mk','jml_sks','jenis_jdl'));
- $result = array(
- 'total_rows' => $total_rows,
- 'record_mk' => $record_mk,
- );
- }
- elseif ($post['data']=='data_jadwal_kuliah') {
- $id = array('id_jdl' => $post['id_jdl']);
- $total_rows = $this->jadwal_model->count($id);
- if ($total_rows > 0) {
- $select_jadwal_detail = array('id_jdl','id_mk_jdl','id_ptk_jdl','hari_jdl','jam_mulai_jdl','jam_akhir_jdl','id_thn_ak_jdl','thn_ajaran_jdl','semester','kelas','ruang','nama_prodi','nama_mk','jml_sks','nama_ptk','status_jdl');
- $record = $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','prodi_mk','ptk'),NULL,$id,NULL,$select_jadwal_detail);
- $record_jadwal = array();
- foreach ($record as $key) {
- $vars = explode('/',$key->thn_ajaran_jdl);
- if ($vars[1] == 1) {
- $thn = array('thn_ajaran_jdl' => $vars[0].'/Ganjil');
- }
- else{
- $thn = array('thn_ajaran_jdl' => $vars[0].'/Genap');
- }
- $record_jadwal[] = array_merge((array)$key,$thn);
- }
- $result = array(
- 'total_rows' => $total_rows,
- 'record_jdl' => $record_jadwal,
- );
- }
- else{
- $result = array(
- 'total_rows' => $total_rows,
- );
- }
- }
- elseif ($post['data']=='daftar_nilai_mhs') {
- $cari = $post['value'];
- $act = array(
- 'like' => array(
- 'nisn' => $cari,
- ),
- 'or_like' => array(
- 'nama' => $cari,
- ),
- );
- $data = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik','mahasiswa'),$act,NULL,FALSE,array('id_mhs_kls','nisn','nama','thn_ajaran_jdl','id_kelas','id_thn_ak'),array('thn_ajaran_jdl','id_mhs_kls'),'thn_ajaran_jdl DESC, nisn ASC');
- $total_rows = count($data);
- if ($total_rows > 0 ) {
- foreach ($data as $key => $value) {
- $vars = explode('/',$value->thn_ajaran_jdl);
- if (isset($vars[1])) {
- if ($vars[1] == 1) {
- $thn = $vars[0].'/Ganjil';
- }
- else{
- $thn = $vars[0].'/Genap';
- }
- }
- else{
- $thn = 'Tidak ditemukan';
- }
- $record[] = array(
- 'id' => $value->id_mhs_kls.'/'.$value->id_thn_ak,
- 'text' => $value->nisn.' | '.$value->nama,
- 'nim_mhs' => $value->nisn,
- 'nama_mhs' => $value->nama,
- 'thn_akademik' => $thn,
- );
- }
- $result = array(
- 'nilai_mhs' => $record,
- 'total_count' => $total_rows
- );
- }
- else{
- $result['nilai_mhs'] = '';
- }
- }
- elseif ($post['data'] == 'data_nilai_mhs') {
- $vars = explode('/',$post['thn']);
- $where = array('id_mhs_kls' => $vars[0],'id_thn_ak' => $vars[1]);
- $record = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik','mata_kuliah','mahasiswa','prodi_mhs','fakultas'),NULL,$where,FALSE,array('kode_mk','nama_mk','jml_sks','nilai_akhir','thn_ajaran_jdl','nama','nisn','nama_fakultas','nama_prodi','jenjang_prodi','photo_mhs'),NULL,'kode_mk ASC');
- $record_nilai = array();
- $sks = 0;
- $mutu = 0;
- foreach ($record as $key) {
- $vars = explode('/',$key->thn_ajaran_jdl);
- if ($vars[1] == 1) {
- $thn = $vars[0].'/Ganjil';
- }
- else{
- $thn = $vars[0].'/Genap';
- }
- $n = explode('/',nilai_conv($key->nilai_akhir,$key->jml_sks));
- $mt = array(
- 'thn_ajaran_jdl' => $thn,
- 'hm' => $n[0],
- 'am' => $n[1],
- 'mutu' => $n[2],
- );
- $record_nilai[] = array_merge((array)$key,$mt);
- $sks += $key->jml_sks;
- $mutu += $n[2];
- }
- $result = array(
- 'record_nilai' => $record_nilai,
- 'sks' => $sks,
- 'mutu' => $mutu,
- );
- }
- elseif ($post['data']=='daftar_mk') {
- $cari = $post['value'];
- $act = array(
- 'or_like' => array(
- 'kode_mk' => $cari,
- 'nama_mk' => $cari,
- ),
- );
- $data = $this->mata_kuliah_model->get_detail_data('get',array('prodi_mk'),$act,NULL,FALSE,array('id_mk','kode_mk','nama_mk','nama_prodi','jml_sks','jenjang_prodi','jenis_jdl'));
- $total_rows = count($data);
- if ($total_rows > 0 ) {
- foreach ($data as $key => $value) {
- if ($value->jenis_jdl == '0') {
- $jenis_jdl = '';
- }
- else{
- $jenis_jdl = ' (Konsentrasi '.$value->jenis_jdl.')';
- }
- $record[] = array(
- 'id' => $value->id_mk,
- 'text' => $value->kode_mk.' | '.$value->nama_mk.''.$jenis_jdl,
- 'nama_prodi' => $value->nama_prodi,
- 'jml_sks' => $value->jml_sks,
- 'jenjang_prodi' => $value->jenjang_prodi,
- 'jenis_jdl' => $jenis_jdl,
- );
- }
- $result = array(
- 'mk' => $record,
- 'total_count' => $total_rows
- );
- }
- else{
- $result['mk'] = '';
- }
- }
- elseif ($post['data']=='daftar_ptk') {
- $cari = $post['value'];
- $act = array(
- 'or_like' => array(
- 'nuptk' => $cari,
- 'nama_ptk' => $cari
- ),
- );
- $select = array('nama_ptk','id_ptk','nama_prodi','nuptk AS nidn','jenjang_prodi','status_aktif_ptk');
- $data = $this->ptk_model->get_detail_data('get',array('prodi_ptk'),$act,NULL,NULL,$select);
- $total_rows = count($data);
- if ($total_rows > 0 ) {
- foreach ($data as $key => $value) {
- $record[] = array(
- 'id' => $value->id_ptk,
- 'text' => $value->nidn.' | '.$value->nama_ptk,
- 'nama' => $value->nama_ptk,
- 'nidn' => $value->nidn,
- 'nama_prodi' => $value->nama_prodi,
- 'jenjang_prodi' => $value->jenjang_prodi,
- 'status_aktif_ptk' => select_conv_value($value->status_aktif_ptk,'ptk','status_aktif_ptk'),
- );
- }
- $result = array(
- 'ptk' => $record,
- 'total_count' => $total_rows
- );
- }
- else{
- $result['ptk'] = '';
- }
- }
- elseif ($post['data']=='daftar_jadwal_pd') {
- $thn_ajaran = explode(' ',$post['thn']);
- $where = array('id_thn_ak_jdl' => $thn_ajaran[0], 'id_pd_mk' => $thn_ajaran[1]);
- $select_jadwal_detail = array('id_jdl','id_thn_ak_jdl','hari_jdl','jam_mulai_jdl','jam_akhir_jdl','thn_ajaran_jdl','semester','kelas','ruang','jenis_jdl','nama_prodi','nama_mk','id_pd_mk','jml_sks','nama_ptk','status_jdl');
- $data = $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','prodi_mk','ptk'),NULL,$where,NULL,$select_jadwal_detail);
- $record_jadwal = array();
- foreach ($data as $key) {
- $count_mhs = array('jml_mhs' => $this->kelas_model->count(array('id_jdl_kls' =>$key->id_jdl)));
- $record_jadwal[] = array_merge((array)$key,(array)$count_mhs);
- }
- $data_kelas = $this->jadwal_model->get_detail_data('get',array('mata_kuliah'),NULL,$where,NULL,array('semester','kelas','jenis_jdl'),array('semester','kelas'),'semester ASC, kelas ASC');
- $data_u = $this->jadwal_model->get_detail_data('get',array('mata_kuliah'),NULL,$where,NULL,array('jenis_jdl'),array('jenis_jdl'),'jenis_jdl ASC');
- $result = array(
- 'record_jadwal' => $record_jadwal,
- 'record_kelas' => $data_kelas,
- 'record_u' => $data_u,
- );
- }
- elseif ($post['data']== 'daftar_kelas_mhs') {
- $select_daftar_mhs = array('id_kelas','id_jdl_kls','id AS in_mhs','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
- $select_kelas = array('id_jdl','hari_jdl','jam_mulai_jdl','jam_akhir_jdl','semester','kelas','ruang','jenis_jdl','nama_mk','nama_ptk','status_jdl');
- $data_mhs = $this->kelas_model->get_detail_data('get',array('mahasiswa','thn_angkatan'),NULL,array('id_jdl_kls' => $post['kelas']),NULL,$select_daftar_mhs);
- $data_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','ptk'),NULL,array('id_jdl' => $post['kelas']),NULL,$select_kelas);
- $result = array(
- 'record_mhs' => $data_mhs,
- 'record_kelas' => $data_kelas
- );
- }
- elseif ($post['data']=='daftar_mhs' && isset($post['pd']) || $post['data']=='daftar_mhs' && isset($post['act'])) {
- $cari = $post['value'];
- if (isset($post['pd'])) {
- $pd = $this->jadwal_model->get_detail_data('get',array('mata_kuliah'),NULL,array('id_jdl' => $post['pd']),TRUE,array('id_pd_mk'));
- $pd = $pd->id_pd_mk;
- $mhs_check = $this->kelas_model->get_detail_data('get',NULL,NULL,array('id_jdl_kls' => $post['pd']),NULL,array('id_mhs_kls'),NULL,'id_kelas');
- $mhs_list = array();
- foreach ($mhs_check as $key => $value) {
- $mhs_list[] = $value->id_mhs_kls;
- }
- $act = NULL;
- if (count($mhs_list) > 0) {
- $act = array(
- 0 => array(
- 'not_in' => array('id' => $mhs_list),
- 'where' => array(
- 'id_pd_mhs' => $pd,
- 'id_mhs_alni' => NULL,
- 'id_mhs_DO' => NULL,
- ),
- 'like' => array(
- 'nisn' => $cari,
- ),
- ),
- 1 => array(
- 'or_not_in' => array('id' => $mhs_list),
- 'where' => array(
- 'id_pd_mhs' => $pd,
- 'id_mhs_alni' => NULL,
- 'id_mhs_DO' => NULL,
- ),
- 'like' => array(
- 'nama' => $cari,
- ),
- ),
- );
- }
- else{
- $act = array(
- 0 => array(
- 'where' => array(
- 'id_pd_mhs' => $pd,
- 'id_mhs_alni' => NULL,
- 'id_mhs_DO' => NULL,
- ),
- 'like' => array(
- 'nisn' => $cari,
- ),
- ),
- 1 => array(
- 'or' => array(
- 'id_pd_mhs' => $pd,
- ),
- 'where' => array(
- 'id_mhs_alni' => NULL,
- 'id_mhs_DO' => NULL,
- ),
- 'like' => array(
- 'nama' => $cari,
- ),
- ),
- );
- }
- $cari = array('id_pd_mhs' => $pd);
- $data = $this->mahasiswa_model->get_detail_data('get',array('alumni','mhs_do'),$act,NULL,FALSE,array('id','nisn','nama'),array('id'));
- }
- elseif (isset($post['act'])) {
- $act = array(
- 0 => array(
- 'where' => array(
- 'id_mhs_alni' => NULL,
- 'id_mhs_DO' => NULL,
- ),
- 'like' => array(
- 'nisn' => $cari,
- ),
- ),
- 1 => array(
- 'or' => array(
- 'id_mhs_alni' => NULL,
- ),
- 'where' => array(
- 'id_mhs_DO' => NULL,
- ),
- 'like' => array(
- 'nama' => $cari,
- ),
- ),
- );
- $data = $this->mahasiswa_model->get_detail_data('get',array('alumni','mhs_do'),$act,NULL,FALSE,array('id','nisn','nama'),array('id'));
- }
- $total_rows = count($data);
- if ($total_rows >0 ) {
- foreach ($data as $key => $value) {
- $record[] = array(
- 'id' => $value->id,
- 'text' => $value->nisn.' | '.$value->nama,
- 'nama_mhs' => $value->nama,
- 'nim_mhs' => $value->nisn,
- );
- }
- $result = array(
- 'mhs' => $record,
- 'total_count' => $total_rows
- );
- }
- else{
- $result['mhs'] = '';
- }
- }
- elseif ($post['data']=='daftar_kelas') {
- $cari_k = $post['value'];
- $total_rows = 0;
- if (isset($post['thn'])) {
- $thn_f = $post['thn'];
- }
- elseif (isset($post['m_thn'])) {
- $thn_f = $post['m_thn'];
- }
- $thn_dt = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik','mata_kuliah'),NULL,array('id_kelas' => $thn_f),TRUE,array('thn_ajaran_jdl','id_pd_mk','id_mk_jdl','id_jdl'),NULL,'id_kelas');
- if ($thn_dt) {
- $thn = $thn_dt->thn_ajaran_jdl;
- $pd = $thn_dt->id_pd_mk;
- $mk = $thn_dt->id_mk_jdl;
- $jdl = $thn_dt->id_jdl;
- $cari = array('kelas LIKE' => '%'.$cari_k.'%', 'id_pd_mk' => $pd, 'thn_ajaran_jdl' => $thn, 'status_jdl' => 1,'id_mk_jdl' => $mk);
- $act = array(
- 'not_in' => array(
- 'id_jdl' => $jdl
- ),
- );
- $data= $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','prodi_mk'),$act,$cari,FALSE,array('id_jdl','semester','kelas','nama_mk','jenis_jdl'),NULL,'semester ASC, kelas ASC');
- $total_rows = count($data);
- }
- if ($total_rows > 0 ) {
- foreach ($data as $key => $value) {
- $record[] = array(
- 'id' => $value->id_jdl.'/'.$thn_f,
- 'text' => $value->semester.'/'.$value->kelas.' '.$value->nama_mk,
- 'semester' => $value->semester,
- 'kelas' => $value->kelas,
- 'mk' => $value->nama_mk,
- 'jns' => $value->jenis_jdl,
- 'jml_mhs' => $this->kelas_model->count(array('id_jdl_kls' => $value->id_jdl)),
- 'jml_lk' => $this->kelas_model->get_detail_data('count',array('mahasiswa'),NULL,array('id_jdl_kls' => $value->id_jdl, 'jk' => 'L')),
- 'jml_pr' => $this->kelas_model->get_detail_data('count',array('mahasiswa'),NULL,array('id_jdl_kls' => $value->id_jdl, 'jk' => 'P')),
- );
- }
- $result = array(
- 'kls' => $record,
- 'total_count' => $total_rows
- );
- }
- else{
- $result['kls'] = '';
- }
- }
- elseif ($post['data'] =='riwayat_akademik_mhs') {
- $where = array('id_mhs_kls' => $post['in_mhs']);
- $select = array('id_thn_ak_jdl','thn_ajaran_jdl','kode_mk','nama_mk','jml_sks');
- $data = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik','mata_kuliah'),NULL,$where,NULL,$select,NULL,'thn_ajaran_jdl ASC, kode_mk ASC');
- $record = array();
- $count = 0;
- $thn_ak = '';
- foreach ($data as $key) {
- $vars = explode('/',$key->thn_ajaran_jdl);
- if ($vars[1] == 1) {
- $semester = 'Ganjil';
- }
- else{
- $semester = 'Genap';
- }
- $where = array_merge($where,array('id_thn_ak' => $key->id_thn_ak_jdl));
- if ($key->id_thn_ak_jdl != $thn_ak) {
- $thn_ak = $key->id_thn_ak_jdl;
- $act = array(
- 'sum' => array(
- 'jml_sks' => 'total_sks'
- )
- );
- $sks_count = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik','mata_kuliah'),$act,$where,TRUE,array('jml_sks'),NULL,'id_kelas');
- $total_sks = $sks_count->total_sks;
- $count_studi = $this->kelas_model->get_detail_data('count',array('jadwal','thn_akademik'),NULL,$where);
- $count_aktif_studi = $this->kelas_model->get_detail_data('count',array('jadwal','thn_akademik'),NULL,array_merge($where,array('status_mhs_kls' => 1)));
- $statik_studi = round($count_aktif_studi/$count_studi*100);
- if ($statik_studi >= 50) {
- $status_aktif_mhs = 'Aktif';
- }
- else{
- $status_aktif_mhs = 'Tidak Aktif';
- }
- }
- $arr = array(
- 'id_thn_ak_jdl' => rand_val(),
- 'thn_ajaran_jdl' => $vars[0].'/'.$semester,
- 'total_sks' => $total_sks,
- 'status_aktif_mhs' => $status_aktif_mhs,
- 'statik_aktif_mhs' => $statik_studi,
- );
- $record[] = array_merge((array)$key,$arr);
- $count += $key->jml_sks;
- }
- $result = array(
- 'record_akademik' => $record,
- 'sks' => $count,
- );
- }
- elseif ($post['data'] =='detail_data_ptk') {
- $in_ptk = $post['in_ptk'];
- $data_studi = $this->ptk_studi_model->get_detail_data('get',NULL,NULL,array('id_ptk_studi' => $in_ptk),NULL,array('id_studi AS in_studi','nama_pt_studi','studi_ptk','jenjang_studi_ptk','gelar_ak_ptk','tgl_ijazah_ptk'),NULL,'tgl_ijazah_ptk ASC');
- $record_studi = array();
- foreach ($data_studi as $key) {
- $arr = array('tgl_ijazah_ptk' => date_convert($key->tgl_ijazah_ptk));
- $record_studi[] = array_merge((array)$key,$arr);
- }
- $data_jadwal = $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','prodi_mk'),NULL,array('id_ptk_jdl' => $in_ptk),NULL,array('thn_ajaran_jdl','kode_mk','nama_mk','semester','kelas','nama_prodi'),NULL,'thn_ajaran_jdl ASC, semester ASC, kelas ASC');
- $record_jadwal = array();
- foreach ($data_jadwal as $key) {
- $vars = explode('/',$key->thn_ajaran_jdl);
- if ($vars[1] == 1) {
- $semester = 'Ganjil';
- }
- else{
- $semester = 'Genap';
- }
- $arr = array(
- 'thn_ajaran_jdl' => $vars[0].'/'.$semester,
- 'kelas' => $key->semester.'/'.$key->kelas,
- );
- $record_jadwal[] = array_merge((array)$key,$arr);
- }
- $record_penelitian = $this->ptk_penelitian_model->get_detail_data('get',NULL,NULL,array('id_ptk_rsch' => $in_ptk),NULL,array('id_penelitian_ptk AS in_research','judul_penelitian','bidang_ilmu','lembaga'));
- $result = array(
- 'studi_ptk' => $record_studi,
- 'riwayat_mengajar' => $record_jadwal,
- 'penelitian_ptk' => $record_penelitian,
- );
- }
- elseif ($post['data']=='check_mhs') {
- $id_mhs_check = array();
- $data = array();
- if ($post['check'] == 'data_exists') {
- if (isset($post['id_alumni'])) {
- $id_mhs_check = array($post['id_alumni']);
- }
- elseif (isset($post['id_mhs_do'])) {
- $id_mhs_check = array($post['id_mhs_do']);
- }
- else{
- foreach ($post['id'] as $key) {
- $id_mhs = explode(' ',$key);
- $id_mhs_check[] = $id_mhs[0];
- }
- }
- $count_check = count($id_mhs_check);
- if ($count_check > 0) {
- $act = array(
- 'in' => array(
- 'id' => $id_mhs_check,
- ),
- );
- if (isset($post['id_alumni'])) {
- $select = array('id_alni AS in_mhs','id AS in_data','nisn AS nim','nama','tgl_lulus','tgl_yudisium');
- $join_table = array('alumni');
- }
- elseif (isset($post['id_mhs_do'])) {
- $select = array('id_DO AS in_mhs','id AS in_data','nisn AS nim','nama','tgl_drop_out','drop_out_reason');
- $join_table = array('mhs_do');
- }
- else {
- $select = array('nisn AS nim','nama');
- $join_table = array();
- }
- $data = $this->mahasiswa_model->get_detail_data('get',$join_table,$act,NULL,FALSE,$select);
- $count_check = count($data);
- if (count($data) == 0) {
- $message = 'Mahasiswa yang anda pilih tidak ada didalam database atau sudah terhapus!';
- }
- }
- else{
- $message = 'Silahkan pilih data mahasiswa!';
- }
- }
- elseif ($post['check'] == 'alumni') {
- $alumni_count = 0;
- $mhs_do_count = 0;
- foreach ($post['id'] as $key) {
- $id_mhs = explode(' ',$key);
- /*$check_alumni = $this->alumni_model->count(array('id_mhs_alni' => $id_mhs[0]));
- $check_mhs_do = $this->mahasiswa_do_model->count(array('id_mhs_DO' => $id_mhs[0]));
- if ($check_alumni == 0 && $check_mhs_do == 0) {
- $id_mhs_check[] = $id_mhs[0];
- }
- if ($check_alumni > 0) {
- $alumni_count++;
- }
- if ($check_mhs_do > 0) {
- $mhs_do_count++;
- }*/
- $id_mhs_check[] = $id_mhs[0];
- }
- $count_check = count($id_mhs_check);
- if ($count_check > 0) {
- $act = array(
- 'where' => array('id_mhs_alni' => NULL,'id_mhs_DO' => NULL),
- 'in' => array(
- 'id' => $id_mhs_check,
- ),
- );
- $data = $this->mahasiswa_model->get_detail_data('get',array('alumni','mhs_do'),$act,NULL,FALSE,array('nisn AS nim','nama'));
- $count_check = count($data);
- if (count($data) == 0) {
- $message = 'Mahasiswa yang anda pilih sudah ada dalam data alumni / drop out!';
- }
- }
- /*elseif ($alumni_count > 0 && $mhs_do_count > 0) {
- $message = 'Mahasiswa yang anda pilih ada yang sudah terdaftar sebagai alumni dan ada juga yang sudah drop out!';
- }
- elseif ($alumni_count > 0) {
- $message = 'Mahasiswa yang anda pilih sudah terdaftar sebagai alumni!';
- }
- elseif ($mhs_do_count > 0) {
- $message = 'Mahasiswa yang anda pilih sudah terdaftar sebagai mahasiswa yang drop out!';
- }*/
- }
- if ($count_check > 0 && count($data) > 0) {
- $result = array(
- 'data' => $data,
- 'total_rows' => $count_check,
- );
- }
- else{
- $result = array(
- 'total_rows' => $count_check,
- 'message' => $message,
- );
- }
- }
- elseif ($post['data']=='check_ptk') {
- $id_ptk_check = array();
- if ($post['check'] == 'data_exists') {
- foreach ($post['id'] as $key) {
- $id_ptk_check[] = $key;
- }
- $count_check = count($id_ptk_check);
- if ($count_check > 0) {
- $act = array(
- 'in' => array(
- 'id_ptk' => $id_ptk_check,
- ),
- );
- $data = $this->ptk_model->get_detail_data('get',NULL,$act,NULL,FALSE,array('nuptk AS nidn','nama_ptk AS nama'));
- $count_check = count($data);
- if (count($data) == 0) {
- $message = 'Tenaga Pendidik yang anda pilih tidak ada didalam database atau sudah terhapus!';
- }
- }
- }
- if ($count_check > 0) {
- $result = array(
- 'data' => $data,
- 'total_rows' => $count_check,
- );
- }
- else{
- $result = array(
- 'total_rows' => $count_check,
- );
- }
- }
- elseif ($post['data']=='check_mk') {
- $id_mk_check = array();
- if ($post['check'] == 'data_exists') {
- foreach ($post['id'] as $key) {
- $id_mk_check[] = $key;
- }
- $count_check = count($id_mk_check);
- if ($count_check > 0) {
- $act = array(
- 'in' => array(
- 'id_mk' => $id_mk_check,
- ),
- );
- $data = $this->mata_kuliah_model->get_detail_data('get',NULL,$act,NULL,FALSE,array('kode_mk','nama_mk','jenis_jdl'));
- $count_check = count($data);
- }
- }
- if ($count_check > 0) {
- $result = array(
- 'data' => $data,
- 'total_rows' => $count_check,
- );
- }
- else{
- $result = array(
- 'total_rows' => $count_check,
- );
- }
- }
- elseif ($post['data']=='status_jdl') {
- if (isset($post['status_kelas'])) {
- $status_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $post['status_kelas']),NULL,array('status_jdl'));
- if ($status_kelas) {
- foreach ($status_kelas as $key => $value) {
- $status = $value->status_jdl;
- }
- }
- else{
- $status = 'not_found';
- }
- }
- elseif (isset($post['status'])) {
- $status_kelas = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik'),NULL,array('id_kelas' => $post['status']),NULL,array('status_jdl'),NULL,'id_kelas');
- if ($status_kelas) {
- foreach ($status_kelas as $key => $value) {
- $status = $value->status_jdl;
- }
- }
- else{
- $status = 'not_found';
- }
- }
- $result = array(
- 'status_jdl' => $status,
- );
- }
- else{
- $result = array('status_action' => 'Not find...');
- }
- }
- elseif ($param == 'ambil_id') {
- if ($post['data']=='data_mhs') {
- $id = array('id' => $post['id']);
- $select_mhs = array('id','nisn','nama');
- $record_mhs = $this->mahasiswa_model->get_by_search($id,FALSE,$select_mhs);
- $result = array(
- 'total_rows' => count($record_mhs),
- 'record_mhs' => $record_mhs,
- );
- }
- elseif ($post['data']=='data_ptk') {
- $id = array('id_ptk' => $post['id_ptk']);
- $select = array('id_ptk','nama_ptk','nuptk');
- $record_ptk = $this->ptk_model->get_by_search($id,FALSE,$select);
- $result = array(
- 'total_rows' => count($record_ptk),
- 'record_ptk' => $record_ptk,
- );
- }
- elseif ($post['data']=='data_mk') {
- $id = array('id_mk' => $post['id_mk']);
- $select = array('id_mk','id_pd_mk','nama_prodi','jenjang_prodi','nama_mk');
- $record_mk = $this->mata_kuliah_model->get_detail_data('get',array('prodi_mk'),NULL,$id,FALSE,$select);
- $result = array(
- 'total_rows' => count($record_mk),
- 'record_mk' => $record_mk,
- );
- }
- elseif ($post['data']=='data_jadwal_kuliah') {
- $id = array('id_jdl' => $post['id_jdl']);
- $select = array('id_jdl','id_thn_ak_jdl','id_pd_mk','nama_prodi','thn_ajaran_jdl','nama_mk','semester','kelas','status_jdl','jenis_jdl');
- $record_jadwal = $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','prodi_mk'),NULL,$id,NULL,$select);
- $result = array(
- 'total_rows' => count($record_jadwal),
- 'record_jdl' => $record_jadwal,
- );
- }
- elseif ($post['data']=='kelas_mhs') {
- $id = array('id_kelas' => $post['id_kls']);
- $select = array('id_kelas','id_jdl_kls','nama','nisn','nama_prodi','thn_ajaran_jdl','nama_mk','semester','kelas','status_jdl','jenis_jdl');
- $record_mhs = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik','mahasiswa','mata_kuliah','prodi_mk'),NULL,$id,NULL,$select);
- $result = array(
- 'total_rows' => count($record_mhs),
- 'record_mhs' => $record_mhs,
- );
- }
- elseif ($post['data']=='data_alumni') {
- $id = array('id_mhs_alni' => $post['id']);
- $select_mhs = array('id_mhs_alni AS in_mhs','nisn AS nim','nama');
- $record_mhs = $this->mahasiswa_model->get_detail_data('get',array('alumni'),NULL,$id,FALSE,$select_mhs);
- $result = array(
- 'total_rows' => count($record_mhs),
- 'record_mhs' => $record_mhs,
- );
- }
- else{
- $result = array('status_action' => 'Not find...');
- }
- }
- elseif ($param == 'update') {
- if (isset($post['data_mhs'])) {
- $rules = $this->mahasiswa_model->rules;
- $this->form_validation->set_rules($rules);
- $this->id_mhs = $post['id_mhs'];
- if ($this->form_validation->run() == TRUE) {
- $id_mhs = array('id' => $post['id_mhs']);
- $nama_mhs = strtoupper($post['nama']);
- $tmp_lhr = ucwords($post['tmp_lhr']);
- $alamat = ucwords($post['alamat']);
- $dusun = ucwords($post['dusun']);
- $kelurahan = ucwords($post['kelurahan']);
- $kecamatan = ucwords($post['kecamatan']);
- $email = strtolower($post['email']);
- $data_mhs = array(
- 'nisn' => $post['nisn'],
- 'nama' => $nama_mhs,
- 'thn_angkatan' => $post['thn_angkatan'],
- 'id_pd_mhs' => $post['id_pd_mhs'],
- 'jk' => $post['jk'],
- 'tmp_lhr' => $tmp_lhr,
- 'tgl_lhr' => $post['tgl_lhr'],
- 'nik' => $post['nik'],
- 'agama' => $post['agama'],
- 'alamat' => $alamat,
- 'rt' => $post['rt'],
- 'rw' => $post['rw'],
- 'dusun' => $dusun,
- 'kelurahan' => $kelurahan,
- 'kecamatan' => $kecamatan,
- 'kode_pos' => $post['kode_pos'],
- 'jns_tinggal' => $post['jns_tinggal'],
- 'alt_trans' => $post['alt_trans'],
- 'tlp' => $post['tlp'],
- 'hp' => $post['hp'],
- 'email' => $email,
- 'photo_mhs' => $post['photo_mhs']
- );
- $save_data_mhs = $this->mahasiswa_model->update($data_mhs,$id_mhs);
- if ($save_data_mhs) {
- /*if ($post['nisn'] != $post['nisn_sebelumnya']) {
- $id_user = array(
- 'id_user_detail' => $post['id_mhs'],
- 'level_akses' => 'mhs'
- );
- $nisn_user = array('username' => $post['nisn']);
- $this->user_model->update($nisn_user,$id_user);
- }*/
- $id_ortu = array('id_ortu' => $post['id_ortu']);
- $nm_ayah = strtoupper($post['nm_ayah']);
- $nm_ibu = strtoupper($post['nm_ibu']);
- $nm_wali = strtoupper($post['nm_wali']);
- $data_ortu_wali = array(
- 'nm_ayah' => $nm_ayah,
- 'thn_lhr_ayah' => $post['thn_lhr_ayah'],
- 'pendi_ayah' => $post['pendi_ayah'],
- 'pekerjaan_ayah' => $post['pekerjaan_ayah'],
- 'penghasilan_ayah' => $post['penghasilan_ayah'],
- 'nik_ayah' => $post['nik_ayah'],
- 'nm_ibu' => $nm_ibu,
- 'thn_lhr_ibu' => $post['thn_lhr_ibu'],
- 'pendi_ibu' => $post['pendi_ibu'],
- 'pekerjaan_ibu' => $post['pekerjaan_ibu'],
- 'penghasilan_ibu' => $post['penghasilan_ibu'],
- 'nik_ibu' => $post['nik_ibu'],
- 'nm_wali' => $nm_wali,
- 'thn_lhr_wali' => $post['thn_lhr_wali'],
- 'pendi_wali' => $post['pendi_wali'],
- 'pekerjaan_wali' => $post['pekerjaan_wali'],
- 'penghasilan_wali' => $post['penghasilan_wali'],
- 'nik_wali' => $post['nik_wali'],
- );
- $save_data_ortu = $this->ortu_model->update($data_ortu_wali,$id_ortu);
- if ($save_data_ortu) {
- $data = 'data_mhs';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in'=>$post['id_mhs'],
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_ptk'])) {
- $rules = $this->ptk_model->rules;
- $this->id_ptk = $post['id_ptk'];
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $id_ptk = array('id_ptk' => $post['id_ptk']);
- $nama_ptk = ucwords(strtolower($post['nama_ptk']));
- $tmp_lhr = ucwords($post['tmp_lhr_ptk']);
- $data_ptk = array(
- 'nama_ptk' => $nama_ptk,
- 'nuptk' => $post['nuptk'],
- 'nip' => $post['nip'],
- 'jk_ptk' => $post['jk_ptk'],
- 'tmp_lhr_ptk' => $tmp_lhr,
- 'tgl_lhr_ptk' => $post['tgl_lhr_ptk'],
- 'status_ptk' => $post['status_ptk'],
- 'status_aktif_ptk' =>$post['status_aktif_ptk'],
- 'jenjang' => $post['jenjang'],
- 'jurusan_prodi' => $post['jurusan_prodi'],
- 'nik_ptk' => $post['nik_ptk'],
- 'agama_ptk' => $post['agama_ptk'],
- 'alamat_ptk' => ucwords($post['alamat_ptk']),
- 'rt_ptk' => $post['rt_ptk'],
- 'rw_ptk' => $post['rw_ptk'],
- 'dusun_ptk' => ucwords($post['dusun_ptk']),
- 'kelurahan_ptk' => ucwords($post['kelurahan_ptk']),
- 'kecamatan_ptk' => ucwords($post['kecamatan_ptk']),
- 'kode_pos_ptk' => $post['kode_pos_ptk'],
- 'tlp_ptk' => $post['tlp_ptk'],
- 'hp_ptk' => $post['hp_ptk'],
- 'email_ptk' => $post['email_ptk'],
- );
- $update_data_ptk = $this->ptk_model->update($data_ptk,$id_ptk);
- if ($update_data_ptk) {
- /*if ($post['nuptk'] != $post['nuptk_sebelumnya']) {
- $id_user = array(
- 'id_user_detail' => $post['id_ptk'],
- 'level_akses' => 'ptk'
- );
- if (!empty($post['nuptk'])) {
- $username = array('username' => $post['nuptk']);
- }
- else{
- for ($i=0; $i <= 1; $i++) {
- $user = rand(10000000000000,99999999999999).$post['id_ptk'];
- $check_user = array('username' => $user);
- $total_rows = $this->user_model->count($check_user);
- if ($total_rows > 0) {
- $i = 0;
- }
- else{
- $i = 1;
- }
- }
- $username = array('username' => $user);
- }
- $this->user_model->update($username,$id_user);
- }*/
- $data = 'data_ptk';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in'=>$post['id_ptk'],
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_studi_ptk'])) {
- $rules = $this->ptk_studi_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $in_ptk = $post['id_ptk_studi'];
- $data_studi = array(
- 'id_ptk_studi' => $in_ptk,
- 'nama_pt_studi' => ucwords($post['nama_pt_studi']),
- 'studi_ptk' => ucwords($post['studi_ptk']),
- 'jenjang_studi_ptk' => $post['jenjang_studi_ptk'],
- 'gelar_ak_ptk' => $post['gelar_ak_ptk'],
- 'tgl_ijazah_ptk' => $post['tgl_ijazah_ptk'],
- );
- $update_data_studi = $this->ptk_studi_model->update($data_studi,array('id_studi' => $post['id_studi']));
- if ($update_data_studi) {
- $record_studi = array();
- if (isset($post['ptk_detail'])) {
- $data_studi = $this->ptk_studi_model->get_detail_data('get',NULL,NULL,array('id_ptk_studi' => $post['ptk_detail']),NULL,array('id_studi AS in_studi','nama_pt_studi','studi_ptk','jenjang_studi_ptk','gelar_ak_ptk','tgl_ijazah_ptk'),NULL,'tgl_ijazah_ptk ASC');
- $record_studi = array();
- foreach ($data_studi as $key) {
- $arr = array('tgl_ijazah_ptk' => date_convert($key->tgl_ijazah_ptk));
- $record_studi[] = array_merge((array)$key,$arr);
- }
- }
- $data = 'data_studi_ptk';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in_ptk' => @$post['ptk_detail'],
- 'studi_ptk' => $record_studi
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_penelitian_ptk'])) {
- $rules = $this->ptk_penelitian_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $in_ptk = $post['id_ptk_rsch'];
- $data_penelitian = array(
- 'id_ptk_rsch' => $in_ptk,
- 'judul_penelitian' => ucwords($post['judul_penelitian']),
- 'bidang_ilmu' => ucwords($post['bidang_ilmu']),
- 'lembaga' => $post['lembaga'],
- );
- $update_data_penelitian = $this->ptk_penelitian_model->update($data_penelitian,array('id_penelitian_ptk' => $post['id_penelitian_ptk']));
- if ($update_data_penelitian) {
- $record_penelitian = array();
- if (isset($post['ptk_detail'])) {
- $record_penelitian = $this->ptk_penelitian_model->get_detail_data('get',NULL,NULL,array('id_ptk_rsch' => $post['ptk_detail']),NULL,array('id_penelitian_ptk AS in_research','judul_penelitian','bidang_ilmu','lembaga'));
- }
- $data = 'data_penelitian_ptk';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in_ptk' => $post['ptk_detail'],
- 'penelitian_ptk' => $record_penelitian
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_mk'])) {
- $rules = $this->mata_kuliah_model->rules;
- $this->form_validation->set_rules($rules);
- $this->id_mk = $post['id_mk'];
- if (isset($post['id_pd_mk'])) {
- $this->mk_pd = $post['id_pd_mk'];
- }
- if ($this->form_validation->run() == TRUE) {
- $data_mk = array(
- 'kode_mk' => strtoupper($post['kode_mk']),
- 'nama_mk' => ucwords($post['nama_mk']),
- 'id_pd_mk' => $post['id_pd_mk'],
- 'jml_sks' => $post['jml_sks'],
- 'jenis_jdl' => $post['jenis_jdl'],
- );
- $id_mk = array('id_mk' => $post['id_mk']);
- $update_data_mk = $this->mata_kuliah_model->update($data_mk,$id_mk);
- if ($update_data_mk) {
- $data = 'data_mk';
- $result = array(
- 'status' => 'success',
- 'data' => $data
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['data_jadwal_kuliah'])) {
- $this->jam_awal = $post['jam_mulai_jdl'];
- $rules = $this->jadwal_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $data_jadwal = array(
- 'id_thn_ak_jdl' => $post['id_thn_ak_jdl'],
- 'id_mk_jdl' => $post['id_mk_jdl'],
- 'id_ptk_jdl' => $post['id_ptk_jdl'],
- 'hari_jdl' => $post['hari_jdl'],
- 'jam_mulai_jdl' => $post['jam_mulai_jdl'],
- 'jam_akhir_jdl' => $post['jam_akhir_jdl'],
- 'semester' => $post['semester'],
- 'kelas' => $post['kelas'],
- 'ruang' => strtoupper($post['ruang']),
- );
- $id_jdl = array('id_jdl' => $post['id_jdl']);
- $update_data_jadwal = $this->jadwal_model->update($data_jadwal,$id_jdl);
- if ($update_data_jadwal) {
- $thn= $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah'),NULL,array('id_thn_ak_jdl' => $post['id_thn_ak_jdl'], 'id_mk_jdl' => $post['id_mk_jdl']),NULL,array('id_thn_ak_jdl AS thn_ajaran_jdl','id_pd_mk'),array('thn_ajaran_jdl','id_pd_mk'));
- $data = 'data_jadwal';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'thn' => $thn,
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- elseif (isset($post['status_thn_ajaran'])) {
- if ($post['status_thn_ajaran'] == 'true') {
- $status = 1;
- }
- else{
- $status = 0;
- }
- $data = array('status_jdl' => $status);
- $where = array('thn_ajaran_jdl' => $post['thn']);
- if ($status == 1) {
- $update_status_noaktif = $this->jadwal_model->update(array('status_jdl' => 0),array('status_jdl' => 1));
- }
- $update_status_aktif = $this->jadwal_model->update($data,$where);
- if ($update_status_aktif || $update_status_noaktif && $update_status_aktif) {
- $result = array(
- 'status' => 'success',
- 'status_user' => $status,
- );
- }
- else{
- $result = array(
- 'status' => 'failed',
- 'status_user' => $status,
- );
- }
- }
- elseif (isset($post['update_kelas'])) {
- if ($post['update_kelas'] == '') {
- if (isset($post['kls_mhs'])) {
- $var = explode('/', $post['kls_mhs']);
- $l_kls = $this->kelas_model->get_detail_data('get',NULL,NULL,array('id_kelas' => $var[1]),TRUE,array('id_jdl_kls','id_mhs_kls'),NULL,'id_kelas');
- $kelas_l = $l_kls->id_jdl_kls;
- $mhs = $l_kls->id_mhs_kls;
- $count = $this->kelas_model->count(array('id_jdl_kls' => $var[0], 'id_mhs_kls' => $mhs));
- if ($count == 0) {
- $status_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $var[0]),TRUE,array('status_jdl'));
- $status = $status_kelas->status_jdl;
- if (@$status == 1) {
- $data = array('id_jdl_kls' => $var[0]);
- $where = array('id_kelas' => $var[1]);
- $update_kelas = $this->kelas_model->update($data,$where);
- if ($update_kelas) {
- $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
- $data_mhs = $this->kelas_model->get_detail_data('get',array('jadwal','mahasiswa','thn_angkatan'),NULL,array('id_jdl' => $kelas_l),NULL,$select_daftar_mhs);
- $result = array(
- 'status' => 'success',
- 'data' => 'data_mhs_kls',
- 'record_mhs' => $data_mhs,
- 'c_kls' => $kelas_l,
- );
- }
- else{
- $result = array(
- 'status' => 'failed',
- );
- }
- }
- else{
- $error = array('mhs-kelas' => 'Anda tidak bisa memindahkan kelas mahasiswa saat ini');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- else{
- $error = array('mhs-kelas' => 'Mahasiswa yang anda akan pindahkan ke dalam kelas ini sudah ada');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- else{
- $error = array('mhs-kelas' => 'Silahkan pilih kelas yang dituju');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- elseif ($post['update_kelas'] == 'data_mhs_kls'){
- if ($post['kls_mhs'] != '') {
- $var = explode('/', $post['kls_mhs']);
- $status_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $var[0]),TRUE,array('status_jdl'));
- $status = $status_kelas->status_jdl;
- if (@$status == 1) {
- foreach ($post['id'] as $key => $value_kelas) {
- $l_kls = $this->kelas_model->get_detail_data('get',NULL,NULL,array('id_kelas' => $value_kelas),TRUE,array('id_jdl_kls','id_mhs_kls'),NULL,'id_kelas');
- $kelas_l = $l_kls->id_jdl_kls;
- $mhs = $l_kls->id_mhs_kls;
- $count = $this->kelas_model->get_detail_data('count',array('jadwal','thn_akademik'),NULL,array('id_jdl_kls' => $var[0], 'id_mhs_kls' => $mhs, 'status_jdl' => 1));
- if ($count == 0) {
- $data[] = array(
- 'id_kelas' => $value_kelas,
- 'id_jdl_kls' => $var[0],
- );
- }
- }
- if (isset($data)) {
- $update_kelas = $this->kelas_model->update($data,'id_kelas',TRUE);
- }
- if (isset($update_kelas) && $update_kelas > 0) {
- $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
- $data_mhs = $this->kelas_model->get_detail_data('get',array('jadwal','mahasiswa','thn_angkatan'),NULL,array('id_jdl' => $kelas_l),NULL,$select_daftar_mhs);
- $result = array(
- 'status' => 'success',
- 'record_mhs' => $data_mhs,
- 'c_kls' => $post['c_kls'],
- );
- }
- else{
- $error = array('mhs-kelas' => 'Gagal memindahkan kelas mahasiswa, mahasiswa yang anda akan pindahkan ke dalam kelas ini sudah ada atau tahun akademik kelas ini sedang tidak aktif/diterapkan');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- else{
- $error = array('mhs-kelas' => 'Anda tidak bisa memindahkan kelas mahasiswa saat ini');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- else{
- $error = array('mhs-kelas' => 'Silahkan pilih kelas yang dituju');
- $result = array('status' => 'failed', 'errors' => $error);
- }
- }
- }
- elseif (isset($post['data_alumni'])) {
- $rules = $this->alumni_model->rules;
- $this->form_validation->set_rules($rules);
- if ($this->form_validation->run() == TRUE) {
- $data_alumni = array(
- 'tgl_lulus' => $post['tgl_lulus'],
- 'tgl_yudisium' => $post['tgl_yudisium'],
- );
- $id_alumni = array('id_alni' => $post['in_mhs']);
- $update_data_alumni = $this->alumni_model->update($data_alumni,$id_alumni);
- if ($update_data_alumni) {
- $data = 'data_alumni';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in' => $post['in_mhs']
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else {
- $result = array(
- 'status' => 'failed',
- 'errors'=> $this->form_validation->error_array()
- );
- }
- }
- else{
- $result = array('status_action' => 'Not find...');
- }
- }
- elseif ($param == 'delete') {
- if (isset($post['data_mhs'])) {
- $id_mhs = $post['id_mhs'];
- $delete_mhs_by = array('id' => $id_mhs);
- $delete_ortu_by = array('id_mhs_ortu' => $id_mhs);
- $delete_user_by = array(
- 'id_user_detail' => $id_mhs,
- 'level_akses' => 'mhs'
- );
- $detail = $this->mahasiswa_model->get($id_mhs,TRUE);
- $delete_mhs = $this->mahasiswa_model->delete_by($delete_mhs_by);
- $delete_ortu = $this->ortu_model->delete_by($delete_ortu_by);
- $delete_user = $this->user_model->delete_by($delete_user_by);
- if ($delete_mhs && $delete_ortu && $delete_user) {
- $data = 'data_mhs';
- if ($detail->photo_mhs != '') {
- unlink('./uploads/mhs-photo/'.$detail->photo_mhs);
- }
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'delete_id' => $id_mhs
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif (isset($post['data_ptk'])) {
- $id_ptk = $post['id_ptk'];
- $delete_ptk_by = array('id_ptk' => $id_ptk);
- $delete_user_by = array(
- 'id_user_detail' => $id_ptk,
- 'level_akses' => 'ptk'
- );
- $detail = $this->ptk_model->get($id_ptk,TRUE);
- $delete_ptk = $this->ptk_model->delete_by($delete_ptk_by);
- $delete_user = $this->user_model->delete_by($delete_user_by);
- if ($delete_ptk && $delete_user) {
- $data = 'data_ptk';
- if ($detail->photo_ptk != '') {
- unlink('./uploads/ptk-photo/'.$detail->photo_ptk);
- }
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'delete_id' => $id_ptk
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif (isset($post['data_studi_ptk'])) {
- $id_studi = $post['id_studi'];
- $delete_studi = $this->ptk_studi_model->delete_by(array('id_studi' => $id_studi));
- if ($delete_studi) {
- $record_studi = array();
- if (isset($post['ptk_detail']) && $post['id_ptk_studi'] == $post['ptk_detail']) {
- $data_studi = $this->ptk_studi_model->get_detail_data('get',NULL,NULL,array('id_ptk_studi' => $post['ptk_detail']),NULL,array('id_studi AS in_studi','nama_pt_studi','studi_ptk','jenjang_studi_ptk','gelar_ak_ptk','tgl_ijazah_ptk'),NULL,'tgl_ijazah_ptk ASC');
- foreach ($data_studi as $key) {
- $arr = array('tgl_ijazah_ptk' => date_convert($key->tgl_ijazah_ptk));
- $record_studi[] = array_merge((array)$key,$arr);
- }
- }
- $data = 'data_studi_ptk';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in_ptk' => @$post['id_ptk_studi'],
- 'studi_ptk' => $record_studi
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif (isset($post['data_penelitian_ptk'])) {
- $id_penelitian_ptk = $post['id_penelitian_ptk'];
- $delete_penelitian_ptk = $this->ptk_penelitian_model->delete_by(array('id_penelitian_ptk' => $id_penelitian_ptk));
- if ($delete_penelitian_ptk) {
- $record_penelitian = array();
- if (isset($post['ptk_detail']) && $post['id_ptk_rsch'] == $post['ptk_detail']) {
- $record_penelitian = $this->ptk_penelitian_model->get_detail_data('get',NULL,NULL,array('id_ptk_rsch' => $post['ptk_detail']),NULL,array('id_penelitian_ptk AS in_research','judul_penelitian','bidang_ilmu','lembaga'));
- }
- $data = 'data_penelitian_ptk';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'in_ptk' => @$post['id_ptk_rsch'],
- 'penelitian_ptk' => $record_penelitian
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif (isset($post['data_mk'])) {
- $id_mk = $post['id_mk'];
- $delete_mk_by = array('id_mk' => $id_mk);
- $delete_mk = $this->mata_kuliah_model->delete_by($delete_mk_by);
- if ($delete_mk) {
- $data = 'data_mk';
- $result = array(
- 'status' => 'success',
- 'data' => $data
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif (isset($post['data_jadwal_kuliah'])) {
- $var = explode('/', $post['id_jdl']);
- $status = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $var[0]),TRUE,array('status_jdl'));
- $status = $status->status_jdl;
- if ($status == 1) {
- $delete_jadwal_by = array('id_jdl' => $var[0]);
- $delete_jadwal = $this->jadwal_model->delete_by($delete_jadwal_by);
- if ($delete_jadwal) {
- $data = 'data_jadwal';
- $count_thn = $this->jadwal_model->get_detail_data('count',array('mata_kuliah'),NULL,array('id_thn_ak_jdl' => $var[2],'id_pd_mk' => $var[1]));
- $result = array(
- 'status' => 'success',
- 'data' => $data
- );
- if ($count_thn > 0) {
- $result['thn'] = $var[2];
- $result['pd'] = $var[1];
- }
- else{
- $result['thn'] = '';
- }
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- $result = array(
- 'status' => 'no_active_thn_jdl',
- 'error_message' => 'Gagal menghapus jadwal, karena tahun akademik jadwal ini tidak aktif/diterapkan'
- );
- }
- }
- elseif (isset($post['data_mhs_kls'])) {
- $var = explode('/', $post['id_mhs_kls']);
- $id_mhs = $var[0];
- $id_kelas = $var[1];
- $status = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $id_kelas),TRUE,array('status_jdl'));
- $status = $status->status_jdl;
- if ($status == 1) {
- $delete_mhs_by = array('id_kelas' => $id_mhs);
- $delete_mhs_kls = $this->kelas_model->delete_by($delete_mhs_by);
- if ($delete_mhs_kls) {
- $data = 'data_mhs_kls';
- $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
- $data_mhs = $this->kelas_model->get_detail_data('get',array('mahasiswa','thn_angkatan'),NULL,array('id_jdl_kls' => $id_kelas),NULL,$select_daftar_mhs);
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- 'record_mhs' => $data_mhs,
- 'c_kls' => $id_kelas,
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- $result = array(
- 'status' => 'no_active_thn_kls',
- 'error_message' => 'Anda tidak bisa menghapus mahasiswa dari kelas ini karena tahun akademik kelas tidak sedang diterapkan'
- );
- }
- }
- elseif (isset($post['data_alumni'])) {
- $id_alumni = array('id_mhs_alni' => $post['in_mhs']);
- $delete_alumni = $this->alumni_model->delete_by($id_alumni);
- if ($delete_alumni) {
- $data = 'data_alumni';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif (isset($post['data_mhs_do'])) {
- $id_mhs_do = array('id_mhs_DO' => $post['in_mhs']);
- $delete_mhs_do = $this->mahasiswa_do_model->delete_by($id_mhs_do);
- if ($delete_mhs_do) {
- $data = 'data_mhs_do';
- $result = array(
- 'status' => 'success',
- 'data' => $data,
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif (isset($post['data'])) {
- if ($post['data'] == 'data_mhs') {
- $id = $post['id'];
- $id_mhs = array();
- $photo_mhs = array();
- foreach ($id as $key) {
- $id_mhs[] = $key;
- $id = $key;
- $detail = $this->mahasiswa_model->get($id,TRUE);
- if ($detail->photo_mhs != '') {
- $photo_mhs[] = $detail->photo_mhs;
- }
- }
- $where_mhs = array(
- 'id' => $id_mhs,
- );
- $where_ortu = array(
- 'id_mhs_ortu' => $id_mhs,
- );
- $where_user = array(
- 'id_user_detail' => $id_mhs,
- );
- $delete_mhs = $this->mahasiswa_model->delete_by(NULL,$where_mhs);
- $delete_ortu = $this->ortu_model->delete_by(NULL,$where_ortu);
- $delete_user = $this->user_model->delete_by(array('level_akses' => 'mhs'),$where_user);
- if ($delete_mhs && $delete_ortu && $delete_user) {
- foreach ($photo_mhs as $key) {
- unlink('./uploads/mhs-photo/'.$key);
- }
- $result = array(
- 'status' => 'success',
- 'delete_id' => $id_mhs
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif ($post['data'] == 'data_ptk') {
- $id = $post['id'];
- $id_ptk = array();
- $photo_ptk = array();
- foreach ($id as $key) {
- $id_ptk[] = $key;
- $detail = $this->ptk_model->get($key,TRUE);
- if ($detail->photo_ptk != '') {
- $photo_ptk[] = $detail->photo_ptk;
- }
- }
- $where_ptk = array(
- 'id_ptk' => $id_ptk
- );
- $where_user = array(
- 'id_user_detail' => $id_ptk,
- );
- $delete_ptk = $this->ptk_model->delete_by(NULL,$where_ptk);
- $delete_user = $this->user_model->delete_by(array('level_akses' => 'ptk'),$where_user);
- if ($delete_ptk && $delete_user) {
- foreach ($photo_ptk as $key) {
- unlink('./uploads/ptk-photo/'.$key);
- }
- $result = array(
- 'status' => 'success',
- 'delete_id' => $id_ptk
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif ($post['data'] == 'data_mk') {
- $id = $post['id'];
- $id_mk = array();
- foreach ($id as $key) {
- $id_mk[] = $key;
- }
- $where_mk = array('id_mk' => $id_mk);
- $delete_mk = $this->mata_kuliah_model->delete_by(NULL,$where_mk);
- if ($delete_mk) {
- $result = array('status' => 'success');
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif ($post['data'] == 'data_jadwal_kuliah') {
- $id = $post['id'];
- $id_jdl_m = array();
- foreach ($id as $key) {
- $id_jdl = explode('/',$key);
- $where_jdl = array('id_jdl' => $id_jdl[0]);
- $check_thn = $this->jadwal_model->get_detail_data('count',array('thn_akademik'),NULL,array('id_jdl' => $id[0], 'status_jdl' => 1));
- if ($check_thn > 0) {
- $id_jdl_m[] = $id_jdl[0];
- }
- }
- if (count($id_jdl_m) > 0) {
- $where_jdl = array(
- 'id_jdl' => $id_jdl_m,
- );
- $delete_jdl = $this->jadwal_model->delete_by(NULL,$where_jdl);
- }
- if (count($id_jdl_m) > 0 && isset($delete_jdl) && $delete_jdl) {
- $result = array(
- 'status' => 'success',
- 'thn' => explode('/',$id[0])[2],
- 'pd' => explode('/',$id[0])[1],
- );
- }
- elseif (count($id_jdl_m) > 0 && !isset($delete_jdl)) {
- $result = array('status' => 'failed_db');
- }
- elseif (!isset($delete_jdl)) {
- $result = array('status' => 'no_record_delete');
- }
- }
- elseif ($post['data'] == 'data_mhs_kls') {
- $status_thn = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik'),NULL,array('id_kelas' => $post['id'][0]),TRUE,array('status_jdl','id_jdl_kls'),NULL,'id_kelas');
- $status = $status_thn->status_jdl;
- $id_kelas = $status_thn->id_jdl_kls;
- $id_mhs_kls = array();
- if ($status == 1) {
- foreach ($post['id'] as $key) {
- $id_mhs = $key;
- $status_thn = $this->kelas_model->get_detail_data('count',array('jadwal','thn_akademik'),NULL,array('id_kelas' => $id_mhs,'status_jdl' => 1));
- if ($status_thn > 0) {
- $id_mhs_kls[] = $id_mhs;
- }
- }
- if (count($id_mhs_kls) > 0) {
- $delete_in = array(
- 'id_kelas' => $id_mhs_kls
- );
- $delete_mhs_kls = $this->kelas_model->delete_by(NULL,$delete_in);
- }
- if (count($id_mhs_kls) > 0 && isset($delete_mhs_kls) && $delete_mhs_kls) {
- $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
- $data_mhs = $this->kelas_model->get_detail_data('get',array('mahasiswa','thn_angkatan'),NULL,array('id_jdl_kls' => $id_kelas),NULL,$select_daftar_mhs);
- $result = array(
- 'status' => 'success',
- 'record_mhs' => $data_mhs,
- 'c_kls' => $id_kelas,
- 'delete' => $delete_mhs_kls,
- );
- }
- elseif (count($id_mhs_kls) > 0 && !isset($delete_mhs_kls)) {
- $result = array('status' => 'failed', 'errors' => 'Anda tidak bisa menghapus mahasiswa dari kelas ini karena tahun akademik kelas tidak sedang diterapkan');
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- $result = array('status' => 'failed', 'errors' => 'Anda tidak bisa menghapus mahasiswa dari kelas ini karena tahun akademik kelas tidak sedang diterapkan');
- }
- }
- elseif ($post['data'] == 'data_alumni') {
- $id = $post['id'];
- $id_alumni = array();
- foreach ($id as $key) {
- $vars = explode('-',$key);
- if ($vars[1] == 'alumni') {
- $id_alumni[] = $vars[0];
- }
- }
- $where_alumni = array(
- 'id_mhs_alni' => $id_alumni,
- );
- $delete_alumni = $this->alumni_model->delete_by(NULL,$where_alumni);
- if ($delete_alumni) {
- $result = array(
- 'status' => 'success',
- 'delete_id' => $id_alumni
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- elseif ($post['data'] == 'data_mhs_do') {
- $id = $post['id'];
- $id_mhs_do = array();
- foreach ($id as $key) {
- $vars = explode('-',$key);
- if ($vars[1] == 'do') {
- $id_mhs_do[] = $vars[0];
- }
- }
- $where_mhs_do = array(
- 'id_mhs_DO' => $id_mhs_do,
- );
- $delete_mhs_do = $this->mahasiswa_do_model->delete_by(NULL,$where_mhs_do);
- if ($delete_mhs_do) {
- $result = array(
- 'status' => 'success',
- 'delete_id' => $id_mhs_do
- );
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- $result = array('status_action' => 'Not find...');
- }
- }
- else{
- $result = array('status_action' => 'Not find...');
- }
- }
- elseif ($param == 'update_pd') {
- $id = $post['id'];
- if (!empty($post['pd'])) {
- $pd = array();
- foreach ($id as $key) {
- $id_mhs = explode(' ',$key);
- $pd[] = array(
- 'id' => $id_mhs[0],
- 'id_pd_mhs' => $post['pd'],
- );
- }
- $pindah = $this->mahasiswa_model->update($pd,'id',TRUE);
- if ($pindah > 0) {
- $result = array('status' => 'success');
- }
- elseif ($pindah == 0){
- $result = array('status' => 'zero_change');
- }
- else{
- $result = array('status' => 'failed_db');
- }
- }
- else{
- $result = array('status' => 'empty-ch');
- }
- }
- elseif ($param == 'update_pd_mk') {
- $id = $post['id'];
- $this->form_validation->set_rules($this->mata_kuliah_model->mk_update_rules);
- if ($this->form_validation->run() == TRUE) {
- $pd = array();
- $no = 0;
- foreach ($id as $key) {
- $id_mk = $key;
- $pd[$no] = array(
- 'id_mk' => $id_mk,
- );
- if ($post['id_pd_mk'] != '') {
- $pd[$no] = array_merge($pd[$no],array('id_pd_mk' => $post['id_pd_mk']));
- }
- if ($post['sks'] != '') {
- $pd[$no] = array_merge($pd[$no],array('jml_sks' => $post['sks']));
- }
- if ($post['mk_j'] != '') {
- $pd[$no] = array_merge($pd[$no],array('jenis_jdl' => $post['mk_j']));
- }
- $no++;
- }
- $update = $this->mata_kuliah_model->update($pd,'id_mk',TRUE);
- if ($update > 0) {
- $result = array('status' => 'success');
- }
- elseif ($update == 0){
- $result = array(
- 'status' => 'zero_change',
- 'errors_message' => 'Gagal memperbahrui, karena data baru yang anda masukkan sama dengan data lama mata kuliah',
- );
- }
- else{
- $result = array(
- 'status' => 'failed_db',
- 'errors_message' => 'Maaf terjadi kesalahan dalam memperbahrui program studi data mata kuliah',
- );
- }
- }
- else{
- $errors = $this->form_validation->error_array();
- $result = array(
- 'status' => 'errors_pd',
- 'errors_message' => $errors['id_pd_mk']
- );
- }
- }
- else{
- $result = array('status_action' => 'Not find...');
- }
- $result['n_token'] = $this->security->get_csrf_hash();
- echo json_encode($result);
- }
- else{
- $result = array(
- "success" => FALSE,
- "info" => "Service not found or not set",
- 'n_token' => $this->security->get_csrf_hash()
- );
- echo json_encode($result);
- }
- }
Add Comment
Please, Sign In to add comment