小テスト)1ページに1問表示の問題を正解したら次へ(Part2)

Re: 小テスト)1ページに1問表示の問題を正解したら次へ(Part2)

- Hitomi Ikefuji の投稿
返信数: 0

大変、参考になりました。

>「問題動作」が「アダプティブモード」または「アダプティブモード (ペナルティなし)」の場合のみ、1ページに表示された問題すべてに正解するまで「次へ」が消えます。

とのことだったので、私のとっても理想的だったので、変更を試みました。


ところが、ご指摘いただいたプログラムをそのまま入れると、エラーが出て、

「,」が余計だ

と言っているのは分かりました。


そこで、再度、書いていただいた修正対象プログラムの修正箇所を読んで、訂正させていただきました。

私が入れているMoodleでは、対象ヵ所が、

一部異なっていたので、その部分を消して修正してみました。


修正対象プログラム:

mod/quiz/renderer.php


修正対象プログラム:

mod/quiz/renderer.php


修正箇所:

行数不明(最初の文字で検索したため。スミマセン)


[ 修正前 ] (書いて下さったプログラムと違ったところを消しました)

      // Print all the questions.

        foreach ($slots as $slot) {

            $output .= $attemptobj->render_question($slot, false, $this,

                    $attemptobj->attempt_url($slot, $page), $this);

        }

 $navmethod = $attemptobj->get_quiz()->navmethod;

        $output .= $this->attempt_navigation_buttons($page, $attemptobj->is_last_page($page), $navmethod);




[ 修正後 ]

        // Print all the questions.

        $displayoptions = $attemptobj->get_display_options(true);

        $incorrectcount = 0;


        foreach ($slots as $slot) {

            $output .= $attemptobj->render_question($slot, false, $this,

                    $attemptobj->attempt_url($slot, $page), $this);

            $current_correctness =

$attemptobj->get_question_status($slot, $displayoptions->correctness);

            if ($current_correctness != get_string('correct',

'quiz')) {

                $incorrectcount += 1;

            }

        }


        $navmethod = $attemptobj->get_quiz()->navmethod;

//        $output .= $this->attempt_navigation_buttons($page, $attemptobj->is_last_page($page), $navmethod);


        $preferredbehaviour =

$attemptobj->get_quiz()->preferredbehaviour;

        if ($preferredbehaviour == 'adaptive' || $preferredbehaviour

== 'adaptivenopenalty') {

            if ($incorrectcount == 0) {

                $output .=

$this->attempt_navigation_buttons($page, $attemptobj->is_last_page($page),

$navmethod);

            }

        } else {

            $output .= $this->attempt_navigation_buttons($page,

$attemptobj->is_last_page($page), $navmethod);

        }


-------------


以上です。

おかげで、理想どおりになりました。

ただ、また、バージョンアップした場合、プログラムを変更しなくてはいけないと思うので、また、ご指導いただければと思います。

評点平均: お役立ち度: ★★★★★★★ (1)