MuhammadDicky

Data_akademik CI Controller

Nov 20th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 86.31 KB | None | 0 0
  1. ?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Data_akademik extends Backend_Controller {
  5.  
  6.     protected $id_mhs;
  7.     protected $mata_pelajaran;
  8.     protected $id_mk;
  9.     protected $mk_pd;
  10.     protected $hari;
  11.     protected $id_ptk;
  12.     protected $jadwal_field = array();
  13.     protected $jam_awal;
  14.  
  15.     public function __construct()
  16.     {
  17.         parent::__construct();     
  18.         $this->site->login_status_check();     
  19.     }
  20.    
  21.     public function data_mahasiswa(){
  22.         /*$this->page_on_repair('Data Mahasiswa','fa-users');*/
  23.         $this->site->view('data_mahasiswa');
  24.     }
  25.  
  26.     public function data_ptk(){    
  27.         $this->site->view('data_ptk');
  28.     }
  29.  
  30.     public function data_kurikulum(){
  31.         $this->page_soon('Data Kurikulum','fa-book');
  32.     }
  33.  
  34.     public function data_mata_kuliah(){
  35.         $this->site->view('data_mata_kuliah');
  36.     }
  37.  
  38.     public function data_jadwal_kuliah(){
  39.         $this->site->view('data_jadwal_kuliah');
  40.     }
  41.  
  42.     public function data_nilai_mhs(){
  43.         $this->site->view('data_nilai_mhs');
  44.     }
  45.  
  46.     public function data_alumni_do(){
  47.         $this->site->view('data_alumni_do');
  48.     }
  49.  
  50.     protected function print_nilai(){
  51.         $get = $this->input->get();
  52.         $kelas = $get['kelas'];
  53.         $thn_ajaran = $get['thn_ajaran'];
  54.         $semester = $get['semester'];
  55.         $where = array('kelas' => $kelas, 'thn_ajaran' => $thn_ajaran, 'semester' => $semester);
  56.         $count = $this->nilai_siswa_model->count($where);
  57.  
  58.         if ($count > 0) {
  59.             $wali = $this->kelas_model->get_by_search(array('kelas' => $kelas), TRUE, array('wali_kelas'));
  60.             $record_mp = $this->mata_pelajaran_model->get_by_search(NULL,FALSE,array('kode_mp','mata_pelajaran'));
  61.             foreach ($record_mp as $key => $value) {
  62.                 $replace_space = str_replace(" ", "_", $value->mata_pelajaran);
  63.                 $field = strtolower(str_replace(".", "", $replace_space));
  64.                 $daftar_mp[] = $field;
  65.             }
  66.             $nilai = $this->nilai_siswa_model->get_by_search($where);
  67.             $data = array(
  68.                 'status' => 'success',
  69.                 'thn_ajaran' => $thn_ajaran,
  70.                 'semester' => $semester,
  71.                 'kelas' => $kelas,
  72.                 'wali_kelas' => $wali->wali_kelas,
  73.                 'daftar_nilai' => $nilai,
  74.                 'daftar_mp' => $daftar_mp,
  75.                 'record_mp' => $record_mp
  76.                 );         
  77.         }
  78.         else{
  79.             $data = array(
  80.                 'status' => 'not found',                               
  81.                 );         
  82.         }
  83.         $this->site->view('print_nilai',$data);
  84.     }
  85.  
  86.     public function action($param){
  87.         global $Config;
  88.         $result = array();
  89.         if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  90.             $post = $this->input->post(NULL, TRUE);
  91.             if ($param == 'tambah') {
  92.                 if (isset($post['data_mhs'])) {
  93.                     $rules = $this->mahasiswa_model->rules;
  94.                     $this->form_validation->set_rules($rules);
  95.  
  96.                     if ($this->form_validation->run() == TRUE) {
  97.                         $nama_mhs = strtoupper($post['nama']);
  98.                         $tmp_lhr = ucwords($post['tmp_lhr']);
  99.                         $alamat = ucwords($post['alamat']);
  100.                         $dusun = ucwords($post['dusun']);
  101.                         $kelurahan = ucwords($post['kelurahan']);
  102.                         $kecamatan = ucwords($post['kecamatan']);
  103.                         $email = strtolower($post['email']);
  104.                         $data_mhs = array(
  105.                             'nisn' => $post['nisn'],
  106.                             'nama' => $nama_mhs,
  107.                             'thn_angkatan' => $post['thn_angkatan'],
  108.                             'id_pd_mhs' => $post['id_pd_mhs'],
  109.                             'jk' => $post['jk'],
  110.                             'tmp_lhr' => $tmp_lhr,
  111.                             'tgl_lhr' => $post['tgl_lhr'],
  112.                             'nik' => $post['nik'],
  113.                             'agama' => $post['agama'],
  114.                             'alamat' => $alamat,
  115.                             'rt' => $post['rt'],
  116.                             'rw' => $post['rw'],
  117.                             'dusun' => $dusun,
  118.                             'kelurahan' => $kelurahan,
  119.                             'kecamatan' => $kecamatan,
  120.                             'kode_pos' => $post['kode_pos'],
  121.                             'jns_tinggal' => $post['jns_tinggal'],
  122.                             'alt_trans' => $post['alt_trans'],
  123.                             'tlp' => $post['tlp'],
  124.                             'hp' => $post['hp'],
  125.                             'email' => $email,
  126.                             );
  127.                         $save_data_mhs = $this->mahasiswa_model->insert($data_mhs);
  128.                         if ($save_data_mhs) {
  129.                             $nm_ayah = strtoupper($post['nm_ayah']);
  130.                             $nm_ibu = strtoupper($post['nm_ibu']);
  131.                             $nm_wali = strtoupper($post['nm_wali']);
  132.                             $data_ortu_wali = array(
  133.                                 'id_mhs_ortu' => $save_data_mhs,
  134.                                 'nm_ayah' => $nm_ayah,
  135.                                 'thn_lhr_ayah' => $post['thn_lhr_ayah'],
  136.                                 'pendi_ayah' => $post['pendi_ayah'],
  137.                                 'pekerjaan_ayah' => $post['pekerjaan_ayah'],
  138.                                 'penghasilan_ayah' => $post['penghasilan_ayah'],                               
  139.                                 'nik_ayah' => $post['nik_ayah'],
  140.                                 'nm_ibu' => $nm_ibu,
  141.                                 'thn_lhr_ibu' => $post['thn_lhr_ibu'],
  142.                                 'pendi_ibu' => $post['pendi_ibu'],
  143.                                 'pekerjaan_ibu' => $post['pekerjaan_ibu'],
  144.                                 'penghasilan_ibu' => $post['penghasilan_ibu'],                             
  145.                                 'nik_ibu' => $post['nik_ibu'],
  146.                                 'nm_wali' => $nm_wali,
  147.                                 'thn_lhr_wali' => $post['thn_lhr_wali'],
  148.                                 'pendi_wali' => $post['pendi_wali'],
  149.                                 'pekerjaan_wali' => $post['pekerjaan_wali'],
  150.                                 'penghasilan_wali' => $post['penghasilan_wali'],                               
  151.                                 'nik_wali' => $post['nik_wali'],
  152.                                 );
  153.                             $save_data_ortu = $this->ortu_model->insert($data_ortu_wali);
  154.                             $password = $this->user_model->password_generate();
  155.                             $encrypt_password = bCrypt($password,12);
  156.                             $data_user = array(
  157.                                 'id_user_detail' => $save_data_mhs,
  158.                                 'password' => $encrypt_password,
  159.                                 'level_akses' => 'mhs',
  160.                                 'active_status' => 1,
  161.                                 );
  162.                             $save_data_user = $this->user_model->insert($data_user);
  163.                            
  164.                             if ($save_data_user && $save_data_ortu) {
  165.                                 $data = 'data_mhs';
  166.                                 $result = array(
  167.                                     'status' => 'success',
  168.                                     'data' => $data,
  169.                                     'in' => $save_data_mhs
  170.                                     );
  171.                             }
  172.                             else{
  173.                                 $result = array('status' => 'failed_db');
  174.                             }
  175.                         }
  176.                         else{
  177.                             $result = array('status' => 'failed_db');
  178.                         }
  179.                     }
  180.                     else {
  181.                         $result = array(
  182.                             'status' => 'failed',
  183.                             'errors'=> $this->form_validation->error_array()
  184.                             );
  185.                     }
  186.                 }
  187.                 elseif (isset($post['data_ptk'])) {
  188.                     $rules = $this->ptk_model->rules;
  189.                     $this->form_validation->set_rules($rules);
  190.  
  191.                     if ($this->form_validation->run() == TRUE) {
  192.                         $nama_ptk = ucwords(strtolower($post['nama_ptk']));
  193.                         $tmp_lhr = ucwords($post['tmp_lhr_ptk']);
  194.                         $data_ptk = array(                         
  195.                             'nama_ptk' => $nama_ptk,
  196.                             'nuptk' => $post['nuptk'],
  197.                             'nip' => $post['nip'],
  198.                             'jk_ptk' => $post['jk_ptk'],
  199.                             'tmp_lhr_ptk' => $tmp_lhr,
  200.                             'tgl_lhr_ptk' => $post['tgl_lhr_ptk'],                         
  201.                             'status_ptk' => $post['status_ptk'],
  202.                             'status_aktif_ptk' =>$post['status_aktif_ptk'],
  203.                             'jenjang' => $post['jenjang'], 
  204.                             'jurusan_prodi' => $post['jurusan_prodi'],
  205.                             'nik_ptk' => $post['nik_ptk'],
  206.                             'agama_ptk' => $post['agama_ptk'],
  207.                             'alamat_ptk' => ucwords($post['alamat_ptk']),
  208.                             'rt_ptk' => $post['rt_ptk'],
  209.                             'rw_ptk' => $post['rw_ptk'],
  210.                             'dusun_ptk' => ucwords($post['dusun_ptk']),
  211.                             'kelurahan_ptk' => ucwords($post['kelurahan_ptk']),
  212.                             'kecamatan_ptk' => ucwords($post['kecamatan_ptk']),
  213.                             'kode_pos_ptk' => $post['kode_pos_ptk'],
  214.                             'tlp_ptk' => $post['tlp_ptk'],
  215.                             'hp_ptk' => $post['hp_ptk'],
  216.                             'email_ptk' => $post['email_ptk'],
  217.                             );
  218.                         $save_data_ptk = $this->ptk_model->insert($data_ptk);
  219.                         if ($save_data_ptk) {                          
  220.                             $password = $this->user_model->password_generate();
  221.                             $encrypt_password = bCrypt($password,12);
  222.                             if (!empty($post['nuptk'])) {
  223.                                 $data_user = array(
  224.                                     'id_user_detail' => $save_data_ptk,
  225.                                     'password' => $encrypt_password,
  226.                                     'level_akses' => 'ptk',
  227.                                     'active_status' => 1,
  228.                                 );
  229.                             }
  230.                             else{
  231.                                 for ($i=0; $i <= 1; $i++) {
  232.                                     $user = rand(10000000000000,99999999999999).$save_data_ptk;
  233.                                     $check_user = array('username' => $user);
  234.                                     $total_rows = $this->user_model->count($check_user);
  235.                                     if ($total_rows > 0) {
  236.                                         $i = 0;
  237.                                     }
  238.                                     else{
  239.                                         $i = 1;
  240.                                     }
  241.                                 }
  242.                                 $data_user = array(
  243.                                     'id_user_detail' => $save_data_ptk,
  244.                                     'password' => $encrypt_password,
  245.                                     'level_akses' => 'ptk',
  246.                                     'active_status' => 1,
  247.                                 );
  248.                             }
  249.                             $save_data_user = $this->user_model->insert($data_user);                                                   
  250.                             if ($save_data_user) {
  251.                                 $data = 'data_ptk';
  252.                                 $result = array(
  253.                                     'status' => 'success',
  254.                                     'data' => $data,
  255.                                     'in'=>$save_data_ptk,
  256.                                     );
  257.                             }
  258.                             else{
  259.                                 $result = array('status' => 'failed_db');
  260.                             }
  261.                         }
  262.                         else{
  263.                             $result = array('status' => 'failed_db');
  264.                         }
  265.                     }
  266.                     else {
  267.                         $result = array(
  268.                             'status' => 'failed',
  269.                             'errors'=> $this->form_validation->error_array()
  270.                             );
  271.                     }
  272.                 }
  273.                 elseif (isset($post['data_studi_ptk'])) {
  274.                     $rules = $this->ptk_studi_model->rules;
  275.                     $this->form_validation->set_rules($rules);
  276.  
  277.                     if ($this->form_validation->run() == TRUE) {
  278.                         $in_ptk = $post['id_ptk_studi'];
  279.                         $data_studi = array(                           
  280.                             'id_ptk_studi' => $in_ptk,
  281.                             'nama_pt_studi' => ucwords($post['nama_pt_studi']),
  282.                             'studi_ptk' => ucwords($post['studi_ptk']),
  283.                             'jenjang_studi_ptk' => $post['jenjang_studi_ptk'],
  284.                             'gelar_ak_ptk' => $post['gelar_ak_ptk'],
  285.                             'tgl_ijazah_ptk' => $post['tgl_ijazah_ptk'],
  286.                             );
  287.                         $save_data_studi = $this->ptk_studi_model->insert($data_studi);
  288.                         if ($save_data_studi) {
  289.                             $record_studi = array();
  290.                             if (isset($post['ptk_detail']) && $in_ptk == $post['ptk_detail']) {
  291.                                 $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');
  292.                                 $record_studi = array();
  293.                                 foreach ($data_studi as $key) {
  294.                                     $arr = array('tgl_ijazah_ptk' => date_convert($key->tgl_ijazah_ptk));
  295.                                     $record_studi[] = array_merge((array)$key,$arr);
  296.                                 }
  297.                             }
  298.                             $data = 'data_studi_ptk';
  299.                             $result = array(
  300.                                 'status' => 'success',
  301.                                 'data' => $data,
  302.                                 'in_ptk' => $in_ptk,
  303.                                 'studi_ptk' => $record_studi
  304.                                 );                         
  305.                         }
  306.                         else{
  307.                             $result = array('status' => 'failed_db');
  308.                         }
  309.                     }
  310.                     else {
  311.                         $result = array(
  312.                             'status' => 'failed',
  313.                             'errors'=> $this->form_validation->error_array()
  314.                             );
  315.                     }
  316.                 }
  317.                 elseif (isset($post['data_penelitian_ptk'])) {
  318.                     $rules = $this->ptk_penelitian_model->rules;
  319.                     $this->form_validation->set_rules($rules);
  320.  
  321.                     if ($this->form_validation->run() == TRUE) {
  322.                         $in_ptk = $post['id_ptk_rsch'];
  323.                         $data_penelitian = array(                          
  324.                             'id_ptk_rsch' => $in_ptk,
  325.                             'judul_penelitian' => ucwords($post['judul_penelitian']),
  326.                             'bidang_ilmu' => ucwords($post['bidang_ilmu']),
  327.                             'lembaga' => $post['lembaga'],
  328.                             );
  329.                         $save_data_penelitian = $this->ptk_penelitian_model->insert($data_penelitian);
  330.                         if ($save_data_penelitian) {
  331.                             $record_penelitian = array();
  332.                             if (isset($post['ptk_detail']) && $in_ptk == $post['ptk_detail']) {
  333.                                 $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'));
  334.                             }
  335.                             $data = 'data_penelitian_ptk';
  336.                             $result = array(
  337.                                 'status' => 'success',
  338.                                 'data' => $data,
  339.                                 'in_ptk' => $in_ptk,
  340.                                 'penelitian_ptk' => $record_penelitian
  341.                                 );                         
  342.                         }
  343.                         else{
  344.                             $result = array('status' => 'failed_db');
  345.                         }
  346.                     }
  347.                     else {
  348.                         $result = array(
  349.                             'status' => 'failed',
  350.                             'errors'=> $this->form_validation->error_array()
  351.                             );
  352.                     }
  353.                 }
  354.                 elseif (isset($post['data_mk'])) {
  355.                     if (isset($post['id_pd_mk'])) {
  356.                         $this->mk_pd = $post['id_pd_mk'];
  357.                     }
  358.                     $rules = $this->mata_kuliah_model->rules;
  359.                     $this->form_validation->set_rules($rules);
  360.  
  361.                     if ($this->form_validation->run() == TRUE) {
  362.                         $data_mk = array(                          
  363.                             'kode_mk' => strtoupper($post['kode_mk']),
  364.                             'nama_mk' => ucwords($post['nama_mk']),
  365.                             'id_pd_mk' => $post['id_pd_mk'],
  366.                             'jml_sks' => $post['jml_sks'],
  367.                             'jenis_jdl' => $post['jenis_jdl'],
  368.                             );
  369.                         $save_data_mk = $this->mata_kuliah_model->insert($data_mk);
  370.                         if ($save_data_mk) {
  371.                             $data = 'data_mata_kuliah';
  372.                             $result = array(
  373.                                 'status' => 'success',
  374.                                 'data' => $data
  375.                                 );                         
  376.                         }
  377.                         else{
  378.                             $result = array('status' => 'failed_db');
  379.                         }
  380.                     }
  381.                     else {
  382.                         $result = array(
  383.                             'status' => 'failed',
  384.                             'errors'=> $this->form_validation->error_array()
  385.                             );
  386.                     }
  387.                 }
  388.                 elseif (isset($post['data_jadwal_kuliah'])) {
  389.                     $this->jam_awal = $post['jam_mulai_jdl'];
  390.                     $rules = $this->jadwal_model->rules;
  391.                     $this->form_validation->set_rules($rules);
  392.  
  393.                     if ($this->form_validation->run() == TRUE) {
  394.                         $data_jadwal = array(
  395.                             'id_mk_jdl' => $post['id_mk_jdl'],
  396.                             'id_ptk_jdl' => $post['id_ptk_jdl'],
  397.                             'id_thn_ak_jdl' => $post['id_thn_ak_jdl'],
  398.                             'hari_jdl' => $post['hari_jdl'],
  399.                             'jam_mulai_jdl' => $post['jam_mulai_jdl'],
  400.                             'jam_akhir_jdl' => $post['jam_akhir_jdl'],
  401.                             'semester' => $post['semester'],
  402.                             'kelas' => $post['kelas'],
  403.                             'ruang' => strtoupper($post['ruang']),
  404.                             );
  405.                         $save_data_jadwal = $this->jadwal_model->insert($data_jadwal);
  406.                         if ($save_data_jadwal) {
  407.                             $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'));
  408.                             $data = 'data_jadwal';
  409.                             $result = array(
  410.                                 'status' => 'success',
  411.                                 'data' => $data,
  412.                                 'thn' => $thn,
  413.                                 );                         
  414.                         }
  415.                         else{
  416.                             $result = array('status' => 'failed_db');
  417.                         }
  418.                     }
  419.                     else {
  420.                         $result = array(
  421.                             'status' => 'failed',
  422.                             'errors'=> $this->form_validation->error_array()
  423.                             );
  424.                     }
  425.                 }
  426.                 elseif (isset($post['data_mhs_kls'])) {
  427.                     if (isset($post['mhs-kelas'])) {
  428.                         $status_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $post['kelas_mhs']),TRUE,array('status_jdl'));
  429.                         $status = $status_kelas->status_jdl;
  430.                         if ($status == 1) {
  431.                             foreach ($post['mhs-kelas'] as $key => $value) {
  432.                                 $count = $this->kelas_model->count(array('id_jdl_kls' => $post['kelas_mhs'], 'id_mhs_kls' => $value));
  433.                                 if ($count == 0) {
  434.                                     $batch[] = array(
  435.                                         'id_jdl_kls' => $post['kelas_mhs'],
  436.                                         'id_mhs_kls' => $value,
  437.                                         'status_mhs_kls' => 1
  438.                                         );
  439.                                 }
  440.                             }
  441.                             if (isset($batch)) {
  442.                                 $insert_mhs = $this->kelas_model->insert($batch,TRUE);
  443.                                 if ($insert_mhs) {
  444.                                     $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
  445.                                     $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);
  446.                                     $result = array(
  447.                                         'status' => 'success',
  448.                                         'data' => 'data_mhs_kls',
  449.                                         'record_mhs' => $data_mhs,
  450.                                         );
  451.                                 }
  452.                                 else{
  453.                                     $result = array('status' => 'failed_db');
  454.                                 }
  455.                             }
  456.                             else{
  457.                                 $error = array('mhs-kelas' => 'Mahasiswa yang anda masukkan dalam kelas ini sudah ada');
  458.                                 $result = array('status' => 'failed', 'errors' => $error);
  459.                             }
  460.                         }
  461.                         else{
  462.                             $error = array('mhs-kelas' => 'Anda tidak bisa menambah mahasiswa dikelas ini karena tahun akademik kelas ini tidak diterapkan');
  463.                             $result = array('status' => 'failed', 'errors' => $error);
  464.                         }
  465.                     }
  466.                     else{
  467.                         $error = array('mhs-kelas' => 'Silahkan pilih mahasiswa yang ingin anda masukkan kedalam kelas ini');
  468.                         $result = array('status' => 'failed', 'errors' => $error);
  469.                     }
  470.                 }
  471.                 elseif (isset($post['data_alumni'])) {
  472.                     if (isset($post['id']) && $post['id'] != '') {
  473.                         $rules = $this->alumni_model->rules;
  474.                         $this->form_validation->set_rules($rules);
  475.  
  476.                         if ($this->form_validation->run() == TRUE) {
  477.                             foreach ($post['id'] as $key) {
  478.                                 $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'));
  479.                                 if (@$data_alumni->id_mhs_alni == NULL && @$data_alumni->id_mhs_DO == NULL) {
  480.                                     $batch[] = array(
  481.                                         'id_mhs_alni' => $key,
  482.                                         'tgl_yudisium' => $post['tgl_yudisium'],
  483.                                         'tgl_lulus' => $post['tgl_lulus']
  484.                                         );
  485.                                 }
  486.                             }
  487.                             if (isset($batch)) {
  488.                                 $insert_alumni = $this->alumni_model->insert($batch,TRUE);
  489.                                 if ($insert_alumni) {
  490.                                     $result = array(
  491.                                         'status' => 'success',
  492.                                         'data' => 'data_alumni',
  493.                                         );
  494.                                 }
  495.                                 else{
  496.                                     $result = array('status' => 'failed_db');
  497.                                 }
  498.                             }
  499.                             else{
  500.                                 if ($data_alumni->id_mhs_alni != NULL) {
  501.                                     $error = array('alumni' => 'Mahasiswa yang anda pilih sudah ada dalam data alumni');
  502.                                 }
  503.                                 elseif ($data_alumni->id_mhs_DO != NULL) {
  504.                                     $error = array('alumni' => 'Mahasiswa yang anda pilih sudah ada dalam data mahasiswa drop out');
  505.                                 }
  506.                                 $result = array('status' => 'failed', 'errors' => $error);
  507.                             }
  508.                         }
  509.                         else{
  510.                             $result = array(
  511.                                 'status' => 'failed',
  512.                                 'errors'=> $this->form_validation->error_array()
  513.                                 );
  514.                         }
  515.                     }
  516.                     else{
  517.                         $error = array('alumni' => 'Silahkan pilih mahasiswa yang ingin anda masukkan kedalam data alumni');
  518.                         $result = array('status' => 'failed', 'errors' => $error);
  519.                     }
  520.                 }
  521.                 elseif (isset($post['data_mhs_do'])) {
  522.                     if (isset($post['mhs-data']) && $post['mhs-data'] != '') {
  523.                         $rules = $this->mahasiswa_do_model->rules;
  524.                         $this->form_validation->set_rules($rules);
  525.  
  526.                         if ($this->form_validation->run() == TRUE) {
  527.                             foreach ($post['mhs-data'] as $key) {
  528.                                 $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'));
  529.                                 if (@$data_do->id_mhs_alni == NULL && @$data_do->id_mhs_DO == NULL) {
  530.                                     $batch[] = array(
  531.                                         'id_mhs_DO' => $key,
  532.                                         'tgl_drop_out' => $post['tgl_drop_out'],
  533.                                         'drop_out_reason' => $post['drop_out_reason']
  534.                                         );
  535.                                 }
  536.                             }
  537.                             if (isset($batch)) {
  538.                                 $insert_mhs_do = $this->mahasiswa_do_model->insert($batch,TRUE);
  539.                                 if ($insert_mhs_do) {
  540.                                     $result = array(
  541.                                         'status' => 'success',
  542.                                         'data' => 'data_mhs_do',
  543.                                         );
  544.                                 }
  545.                                 else{
  546.                                     $result = array('status' => 'failed_db');
  547.                                 }
  548.                             }
  549.                             else{
  550.                                 if ($data_do->id_mhs_alni != NULL) {
  551.                                     $error = array('mhs-do' => 'Mahasiswa yang anda pilih sudah ada dalam data alumni');
  552.                                 }
  553.                                 elseif ($data_do->id_mhs_DO != NULL) {
  554.                                     $error = array('mhs-do' => 'Mahasiswa yang anda pilih sudah ada dalam data mahasiswa drop out');
  555.                                 }
  556.                                 $result = array('status' => 'failed', 'errors' => $error);
  557.                             }
  558.                         }
  559.                         else{
  560.                             $result = array(
  561.                                 'status' => 'failed',
  562.                                 'errors'=> $this->form_validation->error_array()
  563.                                 );
  564.                         }
  565.                     }
  566.                     else{
  567.                         $error = array('mhs-do' => 'Silahkan pilih mahasiswa yang ingin anda masukkan kedalam data mahasiswa yang drop out');
  568.                         $result = array('status' => 'failed', 'errors' => $error);
  569.                     }
  570.                 }
  571.                 else{
  572.                     $result = array('status_action' => 'Not find...');
  573.                 }
  574.             }
  575.             elseif ($param == 'ambil') {
  576.                 if ($post['data']=='data_mhs') {
  577.                     $id = array('id' => $post['id']);
  578.                     $total_rows = $this->mahasiswa_model->count($id);
  579.                    
  580.                     if ($total_rows > 0) {
  581.                         $record_mhs = array();
  582.                         if (!isset($post['ac'])) {
  583.                             $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')));
  584.                             $this->load->helper('file');
  585.                             foreach ($record as $key) {
  586.                                 $photo = photo_u();
  587.                                 if ($key->photo_mhs != '') {
  588.                                     $check_file = get_file_info('uploads/mhs-photo/'.$key->photo_mhs);
  589.                                     if ($check_file != FALSE) {
  590.                                         $check_file = TRUE;
  591.                                         $photo = photo_u('mhs',$key->photo_mhs.'?n_img='.rand_val(20));
  592.                                     }
  593.                                     else{
  594.                                         $check_file = FALSE;
  595.                                     }
  596.                                 }
  597.                                 $arr = array(
  598.                                     'tgl_lulus' => date_convert($key->tgl_lulus),
  599.                                     'tgl_drop_out' => date_convert($key->tgl_drop_out),
  600.                                     'id_user' => md5($key->id_user),
  601.                                     'in_user' => md5($key->id),
  602.                                     'tgl_lhr' => date_convert($key->tgl_lhr),
  603.                                     'photo_mhs' => $photo,
  604.                                     'check_file' => @$check_file
  605.                                     );
  606.                                 $record_mhs[] = array_merge((array)$key,$arr);
  607.                             }
  608.                         }
  609.                         else{
  610.                             $record = $this->mahasiswa_model->get_detail_data('get',array('prodi_mhs','ortu','thn_angkatan'),NULL,$id);
  611.                             $this->load->helper('file');
  612.                             foreach ($record as $key) {
  613.                                 $photo = photo_u();
  614.                                 if ($key->photo_mhs != '') {
  615.                                     $check_file = get_file_info('uploads/mhs-photo/'.$key->photo_mhs);
  616.                                     if ($check_file != FALSE) {
  617.                                         $check_file = TRUE;
  618.                                         $photo = photo_u('mhs',$key->photo_mhs.'?n_img='.rand_val(20));
  619.                                     }
  620.                                     else{
  621.                                         $check_file = FALSE;
  622.                                     }
  623.                                 }
  624.                                 $arr = array(
  625.                                     'file_name' => $key->photo_mhs,
  626.                                     'photo_mhs' => $photo,
  627.                                     'check_file' => @$check_file
  628.                                     );
  629.                                 $record_mhs[] = array_merge((array)$key,$arr);
  630.                             }
  631.                         }
  632.                         $result = array(                           
  633.                                 'total_rows' => $total_rows,                           
  634.                                 'record_mhs' => $record_mhs,
  635.                                 );
  636.                     }
  637.                     else{
  638.                         $result = array(                           
  639.                                 'total_rows' => $total_rows,                               
  640.                                 );
  641.                     }
  642.                 }
  643.                 elseif ($post['data']=='data_ptk') {
  644.                     $id = array('id_ptk' => $post['id_ptk']);                  
  645.                     $total_rows = $this->ptk_model->count($id);
  646.  
  647.                     if ($total_rows > 0) {
  648.                         if (!isset($post['ac'])) {
  649.                             $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')));
  650.                             $record = array();
  651.                             $this->load->helper('file');
  652.                             foreach ($data as $key) {
  653.                                 $photo = photo_u();
  654.                                 if ($key->photo_ptk != '') {
  655.                                     $check_file = get_file_info('uploads/ptk-photo/'.$key->photo_ptk);
  656.                                     if ($check_file != FALSE) {
  657.                                         $check_file = TRUE;
  658.                                         $photo = photo_u('ptk',$key->photo_ptk.'?n_img='.rand_val(20));
  659.                                     }
  660.                                     else{
  661.                                         $check_file = FALSE;
  662.                                     }
  663.                                 }
  664.                                 $arr = array(
  665.                                     'id_user' => md5($key->id_user),
  666.                                     'in_user' => md5($key->id_ptk),
  667.                                     'tgl_lhr_ptk' => date_convert($key->tgl_lhr_ptk),
  668.                                     'agama_ptk' => select_conv_value($key->agama_ptk,'ptk','agama_ptk'),
  669.                                     'status_ptk' => select_conv_value($key->status_ptk,'ptk','status_ptk'),
  670.                                     'status_aktif_ptk' => select_conv_value($key->status_aktif_ptk,'ptk','status_aktif_ptk'),
  671.                                     'jenjang' => select_conv_value($key->jenjang,'ptk','jenjang'),
  672.                                     'photo_ptk' => $photo,
  673.                                     'check_file' => @$check_file
  674.                                     );
  675.                                 $record[] = array_merge((array)$key,$arr);
  676.                             }
  677.                         }
  678.                         else{
  679.                             $data = $this->ptk_model->get_by_search(array('id_ptk' => $post['id_ptk']));
  680.                             $record = array();
  681.                             foreach ($data as $key) {
  682.                                 $photo = '';
  683.                                 if ($key->photo_ptk != '') {
  684.                                     $photo = $key->photo_ptk.'?n_img='.rand_val(20);
  685.                                 }
  686.                                 $select = array('id_prodi','nama_prodi','jenjang_prodi');
  687.                                 $ptk_detail = $this->ptk_model->get_detail_data('get',array('prodi_ptk'),NULL,array('id_ptk' => $post['id_ptk']),TRUE,$select);
  688.                                 $arr = array(
  689.                                     'photo_ptk' => $photo,
  690.                                     );
  691.                                 $record[] = array_merge((array)$key,$arr,(array)$ptk_detail);
  692.                             }
  693.                         }
  694.                         $result = array(                           
  695.                                 'total_rows' => $total_rows,                           
  696.                                 'record_ptk' => $record,
  697.                                 );
  698.                     }
  699.                     else{
  700.                         $result = array(                           
  701.                                 'total_rows' => $total_rows,                               
  702.                                 );
  703.                     }
  704.                 }
  705.                 elseif ($post['data']=='data_studi_ptk') {
  706.                     $id = array('id_studi' => $post['id_studi']);
  707.                     $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'));
  708.                     $result = array(
  709.                             'total_rows' => count($record_studi),
  710.                             'studi_ptk' => $record_studi,
  711.                             );
  712.                 }
  713.                 elseif ($post['data']=='data_penelitian_ptk') {
  714.                     $id = array('id_penelitian_ptk' => $post['id_penelitian_ptk']);
  715.                     $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'));
  716.                     $result = array(
  717.                             'total_rows' => count($record_penelitian),
  718.                             'penelitian_ptk' => $record_penelitian,
  719.                             );
  720.                 }
  721.                 elseif ($post['data']=='data_mk') {
  722.                     $id = array('id_mk' => $post['id_mk']);
  723.                     $total_rows = $this->mata_kuliah_model->count($id);
  724.                     $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'));
  725.                     $result = array(
  726.                             'total_rows' => $total_rows,
  727.                             'record_mk' => $record_mk,
  728.                             );                 
  729.                 }
  730.                 elseif ($post['data']=='data_jadwal_kuliah') {
  731.                     $id = array('id_jdl' => $post['id_jdl']);
  732.                     $total_rows = $this->jadwal_model->count($id);
  733.  
  734.                     if ($total_rows > 0) {
  735.                         $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');
  736.                         $record = $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','prodi_mk','ptk'),NULL,$id,NULL,$select_jadwal_detail);
  737.                         $record_jadwal = array();
  738.                         foreach ($record as $key) {
  739.                             $vars = explode('/',$key->thn_ajaran_jdl);
  740.                             if ($vars[1] == 1) {
  741.                                 $thn = array('thn_ajaran_jdl' => $vars[0].'/Ganjil');
  742.                             }
  743.                             else{
  744.                                 $thn = array('thn_ajaran_jdl' => $vars[0].'/Genap');
  745.                             }
  746.                             $record_jadwal[] = array_merge((array)$key,$thn);
  747.                         }
  748.                         $result = array(                           
  749.                                 'total_rows' => $total_rows,                           
  750.                                 'record_jdl' => $record_jadwal,                            
  751.                                 );
  752.                     }
  753.                     else{
  754.                         $result = array(                           
  755.                                 'total_rows' => $total_rows,                               
  756.                                 );
  757.                     }
  758.                 }
  759.                 elseif ($post['data']=='daftar_nilai_mhs') {
  760.                     $cari = $post['value'];
  761.                     $act = array(
  762.                         'like' => array(
  763.                             'nisn' => $cari,
  764.                             ),
  765.                         'or_like' => array(
  766.                             'nama' => $cari,
  767.                             ),
  768.                         );
  769.                     $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');
  770.                     $total_rows = count($data);
  771.                     if ($total_rows > 0 ) {
  772.                         foreach ($data as $key => $value) {
  773.                             $vars = explode('/',$value->thn_ajaran_jdl);
  774.                             if (isset($vars[1])) {
  775.                                 if ($vars[1] == 1) {
  776.                                     $thn = $vars[0].'/Ganjil';
  777.                                 }
  778.                                 else{
  779.                                     $thn = $vars[0].'/Genap';
  780.                                 }
  781.                             }
  782.                             else{
  783.                                 $thn = 'Tidak ditemukan';
  784.                             }
  785.                             $record[] = array(
  786.                                 'id' => $value->id_mhs_kls.'/'.$value->id_thn_ak,
  787.                                 'text' => $value->nisn.' | '.$value->nama,
  788.                                 'nim_mhs' => $value->nisn,
  789.                                 'nama_mhs' => $value->nama,
  790.                                 'thn_akademik' => $thn,
  791.                                 );
  792.                         }      
  793.                         $result = array(
  794.                             'nilai_mhs' => $record,
  795.                             'total_count' => $total_rows
  796.                             );
  797.                     }                  
  798.                     else{
  799.                         $result['nilai_mhs'] = '';
  800.                     }                  
  801.                 }
  802.                 elseif ($post['data'] == 'data_nilai_mhs') {
  803.                     $vars = explode('/',$post['thn']);
  804.                     $where = array('id_mhs_kls' => $vars[0],'id_thn_ak' => $vars[1]);
  805.  
  806.                     $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');
  807.                     $record_nilai = array();
  808.                     $sks = 0;
  809.                     $mutu = 0;
  810.                     foreach ($record as $key) {
  811.                         $vars = explode('/',$key->thn_ajaran_jdl);
  812.                         if ($vars[1] == 1) {
  813.                             $thn = $vars[0].'/Ganjil';
  814.                         }
  815.                         else{
  816.                             $thn = $vars[0].'/Genap';
  817.                         }
  818.                         $n = explode('/',nilai_conv($key->nilai_akhir,$key->jml_sks));
  819.                         $mt = array(
  820.                             'thn_ajaran_jdl' => $thn,
  821.                             'hm' => $n[0],
  822.                             'am' => $n[1],
  823.                             'mutu' => $n[2],
  824.                             );
  825.                         $record_nilai[] = array_merge((array)$key,$mt);
  826.                         $sks += $key->jml_sks;
  827.                         $mutu += $n[2];
  828.                     }
  829.                     $result = array(
  830.                         'record_nilai' => $record_nilai,
  831.                         'sks' => $sks,
  832.                         'mutu' => $mutu,
  833.                         );
  834.                 }
  835.                 elseif ($post['data']=='daftar_mk') {
  836.                     $cari = $post['value'];
  837.                     $act = array(
  838.                         'or_like' => array(
  839.                             'kode_mk' => $cari,
  840.                             'nama_mk' => $cari,
  841.                             ),
  842.                         );
  843.                     $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'));
  844.                     $total_rows = count($data);
  845.                     if ($total_rows > 0 ) {
  846.                        
  847.                         foreach ($data as $key => $value) {
  848.                             if ($value->jenis_jdl == '0') {
  849.                                 $jenis_jdl = '';
  850.                             }
  851.                             else{
  852.                                 $jenis_jdl = ' (Konsentrasi '.$value->jenis_jdl.')';
  853.                             }
  854.                             $record[] = array(
  855.                                 'id' => $value->id_mk,
  856.                                 'text' => $value->kode_mk.' | '.$value->nama_mk.''.$jenis_jdl,
  857.                                 'nama_prodi' => $value->nama_prodi,
  858.                                 'jml_sks' => $value->jml_sks,
  859.                                 'jenjang_prodi' => $value->jenjang_prodi,
  860.                                 'jenis_jdl' => $jenis_jdl,
  861.                                 );
  862.                         }      
  863.                         $result = array(
  864.                             'mk' => $record,
  865.                             'total_count' => $total_rows
  866.                             );
  867.                     }                  
  868.                     else{
  869.                         $result['mk'] = '';
  870.                     }                  
  871.                 }
  872.                 elseif ($post['data']=='daftar_ptk') {
  873.                     $cari = $post['value'];
  874.                     $act = array(
  875.                         'or_like' => array(
  876.                             'nuptk' => $cari,
  877.                             'nama_ptk' => $cari
  878.                             ),
  879.                         );
  880.                     $select = array('nama_ptk','id_ptk','nama_prodi','nuptk AS nidn','jenjang_prodi','status_aktif_ptk');
  881.                     $data = $this->ptk_model->get_detail_data('get',array('prodi_ptk'),$act,NULL,NULL,$select);
  882.                     $total_rows = count($data);
  883.                     if ($total_rows > 0 ) {
  884.                         foreach ($data as $key => $value) {
  885.                             $record[] = array(
  886.                                 'id' => $value->id_ptk,
  887.                                 'text' => $value->nidn.' | '.$value->nama_ptk,
  888.                                 'nama' => $value->nama_ptk,
  889.                                 'nidn' => $value->nidn,
  890.                                 'nama_prodi' => $value->nama_prodi,
  891.                                 'jenjang_prodi' => $value->jenjang_prodi,
  892.                                 'status_aktif_ptk' => select_conv_value($value->status_aktif_ptk,'ptk','status_aktif_ptk'),
  893.                                 );
  894.                         }      
  895.                         $result = array(
  896.                             'ptk' => $record,
  897.                             'total_count' => $total_rows
  898.                             );
  899.                     }                  
  900.                     else{
  901.                         $result['ptk'] = '';
  902.                     }                  
  903.                 }
  904.                 elseif ($post['data']=='daftar_jadwal_pd') {
  905.                     $thn_ajaran = explode(' ',$post['thn']);
  906.                     $where = array('id_thn_ak_jdl' => $thn_ajaran[0], 'id_pd_mk' => $thn_ajaran[1]);
  907.                     $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');
  908.                     $data = $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','prodi_mk','ptk'),NULL,$where,NULL,$select_jadwal_detail);
  909.                     $record_jadwal = array();
  910.                     foreach ($data as $key) {
  911.                         $count_mhs = array('jml_mhs' => $this->kelas_model->count(array('id_jdl_kls' =>$key->id_jdl)));
  912.                         $record_jadwal[] = array_merge((array)$key,(array)$count_mhs);
  913.                     }
  914.                     $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');
  915.                     $data_u = $this->jadwal_model->get_detail_data('get',array('mata_kuliah'),NULL,$where,NULL,array('jenis_jdl'),array('jenis_jdl'),'jenis_jdl ASC');
  916.                     $result = array(
  917.                         'record_jadwal' => $record_jadwal,
  918.                         'record_kelas' => $data_kelas,
  919.                         'record_u' => $data_u,
  920.                         );
  921.                 }
  922.                 elseif ($post['data']== 'daftar_kelas_mhs') {
  923.                     $select_daftar_mhs = array('id_kelas','id_jdl_kls','id AS in_mhs','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
  924.                     $select_kelas = array('id_jdl','hari_jdl','jam_mulai_jdl','jam_akhir_jdl','semester','kelas','ruang','jenis_jdl','nama_mk','nama_ptk','status_jdl');
  925.                     $data_mhs = $this->kelas_model->get_detail_data('get',array('mahasiswa','thn_angkatan'),NULL,array('id_jdl_kls' => $post['kelas']),NULL,$select_daftar_mhs);
  926.                     $data_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','ptk'),NULL,array('id_jdl' => $post['kelas']),NULL,$select_kelas);
  927.                     $result = array(
  928.                         'record_mhs' => $data_mhs,
  929.                         'record_kelas' => $data_kelas
  930.                         );
  931.                 }
  932.                 elseif ($post['data']=='daftar_mhs' && isset($post['pd']) || $post['data']=='daftar_mhs' && isset($post['act'])) {
  933.                     $cari = $post['value'];
  934.                     if (isset($post['pd'])) {
  935.                         $pd = $this->jadwal_model->get_detail_data('get',array('mata_kuliah'),NULL,array('id_jdl' => $post['pd']),TRUE,array('id_pd_mk'));
  936.                         $pd = $pd->id_pd_mk;
  937.                         $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');
  938.                         $mhs_list = array();
  939.                         foreach ($mhs_check as $key => $value) {
  940.                             $mhs_list[] = $value->id_mhs_kls;
  941.                         }
  942.  
  943.                         $act = NULL;
  944.                         if (count($mhs_list) > 0) {
  945.                             $act = array(
  946.                                 0 => array(
  947.                                     'not_in' => array('id' => $mhs_list),
  948.                                     'where' => array(
  949.                                         'id_pd_mhs' => $pd,
  950.                                         'id_mhs_alni' => NULL,
  951.                                         'id_mhs_DO' => NULL,
  952.                                         ),
  953.                                     'like' => array(
  954.                                         'nisn' => $cari,
  955.                                         ),
  956.                                     ),
  957.                                 1 => array(
  958.                                     'or_not_in' => array('id' => $mhs_list),
  959.                                     'where' => array(
  960.                                         'id_pd_mhs' => $pd,
  961.                                         'id_mhs_alni' => NULL,
  962.                                         'id_mhs_DO' => NULL,
  963.                                         ),
  964.                                     'like' => array(
  965.                                         'nama' => $cari,
  966.                                         ),
  967.                                     ),
  968.                                 );
  969.                         }
  970.                         else{
  971.                             $act = array(
  972.                                 0 => array(
  973.                                     'where' => array(
  974.                                         'id_pd_mhs' => $pd,
  975.                                         'id_mhs_alni' => NULL,
  976.                                         'id_mhs_DO' => NULL,
  977.                                         ),
  978.                                     'like' => array(
  979.                                         'nisn' => $cari,
  980.                                         ),
  981.                                     ),
  982.                                 1 => array(
  983.                                     'or' => array(
  984.                                         'id_pd_mhs' => $pd,
  985.                                         ),
  986.                                     'where' => array(
  987.                                         'id_mhs_alni' => NULL,
  988.                                         'id_mhs_DO' => NULL,
  989.                                         ),
  990.                                     'like' => array(
  991.                                         'nama' => $cari,
  992.                                         ),
  993.                                     ),
  994.                                 );
  995.                         }
  996.                         $cari = array('id_pd_mhs' => $pd);
  997.                         $data = $this->mahasiswa_model->get_detail_data('get',array('alumni','mhs_do'),$act,NULL,FALSE,array('id','nisn','nama'),array('id'));
  998.                     }
  999.                     elseif (isset($post['act'])) {
  1000.                         $act = array(
  1001.                             0 => array(
  1002.                                 'where' => array(
  1003.                                     'id_mhs_alni' => NULL,
  1004.                                     'id_mhs_DO' => NULL,
  1005.                                     ),
  1006.                                 'like' => array(
  1007.                                     'nisn' => $cari,
  1008.                                     ),
  1009.                                 ),
  1010.                             1 => array(
  1011.                                 'or' => array(
  1012.                                     'id_mhs_alni' => NULL,
  1013.                                     ),
  1014.                                 'where' => array(
  1015.                                     'id_mhs_DO' => NULL,
  1016.                                     ),
  1017.                                 'like' => array(
  1018.                                     'nama' => $cari,
  1019.                                     ),
  1020.                                 ),
  1021.                             );
  1022.                         $data = $this->mahasiswa_model->get_detail_data('get',array('alumni','mhs_do'),$act,NULL,FALSE,array('id','nisn','nama'),array('id'));
  1023.                     }
  1024.                     $total_rows = count($data);
  1025.                     if ($total_rows >0 ) {
  1026.                         foreach ($data as $key => $value) {
  1027.                             $record[] = array(
  1028.                                 'id' => $value->id,
  1029.                                 'text' => $value->nisn.' | '.$value->nama,
  1030.                                 'nama_mhs' => $value->nama,
  1031.                                 'nim_mhs' => $value->nisn,
  1032.                                 );
  1033.                         }      
  1034.                         $result = array(
  1035.                             'mhs' => $record,
  1036.                             'total_count' => $total_rows
  1037.                             );
  1038.                     }                  
  1039.                     else{
  1040.                         $result['mhs'] = '';
  1041.                     }                  
  1042.                 }
  1043.                 elseif ($post['data']=='daftar_kelas') {
  1044.                     $cari_k = $post['value'];
  1045.                     $total_rows = 0;
  1046.                     if (isset($post['thn'])) {
  1047.                         $thn_f = $post['thn'];
  1048.                     }
  1049.                     elseif (isset($post['m_thn'])) {
  1050.                         $thn_f = $post['m_thn'];
  1051.                     }
  1052.                     $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');
  1053.  
  1054.                     if ($thn_dt) {
  1055.                         $thn = $thn_dt->thn_ajaran_jdl;
  1056.                         $pd = $thn_dt->id_pd_mk;
  1057.                         $mk = $thn_dt->id_mk_jdl;
  1058.                         $jdl = $thn_dt->id_jdl;
  1059.                         $cari = array('kelas LIKE' => '%'.$cari_k.'%', 'id_pd_mk' => $pd, 'thn_ajaran_jdl' => $thn, 'status_jdl' => 1,'id_mk_jdl' => $mk);
  1060.                         $act = array(
  1061.                             'not_in' => array(
  1062.                                 'id_jdl' => $jdl
  1063.                                 ),
  1064.                             );
  1065.                         $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');
  1066.                         $total_rows = count($data);
  1067.                     }
  1068.  
  1069.                     if ($total_rows > 0 ) {
  1070.                         foreach ($data as $key => $value) {
  1071.                             $record[] = array(
  1072.                                 'id' => $value->id_jdl.'/'.$thn_f,
  1073.                                 'text' => $value->semester.'/'.$value->kelas.' '.$value->nama_mk,
  1074.                                 'semester' => $value->semester,
  1075.                                 'kelas' => $value->kelas,
  1076.                                 'mk' => $value->nama_mk,
  1077.                                 'jns' => $value->jenis_jdl,
  1078.                                 'jml_mhs' => $this->kelas_model->count(array('id_jdl_kls' => $value->id_jdl)),
  1079.                                 'jml_lk' => $this->kelas_model->get_detail_data('count',array('mahasiswa'),NULL,array('id_jdl_kls' => $value->id_jdl, 'jk' => 'L')),
  1080.                                 'jml_pr' => $this->kelas_model->get_detail_data('count',array('mahasiswa'),NULL,array('id_jdl_kls' => $value->id_jdl, 'jk' => 'P')),
  1081.                                 );
  1082.                         }      
  1083.                         $result = array(
  1084.                             'kls' => $record,
  1085.                             'total_count' => $total_rows
  1086.                             );
  1087.                     }                  
  1088.                     else{
  1089.                         $result['kls'] = '';
  1090.                     }                  
  1091.                 }
  1092.                 elseif ($post['data'] =='riwayat_akademik_mhs') {
  1093.                     $where = array('id_mhs_kls' => $post['in_mhs']);
  1094.                     $select = array('id_thn_ak_jdl','thn_ajaran_jdl','kode_mk','nama_mk','jml_sks');
  1095.                     $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');
  1096.                     $record = array();
  1097.                     $count = 0;
  1098.                     $thn_ak = '';
  1099.                     foreach ($data as $key) {
  1100.                         $vars = explode('/',$key->thn_ajaran_jdl);
  1101.                         if ($vars[1] == 1) {
  1102.                             $semester = 'Ganjil';
  1103.                         }
  1104.                         else{
  1105.                             $semester = 'Genap';
  1106.                         }
  1107.                         $where = array_merge($where,array('id_thn_ak' => $key->id_thn_ak_jdl));
  1108.                         if ($key->id_thn_ak_jdl != $thn_ak) {
  1109.                             $thn_ak = $key->id_thn_ak_jdl;
  1110.                             $act = array(
  1111.                                 'sum' => array(
  1112.                                     'jml_sks' => 'total_sks'
  1113.                                     )
  1114.                                 );
  1115.                             $sks_count = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik','mata_kuliah'),$act,$where,TRUE,array('jml_sks'),NULL,'id_kelas');
  1116.                             $total_sks = $sks_count->total_sks;
  1117.  
  1118.                             $count_studi = $this->kelas_model->get_detail_data('count',array('jadwal','thn_akademik'),NULL,$where);
  1119.                             $count_aktif_studi = $this->kelas_model->get_detail_data('count',array('jadwal','thn_akademik'),NULL,array_merge($where,array('status_mhs_kls' => 1)));
  1120.                             $statik_studi = round($count_aktif_studi/$count_studi*100);
  1121.                             if ($statik_studi >= 50) {
  1122.                                 $status_aktif_mhs = 'Aktif';
  1123.                             }
  1124.                             else{
  1125.                                 $status_aktif_mhs = 'Tidak Aktif';
  1126.                             }
  1127.                         }
  1128.                         $arr = array(
  1129.                             'id_thn_ak_jdl' => rand_val(),
  1130.                             'thn_ajaran_jdl' => $vars[0].'/'.$semester,
  1131.                             'total_sks' => $total_sks,
  1132.                             'status_aktif_mhs' => $status_aktif_mhs,
  1133.                             'statik_aktif_mhs' => $statik_studi,
  1134.                             );
  1135.                         $record[] = array_merge((array)$key,$arr);
  1136.                         $count += $key->jml_sks;
  1137.                     }
  1138.                     $result = array(
  1139.                         'record_akademik' => $record,
  1140.                         'sks' => $count,
  1141.                         );
  1142.                 }
  1143.                 elseif ($post['data'] =='detail_data_ptk') {
  1144.                     $in_ptk = $post['in_ptk'];
  1145.                     $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');
  1146.                     $record_studi = array();
  1147.                     foreach ($data_studi as $key) {
  1148.                         $arr = array('tgl_ijazah_ptk' => date_convert($key->tgl_ijazah_ptk));
  1149.                         $record_studi[] = array_merge((array)$key,$arr);
  1150.                     }
  1151.  
  1152.                     $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');
  1153.                     $record_jadwal = array();
  1154.                     foreach ($data_jadwal as $key) {
  1155.                         $vars = explode('/',$key->thn_ajaran_jdl);
  1156.                         if ($vars[1] == 1) {
  1157.                             $semester = 'Ganjil';
  1158.                         }
  1159.                         else{
  1160.                             $semester = 'Genap';
  1161.                         }
  1162.                         $arr = array(
  1163.                             'thn_ajaran_jdl' => $vars[0].'/'.$semester,
  1164.                             'kelas' => $key->semester.'/'.$key->kelas,
  1165.                             );
  1166.                         $record_jadwal[] = array_merge((array)$key,$arr);
  1167.                     }
  1168.  
  1169.                     $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'));
  1170.                     $result = array(
  1171.                         'studi_ptk' => $record_studi,
  1172.                         'riwayat_mengajar' => $record_jadwal,
  1173.                         'penelitian_ptk' => $record_penelitian,
  1174.                         );
  1175.                 }
  1176.                 elseif ($post['data']=='check_mhs') {
  1177.                     $id_mhs_check = array();
  1178.                     $data = array();
  1179.                     if ($post['check'] == 'data_exists') {
  1180.                         if (isset($post['id_alumni'])) {
  1181.                             $id_mhs_check = array($post['id_alumni']);
  1182.                         }
  1183.                         elseif (isset($post['id_mhs_do'])) {
  1184.                             $id_mhs_check = array($post['id_mhs_do']);
  1185.                         }
  1186.                         else{
  1187.                             foreach ($post['id'] as $key) {
  1188.                                 $id_mhs = explode(' ',$key);
  1189.                                 $id_mhs_check[] = $id_mhs[0];
  1190.                             }
  1191.                         }
  1192.                         $count_check = count($id_mhs_check);
  1193.                         if ($count_check > 0) {
  1194.                             $act = array(
  1195.                                 'in' => array(
  1196.                                     'id' => $id_mhs_check,
  1197.                                     ),
  1198.                                 );
  1199.                             if (isset($post['id_alumni'])) {
  1200.                                 $select = array('id_alni AS in_mhs','id AS in_data','nisn AS nim','nama','tgl_lulus','tgl_yudisium');
  1201.                                 $join_table = array('alumni');
  1202.                             }
  1203.                             elseif (isset($post['id_mhs_do'])) {
  1204.                                 $select = array('id_DO AS in_mhs','id AS in_data','nisn AS nim','nama','tgl_drop_out','drop_out_reason');
  1205.                                 $join_table = array('mhs_do');
  1206.                             }
  1207.                             else {
  1208.                                 $select = array('nisn AS nim','nama');
  1209.                                 $join_table = array();
  1210.                             }
  1211.                             $data = $this->mahasiswa_model->get_detail_data('get',$join_table,$act,NULL,FALSE,$select);
  1212.                             $count_check = count($data);
  1213.                             if (count($data) == 0) {
  1214.                                 $message = 'Mahasiswa yang anda pilih tidak ada didalam database atau sudah terhapus!';
  1215.                             }
  1216.                         }
  1217.                         else{
  1218.                             $message = 'Silahkan pilih data mahasiswa!';
  1219.                         }
  1220.                     }
  1221.                     elseif ($post['check'] == 'alumni') {
  1222.                         $alumni_count = 0;
  1223.                         $mhs_do_count = 0;
  1224.                         foreach ($post['id'] as $key) {
  1225.                             $id_mhs = explode(' ',$key);
  1226.                             /*$check_alumni = $this->alumni_model->count(array('id_mhs_alni' => $id_mhs[0]));
  1227.                             $check_mhs_do = $this->mahasiswa_do_model->count(array('id_mhs_DO' => $id_mhs[0]));
  1228.                             if ($check_alumni == 0 && $check_mhs_do == 0) {
  1229.                                 $id_mhs_check[] = $id_mhs[0];
  1230.                             }
  1231.                             if ($check_alumni > 0) {
  1232.                                 $alumni_count++;
  1233.                             }
  1234.                             if ($check_mhs_do > 0) {
  1235.                                 $mhs_do_count++;
  1236.                             }*/
  1237.                             $id_mhs_check[] = $id_mhs[0];
  1238.                         }
  1239.                         $count_check = count($id_mhs_check);
  1240.                         if ($count_check > 0) {
  1241.                             $act = array(
  1242.                                 'where' => array('id_mhs_alni' => NULL,'id_mhs_DO' => NULL),
  1243.                                 'in' => array(
  1244.                                     'id' => $id_mhs_check,
  1245.                                     ),
  1246.                                 );
  1247.                             $data = $this->mahasiswa_model->get_detail_data('get',array('alumni','mhs_do'),$act,NULL,FALSE,array('nisn AS nim','nama'));
  1248.                             $count_check = count($data);
  1249.                             if (count($data) == 0) {
  1250.                                 $message = 'Mahasiswa yang anda pilih sudah ada dalam data alumni / drop out!';
  1251.                             }
  1252.                         }
  1253.                         /*elseif ($alumni_count > 0 && $mhs_do_count > 0) {
  1254.                             $message = 'Mahasiswa yang anda pilih ada yang sudah terdaftar sebagai alumni dan ada juga yang sudah drop out!';
  1255.                         }
  1256.                         elseif ($alumni_count > 0) {
  1257.                             $message = 'Mahasiswa yang anda pilih sudah terdaftar sebagai alumni!';
  1258.                         }
  1259.                         elseif ($mhs_do_count > 0) {
  1260.                             $message = 'Mahasiswa yang anda pilih sudah terdaftar sebagai mahasiswa yang drop out!';
  1261.                         }*/
  1262.                     }
  1263.  
  1264.                     if ($count_check > 0 && count($data) > 0) {
  1265.                         $result = array(
  1266.                             'data' => $data,
  1267.                             'total_rows' => $count_check,
  1268.                             );
  1269.                     }
  1270.                     else{
  1271.                         $result = array(
  1272.                             'total_rows' => $count_check,
  1273.                             'message' => $message,
  1274.                             );
  1275.                     }
  1276.                 }
  1277.                 elseif ($post['data']=='check_ptk') {
  1278.                     $id_ptk_check = array();
  1279.                     if ($post['check'] == 'data_exists') {
  1280.                         foreach ($post['id'] as $key) {
  1281.                             $id_ptk_check[] = $key;
  1282.                         }
  1283.                         $count_check = count($id_ptk_check);
  1284.                         if ($count_check > 0) {
  1285.                             $act = array(
  1286.                                 'in' => array(
  1287.                                     'id_ptk' => $id_ptk_check,
  1288.                                     ),
  1289.                                 );
  1290.                             $data = $this->ptk_model->get_detail_data('get',NULL,$act,NULL,FALSE,array('nuptk AS nidn','nama_ptk AS nama'));
  1291.                             $count_check = count($data);
  1292.                             if (count($data) == 0) {
  1293.                                 $message = 'Tenaga Pendidik yang anda pilih tidak ada didalam database atau sudah terhapus!';
  1294.                             }
  1295.                         }
  1296.                     }
  1297.  
  1298.                     if ($count_check > 0) {
  1299.                         $result = array(
  1300.                             'data' => $data,
  1301.                             'total_rows' => $count_check,
  1302.                             );
  1303.                     }
  1304.                     else{
  1305.                         $result = array(
  1306.                             'total_rows' => $count_check,
  1307.                             );
  1308.                     }
  1309.                 }
  1310.                 elseif ($post['data']=='check_mk') {
  1311.                     $id_mk_check = array();
  1312.                     if ($post['check'] == 'data_exists') {
  1313.                         foreach ($post['id'] as $key) {
  1314.                             $id_mk_check[] = $key;
  1315.                         }
  1316.                         $count_check = count($id_mk_check);
  1317.                         if ($count_check > 0) {
  1318.                             $act = array(
  1319.                                 'in' => array(
  1320.                                     'id_mk' => $id_mk_check,
  1321.                                     ),
  1322.                                 );
  1323.                             $data = $this->mata_kuliah_model->get_detail_data('get',NULL,$act,NULL,FALSE,array('kode_mk','nama_mk','jenis_jdl'));
  1324.                             $count_check = count($data);
  1325.                         }
  1326.                     }
  1327.  
  1328.                     if ($count_check > 0) {
  1329.                         $result = array(
  1330.                             'data' => $data,
  1331.                             'total_rows' => $count_check,
  1332.                             );
  1333.                     }
  1334.                     else{
  1335.                         $result = array(
  1336.                             'total_rows' => $count_check,
  1337.                             );
  1338.                     }
  1339.                 }
  1340.                 elseif ($post['data']=='status_jdl') {
  1341.                     if (isset($post['status_kelas'])) {
  1342.                         $status_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $post['status_kelas']),NULL,array('status_jdl'));
  1343.                         if ($status_kelas) {
  1344.                             foreach ($status_kelas as $key => $value) {
  1345.                                 $status = $value->status_jdl;
  1346.                             }
  1347.                         }
  1348.                         else{
  1349.                             $status = 'not_found';
  1350.                         }
  1351.                     }
  1352.                     elseif (isset($post['status'])) {
  1353.                         $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');
  1354.                         if ($status_kelas) {
  1355.                             foreach ($status_kelas as $key => $value) {
  1356.                                 $status = $value->status_jdl;
  1357.                             }
  1358.                         }
  1359.                         else{
  1360.                             $status = 'not_found';
  1361.                         }
  1362.                     }
  1363.                     $result = array(
  1364.                         'status_jdl' => $status,
  1365.                         );
  1366.                 }
  1367.                 else{
  1368.                     $result = array('status_action' => 'Not find...');
  1369.                 }
  1370.             }
  1371.             elseif ($param == 'ambil_id') {
  1372.                 if ($post['data']=='data_mhs') {
  1373.                     $id = array('id' => $post['id']);
  1374.                     $select_mhs = array('id','nisn','nama');
  1375.                     $record_mhs = $this->mahasiswa_model->get_by_search($id,FALSE,$select_mhs);
  1376.                     $result = array(                           
  1377.                             'total_rows' => count($record_mhs),
  1378.                             'record_mhs' => $record_mhs,
  1379.                             );                 
  1380.                 }
  1381.                 elseif ($post['data']=='data_ptk') {
  1382.                     $id = array('id_ptk' => $post['id_ptk']);
  1383.                     $select = array('id_ptk','nama_ptk','nuptk');
  1384.                     $record_ptk = $this->ptk_model->get_by_search($id,FALSE,$select);
  1385.                     $result = array(                           
  1386.                             'total_rows' => count($record_ptk),
  1387.                             'record_ptk' => $record_ptk,
  1388.                             );                 
  1389.                 }
  1390.                 elseif ($post['data']=='data_mk') {
  1391.                     $id = array('id_mk' => $post['id_mk']);
  1392.                     $select = array('id_mk','id_pd_mk','nama_prodi','jenjang_prodi','nama_mk');
  1393.                     $record_mk = $this->mata_kuliah_model->get_detail_data('get',array('prodi_mk'),NULL,$id,FALSE,$select);
  1394.                     $result = array(                           
  1395.                             'total_rows' => count($record_mk),
  1396.                             'record_mk' => $record_mk,
  1397.                             );                 
  1398.                 }
  1399.                 elseif ($post['data']=='data_jadwal_kuliah') {
  1400.                     $id = array('id_jdl' => $post['id_jdl']);
  1401.                     $select = array('id_jdl','id_thn_ak_jdl','id_pd_mk','nama_prodi','thn_ajaran_jdl','nama_mk','semester','kelas','status_jdl','jenis_jdl');
  1402.                     $record_jadwal = $this->jadwal_model->get_detail_data('get',array('thn_akademik','mata_kuliah','prodi_mk'),NULL,$id,NULL,$select);
  1403.                     $result = array(                           
  1404.                             'total_rows' => count($record_jadwal),
  1405.                             'record_jdl' => $record_jadwal,
  1406.                             );                 
  1407.                 }                              
  1408.                 elseif ($post['data']=='kelas_mhs') {
  1409.                     $id = array('id_kelas' => $post['id_kls']);
  1410.                     $select = array('id_kelas','id_jdl_kls','nama','nisn','nama_prodi','thn_ajaran_jdl','nama_mk','semester','kelas','status_jdl','jenis_jdl');
  1411.                     $record_mhs = $this->kelas_model->get_detail_data('get',array('jadwal','thn_akademik','mahasiswa','mata_kuliah','prodi_mk'),NULL,$id,NULL,$select);
  1412.                     $result = array(                           
  1413.                             'total_rows' => count($record_mhs),
  1414.                             'record_mhs' => $record_mhs,
  1415.                             );                 
  1416.                 }
  1417.                 elseif ($post['data']=='data_alumni') {
  1418.                     $id = array('id_mhs_alni' => $post['id']);
  1419.                     $select_mhs = array('id_mhs_alni AS in_mhs','nisn AS nim','nama');
  1420.                     $record_mhs = $this->mahasiswa_model->get_detail_data('get',array('alumni'),NULL,$id,FALSE,$select_mhs);
  1421.                     $result = array(                           
  1422.                             'total_rows' => count($record_mhs),
  1423.                             'record_mhs' => $record_mhs,
  1424.                             );                 
  1425.                 }
  1426.                 else{
  1427.                     $result = array('status_action' => 'Not find...');
  1428.                 }
  1429.             }
  1430.             elseif ($param == 'update') {
  1431.                 if (isset($post['data_mhs'])) {
  1432.                     $rules = $this->mahasiswa_model->rules;
  1433.                     $this->form_validation->set_rules($rules);
  1434.                     $this->id_mhs = $post['id_mhs'];
  1435.  
  1436.                     if ($this->form_validation->run() == TRUE) {
  1437.                         $id_mhs = array('id' => $post['id_mhs']);
  1438.                         $nama_mhs = strtoupper($post['nama']);
  1439.                         $tmp_lhr = ucwords($post['tmp_lhr']);
  1440.                         $alamat = ucwords($post['alamat']);
  1441.                         $dusun = ucwords($post['dusun']);
  1442.                         $kelurahan = ucwords($post['kelurahan']);
  1443.                         $kecamatan = ucwords($post['kecamatan']);
  1444.                         $email = strtolower($post['email']);
  1445.                         $data_mhs = array(                     
  1446.                             'nisn' => $post['nisn'],
  1447.                             'nama' => $nama_mhs,
  1448.                             'thn_angkatan' => $post['thn_angkatan'],
  1449.                             'id_pd_mhs' => $post['id_pd_mhs'],
  1450.                             'jk' => $post['jk'],
  1451.                             'tmp_lhr' => $tmp_lhr,
  1452.                             'tgl_lhr' => $post['tgl_lhr'],
  1453.                             'nik' => $post['nik'],
  1454.                             'agama' => $post['agama'],
  1455.                             'alamat' => $alamat,
  1456.                             'rt' => $post['rt'],
  1457.                             'rw' => $post['rw'],
  1458.                             'dusun' => $dusun,
  1459.                             'kelurahan' => $kelurahan,
  1460.                             'kecamatan' => $kecamatan,
  1461.                             'kode_pos' => $post['kode_pos'],
  1462.                             'jns_tinggal' => $post['jns_tinggal'],
  1463.                             'alt_trans' => $post['alt_trans'],
  1464.                             'tlp' => $post['tlp'],
  1465.                             'hp' => $post['hp'],
  1466.                             'email' => $email,
  1467.                             'photo_mhs' => $post['photo_mhs']
  1468.                             );
  1469.                         $save_data_mhs = $this->mahasiswa_model->update($data_mhs,$id_mhs);
  1470.                         if ($save_data_mhs) {
  1471.                             /*if ($post['nisn'] != $post['nisn_sebelumnya']) {
  1472.                                 $id_user = array(
  1473.                                     'id_user_detail' => $post['id_mhs'],
  1474.                                     'level_akses' => 'mhs'
  1475.                                     );
  1476.                                 $nisn_user = array('username' => $post['nisn']);
  1477.                                 $this->user_model->update($nisn_user,$id_user);
  1478.                             }*/
  1479.  
  1480.                             $id_ortu = array('id_ortu' => $post['id_ortu']);
  1481.                             $nm_ayah = strtoupper($post['nm_ayah']);
  1482.                             $nm_ibu = strtoupper($post['nm_ibu']);
  1483.                             $nm_wali = strtoupper($post['nm_wali']);
  1484.                             $data_ortu_wali = array(                               
  1485.                                 'nm_ayah' => $nm_ayah,
  1486.                                 'thn_lhr_ayah' => $post['thn_lhr_ayah'],
  1487.                                 'pendi_ayah' => $post['pendi_ayah'],
  1488.                                 'pekerjaan_ayah' => $post['pekerjaan_ayah'],
  1489.                                 'penghasilan_ayah' => $post['penghasilan_ayah'],                               
  1490.                                 'nik_ayah' => $post['nik_ayah'],
  1491.                                 'nm_ibu' => $nm_ibu,
  1492.                                 'thn_lhr_ibu' => $post['thn_lhr_ibu'],
  1493.                                 'pendi_ibu' => $post['pendi_ibu'],
  1494.                                 'pekerjaan_ibu' => $post['pekerjaan_ibu'],
  1495.                                 'penghasilan_ibu' => $post['penghasilan_ibu'],                             
  1496.                                 'nik_ibu' => $post['nik_ibu'],
  1497.                                 'nm_wali' => $nm_wali,
  1498.                                 'thn_lhr_wali' => $post['thn_lhr_wali'],
  1499.                                 'pendi_wali' => $post['pendi_wali'],
  1500.                                 'pekerjaan_wali' => $post['pekerjaan_wali'],
  1501.                                 'penghasilan_wali' => $post['penghasilan_wali'],                               
  1502.                                 'nik_wali' => $post['nik_wali'],
  1503.                                 );
  1504.                             $save_data_ortu = $this->ortu_model->update($data_ortu_wali,$id_ortu);
  1505.                             if ($save_data_ortu) {
  1506.                                 $data = 'data_mhs';
  1507.                                 $result = array(
  1508.                                     'status' => 'success',
  1509.                                     'data' => $data,
  1510.                                     'in'=>$post['id_mhs'],
  1511.                                     );
  1512.                             }
  1513.                             else{
  1514.                                 $result = array('status' => 'failed_db');
  1515.                             }
  1516.                         }
  1517.                         else{
  1518.                             $result = array('status' => 'failed_db');
  1519.                         }
  1520.                     }
  1521.                     else {
  1522.                         $result = array(
  1523.                             'status' => 'failed',
  1524.                             'errors'=> $this->form_validation->error_array()
  1525.                             );
  1526.                     }
  1527.                 }
  1528.                 elseif (isset($post['data_ptk'])) {
  1529.                     $rules = $this->ptk_model->rules;
  1530.                     $this->id_ptk = $post['id_ptk'];
  1531.                     $this->form_validation->set_rules($rules);
  1532.  
  1533.                     if ($this->form_validation->run() == TRUE) {
  1534.                         $id_ptk = array('id_ptk' => $post['id_ptk']);
  1535.                         $nama_ptk = ucwords(strtolower($post['nama_ptk']));
  1536.                         $tmp_lhr = ucwords($post['tmp_lhr_ptk']);
  1537.                         $data_ptk = array(                         
  1538.                             'nama_ptk' => $nama_ptk,
  1539.                             'nuptk' => $post['nuptk'],
  1540.                             'nip' => $post['nip'],
  1541.                             'jk_ptk' => $post['jk_ptk'],
  1542.                             'tmp_lhr_ptk' => $tmp_lhr,
  1543.                             'tgl_lhr_ptk' => $post['tgl_lhr_ptk'],                         
  1544.                             'status_ptk' => $post['status_ptk'],
  1545.                             'status_aktif_ptk' =>$post['status_aktif_ptk'],
  1546.                             'jenjang' => $post['jenjang'], 
  1547.                             'jurusan_prodi' => $post['jurusan_prodi'],
  1548.                             'nik_ptk' => $post['nik_ptk'],
  1549.                             'agama_ptk' => $post['agama_ptk'],
  1550.                             'alamat_ptk' => ucwords($post['alamat_ptk']),
  1551.                             'rt_ptk' => $post['rt_ptk'],
  1552.                             'rw_ptk' => $post['rw_ptk'],
  1553.                             'dusun_ptk' => ucwords($post['dusun_ptk']),
  1554.                             'kelurahan_ptk' => ucwords($post['kelurahan_ptk']),
  1555.                             'kecamatan_ptk' => ucwords($post['kecamatan_ptk']),
  1556.                             'kode_pos_ptk' => $post['kode_pos_ptk'],
  1557.                             'tlp_ptk' => $post['tlp_ptk'],
  1558.                             'hp_ptk' => $post['hp_ptk'],
  1559.                             'email_ptk' => $post['email_ptk'],
  1560.                             );
  1561.                         $update_data_ptk = $this->ptk_model->update($data_ptk,$id_ptk);
  1562.                         if ($update_data_ptk) {
  1563.                             /*if ($post['nuptk'] != $post['nuptk_sebelumnya']) {
  1564.                                 $id_user = array(
  1565.                                     'id_user_detail' => $post['id_ptk'],
  1566.                                     'level_akses' => 'ptk'
  1567.                                 );
  1568.                                 if (!empty($post['nuptk'])) {                                  
  1569.                                     $username = array('username' => $post['nuptk']);
  1570.                                 }
  1571.                                 else{
  1572.                                     for ($i=0; $i <= 1; $i++) {
  1573.                                         $user = rand(10000000000000,99999999999999).$post['id_ptk'];
  1574.                                         $check_user = array('username' => $user);
  1575.                                         $total_rows = $this->user_model->count($check_user);
  1576.                                         if ($total_rows > 0) {
  1577.                                             $i = 0;
  1578.                                         }
  1579.                                         else{
  1580.                                             $i = 1;
  1581.                                         }
  1582.                                     }
  1583.                                     $username = array('username' => $user);
  1584.                                 }                              
  1585.                                 $this->user_model->update($username,$id_user);
  1586.                             }*/
  1587.                             $data = 'data_ptk';
  1588.                             $result = array(
  1589.                                 'status' => 'success',
  1590.                                 'data' => $data,
  1591.                                 'in'=>$post['id_ptk'],
  1592.                                 );                         
  1593.                         }
  1594.                         else{
  1595.                             $result = array('status' => 'failed_db');
  1596.                         }
  1597.                     }
  1598.                     else {
  1599.                         $result = array(
  1600.                             'status' => 'failed',
  1601.                             'errors'=> $this->form_validation->error_array()
  1602.                             );
  1603.                     }
  1604.                 }
  1605.                 elseif (isset($post['data_studi_ptk'])) {
  1606.                     $rules = $this->ptk_studi_model->rules;
  1607.                     $this->form_validation->set_rules($rules);
  1608.  
  1609.                     if ($this->form_validation->run() == TRUE) {
  1610.                         $in_ptk = $post['id_ptk_studi'];
  1611.                         $data_studi = array(                           
  1612.                             'id_ptk_studi' => $in_ptk,
  1613.                             'nama_pt_studi' => ucwords($post['nama_pt_studi']),
  1614.                             'studi_ptk' => ucwords($post['studi_ptk']),
  1615.                             'jenjang_studi_ptk' => $post['jenjang_studi_ptk'],
  1616.                             'gelar_ak_ptk' => $post['gelar_ak_ptk'],
  1617.                             'tgl_ijazah_ptk' => $post['tgl_ijazah_ptk'],
  1618.                             );
  1619.                         $update_data_studi = $this->ptk_studi_model->update($data_studi,array('id_studi' => $post['id_studi']));
  1620.                         if ($update_data_studi) {
  1621.                             $record_studi = array();
  1622.                             if (isset($post['ptk_detail'])) {
  1623.                                 $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');
  1624.                                 $record_studi = array();
  1625.                                 foreach ($data_studi as $key) {
  1626.                                     $arr = array('tgl_ijazah_ptk' => date_convert($key->tgl_ijazah_ptk));
  1627.                                     $record_studi[] = array_merge((array)$key,$arr);
  1628.                                 }
  1629.                             }
  1630.                             $data = 'data_studi_ptk';
  1631.                             $result = array(
  1632.                                 'status' => 'success',
  1633.                                 'data' => $data,
  1634.                                 'in_ptk' => @$post['ptk_detail'],
  1635.                                 'studi_ptk' => $record_studi
  1636.                                 );
  1637.                         }
  1638.                         else{
  1639.                             $result = array('status' => 'failed_db');
  1640.                         }
  1641.                     }
  1642.                     else {
  1643.                         $result = array(
  1644.                             'status' => 'failed',
  1645.                             'errors'=> $this->form_validation->error_array()
  1646.                             );
  1647.                     }
  1648.                 }
  1649.                 elseif (isset($post['data_penelitian_ptk'])) {
  1650.                     $rules = $this->ptk_penelitian_model->rules;
  1651.                     $this->form_validation->set_rules($rules);
  1652.  
  1653.                     if ($this->form_validation->run() == TRUE) {
  1654.                         $in_ptk = $post['id_ptk_rsch'];
  1655.                         $data_penelitian = array(                          
  1656.                             'id_ptk_rsch' => $in_ptk,
  1657.                             'judul_penelitian' => ucwords($post['judul_penelitian']),
  1658.                             'bidang_ilmu' => ucwords($post['bidang_ilmu']),
  1659.                             'lembaga' => $post['lembaga'],
  1660.                             );
  1661.                         $update_data_penelitian = $this->ptk_penelitian_model->update($data_penelitian,array('id_penelitian_ptk' => $post['id_penelitian_ptk']));
  1662.                         if ($update_data_penelitian) {
  1663.                             $record_penelitian = array();
  1664.                             if (isset($post['ptk_detail'])) {
  1665.                                 $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'));
  1666.                             }
  1667.                             $data = 'data_penelitian_ptk';
  1668.                             $result = array(
  1669.                                 'status' => 'success',
  1670.                                 'data' => $data,
  1671.                                 'in_ptk' => $post['ptk_detail'],
  1672.                                 'penelitian_ptk' => $record_penelitian
  1673.                                 );                         
  1674.                         }
  1675.                         else{
  1676.                             $result = array('status' => 'failed_db');
  1677.                         }
  1678.                     }
  1679.                     else {
  1680.                         $result = array(
  1681.                             'status' => 'failed',
  1682.                             'errors'=> $this->form_validation->error_array()
  1683.                             );
  1684.                     }
  1685.                 }
  1686.                 elseif (isset($post['data_mk'])) {
  1687.                     $rules = $this->mata_kuliah_model->rules;
  1688.                     $this->form_validation->set_rules($rules);
  1689.                     $this->id_mk = $post['id_mk'];
  1690.                     if (isset($post['id_pd_mk'])) {
  1691.                         $this->mk_pd = $post['id_pd_mk'];
  1692.                     }
  1693.  
  1694.                     if ($this->form_validation->run() == TRUE) {
  1695.                         $data_mk = array(                          
  1696.                             'kode_mk' => strtoupper($post['kode_mk']),
  1697.                             'nama_mk' => ucwords($post['nama_mk']),
  1698.                             'id_pd_mk' => $post['id_pd_mk'],
  1699.                             'jml_sks' => $post['jml_sks'],
  1700.                             'jenis_jdl' => $post['jenis_jdl'],
  1701.                             );
  1702.                         $id_mk = array('id_mk' => $post['id_mk']);
  1703.                         $update_data_mk = $this->mata_kuliah_model->update($data_mk,$id_mk);
  1704.                         if ($update_data_mk) {
  1705.                             $data = 'data_mk';
  1706.                             $result = array(
  1707.                                 'status' => 'success',
  1708.                                 'data' => $data
  1709.                                 );                         
  1710.                         }
  1711.                         else{
  1712.                             $result = array('status' => 'failed_db');
  1713.                         }
  1714.                     }
  1715.                     else {
  1716.                         $result = array(
  1717.                             'status' => 'failed',
  1718.                             'errors'=> $this->form_validation->error_array()
  1719.                             );
  1720.                     }
  1721.                 }
  1722.                 elseif (isset($post['data_jadwal_kuliah'])) {
  1723.                     $this->jam_awal = $post['jam_mulai_jdl'];
  1724.                     $rules = $this->jadwal_model->rules;
  1725.                     $this->form_validation->set_rules($rules);
  1726.  
  1727.                     if ($this->form_validation->run() == TRUE) {
  1728.                         $data_jadwal = array(
  1729.                             'id_thn_ak_jdl' => $post['id_thn_ak_jdl'],
  1730.                             'id_mk_jdl' => $post['id_mk_jdl'],
  1731.                             'id_ptk_jdl' => $post['id_ptk_jdl'],
  1732.                             'hari_jdl' => $post['hari_jdl'],
  1733.                             'jam_mulai_jdl' => $post['jam_mulai_jdl'],
  1734.                             'jam_akhir_jdl' => $post['jam_akhir_jdl'],
  1735.                             'semester' => $post['semester'],
  1736.                             'kelas' => $post['kelas'],
  1737.                             'ruang' => strtoupper($post['ruang']),
  1738.                             );
  1739.                         $id_jdl = array('id_jdl' => $post['id_jdl']);
  1740.                         $update_data_jadwal = $this->jadwal_model->update($data_jadwal,$id_jdl);
  1741.                         if ($update_data_jadwal) {
  1742.                             $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'));
  1743.                             $data = 'data_jadwal';
  1744.                             $result = array(
  1745.                                 'status' => 'success',
  1746.                                 'data' => $data,
  1747.                                 'thn' => $thn,
  1748.                                 );                         
  1749.                         }
  1750.                         else{
  1751.                             $result = array('status' => 'failed_db');
  1752.                         }
  1753.                     }
  1754.                     else {
  1755.                         $result = array(
  1756.                             'status' => 'failed',
  1757.                             'errors'=> $this->form_validation->error_array()
  1758.                             );
  1759.                     }
  1760.                 }
  1761.                 elseif (isset($post['status_thn_ajaran'])) {
  1762.                     if ($post['status_thn_ajaran'] == 'true') {
  1763.                         $status = 1;
  1764.                     }
  1765.                     else{
  1766.                         $status = 0;
  1767.                     }
  1768.                     $data = array('status_jdl' => $status);
  1769.                     $where = array('thn_ajaran_jdl' => $post['thn']);
  1770.                     if ($status == 1) {
  1771.                         $update_status_noaktif = $this->jadwal_model->update(array('status_jdl' => 0),array('status_jdl' => 1));
  1772.                     }
  1773.                     $update_status_aktif = $this->jadwal_model->update($data,$where);
  1774.                     if ($update_status_aktif || $update_status_noaktif && $update_status_aktif) {
  1775.                         $result = array(
  1776.                             'status' => 'success',
  1777.                             'status_user' => $status,
  1778.                             );
  1779.                     }
  1780.                     else{
  1781.                         $result = array(
  1782.                             'status' => 'failed',
  1783.                             'status_user' => $status,
  1784.                             );
  1785.                     }
  1786.                 }
  1787.                 elseif (isset($post['update_kelas'])) {
  1788.                     if ($post['update_kelas'] == '') {
  1789.                         if (isset($post['kls_mhs'])) {
  1790.                             $var = explode('/', $post['kls_mhs']);
  1791.                             $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');
  1792.                             $kelas_l = $l_kls->id_jdl_kls;
  1793.                             $mhs = $l_kls->id_mhs_kls;
  1794.                             $count = $this->kelas_model->count(array('id_jdl_kls' => $var[0], 'id_mhs_kls' => $mhs));
  1795.                             if ($count == 0) {
  1796.                                 $status_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $var[0]),TRUE,array('status_jdl'));
  1797.                                 $status = $status_kelas->status_jdl;
  1798.                                 if (@$status == 1) {
  1799.                                     $data = array('id_jdl_kls' => $var[0]);
  1800.                                     $where = array('id_kelas' => $var[1]);
  1801.                                     $update_kelas = $this->kelas_model->update($data,$where);
  1802.                                     if ($update_kelas) {
  1803.                                         $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
  1804.                                         $data_mhs = $this->kelas_model->get_detail_data('get',array('jadwal','mahasiswa','thn_angkatan'),NULL,array('id_jdl' => $kelas_l),NULL,$select_daftar_mhs);
  1805.                                         $result = array(
  1806.                                             'status' => 'success',
  1807.                                             'data' => 'data_mhs_kls',
  1808.                                             'record_mhs' => $data_mhs,
  1809.                                             'c_kls' => $kelas_l,
  1810.                                             );
  1811.                                     }
  1812.                                     else{
  1813.                                         $result = array(
  1814.                                             'status' => 'failed',
  1815.                                             );
  1816.                                     }
  1817.                                 }
  1818.                                 else{
  1819.                                     $error = array('mhs-kelas' => 'Anda tidak bisa memindahkan kelas mahasiswa saat ini');
  1820.                                     $result = array('status' => 'failed', 'errors' => $error);
  1821.                                 }
  1822.                             }
  1823.                             else{
  1824.                                 $error = array('mhs-kelas' => 'Mahasiswa yang anda akan pindahkan ke dalam kelas ini sudah ada');
  1825.                                 $result = array('status' => 'failed', 'errors' => $error);
  1826.                             }
  1827.                         }
  1828.                         else{
  1829.                             $error = array('mhs-kelas' => 'Silahkan pilih kelas yang dituju');
  1830.                             $result = array('status' => 'failed', 'errors' => $error);
  1831.                         }
  1832.                     }
  1833.                     elseif ($post['update_kelas'] == 'data_mhs_kls'){
  1834.                         if ($post['kls_mhs'] != '') {
  1835.                             $var = explode('/', $post['kls_mhs']);
  1836.                             $status_kelas = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $var[0]),TRUE,array('status_jdl'));
  1837.                             $status = $status_kelas->status_jdl;
  1838.                             if (@$status == 1) {
  1839.                                 foreach ($post['id'] as $key => $value_kelas) {
  1840.                                     $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');
  1841.                                     $kelas_l = $l_kls->id_jdl_kls;
  1842.                                     $mhs = $l_kls->id_mhs_kls;
  1843.                                     $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));
  1844.                                     if ($count == 0) {
  1845.                                         $data[] = array(
  1846.                                             'id_kelas' => $value_kelas,
  1847.                                             'id_jdl_kls' => $var[0],
  1848.                                             );
  1849.                                     }
  1850.                                 }
  1851.                                 if (isset($data)) {
  1852.                                     $update_kelas = $this->kelas_model->update($data,'id_kelas',TRUE);
  1853.                                 }
  1854.                                 if (isset($update_kelas) && $update_kelas > 0) {
  1855.                                     $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
  1856.                                     $data_mhs = $this->kelas_model->get_detail_data('get',array('jadwal','mahasiswa','thn_angkatan'),NULL,array('id_jdl' => $kelas_l),NULL,$select_daftar_mhs);
  1857.                                     $result = array(
  1858.                                         'status' => 'success',
  1859.                                         'record_mhs' => $data_mhs,
  1860.                                         'c_kls' => $post['c_kls'],
  1861.                                         );
  1862.                                 }
  1863.                                 else{
  1864.                                     $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');
  1865.                                     $result = array('status' => 'failed', 'errors' => $error);
  1866.                                 }
  1867.                             }
  1868.                             else{
  1869.                                 $error = array('mhs-kelas' => 'Anda tidak bisa memindahkan kelas mahasiswa saat ini');
  1870.                                 $result = array('status' => 'failed', 'errors' => $error);
  1871.                             }
  1872.                         }
  1873.                         else{
  1874.                             $error = array('mhs-kelas' => 'Silahkan pilih kelas yang dituju');
  1875.                             $result = array('status' => 'failed', 'errors' => $error);
  1876.                         }
  1877.                     }
  1878.                 }
  1879.                 elseif (isset($post['data_alumni'])) {
  1880.                     $rules = $this->alumni_model->rules;
  1881.                     $this->form_validation->set_rules($rules);
  1882.  
  1883.                     if ($this->form_validation->run() == TRUE) {
  1884.                         $data_alumni = array(
  1885.                             'tgl_lulus' => $post['tgl_lulus'],
  1886.                             'tgl_yudisium' => $post['tgl_yudisium'],
  1887.                             );
  1888.                         $id_alumni = array('id_alni' => $post['in_mhs']);
  1889.                         $update_data_alumni = $this->alumni_model->update($data_alumni,$id_alumni);
  1890.                         if ($update_data_alumni) {
  1891.                             $data = 'data_alumni';
  1892.                             $result = array(
  1893.                                 'status' => 'success',
  1894.                                 'data' => $data,
  1895.                                 'in' => $post['in_mhs']
  1896.                                 );                         
  1897.                         }
  1898.                         else{
  1899.                             $result = array('status' => 'failed_db');
  1900.                         }
  1901.                     }
  1902.                     else {
  1903.                         $result = array(
  1904.                             'status' => 'failed',
  1905.                             'errors'=> $this->form_validation->error_array()
  1906.                             );
  1907.                     }
  1908.                 }
  1909.                 else{
  1910.                     $result = array('status_action' => 'Not find...');
  1911.                 }
  1912.             }
  1913.             elseif ($param == 'delete') {
  1914.                 if (isset($post['data_mhs'])) {
  1915.                     $id_mhs = $post['id_mhs'];
  1916.  
  1917.                     $delete_mhs_by = array('id' => $id_mhs);
  1918.                     $delete_ortu_by = array('id_mhs_ortu' => $id_mhs);
  1919.                     $delete_user_by = array(
  1920.                         'id_user_detail' => $id_mhs,
  1921.                         'level_akses' => 'mhs'
  1922.                         );
  1923.  
  1924.                     $detail = $this->mahasiswa_model->get($id_mhs,TRUE);
  1925.                     $delete_mhs = $this->mahasiswa_model->delete_by($delete_mhs_by);
  1926.                     $delete_ortu = $this->ortu_model->delete_by($delete_ortu_by);
  1927.                     $delete_user = $this->user_model->delete_by($delete_user_by);
  1928.  
  1929.                     if ($delete_mhs && $delete_ortu && $delete_user) {
  1930.                         $data = 'data_mhs';
  1931.                         if ($detail->photo_mhs != '') {
  1932.                             unlink('./uploads/mhs-photo/'.$detail->photo_mhs);
  1933.                         }
  1934.                         $result = array(
  1935.                             'status' => 'success',
  1936.                             'data' => $data,
  1937.                             'delete_id' => $id_mhs
  1938.                             );
  1939.                     }
  1940.                     else{
  1941.                         $result = array('status' => 'failed_db');
  1942.                     }
  1943.                 }
  1944.                 elseif (isset($post['data_ptk'])) {
  1945.                     $id_ptk = $post['id_ptk'];
  1946.                     $delete_ptk_by = array('id_ptk' => $id_ptk);
  1947.                     $delete_user_by = array(
  1948.                         'id_user_detail' => $id_ptk,
  1949.                         'level_akses' => 'ptk'
  1950.                         );
  1951.  
  1952.                     $detail = $this->ptk_model->get($id_ptk,TRUE);
  1953.                     $delete_ptk = $this->ptk_model->delete_by($delete_ptk_by);                     
  1954.                     $delete_user = $this->user_model->delete_by($delete_user_by);
  1955.  
  1956.                     if ($delete_ptk && $delete_user) {                         
  1957.                         $data = 'data_ptk';
  1958.                         if ($detail->photo_ptk != '') {
  1959.                             unlink('./uploads/ptk-photo/'.$detail->photo_ptk);
  1960.                         }
  1961.                         $result = array(
  1962.                             'status' => 'success',
  1963.                             'data' => $data,
  1964.                             'delete_id' => $id_ptk
  1965.                             );
  1966.                     }
  1967.                     else{
  1968.                         $result = array('status' => 'failed_db');
  1969.                     }
  1970.                 }
  1971.                 elseif (isset($post['data_studi_ptk'])) {
  1972.                     $id_studi = $post['id_studi'];
  1973.                     $delete_studi = $this->ptk_studi_model->delete_by(array('id_studi' => $id_studi));
  1974.                     if ($delete_studi) {
  1975.                         $record_studi = array();
  1976.                         if (isset($post['ptk_detail']) && $post['id_ptk_studi'] == $post['ptk_detail']) {
  1977.                             $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');
  1978.                             foreach ($data_studi as $key) {
  1979.                                 $arr = array('tgl_ijazah_ptk' => date_convert($key->tgl_ijazah_ptk));
  1980.                                 $record_studi[] = array_merge((array)$key,$arr);
  1981.                             }
  1982.                         }
  1983.                         $data = 'data_studi_ptk';
  1984.                         $result = array(
  1985.                             'status' => 'success',
  1986.                             'data' => $data,
  1987.                             'in_ptk' => @$post['id_ptk_studi'],
  1988.                             'studi_ptk' => $record_studi
  1989.                             );                         
  1990.                     }
  1991.                     else{
  1992.                         $result = array('status' => 'failed_db');
  1993.                     }
  1994.                 }
  1995.                 elseif (isset($post['data_penelitian_ptk'])) {
  1996.                     $id_penelitian_ptk = $post['id_penelitian_ptk'];
  1997.                     $delete_penelitian_ptk = $this->ptk_penelitian_model->delete_by(array('id_penelitian_ptk' => $id_penelitian_ptk));
  1998.                     if ($delete_penelitian_ptk) {
  1999.                         $record_penelitian = array();
  2000.                         if (isset($post['ptk_detail']) && $post['id_ptk_rsch'] == $post['ptk_detail']) {
  2001.                             $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'));
  2002.                         }
  2003.                         $data = 'data_penelitian_ptk';
  2004.                         $result = array(
  2005.                             'status' => 'success',
  2006.                             'data' => $data,
  2007.                             'in_ptk' => @$post['id_ptk_rsch'],
  2008.                             'penelitian_ptk' => $record_penelitian
  2009.                             );                         
  2010.                     }
  2011.                     else{
  2012.                         $result = array('status' => 'failed_db');
  2013.                     }
  2014.                 }
  2015.                 elseif (isset($post['data_mk'])) {
  2016.                     $id_mk = $post['id_mk'];
  2017.                     $delete_mk_by = array('id_mk' => $id_mk);
  2018.                     $delete_mk = $this->mata_kuliah_model->delete_by($delete_mk_by);                   
  2019.  
  2020.                     if ($delete_mk) {
  2021.                         $data = 'data_mk';
  2022.                         $result = array(
  2023.                             'status' => 'success',
  2024.                             'data' => $data
  2025.                             );
  2026.                     }
  2027.                     else{
  2028.                         $result = array('status' => 'failed_db');
  2029.                     }
  2030.                 }
  2031.                 elseif (isset($post['data_jadwal_kuliah'])) {
  2032.                     $var = explode('/', $post['id_jdl']);
  2033.                     $status = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $var[0]),TRUE,array('status_jdl'));
  2034.                     $status = $status->status_jdl;
  2035.                     if ($status == 1) {
  2036.                         $delete_jadwal_by = array('id_jdl' => $var[0]);
  2037.                         $delete_jadwal = $this->jadwal_model->delete_by($delete_jadwal_by);
  2038.  
  2039.                         if ($delete_jadwal) {
  2040.                             $data = 'data_jadwal';
  2041.                             $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]));
  2042.                             $result = array(
  2043.                                 'status' => 'success',
  2044.                                 'data' => $data
  2045.                                 );
  2046.                             if ($count_thn > 0) {
  2047.                                 $result['thn'] = $var[2];
  2048.                                 $result['pd'] = $var[1];
  2049.                             }
  2050.                             else{
  2051.                                 $result['thn'] = '';
  2052.                             }
  2053.                         }
  2054.                         else{
  2055.                             $result = array('status' => 'failed_db');
  2056.                         }
  2057.                     }
  2058.                     else{
  2059.                         $result = array(
  2060.                             'status' => 'no_active_thn_jdl',
  2061.                             'error_message' => 'Gagal menghapus jadwal, karena tahun akademik jadwal ini tidak aktif/diterapkan'
  2062.                             );
  2063.                     }
  2064.                 }
  2065.                 elseif (isset($post['data_mhs_kls'])) {
  2066.                     $var = explode('/', $post['id_mhs_kls']);
  2067.                     $id_mhs = $var[0];
  2068.                     $id_kelas = $var[1];
  2069.                     $status = $this->jadwal_model->get_detail_data('get',array('thn_akademik'),NULL,array('id_jdl' => $id_kelas),TRUE,array('status_jdl'));
  2070.                     $status = $status->status_jdl;
  2071.                     if ($status == 1) {
  2072.                         $delete_mhs_by = array('id_kelas' => $id_mhs);
  2073.                         $delete_mhs_kls = $this->kelas_model->delete_by($delete_mhs_by);
  2074.  
  2075.                         if ($delete_mhs_kls) {
  2076.                             $data = 'data_mhs_kls';
  2077.                             $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
  2078.                             $data_mhs = $this->kelas_model->get_detail_data('get',array('mahasiswa','thn_angkatan'),NULL,array('id_jdl_kls' => $id_kelas),NULL,$select_daftar_mhs);
  2079.                             $result = array(
  2080.                                 'status' => 'success',
  2081.                                 'data' => $data,
  2082.                                 'record_mhs' => $data_mhs,
  2083.                                 'c_kls' => $id_kelas,
  2084.                                 );
  2085.                         }
  2086.                         else{
  2087.                             $result = array('status' => 'failed_db');
  2088.                         }
  2089.                     }
  2090.                     else{
  2091.                         $result = array(
  2092.                             'status' => 'no_active_thn_kls',
  2093.                             'error_message' => 'Anda tidak bisa menghapus mahasiswa dari kelas ini karena tahun akademik kelas tidak sedang diterapkan'
  2094.                             );
  2095.                     }
  2096.                 }
  2097.                 elseif (isset($post['data_alumni'])) {
  2098.                     $id_alumni = array('id_mhs_alni' => $post['in_mhs']);
  2099.                     $delete_alumni = $this->alumni_model->delete_by($id_alumni);
  2100.                     if ($delete_alumni) {
  2101.                         $data = 'data_alumni';
  2102.                         $result = array(
  2103.                             'status' => 'success',
  2104.                             'data' => $data,
  2105.                             );
  2106.                     }
  2107.                     else{
  2108.                         $result = array('status' => 'failed_db');
  2109.                     }
  2110.                 }
  2111.                 elseif (isset($post['data_mhs_do'])) {
  2112.                     $id_mhs_do = array('id_mhs_DO' => $post['in_mhs']);
  2113.                     $delete_mhs_do = $this->mahasiswa_do_model->delete_by($id_mhs_do);
  2114.                     if ($delete_mhs_do) {
  2115.                         $data = 'data_mhs_do';
  2116.                         $result = array(
  2117.                             'status' => 'success',
  2118.                             'data' => $data,
  2119.                             );
  2120.                     }
  2121.                     else{
  2122.                         $result = array('status' => 'failed_db');
  2123.                     }
  2124.                 }
  2125.                 elseif (isset($post['data'])) {
  2126.                     if ($post['data'] == 'data_mhs') {
  2127.                         $id = $post['id'];
  2128.                         $id_mhs = array();
  2129.                         $photo_mhs = array();
  2130.                         foreach ($id as $key) {
  2131.                             $id_mhs[] = $key;
  2132.                             $id = $key;
  2133.                             $detail = $this->mahasiswa_model->get($id,TRUE);
  2134.  
  2135.                             if ($detail->photo_mhs != '') {
  2136.                                 $photo_mhs[] = $detail->photo_mhs;
  2137.                             }
  2138.                         }
  2139.  
  2140.                         $where_mhs = array(
  2141.                             'id' => $id_mhs,
  2142.                             );
  2143.                         $where_ortu = array(
  2144.                             'id_mhs_ortu' => $id_mhs,
  2145.                             );
  2146.                         $where_user = array(
  2147.                             'id_user_detail' => $id_mhs,
  2148.                             );
  2149.  
  2150.                         $delete_mhs = $this->mahasiswa_model->delete_by(NULL,$where_mhs);
  2151.                         $delete_ortu = $this->ortu_model->delete_by(NULL,$where_ortu);
  2152.                         $delete_user = $this->user_model->delete_by(array('level_akses' => 'mhs'),$where_user);
  2153.  
  2154.                         if ($delete_mhs && $delete_ortu && $delete_user) {
  2155.                             foreach ($photo_mhs as $key) {
  2156.                                 unlink('./uploads/mhs-photo/'.$key);
  2157.                             }
  2158.                             $result = array(
  2159.                                 'status' => 'success',
  2160.                                 'delete_id' => $id_mhs
  2161.                                 );
  2162.                         }
  2163.                         else{
  2164.                             $result = array('status' => 'failed_db');
  2165.                         }  
  2166.                     }
  2167.                     elseif ($post['data'] == 'data_ptk') {
  2168.                         $id = $post['id'];
  2169.                         $id_ptk = array();
  2170.                         $photo_ptk = array();
  2171.                         foreach ($id as $key) {
  2172.                             $id_ptk[] = $key;
  2173.                             $detail = $this->ptk_model->get($key,TRUE);
  2174.                             if ($detail->photo_ptk != '') {
  2175.                                 $photo_ptk[] = $detail->photo_ptk;
  2176.                             }
  2177.                         }
  2178.  
  2179.                         $where_ptk = array(
  2180.                             'id_ptk' => $id_ptk
  2181.                             );
  2182.                         $where_user = array(
  2183.                             'id_user_detail' => $id_ptk,
  2184.                             );
  2185.  
  2186.                         $delete_ptk = $this->ptk_model->delete_by(NULL,$where_ptk);
  2187.                         $delete_user = $this->user_model->delete_by(array('level_akses' => 'ptk'),$where_user);
  2188.  
  2189.                         if ($delete_ptk && $delete_user) {
  2190.                             foreach ($photo_ptk as $key) {
  2191.                                 unlink('./uploads/ptk-photo/'.$key);
  2192.                             }
  2193.                             $result = array(
  2194.                                 'status' => 'success',
  2195.                                 'delete_id' => $id_ptk
  2196.                                 );
  2197.                         }
  2198.                         else{
  2199.                             $result = array('status' => 'failed_db');
  2200.                         }
  2201.                     }
  2202.                     elseif ($post['data'] == 'data_mk') {
  2203.                         $id = $post['id'];
  2204.                         $id_mk = array();
  2205.                         foreach ($id as $key) {
  2206.                             $id_mk[] = $key;
  2207.                         }
  2208.                         $where_mk = array('id_mk' => $id_mk);
  2209.                         $delete_mk = $this->mata_kuliah_model->delete_by(NULL,$where_mk);
  2210.                         if ($delete_mk) {
  2211.                             $result = array('status' => 'success');
  2212.                         }
  2213.                         else{
  2214.                             $result = array('status' => 'failed_db');
  2215.                         }
  2216.                     }
  2217.                     elseif ($post['data'] == 'data_jadwal_kuliah') {
  2218.                         $id = $post['id'];
  2219.                         $id_jdl_m = array();
  2220.                         foreach ($id as $key) {
  2221.                             $id_jdl = explode('/',$key);
  2222.                             $where_jdl = array('id_jdl' => $id_jdl[0]);
  2223.                             $check_thn = $this->jadwal_model->get_detail_data('count',array('thn_akademik'),NULL,array('id_jdl' => $id[0], 'status_jdl' => 1));
  2224.                             if ($check_thn > 0) {
  2225.                                 $id_jdl_m[] = $id_jdl[0];
  2226.                             }
  2227.                         }
  2228.                         if (count($id_jdl_m) > 0) {
  2229.                             $where_jdl = array(
  2230.                                 'id_jdl' => $id_jdl_m,
  2231.                                 );
  2232.                             $delete_jdl = $this->jadwal_model->delete_by(NULL,$where_jdl);
  2233.                         }
  2234.                         if (count($id_jdl_m) > 0 && isset($delete_jdl) && $delete_jdl) {
  2235.                             $result = array(
  2236.                                     'status' => 'success',
  2237.                                     'thn' => explode('/',$id[0])[2],
  2238.                                     'pd' => explode('/',$id[0])[1],
  2239.                                     );
  2240.                         }
  2241.                         elseif (count($id_jdl_m) > 0 && !isset($delete_jdl)) {
  2242.                             $result = array('status' => 'failed_db');
  2243.                         }
  2244.                         elseif (!isset($delete_jdl)) {
  2245.                             $result = array('status' => 'no_record_delete');
  2246.                         }
  2247.                     }
  2248.                     elseif ($post['data'] == 'data_mhs_kls') {
  2249.                         $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');
  2250.                         $status = $status_thn->status_jdl;
  2251.                         $id_kelas = $status_thn->id_jdl_kls;
  2252.                         $id_mhs_kls = array();
  2253.                         if ($status == 1) {
  2254.                             foreach ($post['id'] as $key) {
  2255.                                 $id_mhs = $key;
  2256.                                 $status_thn = $this->kelas_model->get_detail_data('count',array('jadwal','thn_akademik'),NULL,array('id_kelas' => $id_mhs,'status_jdl' => 1));
  2257.                                 if ($status_thn > 0) {
  2258.                                     $id_mhs_kls[] = $id_mhs;
  2259.                                 }
  2260.                             }
  2261.                             if (count($id_mhs_kls) > 0) {
  2262.                                 $delete_in = array(
  2263.                                     'id_kelas' => $id_mhs_kls
  2264.                                     );
  2265.                                 $delete_mhs_kls = $this->kelas_model->delete_by(NULL,$delete_in);
  2266.                             }
  2267.                             if (count($id_mhs_kls) > 0 && isset($delete_mhs_kls) && $delete_mhs_kls) {
  2268.                                 $select_daftar_mhs = array('id_kelas','id_jdl_kls','nisn','nama','mahasiswa.jk','tahun_angkatan','status_mhs_kls');
  2269.                                 $data_mhs = $this->kelas_model->get_detail_data('get',array('mahasiswa','thn_angkatan'),NULL,array('id_jdl_kls' => $id_kelas),NULL,$select_daftar_mhs);
  2270.                                 $result = array(
  2271.                                     'status' => 'success',
  2272.                                     'record_mhs' => $data_mhs,
  2273.                                     'c_kls' => $id_kelas,
  2274.                                     'delete' => $delete_mhs_kls,
  2275.                                     );
  2276.                             }
  2277.                             elseif (count($id_mhs_kls) > 0 && !isset($delete_mhs_kls)) {
  2278.                                 $result = array('status' => 'failed', 'errors' => 'Anda tidak bisa menghapus mahasiswa dari kelas ini karena tahun akademik kelas tidak sedang diterapkan');
  2279.                             }
  2280.                             else{
  2281.                                 $result = array('status' => 'failed_db');
  2282.                             }
  2283.                         }
  2284.                         else{
  2285.                             $result = array('status' => 'failed', 'errors' => 'Anda tidak bisa menghapus mahasiswa dari kelas ini karena tahun akademik kelas tidak sedang diterapkan');
  2286.                         }
  2287.                     }
  2288.                     elseif ($post['data'] == 'data_alumni') {
  2289.                         $id = $post['id'];
  2290.                         $id_alumni = array();
  2291.                         foreach ($id as $key) {
  2292.                             $vars = explode('-',$key);
  2293.                             if ($vars[1] == 'alumni') {
  2294.                                 $id_alumni[] = $vars[0];
  2295.                             }
  2296.                         }
  2297.  
  2298.                         $where_alumni = array(
  2299.                             'id_mhs_alni' => $id_alumni,
  2300.                             );
  2301.                         $delete_alumni = $this->alumni_model->delete_by(NULL,$where_alumni);
  2302.                         if ($delete_alumni) {
  2303.                             $result = array(
  2304.                                 'status' => 'success',
  2305.                                 'delete_id' => $id_alumni
  2306.                                 );
  2307.                         }
  2308.                         else{
  2309.                             $result = array('status' => 'failed_db');
  2310.                         }  
  2311.                     }
  2312.                     elseif ($post['data'] == 'data_mhs_do') {
  2313.                         $id = $post['id'];
  2314.                         $id_mhs_do = array();
  2315.                         foreach ($id as $key) {
  2316.                             $vars = explode('-',$key);
  2317.                             if ($vars[1] == 'do') {
  2318.                                 $id_mhs_do[] = $vars[0];
  2319.                             }
  2320.                         }
  2321.  
  2322.                         $where_mhs_do = array(
  2323.                             'id_mhs_DO' => $id_mhs_do,
  2324.                             );
  2325.                         $delete_mhs_do = $this->mahasiswa_do_model->delete_by(NULL,$where_mhs_do);
  2326.                         if ($delete_mhs_do) {
  2327.                             $result = array(
  2328.                                 'status' => 'success',
  2329.                                 'delete_id' => $id_mhs_do
  2330.                                 );
  2331.                         }
  2332.                         else{
  2333.                             $result = array('status' => 'failed_db');
  2334.                         }  
  2335.                     }
  2336.                     else{
  2337.                         $result = array('status_action' => 'Not find...');
  2338.                     }
  2339.                 }
  2340.                 else{
  2341.                     $result = array('status_action' => 'Not find...');
  2342.                 }
  2343.             }
  2344.             elseif ($param == 'update_pd') {
  2345.                 $id = $post['id'];
  2346.                 if (!empty($post['pd'])) {
  2347.                     $pd = array();
  2348.                     foreach ($id as $key) {
  2349.                         $id_mhs = explode(' ',$key);
  2350.                         $pd[] = array(
  2351.                             'id' => $id_mhs[0],
  2352.                             'id_pd_mhs' => $post['pd'],
  2353.                             );
  2354.                     }
  2355.                     $pindah = $this->mahasiswa_model->update($pd,'id',TRUE);
  2356.                     if ($pindah > 0) {
  2357.                         $result = array('status' => 'success');
  2358.                     }
  2359.                     elseif ($pindah == 0){
  2360.                         $result = array('status' => 'zero_change');
  2361.                     }
  2362.                     else{
  2363.                         $result = array('status' => 'failed_db');
  2364.                     }
  2365.                 }
  2366.                 else{
  2367.                     $result = array('status' => 'empty-ch');
  2368.                 }
  2369.             }
  2370.             elseif ($param == 'update_pd_mk') {
  2371.                 $id = $post['id'];
  2372.                 $this->form_validation->set_rules($this->mata_kuliah_model->mk_update_rules);
  2373.  
  2374.                 if ($this->form_validation->run() == TRUE) {
  2375.                     $pd = array();
  2376.                     $no = 0;
  2377.                     foreach ($id as $key) {
  2378.                         $id_mk = $key;
  2379.                         $pd[$no] = array(
  2380.                             'id_mk' => $id_mk,
  2381.                             );
  2382.                         if ($post['id_pd_mk'] != '') {
  2383.                             $pd[$no] = array_merge($pd[$no],array('id_pd_mk' => $post['id_pd_mk']));
  2384.                         }
  2385.                         if ($post['sks'] != '') {
  2386.                             $pd[$no] = array_merge($pd[$no],array('jml_sks' => $post['sks']));
  2387.                         }
  2388.                         if ($post['mk_j'] != '') {
  2389.                             $pd[$no] = array_merge($pd[$no],array('jenis_jdl' => $post['mk_j']));
  2390.                         }
  2391.                         $no++;
  2392.                     }
  2393.                     $update = $this->mata_kuliah_model->update($pd,'id_mk',TRUE);
  2394.                     if ($update > 0) {
  2395.                         $result = array('status' => 'success');
  2396.                     }
  2397.                     elseif ($update == 0){
  2398.                         $result = array(
  2399.                             'status' => 'zero_change',
  2400.                             'errors_message' => 'Gagal memperbahrui, karena data baru yang anda masukkan sama dengan data lama mata kuliah',
  2401.                             );
  2402.                     }
  2403.                     else{
  2404.                         $result = array(
  2405.                             'status' => 'failed_db',
  2406.                             'errors_message' => 'Maaf terjadi kesalahan dalam memperbahrui program studi data mata kuliah',
  2407.                             );
  2408.                     }
  2409.                 }
  2410.                 else{
  2411.                     $errors = $this->form_validation->error_array();
  2412.                     $result = array(
  2413.                         'status' => 'errors_pd',
  2414.                         'errors_message' => $errors['id_pd_mk']
  2415.                         );
  2416.                 }
  2417.             }
  2418.             else{
  2419.                 $result = array('status_action' => 'Not find...');
  2420.             }
  2421.             $result['n_token'] = $this->security->get_csrf_hash();
  2422.             echo json_encode($result);
  2423.         }
  2424.         else{
  2425.             $result = array(
  2426.                 "success" => FALSE,
  2427.                 "info" => "Service not found or not set",
  2428.                 'n_token' => $this->security->get_csrf_hash()
  2429.                 );
  2430.             echo json_encode($result);
  2431.         }
  2432.     }
Add Comment
Please, Sign In to add comment