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:
Tim Hunt
2014-06-12 19:43:42 +01:00
parent c41ace2f7a
commit 8fbc1919df
+3 -3
View File
@@ -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.