当前位置: 首页>>代码示例>>PHP>>正文


PHP quiz_attempt::preload_question_states方法代码示例

本文整理汇总了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;
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:processattempt.php


注:本文中的quiz_attempt::preload_question_states方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。