Skip to content

Commit 0bb1838

Browse files
committed
Fix: warnings in code checker
1 parent 540fb35 commit 0bb1838

6 files changed

Lines changed: 42 additions & 46 deletions

File tree

bookquiz/play.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function game_bookquiz_continue(
7474
* @param stdClass $course
7575
*/
7676
function game_bookquiz_play($cm, $game, $attempt, $bookquiz, $chapterid, $context, $course) {
77-
global $DB, $OUTPUT, $cm;
77+
global $DB, $OUTPUT;
7878

7979
// Find where the book is stoped.
8080
if ($bookquiz->lastchapterid == 0) {

lib.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -749,14 +749,14 @@ function game_get_extra_capabilities(): array {
749749
return $caps;
750750
}
751751

752-
/*
753-
* Return a textual summary of the number of attemtps that have been made at a particular game,
752+
/**
753+
* Return a summary of the number of attempts made for a game.
754754
*
755-
* @param stdClass $game the game object. Only $game->id is used at the moment.
756-
* @param stcClass $cm the cm object. Only $cm->course, $cm->groupmode and $cm->groupingid fields are used at the moment.
757-
* @param bool $returnzero if false (default), when no attempts have been made '' is returned instead of 'Attempts: 0'.
758-
* @param int $currentgroup if there is a concept of current group pass it in here. Default 0 which means no current group.
759-
* @return string a string like "Attempts: 123", "Attemtps 123 (45 from your groups)"
755+
* @param stdClass $game The game object. Only $game->id is used.
756+
* @param stdClass $cm The course module object. Only $cm->course, $cm->groupmode and $cm->groupingid are used.
757+
* @param bool $returnzero If false, when no attempts have been made an empty string is returned.
758+
* @param int $currentgroup The current group id. Default 0 means no current group.
759+
* @return string A summary such as "Attempts: 123".
760760
*/
761761
function game_num_attempt_summary(stdClass $game, stdClass $cm, bool $returnzero = false, int $currentgroup = 0) {
762762
global $CFG, $USER, $DB;

showattempts.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

1717
/**
18-
* This page shows the answers of the current game
18+
* This page shows the answers of the current game.
1919
*
2020
* @package mod_game
21+
* @subpackage game
2122
* @copyright 2007 Vasilis Daloukas
2223
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2324
*/

snakes/play.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

1717
/**
18-
* Snakes and Ladders game play logic.
19-
*
20-
* This file contains all gameplay functions for the snakes game type.
18+
* Export game to printable HTML format.
2119
*
2220
* @package mod_game
21+
* @subpackage snakes
2322
* @copyright 2007 Vasilis Daloukas
2423
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2524
*/

sudoku/create.php

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,29 @@
3434
}
3535

3636
/**
37-
* Show form
37+
* Show the form.
3838
*
3939
* @package mod_game
4040
*/
4141
function showform() {
42-
$id = required_param('id', PARAM_NUMBER); // The action.
43-
44-
?>
45-
<form name="form" method="post" action="create.php">
46-
<center>
47-
<table cellpadding="5">
48-
<tr valign="top">
49-
<td align="right"><b><?php echo get_string('sudoku_create_count', 'game'); ?>:</b></td>
50-
<td>
51-
<input type="text" name="count" size="6" value="2" /><br>
52-
</td>
53-
</tr>
54-
<tr><td colspan=2><center><br><input type="submit" value="<?php print_string('sudoku_create_start', 'game') ?>" /></td></tr>
55-
</table>
56-
<input type="hidden" name=action value="create" >
57-
<input type="hidden" name=level1 value="1" >
58-
<input type="hidden" name=level2 value="10" >
59-
<input type="hidden" name=id value="<?php echo $id; ?>" />
60-
</form>
61-
62-
<?php
42+
$id = required_param('id', PARAM_INT);
43+
44+
echo '<form name="form" method="post" action="create.php">';
45+
echo '<div>';
46+
echo '<table cellpadding="5">';
47+
echo '<tr valign="top">';
48+
echo '<td align="right"><b>' . get_string('sudoku_create_count', 'game') . ':</b></td>';
49+
echo '<td><input type="text" name="count" size="6" value="2" /><br></td>';
50+
echo '</tr>';
51+
echo '<tr><td colspan="2"><center><br><input type="submit" value="' .
52+
s(get_string('sudoku_create_start', 'game')) . '" /></center></td></tr>';
53+
echo '</table>';
54+
echo '<input type="hidden" name="action" value="create" />';
55+
echo '<input type="hidden" name="level1" value="1" />';
56+
echo '<input type="hidden" name="level2" value="10" />';
57+
echo '<input type="hidden" name="id" value="' . s($id) . '" />';
58+
echo '</div>';
59+
echo '</form>';
6360
}
6461

6562
/**

sudoku/play.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -372,19 +372,18 @@ function game_sudoku_showsudoku(
372372
echo "</table>\r\n";
373373
$href = $CFG->wwwroot . '/mod/game/attempt.php?action=sudokucheckn&id=' . $cm->id;
374374

375-
?>
376-
<script language="javascript">
377-
function OnCheck(pos) {
378-
s = window.prompt("<?php echo get_string('sudoku_guessnumber', 'game') ?>", "");
379-
if (s < "1")
380-
return;
381-
if (s > "9")
382-
return;
383-
window.location.href = "<?php echo $href; ?>&pos=" + pos + "&num=" + s;
375+
echo '<script type="text/javascript">
376+
function OnCheck(pos) {
377+
var s = window.prompt(' . json_encode(get_string('sudoku_guessnumber', 'game')) . ', "");
378+
if (s < "1") {
379+
return;
384380
}
385-
</script>
386-
<?php
387-
381+
if (s > "9") {
382+
return;
383+
}
384+
window.location.href = ' . json_encode($href) . ' + "&pos=" + pos + "&num=" + s;
385+
}
386+
</script>';
388387
// Here are the congratulations.
389388
if ($attempt->timefinish) {
390389
return $count;

0 commit comments

Comments
 (0)