ion_auth->logged_in()){ redirect('auth'); } $this->load->model('Dashboard_model', 'dashboard'); $this->user = $this->ion_auth->user()->row(); } public function admin_box() { $box = [ [ 'box' => 'light-blue', 'total' => $this->dashboard->total('jurusan'), 'title' => 'Jurusan', 'icon' => 'graduation-cap' ], [ 'box' => 'olive', 'total' => $this->dashboard->total('mkwu_kelas'), 'title' => 'Kelas', 'icon' => 'building-o' ], [ 'box' => 'yellow-active', 'total' => $this->dashboard->total('mkwu_dosen'), 'title' => 'Dosen', 'icon' => 'user-secret' ], [ 'box' => 'red', 'total' => $this->dashboard->total('mkwu_mahasiswa'), 'title' => 'Mahasiswa', 'icon' => 'user' ], ]; $info_box = json_decode(json_encode($box), FALSE); return $info_box; } public function index() { $user = $this->user; $data = [ 'user' => $user, 'judul' => 'Dashboard', 'subjudul' => 'Data Aplikasi', ]; if ( $this->ion_auth->is_admin() ) { $data['info_box'] = $this->admin_box(); } elseif ( $this->ion_auth->in_group('dosen') ) { $matkul = ['mkwu_matkul' => 'mkwu_dosen.matkul_id=mkwu_matkul.id_matkul']; $data['dosen'] = $this->dashboard->get_where('mkwu_dosen', 'nidn', $user->username, $matkul)->row(); $kelas = ['mkwu_kelas' => 'mkwu_dosen_kelas.kelas_id=mkwu_kelas.id_kelas']; $data['kelas'] = $this->dashboard->get_where('mkwu_dosen_kelas', 'dosen_id' , $data['dosen']->id_dosen, $kelas, ['nama_kelas'=>'ASC'])->result(); }else{ $join = [ 'mkwu_kelas b' => 'a.kelas_id = b.id_kelas', 'jurusan c' => 'b.jurusan_id = c.id_jurusan' ]; $data['mahasiswa'] = $this->dashboard->get_where('mkwu_mahasiswa a', 'nim', $user->username, $join)->row(); // $data['total_nilai'] = $this->ujian->getTotalHslUjian(); $data['id_mhs'] = $this->dashboard->getIdMhs($user->username); $data['total_skor'] = $this->dashboard->getTotalSkor($data['id_mhs'])[0]->total_nilai; } $this->load->view('_templates/dashboard/_header.php', $data); $this->load->view('dashboard'); $this->load->view('_templates/dashboard/_footer.php'); } }