Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function accdataproposal_post()
- {
- $username = trim($this->post('username'));
- $id = $this->post('id');
- if ($username == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'Username kosong.',
- ];
- } elseif ($id == '') {
- $response = [
- 'resp_error' => true,
- 'resp_msg' => 'ID Proposal kosong.',
- ];
- } else {
- $data = array(
- 'propose_status' => 2,
- 'propose_date_confirm' => date('Y-m-d H:i:s'),
- 'propose_update' => date('Y-m-d H:i:s'),
- );
- $this->db->where('propose_id', $id);
- $this->db->update('lemlit_propose', $data);
- // Send Notifikasi ke Member
- $dataProposal = $this->db->get_where('v_proposal', array('propose_id' => $id))->row();
- $username_dosen = $dataProposal->user_username;
- $pesanNotif = 'Proposal Anda : ' . $dataProposal->propose_title . ' Telah di terima oleh Admin';
- $dataNotif = array(
- 'user_pengirim' => $username,
- 'user_username' => $username_dosen,
- 'notifikasi_date' => date('Y-m-d'),
- 'notifikasi_desc' => $pesanNotif,
- 'notifikasi_level' => 'Member',
- );
- $this->db->insert('lemlit_notifikasi', $dataNotif);
- $dataDevice = $this->db->get_where('lemlit_users', array('device_id !=' => '', 'user_username' => $username_dosen))->row();
- sendNotification($dataDevice->device_id, $pesanNotif);
- $response = [
- 'resp_error' => false,
- 'resp_msg' => 'ACC Proposal Berhasil.',
- ];
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement