コード例 #1
0
 public function submit()
 {
     $question = $this->question->get_or_create_by_game($this->game_sessions["game_id"]);
     $estimate = $this->input->post("estimate");
     for ($i = 1; $i < 32; $i++) {
         if (isset($estimate[$i])) {
             $data["estimate"] = $estimate[$i];
             $part_id = $i;
             $this->answer->update_by_question($data, $question->id, $part_id);
         }
     }
     if ($this->input->post("save") == "1") {
         $level_sessions = need_level();
         $margin = get_margin($level_sessions["level_id"]);
         $data["total_score"] = $this->answer->calculate_score_by_questions($question->id, $margin);
         $data["game_id"] = $this->game_sessions["game_id"];
         $data["timestamp"] = $date = date('m/d/Y h:i:s a', time());
         // $this->summary->insert($data);
         $this->session->set_flashdata("notice", "permainan telah berakhir");
         redirect(base_url() . "quiz_cost/index");
         //redirect(base_url()."games/run");
     } else {
         redirect(base_url() . "users/endgame");
         // redirect(base_url()."quiz_cost/index");
     }
 }
コード例 #2
0
 public function submit()
 {
     $data["wst"] = $this->input->post("wst");
     $data["engine_power"] = $this->input->post("engine_power");
     $data["type_of_engine"] = $this->input->post("type_of_engine");
     $data["lwt"] = $this->input->post("lwt");
     $this->tebak_regresi->update_by_game($data, $this->game_sessions["game_id"]);
     if ($this->input->post("save") == "1") {
         $level_sessioins = need_level();
         $margin = get_margin($level_sessioins["level_id"]);
         $this->tebak_regresi->calculate_score_by_game($this->game_sessions["game_id"], $margin);
         $this->session->set_flashdata("notice", "permainan telah berakhir");
         //redirect(base_url()."games/run");
         redirect(base_url() . "quiz_regresi/index");
     } else {
         // redirect(base_url()."quiz_regresi/index");
         redirect(base_url() . "quiz_cost");
     }
 }