|
@ -52,6 +52,9 @@ echo '<br><br>'; |
|
|
|
|
|
|
|
|
$existsbook = ($DB->get_record( 'modules', array( 'name' => 'book'), 'id,id')); |
|
|
$existsbook = ($DB->get_record( 'modules', array( 'name' => 'book'), 'id,id')); |
|
|
game_showanswers( $game, $existsbook, $context); |
|
|
game_showanswers( $game, $existsbook, $context); |
|
|
|
|
|
if ($game->gamekind == 'millionaire') { |
|
|
|
|
|
game_showanswers_extra_millionaire( $game); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
echo $OUTPUT->footer(); |
|
|
echo $OUTPUT->footer(); |
|
|
|
|
|
|
|
@ -224,8 +227,12 @@ function game_showanswers_question( $game, $context) { |
|
|
$order = ($showcategories ? 'category,questiontext' : 'questiontext'); |
|
|
$order = ($showcategories ? 'category,questiontext' : 'questiontext'); |
|
|
$table = '{question} q'; |
|
|
$table = '{question} q'; |
|
|
if ($game->gamekind == 'millionaire') { |
|
|
if ($game->gamekind == 'millionaire') { |
|
|
$select .= " AND qtype='multichoice' AND qmo.single=1 AND qmo.questionid=q.id"; |
|
|
$select .= " AND q.qtype='multichoice' AND qmo.single=1 AND qmo.question=q.id"; |
|
|
$table = '{question} q, {qtype_multichoice_options} qmo'; |
|
|
if (game_get_moodle_version() < '02.06') { |
|
|
|
|
|
$table .= ',{question_multichoice} qmo'; |
|
|
|
|
|
} else { |
|
|
|
|
|
$table .= ',{qtype_multichoice_options} qmo'; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
game_showanswers_question_select( $game, $table, $select, '*', $order, $showcategories, $game->course, $context); |
|
|
game_showanswers_question_select( $game, $table, $select, '*', $order, $showcategories, $game->course, $context); |
|
|
} |
|
|
} |
|
@ -506,3 +513,34 @@ function game_showanswers_bookquiz( $game, $context) { |
|
|
game_showanswers_question_select( $game, $table, $select, "DISTINCT q.*", |
|
|
game_showanswers_question_select( $game, $table, $select, "DISTINCT q.*", |
|
|
"bc.pagenum,questiontext", $showcategories, $game->course, $context); |
|
|
"bc.pagenum,questiontext", $showcategories, $game->course, $context); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function game_showanswers_extra_millionaire( $game) |
|
|
|
|
|
{ |
|
|
|
|
|
global $CFG, $DB; |
|
|
|
|
|
|
|
|
|
|
|
if ($game->questioncategoryid == 0) { |
|
|
|
|
|
print_error( get_string( 'must_select_questioncategory', 'game')); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Include subcategories. |
|
|
|
|
|
$select = 'category='.$game->questioncategoryid; |
|
|
|
|
|
if ($game->subcategories) { |
|
|
|
|
|
$cats = question_categorylist( $game->questioncategoryid); |
|
|
|
|
|
if (count( $cats)) { |
|
|
|
|
|
$select = 'q.category in ('.implode(',', $cats).')'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$select .= " AND qtype='multichoice' AND qmo.single <> 1 AND qmo.question=q.id"; |
|
|
|
|
|
if (game_get_moodle_version() < '02.06') { |
|
|
|
|
|
$table = "{$CFG->prefix}question q, {$CFG->prefix}question_multichoice qmo"; |
|
|
|
|
|
} else { |
|
|
|
|
|
$table = "{$CFG->prefix}question q, {$CFG->prefix}qtype_multichoice_options qmo"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$sql = "SELECT COUNT(*) as c FROM $table WHERE $select"; |
|
|
|
|
|
$rec = $DB->get_record_sql( $sql); |
|
|
|
|
|
if ($rec->c != 0) { |
|
|
|
|
|
echo get_string( 'millionaire_also_multichoice', 'game').': '.$rec->c; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|