datatables->select("a.id_soal, a.soal, FROM_UNIXTIME(a.created_on) as created_on, FROM_UNIXTIME(a.updated_on) as updated_on, b.nama_matkul, c.nama_dosen, a.dosen_id, a.matkul_id, CONCAT(a.id_soal, '/', a.dosen_id, '/', a.matkul_id) as paracon"); $this->datatables->from('tb_soal a'); $this->datatables->join('matkul b', 'b.id_matkul=a.matkul_id'); $this->datatables->join('dosen c', 'c.id_dosen=a.dosen_id'); if ($id!==null && $dosen===null) { $this->datatables->where('a.matkul_id', $id); }else if($id!==null && $dosen!==null){ $this->datatables->where('a.dosen_id', $dosen); } return $this->datatables->generate(); } public function getSoalById($id) { return $this->db->get_where('tb_soal', ['id_soal' => $id])->row(); } public function getMatkulDosen($nip) { $this->db->select('matkul_id, nama_matkul, id_dosen, nama_dosen'); $this->db->join('matkul', 'matkul_id=id_matkul'); $this->db->from('dosen')->where('nip', $nip); return $this->db->get()->result(); } public function getMatkulDosenRow($nip) { $this->db->select('matkul_id, nama_matkul, id_dosen, nama_dosen'); $this->db->join('matkul', 'matkul_id=id_matkul'); $this->db->from('dosen')->where('nip', $nip); return $this->db->get()->row(); } public function getAllMatkul() { return $this->db->get('matkul')->result(); } public function getAllDosen() { $this->db->select('*'); $this->db->from('dosen a'); $this->db->join('matkul b', 'a.matkul_id=b.id_matkul'); return $this->db->get()->result(); } }