From 02a46f653a687c06b1d3061a5b1c77d6e47b3a4d Mon Sep 17 00:00:00 2001 From: ubuntu Date: Wed, 25 Dec 2013 12:41:13 +0200 Subject: [PATCH] CONTRIB-4773 fixed various errors from Tim Lock --- print.php | 2 +- showanswers.php | 7 ++++--- sudoku/play.php | 3 ++- translate.php | 8 +++++++- version.php | 4 ++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/print.php b/print.php index 2821239..f3daf0c 100755 --- a/print.php +++ b/print.php @@ -33,7 +33,7 @@ { require( "cross/play.php"); - $attempt = game_getattempt( $game, &$crossrec); + $attempt = game_getattempt( $game, $crossrec); $g = ''; $onlyshow = true; diff --git a/showanswers.php b/showanswers.php index f268d78..9ff4782 100755 --- a/showanswers.php +++ b/showanswers.php @@ -109,7 +109,7 @@ function game_showusers($game) function game_showanswers( $game, $existsbook, $context) { if( $game->gamekind == 'bookquiz' and $existsbook){ - game_showanswers_bookquiz( $game); + game_showanswers_bookquiz( $game, $context); return; } @@ -398,7 +398,7 @@ function game_showanswers_glossary( $game) echo "
\r\n\r\n"; } -function game_showanswers_bookquiz( $game) +function game_showanswers_bookquiz( $game, $context) { global $CFG; @@ -407,5 +407,6 @@ function game_showanswers_bookquiz( $game) " AND bc.id = gbq.chapterid"; $table = "{question} q,{game_bookquiz_questions} gbq,{book_chapters} bc"; - game_showanswers_question_select( $game, $table, $select, "DISTINCT q.*", "bc.pagenum,questiontext"); + $showcategories = ($game->gamekind == 'bookquiz'); + game_showanswers_question_select( $game, $table, $select, "DISTINCT q.*", "bc.pagenum,questiontext", $showcategories, $game->course, $context); } diff --git a/sudoku/play.php b/sudoku/play.php index 1ed1cc5..a17df09 100755 --- a/sudoku/play.php +++ b/sudoku/play.php @@ -574,7 +574,8 @@ function game_sudoku_check_glossaryentries( $id, $game, $attempt, $sudoku, $fini //correct answer $select = "attemptid=$attempt->id"; $select .= " AND glossaryentryid=$entry->id AND col>0"; - + $select .= " AND questiontext is null"; // check the student guesses not source glossary entry. + $query = new stdClass(); if( ($query->id = $DB->get_field_select( 'game_queries', 'id', $select)) == 0){ echo "not found $select
"; diff --git a/translate.php b/translate.php index ee951f6..06ae926 100755 --- a/translate.php +++ b/translate.php @@ -166,6 +166,9 @@ sort( $strings); foreach( $langname as $lang => $name) { $strings_lang = readlangfile( $lang, $header); + if (empty($string_lang)) { + continue; + } $ret = ''; foreach( $strings_lang as $key => $value) @@ -230,6 +233,9 @@ function readlangfile( $lang, &$header) global $CFG; $file = $CFG->dirroot.'/mod/game/lang/'.$lang.'/game.php'; + if (!is_file($file)) { + return null; + } $a = array(); @@ -289,7 +295,7 @@ function readsourcecode( $file, &$strings) $lines = file( $file); foreach( $lines as $line) { - parseline( &$strings, $line, $file); + parseline( $strings, $line, $file); } return $strings; diff --git a/version.php b/version.php index 6f06066..85cfd15 100755 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ defined('MOODLE_INTERNAL') || die(); $module->component = 'mod_game'; // Full name of the plugin (used for diagnostics) -$module->version = 2013122502; // The current module version (Date: YYYYMMDDXX) +$module->version = 2013122503; // 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.12.25.2'; +$module->release = '3.12.25.3';