Browse Source

Adaptações para português

MOODLE_34_STABLE
Matheus Garcia 7 years ago
parent
commit
46a20bc412
  1. 12
      check.php
  2. 22
      hangman/play.php
  3. 3
      locallib.php

12
check.php

@ -280,12 +280,20 @@ function game_check_common_problems_shortanswer_hangman( $game, &$warnings, $a)
foreach ($a as $word) { foreach ($a as $word) {
$word = game_upper( str_replace( ' ', '', $word), $game->language); $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 == '') { if ($game->language == '') {
$game->language = game_detectlanguage( $word); $game->language = game_detectlanguage( $word);
$word = game_upper( $word, $game->language); $word = game_upper( $word, $game->language);
} }
$allletters = game_getallletters( $word, $game->language, $game->userlanguage); $allletters = game_getallletters( $word, $game->language, $game->userlanguage);
if ($allletters != '') { if ($allletters != '') {
continue; continue;
} }
@ -295,6 +303,7 @@ function game_check_common_problems_shortanswer_hangman( $game, &$warnings, $a)
if (count( $ret) != 0) { if (count( $ret) != 0) {
$warnings[] = get_string( 'common_problems_shortanswer_hangman', 'game').': '.count($ret).' ('.implode( ', ', $ret).')'; $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.')'; $warnings[] = get_string( 'common_problems_crossword_param1', 'game').' (='.$game->param1.')';
} }
} }

22
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 = 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("<script>console.log('PHPX: ".$answer."');</script>");
if ($game->language == '') { if ($game->language == '') {
$game->language = game_detectlanguage( $answer); $game->language = game_detectlanguage( $answer);
$answer = game_upper( $rec->answertext, $game->language); $answer = game_upper( $rec->answertext, $game->language);
@ -350,6 +360,8 @@ function hangman_showpage(&$done, &$correct, &$wrong, $max, &$wordline, &$wordli
$word = $query->answertext; $word = $query->answertext;
echo("<script>console.log('PHP: ".$word."');</script>");
$newletter = optional_param('newletter', "", PARAM_TEXT); $newletter = optional_param('newletter', "", PARAM_TEXT);
if ( $newletter == '_') { if ( $newletter == '_') {
$newletter = ' '; $newletter = ' ';
@ -443,6 +455,7 @@ function hangman_showpage(&$done, &$correct, &$wrong, $max, &$wordline, &$wordli
$finishedword = ($done or $wrong >= $max); $finishedword = ($done or $wrong >= $max);
$finished = false; $finished = false;
$updrec = new stdClass(); $updrec = new stdClass();
$updrec->id = $hangman->id; $updrec->id = $hangman->id;
$updrec->letters = $letters; $updrec->letters = $letters;
@ -569,7 +582,6 @@ function game_hangman_show_nextword( $id, $game, $attempt, $hangman) {
echo "<a href=\"{$CFG->wwwroot}/mod/game/attempt.php?$params"; echo "<a href=\"{$CFG->wwwroot}/mod/game/attempt.php?$params";
} else { } else {
game_hangman_onfinishgame( $game, $attempt, $hangman); game_hangman_onfinishgame( $game, $attempt, $hangman);
if (game_can_start_new_attempt( $game)) { if (game_can_start_new_attempt( $game)) {
echo "<a href=\"{$CFG->wwwroot}/mod/game/attempt.php?id=$id\">". echo "<a href=\"{$CFG->wwwroot}/mod/game/attempt.php?id=$id\">".
get_string( 'nextgame', 'game').'</a> &nbsp; &nbsp; &nbsp; &nbsp; '; get_string( 'nextgame', 'game').'</a> &nbsp; &nbsp; &nbsp; &nbsp; ';
@ -582,3 +594,11 @@ function game_hangman_show_nextword( $id, $game, $attempt, $hangman) {
echo "<a href=\"{$CFG->wwwroot}/course/view.php?id=$cm->course\">".get_string( 'finish', 'game').'</a> '; echo "<a href=\"{$CFG->wwwroot}/course/view.php?id=$cm->course\">".get_string( 'finish', 'game').'</a> ';
} }
function debug_to_console( $data ) {
$output = $data;
if ( is_array( $output ) )
$output = implode( ',', $output);
echo "<script>console.log( 'Debug Objects: " . $output . "' );</script>";
}

3
locallib.php

@ -208,7 +208,6 @@ function game_question_shortanswer_glossary( $game, $allowspaces, $userepetition
if ( $rec->attachment != '') { if ( $rec->attachment != '') {
$rec->attachment = "glossary/{$game->glossaryid}/$rec->id/$rec->attachment"; $rec->attachment = "glossary/{$game->glossaryid}/$rec->id/$rec->attachment";
} }
return $rec; return $rec;
} }
@ -1926,7 +1925,7 @@ foreach ($anss as $answer) {
</tr> </tr>
<?php <?php
} }
?> ?>
</table> </table>
</div> </div>
<?php <?php

Loading…
Cancel
Save