This commit is contained in:
Damyon Wiese 2014-06-10 12:42:09 +08:00
commit 2d8d99ab5b
5 changed files with 122 additions and 3 deletions

View file

@ -213,7 +213,7 @@ function quiz_add_random_questions($quiz, $addonpage, $categoryid, $number,
SELECT *
FROM {quiz_slots}
WHERE questionid = q.id)
ORDER BY id", array($category->id, $includesubcategories))) {
ORDER BY id", array($category->id, ($includesubcategories ? '1' : '0')))) {
// Take as many of these as needed.
while (($existingquestion = array_shift($existingquestions)) && $number > 0) {
quiz_add_quiz_question($existingquestion->id, $quiz, $addonpage);
@ -228,7 +228,7 @@ function quiz_add_random_questions($quiz, $addonpage, $categoryid, $number,
// More random questions are needed, create them.
for ($i = 0; $i < $number; $i += 1) {
$form = new stdClass();
$form->questiontext = array('text' => $includesubcategories, 'format' => 0);
$form->questiontext = array('text' => ($includesubcategories ? '1' : '0'), 'format' => 0);
$form->category = $category->id . ',' . $category->contextid;
$form->defaultmark = 1;
$form->hidden = 1;