Browse Source

Fix: Compatibility with Moodle 2.7

MOODLE_20_STABLE
Vasilis Daloukas 11 years ago
parent
commit
34ff572dd5
  1. 32
      locallib.php
  2. 8
      millionaire/play.php
  3. 4
      version.php

32
locallib.php

@ -160,9 +160,17 @@ function game_question_shortanswer_quiz( $game, $allowspaces, $use_repetitions)
print_error( get_string( 'must_select_quiz', 'game'));
}
if( game_get_moodle_version() < '02.07')
{
$select = "qtype='shortanswer' AND quiz='$game->quizid' ".
" AND qqi.question=q.id";
$table = "{question} q,{quiz_question_instances} qqi";
}else
{
$select = "qtype='shortanswer' AND qs.quizid='$game->quizid' ".
" AND qs.questionid=q.id";
$table = "{question} q,{quiz_slots} qs";
}
$fields = "q.id";
if( ($id = game_question_selectrandom( $game, $table, $select, $fields, $use_repetitions)) == false)
@ -338,11 +346,22 @@ function game_questions_selectrandom( $game, $count=1)
print_error( get_string( 'must_select_quiz', 'game'));
}
if( game_get_moodle_version() < '02.07')
{
$table = '{question} q, {quiz_question_instances} qqi';
$select = " qqi.quiz=$game->quizid".
" AND qqi.question=q.id ".
" AND q.qtype in ('shortanswer', 'truefalse', 'multichoice')".
" AND q.hidden=0";
}else
{
$table = '{question} q, {quiz_slots} qs';
$select = " qs.quizid=$game->quizid".
" AND qs.questionid=q.id ".
" AND q.qtype in ('shortanswer', 'truefalse', 'multichoice')".
" AND q.hidden=0";
}
//todo 'match'
$field = "q.id as id";
@ -561,6 +580,8 @@ function game_questions_shortanswer_quiz( $game)
print_error( get_string( 'must_select_quiz', 'game'));
}
if( game_get_moodle_version() < '02.07')
{
$select = "qtype='shortanswer' AND quiz='$game->quizid' ".
" AND qqi.question=q.id".
" AND qa.question=q.id".
@ -569,6 +590,17 @@ function game_questions_shortanswer_quiz( $game)
$fields = "qa.id as qaid, q.id, q.questiontext as questiontext, ".
"qa.answer as answertext, q.id as questionid,".
" 0 as glossaryentryid,'' as attachment";
}else
{
$select = "qtype='shortanswer' AND qs.quizid='$game->quizid' ".
" AND qs.questionid=q.id".
" AND qa.question=q.id".
" AND q.hidden=0";
$table = "{question} q,{quiz_slots} qs,{question_answers} qa";
$fields = "qa.id as qaid, q.id, q.questiontext as questiontext, ".
"qa.answer as answertext, q.id as questionid,".
" 0 as glossaryentryid,'' as attachment";
}
return game_questions_shortanswer_question_fraction( $table, $fields, $select);
}

8
millionaire/play.php

@ -299,10 +299,18 @@ function game_millionaire_SelectQuestion( &$aAnswer, $game, $attempt, &$milliona
if( $game->quizid == 0){
print_error( get_string( 'must_select_quiz', 'game'));
}
if( game_get_moodle_version() < '02.07')
{
$select = "qtype='multichoice' AND quiz='$game->quizid' ".
" AND qqi.question=q.id";
$table = "{question} q,{quiz_question_instances} qqi";
}else
{
$select = "qtype='multichoice' AND qs.quizid='$game->quizid' ".
" AND qs.questionid=q.id";
$table = "{question} q,{quiz_slots} qs";
}
}else
{
if( $game->questioncategoryid == 0){
print_error( get_string( 'must_select_questioncategory', 'game'));

4
version.php

@ -11,7 +11,7 @@
defined('MOODLE_INTERNAL') || die();
$module->component = 'mod_game'; // Full name of the plugin (used for diagnostics)
$module->version = 2014061003; // The current module version (Date: YYYYMMDDXX)
$module->version = 2014061101; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2010112400; // Requires Moodle 2.0
$module->cron = 0; // Period for cron to check this module (secs)
$module->release = '3.18.10.3';
$module->release = '3.18.11';

Loading…
Cancel
Save