本文整理汇总了PHP中quiz_attempt::preload_question_states方法的典型用法代码示例。如果您正苦于以下问题:PHP quiz_attempt::preload_question_states方法的具体用法?PHP quiz_attempt::preload_question_states怎么用?PHP quiz_attempt::preload_question_states使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类quiz_attempt
的用法示例。
在下文中一共展示了quiz_attempt::preload_question_states方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
}
}
if (!$success) {
print_error('errorprocessingresponses', 'question', $attemptobj->attempt_url(0, $page));
}
/// If we do not have to finish the attempts (if we are only processing responses)
/// save the attempt and redirect to the next page.
if (!$finishattempt) {
$attempt->timemodified = $timenow;
$DB->update_record('quiz_attempts', $attempt);
redirect($nexturl);
}
/// We have been asked to finish attempt, so do that //////////////////////
/// Now load the state of every question, reloading the ones we messed around
/// with above.
$attemptobj->preload_question_states();
$attemptobj->load_question_states();
/// Move each question to the closed state.
$success = true;
$attempt = $attemptobj->get_attempt();
foreach ($attemptobj->get_questions() as $id => $question) {
$state = $attemptobj->get_question_state($id);
$action = new stdClass();
$action->event = QUESTION_EVENTCLOSE;
$action->responses = $state->responses;
$action->responses['_flagged'] = $state->flagged;
$action->timestamp = $state->timestamp;
if (question_process_responses($attemptobj->get_question($id), $state, $action, $attemptobj->get_quiz(), $attempt)) {
save_question_session($attemptobj->get_question($id), $state);
} else {
$success = false;