コード例 #1
0
ファイル: preview.php プロジェクト: nottmoo/moodle
if ($newoptions = $optionsform->get_submitted_data()) {
    // Set user preferences
    $options->save_user_preview_options($newoptions);
    if (!isset($newoptions->variant)) {
        $newoptions->variant = $options->variant;
    }
    restart_preview($previewid, $question->id, $newoptions);
}

// Prepare a URL that is used in various places.
$actionurl = question_preview_action_url($question->id, $quba->get_id(), $options);

// Process any actions from the buttons at the bottom of the form.
if (data_submitted() && confirm_sesskey()) {
    if (optional_param('restart', false, PARAM_BOOL)) {
        restart_preview($previewid, $question->id, $options);

    } else if (optional_param('fill', null, PARAM_BOOL)) {
        $correctresponse = $quba->get_correct_response($slot);
        $quba->process_action($slot, $correctresponse);

        $transaction = $DB->start_delegated_transaction();
        question_engine::save_questions_usage_by_activity($quba);
        $transaction->allow_commit();

        redirect($actionurl);

    } else if (optional_param('finish', null, PARAM_BOOL)) {
        try {
            $quba->process_all_actions();
        } catch (question_out_of_sequence_exception $e) {
コード例 #2
0
ファイル: preview.php プロジェクト: alanaipe2015/moodle
    // Set user preferences.
    $options->save_user_preview_options($newoptions);
    if (!isset($newoptions->variant)) {
        $newoptions->variant = $options->variant;
    }
    if (isset($newoptions->saverestart)) {
        restart_preview($previewid, $question->id, $newoptions, $context);
    }
}
// Prepare a URL that is used in various places.
$actionurl = question_preview_action_url($question->id, $quba->get_id(), $options, $context);
// Process any actions from the buttons at the bottom of the form.
if (data_submitted() && confirm_sesskey()) {
    try {
        if (optional_param('restart', false, PARAM_BOOL)) {
            restart_preview($previewid, $question->id, $options, $context);
        } else {
            if (optional_param('fill', null, PARAM_BOOL)) {
                $correctresponse = $quba->get_correct_response($slot);
                if (!is_null($correctresponse)) {
                    $quba->process_action($slot, $correctresponse);
                    $transaction = $DB->start_delegated_transaction();
                    question_engine::save_questions_usage_by_activity($quba);
                    $transaction->allow_commit();
                }
                redirect($actionurl);
            } else {
                if (optional_param('finish', null, PARAM_BOOL)) {
                    $quba->process_all_actions();
                    $quba->finish_all_questions();
                    $transaction = $DB->start_delegated_transaction();