Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Daftar Nilai per Reviewer
- public function listnilai_post()
- {
- $username = trim($this->post('username'));
- $id = $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 {
- $QReviewer = $this->db->query("SELECT * FROM lemlit_reviewer WHERE propose_id='$id' AND user_username='$username'");
- $HReview = $QReviewer->row();
- $reviewer_id = $HReview->reviewer_id;
- $QNilai = $this->db->query("SELECT * FROM lemlit_point_proposal WHERE propose_id='$id' AND reviewer_id='$reviewer_id'");
- $Hasil = $QNilai->result();
- if (count($Hasil) == 0) {
- $query = $this->db->query("SELECT * FROM lemlit_component_propose ORDER BY component_id ASC");
- $ListKomponen = $query->result();
- foreach ($ListKomponen as $r) {
- $data = array(
- 'propose_id' => $id,
- 'reviewer_id' => $reviewer_id,
- 'component_name' => trim($r->component_name),
- 'component_indicator' => trim($r->component_indicator),
- 'component_bobot' => $r->component_bobot,
- 'point_score' => 0,
- 'point_total' => 0,
- 'point_update' => date('Y-m-d H:i:s'),
- );
- $this->db->insert('lemlit_point_proposal', $data);
- }
- }
- $listData = $this->db->order_by('component_id', 'asc')->get_where('lemlit_point_proposal', array('propose_id' => $id, 'reviewer_id' => $reviewer_id))->result();
- foreach ($listData as $r) {
- $response['items'][] = [
- 'resp_error' => false,
- 'point_id' => $r->point_id,
- 'reviewer_id' => $r->reviewer_id,
- 'nama_komponen' => trim($r->component_name),
- 'indikator' => trim($r->component_indicator),
- 'bobot' => $r->component_bobot,
- 'score' => $r->point_score,
- 'total' => $r->point_total,
- ];
- }
- }
- $this->response($response, 200);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement