Advertisement
Guest User

Untitled

a guest
May 26th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. $url = base_url()."task_board/edit_task/";
  2. $json = file_get_contents('php://input'); //file_get_contents($url);
  3. $data = $jsonIterator = new RecursiveIteratorIterator(new RecursiveArrayIterator(json_decode($json, TRUE)), RecursiveIteratorIterator::SELF_FIRST);
  4.  
  5. $kategori = null;
  6. foreach ($data as $key => $val)
  7. {
  8. // Check type
  9. if (is_array($val))
  10. {
  11. $kategori = "$key:\n";
  12. }
  13. else
  14. {
  15. // one, two, three
  16. $data_lengkap = "$key => $val\n";
  17. $nilai_data = "$val\n";
  18.  
  19. // Get data task, saya menggunakan variabel val.
  20. $load_data_task = $this->task_board_model->get_task_by_id_task($val)->row();
  21.  
  22. // Data update task
  23. $task_id = $load_data_task->task_id;
  24. $data_task_update[] = array(
  25. 'task_id' => $val,
  26. 'project_id' => $load_data_task->project_id,
  27. 'employee_id' => $load_data_task->employee_id,
  28. 'company_id' => $load_data_task->company_id,
  29. 'code' => $load_data_task->code,
  30. 'status' => $key,
  31. 'title_task' => $load_data_task->title_task,
  32. 'priority' => $load_data_task->priority,
  33. 'description_task' => $load_data_task->description_task,
  34. 'date_created' => $load_data_task->date_created,
  35. 'due_date' => $load_data_task->due_date
  36. );
  37.  
  38. $syg = $this->task_board_model->edit_task($data_task_update);
  39. if($syg)
  40. {
  41. echo "Sukses"." = ".$task_id." status = ".$key."<br>";
  42. }
  43. else
  44. {
  45. echo "gagal";
  46. }
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement