Browse Source

Fix: PHP coding style problems

MOODLE_20_STABLE
bdaloukas 8 years ago
parent
commit
bdd03e33dd
  1. 2
      backup/moodle2/restore_game_stepslib.php
  2. 24
      bookquiz/play.php
  3. 2
      cross/cross_class.php
  4. 2
      cross/crossdb_class.php
  5. 70
      cross/play.php
  6. 2
      cryptex/cryptexdb_class.php
  7. 2
      db/access.php
  8. 2
      exporthtml_hangman.php
  9. 2
      exporthtml_millionaire.php
  10. 2
      exporthtml_snakes.php
  11. 2
      exportjavame.php
  12. 2
      headergame.php
  13. 2
      index.php
  14. 3
      lib.php
  15. 4
      locallib.php
  16. 2
      pagelib.php
  17. 2
      report/overview/report.php
  18. 2
      snakes/createboard.php
  19. 2
      snakes/play.php
  20. 2
      sudoku/class.Sudoku.php
  21. 5
      sudoku/play.php
  22. 2
      sudoku/sdd/class.logfile.php

2
backup/moodle2/restore_game_stepslib.php

@ -20,6 +20,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Define all the restore steps that will be used by the restore_game_activity_task
*/

24
bookquiz/play.php

@ -172,11 +172,11 @@ function game_bookquiz_play( $id, $game, $attempt, $bookquiz, $chapterid, $conte
}
}
?>
<table border="0" cellspacing="0" width="100%" valign="top" cellpadding="2">
?>
<table border="0" cellspacing="0" width="100%" valign="top" cellpadding="2">
<!-- subchapter title and upper navigation row //-->
<tr>
<!-- subchapter title and upper navigation row //-->
<tr>
<td width="<?php echo 10;?>" valign="bottom">
</td>
<td valign="top">
@ -186,10 +186,10 @@ function game_bookquiz_play( $id, $game, $attempt, $bookquiz, $chapterid, $conte
</tr>
</table>
</td>
</tr>
</tr>
<!-- toc and chapter row //-->
<tr>
<!-- toc and chapter row //-->
<tr>
<td width="<?php echo $tocwidth ?>" valign="top" align="left">
<?php
echo $OUTPUT->box_start('generalbox');
@ -198,7 +198,7 @@ function game_bookquiz_play( $id, $game, $attempt, $bookquiz, $chapterid, $conte
?>
</td>
<td valign="top" align="left">
<?php
<?php
echo $OUTPUT->box_start('generalbox');
$content = '';
if (!$book->customtitles) {
@ -227,12 +227,12 @@ function game_bookquiz_play( $id, $game, $attempt, $bookquiz, $chapterid, $conte
echo $OUTPUT->box_end();
// Lower navigation.
echo '<p align="right">'.$chnavigation.'</p>';
?>
?>
</td>
</tr>
</table>
</tr>
</table>
<?php
<?php
if ($showquestions) {
if ($game->param3 != 0) {
game_bookquiz_showquestions( $id, $questionid, $chapter->id, $nextid, $scoreattempt, $game, $context);

2
cross/cross_class.php

@ -16,6 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
/*
Crossing Words for
Codewalkers PHP Coding Contest of July 2002

2
cross/crossdb_class.php

@ -16,6 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
/**
* This class is a cross that can load and save to a table
*

70
cross/play.php

@ -280,15 +280,15 @@ margin-top: 1em;
</head>
<?php
if ($print) {
if ($print) {
echo '<body onload="window.print()">';
} else {
} else {
echo '<body>';
}
}
if ($game->toptext != '') {
if ($game->toptext != '') {
echo $game->toptext.'<br>';
}
}
?>
<h1></h1>
@ -302,12 +302,12 @@ margin-top: 1em;
<p><table cellpadding="0" cellspacing="0" border="0">
<?php
if ($game->param3 == 2) {
if ($game->param3 == 2) {
echo "<tr>\r\n";
game_cross_show_welcome( $game);
echo "</tr>\r\n";
echo "<tr><tr><td>&nbsp</td></tr>\r\n";
}
}
?>
<tr>
@ -342,7 +342,6 @@ if (document.getElementById("waitmessage") != null)
<?php
echo $html;
?>
OnlyCheckOnce = false;
// Create the cell-to-word arrays.
@ -355,41 +354,34 @@ if (document.getElementById("waitmessage") != null)
}
GuessLeter = new Array(CrosswordWidth);
for (var x = 0; x < CrosswordWidth; x++)
{
for (var x = 0; x < CrosswordWidth; x++) {
GuessLeter[x] = new Array(CrosswordHeight);
for (var y = 0; y < CrosswordHeight; y++)
{
for (var y = 0; y < CrosswordHeight; y++) {
GuessLeter[ x][ y] = "_";
}
}
solu = new Array(CrosswordWidth);
for (var x = 0; x < CrosswordWidth; x++)
{
for (var x = 0; x < CrosswordWidth; x++) {
solu[x] = new Array(CrosswordHeight);
for (var y = 0; y < CrosswordHeight; y++)
{
for (var y = 0; y < CrosswordHeight; y++) {
solu[ x][ y] = "";
}
}
for (var y = 0; y < CrosswordHeight; y++)
for (var x = 0; x < CrosswordWidth; x++)
{
for (var y = 0; y < CrosswordHeight; y++) {
for (var x = 0; x < CrosswordWidth; x++) {
TableAcrossWord[x][y] = -1;
TableDownWord[x][y] = -1;
}
}
// First, add the horizontal words to the puzzle.
for (var i = 0; i <= LastHorizontalWord; i++)
{
for (var i = 0; i <= LastHorizontalWord; i++) {
x = WordX[i];
y = WordY[i];
s = Guess[ i];
so = Solutions[ i];
for (var j = 0; j < WordLength[i]; j++)
{
for (var j = 0; j < WordLength[i]; j++) {
TableAcrossWord[x + j][y] = i;
if( j < s.length)
c = s.substr( j, 1);
@ -405,14 +397,12 @@ if (document.getElementById("waitmessage") != null)
}
// Second, add the vertical words to the puzzle.
for (var i = LastHorizontalWord + 1; i < Words; i++)
{
for (var i = LastHorizontalWord + 1; i < Words; i++) {
x = WordX[i];
y = WordY[i];
s = Guess[ i];
so = Solutions[ i];
for (var j = 0; j < WordLength[i]; j++)
{
for (var j = 0; j < WordLength[i]; j++) {
TableDownWord[x][y + j] = i;
if( j < s.length)
c = s.substr( j, 1);
@ -428,20 +418,16 @@ if (document.getElementById("waitmessage") != null)
}
document.writeln("<tr><td></td>");
for (var x = 0; x < CrosswordWidth; x++)
{
for (var x = 0; x < CrosswordWidth; x++) {
document.write("<td align=center>" + (x+1) + " </td>"); //col numbers
}
// Now, insert the row HTML into the table.
for (var y = 0; y < CrosswordHeight; y++)
{
for (var y = 0; y < CrosswordHeight; y++) {
document.writeln("<tr>");
document.write("<td>" + (y+1)+" </td>"); //line numbers
for (var x = 0; x < CrosswordWidth; x++)
{
if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0)
{
for (var x = 0; x < CrosswordWidth; x++) {
if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0) {
var s;
s = "<td id=\"c" + PadNumber(x) + PadNumber(y);
s += "\" class=\"gamebox boxnormal_unsel\" onclick=\"SelectThisWord(event);\">";
@ -455,9 +441,10 @@ if (document.getElementById("waitmessage") != null)
document.write( GuessLeter[x][y]);
document.write("</td>");
}else
} else {
document.write("<td></td>"); //empty cell
}
}
document.writeln("</tr>");
}
@ -815,10 +802,8 @@ function OnPrint()
}
<?php
}
?>
<?php
if ($showhtmlprintbutton) {
?>
@ -988,7 +973,6 @@ function CheckHtmlClick()
</tr></table>
<?php
if ($onlyshow == false) {
echo '<div style="margin-top: 1em;">';
@ -1067,7 +1051,6 @@ function CheckHtmlClick()
?>
</body>
<?php
@ -1137,7 +1120,6 @@ function game_cross_show_welcome1() {
onkeypress="WordEntryKeyPress(event)" onchange="WordEntryKeyPress(event)" autocomplete="off"></div>
<div id="worderror" style="color:#c00000;font-weight:bold;display:none;margin-top:1em;"></div>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="margin-top:1em;"><tr>
<td align="right">
<button id="okbutton" type="button" class="button" onclick="OKClick();" style="font-weight: bold;">OK</button> &nbsp;
@ -1146,18 +1128,14 @@ function game_cross_show_welcome1() {
</td><td>&nbsp</td><td>
<div id="answerbox2" class="answerboxstyle" style="display:none;">
<h3 id="wordlabel" style="text-transform:uppercase;margin:0;"> </h3>
<div id="wordinfo" style="font-size:8pt;color:#808080"> </div>
<div id="wordclue" class="cluebox"> </div>
</div>
</div>
</td>
<?php
}

2
cryptex/cryptexdb_class.php

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
class CryptexDB extends CrossDB {
public function savecryptex( $game, &$crossm, $crossd, $id, $letters) {
global $USER;

2
db/access.php

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
/**
* Capability definitions for the game module.
*

2
exporthtml_hangman.php

@ -21,6 +21,8 @@
* @package game
**/
defined('MOODLE_INTERNAL') || die();
?>
<script type="text/javascript">

2
exporthtml_millionaire.php

@ -21,6 +21,8 @@
* @package game
**/
defined('MOODLE_INTERNAL') || die();
function game_millionaire_html_getquestions( $game, $context, &$maxanswers, &$countofquestions, &$retfeedback, $destdir, &$files) {
global $CFG, $DB, $USER;

2
exporthtml_snakes.php

@ -21,6 +21,8 @@
* @package game
**/
defined('MOODLE_INTERNAL') || die();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

2
exportjavame.php

@ -21,6 +21,8 @@
* @package game
**/
defined('MOODLE_INTERNAL') || die();
function game_onexportjavame( $game, $javame) {
global $CFG, $DB;

2
headergame.php

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
require_once(dirname(__FILE__) . '/../../config.php');
require_once($CFG->libdir.'/gradelib.php');
require_once($CFG->dirroot.'/mod/game/locallib.php');

2
index.php

@ -17,7 +17,7 @@
/**
* This page lists all the instances of game module in a particular course
*
* @author
* @author Vasilis Daloukas
* @package game
**/

3
lib.php

@ -21,6 +21,8 @@
* @package game
**/
defined('MOODLE_INTERNAL') || die();
// Define CONSTANTS.
/*
@ -306,6 +308,7 @@ function game_print_recent_activity($course, $isteacher, $timestart) {
* This function searches for things that need to be done, such
* as sending out mail, toggling flags etc ...
*
* @uses $CFG
* @return boolean
* @todo Finish documenting this function

4
locallib.php

@ -14,9 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); // It must be included from a Moodle page.
}
defined('MOODLE_INTERNAL') || die();
// Include those library functions that are also used by core Moodle or other modules.
require_once($CFG->dirroot . '/mod/game/lib.php');

2
pagelib.php

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
require_once( $CFG->libdir.'/pagelib.php');
require_once( $CFG->dirroot.'/course/lib.php'); // Needed for some blocks.

2
report/overview/report.php

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
/**
* This script lists student attempts
*

2
snakes/createboard.php

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
// This file creates a board for "Snakes and Ladders".
function game_createsnakesboard($imageasstring, $colsx, $colsy, $ofstop, $ofsbottom,
$ofsright, $ofsleft, $board, $setwidth, $setheight) {

2
snakes/play.php

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
// This files plays the game "Snakes and Ladders".
function game_snakes_continue( $id, $game, $attempt, $snakes, $context) {

2
sudoku/class.Sudoku.php

@ -54,6 +54,8 @@
* attempting to distribute clues more optimally.
*/
defined('MOODLE_INTERNAL') || die();
@require_once("SDD/class.SDD.php");
/*

5
sudoku/play.php

@ -274,8 +274,7 @@ function game_sudoku_showsudoku( $data, $guess, $bshowlegend, $bshowsolution, $o
?>
<script language="javascript">
function OnCheck( pos)
{
function OnCheck( pos) {
s = window.prompt( "<?php echo get_string ( 'sudoku_guessnumber', 'game') ?>", "");
if (s < "1")
@ -286,7 +285,7 @@ function game_sudoku_showsudoku( $data, $guess, $bshowlegend, $bshowsolution, $o
window.location.href = "<?php echo $href; ?>&pos=" + pos + "&num=" + s;
}
</script>
<?php
<?php
// Here are the congratulations.
if ($attempt->timefinish) {

2
sudoku/sdd/class.logfile.php

@ -28,6 +28,8 @@
* Initial version created/
*/
defined('MOODLE_INTERNAL') || die();
require_once('SDD/class.SDD.php');
class logfile extends SDD {

Loading…
Cancel
Save