diff --git a/check.php b/check.php index ad29ef8..a40966f 100644 --- a/check.php +++ b/check.php @@ -280,12 +280,20 @@ function game_check_common_problems_shortanswer_hangman( $game, &$warnings, $a) foreach ($a as $word) { $word = game_upper( str_replace( ' ', '', $word), $game->language); + $word = str_replace('Ó', 'O', $word); + $word = str_replace('Ê', 'E', $word); + $word = str_replace('Ç', 'C', $word); + $word = str_replace('Ã', 'A', $word); + $word = str_replace('Á', 'A', $word); + $word = str_replace('Ó', 'O', $word); + $word = str_replace('Â', 'A', $word); + $word = str_replace('Í', 'I', $word); if ($game->language == '') { $game->language = game_detectlanguage( $word); $word = game_upper( $word, $game->language); + } $allletters = game_getallletters( $word, $game->language, $game->userlanguage); - if ($allletters != '') { continue; } @@ -295,6 +303,7 @@ function game_check_common_problems_shortanswer_hangman( $game, &$warnings, $a) if (count( $ret) != 0) { $warnings[] = get_string( 'common_problems_shortanswer_hangman', 'game').': '.count($ret).' ('.implode( ', ', $ret).')'; + } } @@ -312,4 +321,3 @@ function game_check_common_problems_crossword_cryptex($game, &$warnings) { $warnings[] = get_string( 'common_problems_crossword_param1', 'game').' (='.$game->param1.')'; } } - diff --git a/hangman/play.php b/hangman/play.php index 3328468..7cf39f2 100644 --- a/hangman/play.php +++ b/hangman/play.php @@ -65,6 +65,16 @@ function game_hangman_continue( $id, $game, $attempt, $hangman, $newletter, $act } $answer = game_upper( $rec->answertext, $game->language); + $answer = str_replace('Ó', 'O', $answer); + $answer = str_replace('Ê', 'E', $answer); + $answer = str_replace('Ç', 'C', $answer); + $answer = str_replace('Ã', 'A', $answer); + $answer = str_replace('Á', 'A', $answer); + $answer = str_replace('Ó', 'O', $answer); + $answer = str_replace('Â', 'A', $answer); + $answer = str_replace('Í', 'I', $answer); + + echo(""); if ($game->language == '') { $game->language = game_detectlanguage( $answer); $answer = game_upper( $rec->answertext, $game->language); @@ -350,6 +360,8 @@ function hangman_showpage(&$done, &$correct, &$wrong, $max, &$wordline, &$wordli $word = $query->answertext; + echo(""); + $newletter = optional_param('newletter', "", PARAM_TEXT); if ( $newletter == '_') { $newletter = ' '; @@ -443,6 +455,7 @@ function hangman_showpage(&$done, &$correct, &$wrong, $max, &$wordline, &$wordli $finishedword = ($done or $wrong >= $max); $finished = false; + $updrec = new stdClass(); $updrec->id = $hangman->id; $updrec->letters = $letters; @@ -569,7 +582,6 @@ function game_hangman_show_nextword( $id, $game, $attempt, $hangman) { echo "wwwroot}/mod/game/attempt.php?$params"; } else { game_hangman_onfinishgame( $game, $attempt, $hangman); - if (game_can_start_new_attempt( $game)) { echo "wwwroot}/mod/game/attempt.php?id=$id\">". get_string( 'nextgame', 'game').'         '; @@ -582,3 +594,11 @@ function game_hangman_show_nextword( $id, $game, $attempt, $hangman) { echo "wwwroot}/course/view.php?id=$cm->course\">".get_string( 'finish', 'game').' '; } + +function debug_to_console( $data ) { + $output = $data; + if ( is_array( $output ) ) + $output = implode( ',', $output); + + echo ""; +} diff --git a/locallib.php b/locallib.php index 31b1bd3..53b1b8e 100644 --- a/locallib.php +++ b/locallib.php @@ -208,7 +208,6 @@ function game_question_shortanswer_glossary( $game, $allowspaces, $userepetition if ( $rec->attachment != '') { $rec->attachment = "glossary/{$game->glossaryid}/$rec->id/$rec->attachment"; } - return $rec; } @@ -1926,7 +1925,7 @@ foreach ($anss as $answer) { +?>