Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function listdosen_post()
- {
- $username = trim($this->post('username'));
- $id = trim($this->post('id'));
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username tidak ditemukan.',
- ];
- } elseif ($id == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'ID Proposal kosong.',
- ];
- } else {
- // Daftar Dosen selain User Login
- $listDosen = $this->db->order_by('user_name', 'asc')->get_where('v_dosen', array('user_username !=' => $username))->result();
- if (count($listDosen) == 0) {
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'Tidak Ada Data Dosen',
- ];
- } else {
- foreach ($listDosen as $r) {
- if ($r->lecture_photo == '' || empty($r->lecture_photo == '')) {
- $foto = base_url('img/user.png');
- } else {
- $foto = base_url('img/icon/' . $r->lecture_photo);
- }
- $response['items'][] = [
- 'resp_error' => false,
- 'lecture_id' => $r->lecture_id,
- 'user_username' => $r->user_username,
- 'nama' => trim($r->user_name),
- 'fakultas' => trim($r->faculty_name),
- 'progdi' => trim($r->study_program_name),
- 'foto' => $foto,
- ];
- }
- }
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement