protected function create_response_question($data) { $data['question_id'] = $this->quiz->questions[0]; $data['response_quiz_id'] = $this->response_quiz_id; // create a new question response entry $question_response = new Enp_quiz_Save_quiz_take_Response_question(); $question_response->insert_response_question($data); }
/** * Checks if the response is valid or not * @param $response = submitted response * @return (mixed) 'invalid' if not valid, Enp_quiz_Slider object if valid */ protected function validate_slider_response($response) { // validate that this ID is attached to this question $question = new Enp_quiz_Question($response['question_id']); $slider_id = $question->get_slider(); $slider = new Enp_quiz_Slider($slider_id); // set it up for future use self::$slider = $slider; // see if their response is within the range $slider_response = (double) $response['question_response']; $slider_range_low = (double) $slider->get_slider_range_low(); $slider_range_high = (double) $slider->get_slider_range_high(); if ($slider_range_low <= $slider_response && $slider_response <= $slider_range_high) { // it's valid! $valid = true; } else { $valid = false; } return $valid; }