MDL-45970 quiz editing: fix display of random questions.
The pass by reference meant the function was clobbering the variable in the calling function. Once that was change, it was not strictly necessary to rename the variable in the function, but I did anyway for clarity. Thanks to Rajesh Taneja for finding the problem, and identifying which bit of code was broken. I really just made the patch.
This commit is contained in:
@@ -824,7 +824,7 @@ function quiz_print_singlequestion($question, $returnurl, $quiz) {
|
||||
* @param object $quiz The quiz in the context of which the question is being displayed
|
||||
* @param bool $quiz_qbanktool Indicate to this function if the question bank window open
|
||||
*/
|
||||
function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktool) {
|
||||
function quiz_print_randomquestion($question, $pageurl, $quiz, $quiz_qbanktool) {
|
||||
global $DB, $OUTPUT;
|
||||
echo '<div class="quiz_randomquestion">';
|
||||
|
||||
@@ -882,8 +882,8 @@ function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktoo
|
||||
|
||||
// Then list them.
|
||||
echo '<ul>';
|
||||
foreach ($questionstoshow as $question) {
|
||||
echo '<li>' . quiz_question_tostring($question, true) . '</li>';
|
||||
foreach ($questionstoshow as $subquestion) {
|
||||
echo '<li>' . quiz_question_tostring($subquestion, true) . '</li>';
|
||||
}
|
||||
|
||||
// Finally display the total number.
|
||||
|
||||
Reference in New Issue
Block a user