Browse Source

Fix compatibility problems with Moodle 2.5

MOODLE_20_STABLE
Vasilis Daloukas 9 years ago
parent
commit
4713b45e2e
  1. 3
      CHANGES.md
  2. 15
      millionaire/play.php
  3. 4
      version.php

3
CHANGES.md

@ -1,3 +1,6 @@
Changes in version 2016-02-14 (20160214)
- Fix compatibility with Moodle 2.5
Changes in version 2015-12-31 (4) (2015123104) Changes in version 2015-12-31 (4) (2015123104)
------------------------------------------------------------------ ------------------------------------------------------------------
- Fix translations check at translate.php - Fix translations check at translate.php

15
millionaire/play.php

@ -312,7 +312,12 @@ function game_millionaire_selectquestion( &$aanswer, $game, $attempt, &$milliona
if ($game->quizid == 0) { if ($game->quizid == 0) {
print_error( get_string( 'must_select_quiz', 'game')); print_error( get_string( 'must_select_quiz', 'game'));
} }
if (game_get_moodle_version() < '02.07') { if (game_get_moodle_version() < '02.06') {
$select = "qtype='multichoice' AND quiz='$game->quizid' AND qmo.question=q.id".
" AND qqi.question=q.id";
$table = "{quiz_question_instances} qqi,{question} q, {question_multichoice} qmo";
$order = '';
} else if (game_get_moodle_version() < '02.07') {
$select = "qtype='multichoice' AND quiz='$game->quizid' AND qmo.questionid=q.id". $select = "qtype='multichoice' AND quiz='$game->quizid' AND qmo.questionid=q.id".
" AND qqi.question=q.id"; " AND qqi.question=q.id";
$table = "{quiz_question_instances} qqi,{question} q, {qtype_multichoice_options} qmo"; $table = "{quiz_question_instances} qqi,{question} q, {qtype_multichoice_options} qmo";
@ -324,6 +329,7 @@ function game_millionaire_selectquestion( &$aanswer, $game, $attempt, &$milliona
$order = 'qs.page,qs.slot'; $order = 'qs.page,qs.slot';
} }
} else { } else {
// Source is questions.
if ($game->questioncategoryid == 0) { if ($game->questioncategoryid == 0) {
print_error( get_string( 'must_select_questioncategory', 'game')); print_error( get_string( 'must_select_questioncategory', 'game'));
} }
@ -336,10 +342,15 @@ function game_millionaire_selectquestion( &$aanswer, $game, $attempt, &$milliona
$select = 'q.category in ('.implode(',', $cats).')'; $select = 'q.category in ('.implode(',', $cats).')';
} }
} }
$select .= " AND qtype='multichoice' AND qmo.single=1 AND qmo.questionid=q.id";
if (game_get_moodle_version() < '02.06') {
$select .= " AND qtype='multichoice' AND qmo.single=1 AND qmo.question=q.id";
$table = '{question} q, {question_multichoice} qmo';
} else {
$select .= " AND qtype='multichoice' AND qmo.single=1 AND qmo.questionid=q.id";
$table = '{question} q, {qtype_multichoice_options} qmo'; $table = '{question} q, {qtype_multichoice_options} qmo';
} }
}
$select .= ' AND hidden=0'; $select .= ' AND hidden=0';
if ($game->shuffle or $game->quizid == 0) { if ($game->shuffle or $game->quizid == 0) {
$questionid = game_question_selectrandom( $game, $table, $select, 'q.id as id', true); $questionid = game_question_selectrandom( $game, $table, $select, 'q.id as id', true);

4
version.php

@ -36,10 +36,10 @@ if (!isset( $plugin)) {
} }
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics). $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2016020201; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2016021401; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2010112400; // Requires Moodle 2.0. $plugin->requires = 2010112400; // Requires Moodle 2.0.
$plugin->cron = 0; // Period for cron to check this module (secs). $plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->release = '2016-02-02'; $plugin->release = '2016-02-14';
if ($useplugin != 2) { if ($useplugin != 2) {
$module = $plugin; $module = $plugin;

Loading…
Cancel
Save