/** * Process all the question actions in the current request. * * If there is a parameter slots included in the post data, then only * those question numbers will be processed, otherwise all questions in this * useage will be. * * This function also does {@link update_question_flags()}. * * @param int $timestamp optional, use this timestamp as 'now'. * @param array $postdata optional, only intended for testing. Use this data * instead of the data from $_POST. */ public function process_all_actions($timestamp = null, $postdata = null) { $slots = question_attempt::get_submitted_var('slots', PARAM_SEQUENCE, $postdata); if (is_null($slots)) { $slots = $this->get_slots(); } else if (!$slots) { $slots = array(); } else { $slots = explode(',', $slots); } foreach ($slots as $slot) { if (!$this->validate_sequence_number($slot, $postdata)) { continue; } $submitteddata = $this->extract_responses($slot, $postdata); $this->process_action($slot, $submitteddata, $timestamp); } $this->update_question_flags($postdata); }