Guest User

controller

a guest
Feb 10th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. function polling_detail($id = NULL) {
  2. //echo "here";
  3. //print_r($_POST);DIE;
  4. $t['title'] = 'Polling Media Indonesia | Refrensi Indonesia';
  5. $data['polling_detail'] = $t['title'];
  6.  
  7.  
  8. //$this->output->enable_profiler(TRUE);
  9. $this->load->model('data', 'polling_detail');
  10. $this->load->helper('analytics');
  11. $this->output->cache(10);
  12.  
  13. //$t['rows'] = $this->model_utama->polling_sum($row['id'])->row_array();
  14. //$t['polling'] = $this->model_utama->polling();
  15. //$t['id'] = $this->polling_detail->polling_sum($row['id'])->row_array();
  16. $t['polling'] = $this->polling_detail->all_polling();
  17. //echo "post:<pre>";
  18. //print_r($_POST);
  19. //echo "</pre>";
  20. //DIE;
  21.  
  22. /*
  23. cek apakah ada post masuk
  24.  
  25. */
  26. if ($this->input->post('poll')) {
  27. if ($id !== NULL) {
  28. die('error no id send');
  29. }
  30. $poll['id'] = $this->input->post('poll'); //POLL
  31. var_dump($poll['id']);
  32. //$poll = array('answer_id'=>$this->input->post('poll'),'pool_id' => $id['id']);
  33. //var_dump($poll);
  34. //die;
  35. //$poll = $this->input->post('id');//ambil IP
  36. //echo($poll);die;
  37. foreach ($poll as $id_poll => $row) {
  38.  
  39. //$ip = '123123'; // silakan ganti dgn fungsi yg bs dapetin IP
  40. $choose = $row;
  41. $data=array(
  42. 'datecreated'=>Date('Y-m-d h:m:s'),
  43. 'datechanged'=>Date('Y-m-d h:m:s'),
  44. 'datepublish'=>Date('Y-m-d h:m:s'),
  45. 'pool_id'=>$id_poll,
  46. 'answer_id'=>$choose
  47. );
  48.  
  49. $this->db->insert('micom_votes',$data);
  50.  
  51. $t['polling_detail'] = $this->polling_detail->polling_sum($id);
  52. //echo "Terima Kasih atas partisipasi anda";//('Terima Kasih atas partisipasi anda');
  53.  
  54. }
  55. //cek apakah ada data yg masuk
  56. //
  57. //echo "<h3>Jumlah Suara Voting: $id</h3>";
  58. $t['count'] = $this->polling_detail->jum_vote($ids);
  59. var_dump($t['count']);
  60. redirect("home/polling_detail/" . $id);
  61. }
  62.  
  63.  
  64. //echo "<pre>";
  65. //print_r($t['count']);
  66. //echo "</pre>";
  67.  
  68. //die('ha');
  69. #Menu
  70. $t['v_menu'] = $this->load->view('template/v_menu', NULL, TRUE);
  71. #Footer
  72. $t['v_footer'] = $this->load->view('template/v_footer', NULL, TRUE);
  73. #Analytic
  74. $t['analytics'] = google();
  75. #Revive
  76. $t['revive'] = revive();
  77. $page = $this->load->view('read/v_detail_polling', $t, FALSE);
  78. }
Advertisement
Add Comment
Please, Sign In to add comment