From a9501acb778eeacc7019cadd99050aae4d8242d0 Mon Sep 17 00:00:00 2001 From: Vasilis Daloukas Date: Wed, 15 Jul 2015 11:55:40 +0300 Subject: [PATCH] Fix: Hangman with greek and english words in the same game --- hangman/play.php | 2 +- locallib.php | 17 ++++++++++++++--- version.php | 4 ++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/hangman/play.php b/hangman/play.php index 8049151..e06b835 100755 --- a/hangman/play.php +++ b/hangman/play.php @@ -52,7 +52,7 @@ function game_hangman_continue( $id, $game, $attempt, $hangman, $newletter, $act } $allletters = game_getallletters( $answer2, $game->language); - + if( $allletters == ''){ continue; } diff --git a/locallib.php b/locallib.php index a229a33..5621612 100755 --- a/locallib.php +++ b/locallib.php @@ -51,16 +51,27 @@ function game_get_moodle_version() function game_upper( $str, $lang='') { - $str = game_strtoupper( $str); + if( $lang == 'user') + return $str; + $str = game_strtoupper( $str); +/* $strings = get_string_manager()->load_component_strings( 'game', ($lang == '' ? 'en' : $lang)); if( !isset( $strings[ 'convertfrom'])) return $str; if( !isset( $strings[ 'convertto'])) return $str; +*/ + switch( $lang) + { + case 'el': + $from = 'ΆΈΉΊΌΎΏ'; + $to = 'ΑΕΗΙΟΥΩ'; + break; + default: + return $str; + } - $from = $strings[ 'convertfrom']; - $to = $strings[ 'convertto']; $len = game_strlen( $from); for($i=0; $i < $len; $i++){ $str = str_replace( game_substr( $from, $i, 1), game_substr( $to, $i, 1), $str); diff --git a/version.php b/version.php index 6b70b08..cafd8fd 100755 --- a/version.php +++ b/version.php @@ -22,10 +22,10 @@ if( !isset( $plugin)) $useplugin = 2; $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics) -$plugin->version = 2015071404; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 20150715; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2010112400; // Requires Moodle 2.0 $plugin->cron = 0; // Period for cron to check this module (secs) -$plugin->release = '3.30.14.4'; +$plugin->release = '3.30.15'; if( $useplugin != 2) $module = $plugin;