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. 64
      bookquiz/play.php
  3. 2
      cross/cross_class.php
  4. 2
      cross/crossdb_class.php
  5. 258
      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. 27
      lib.php
  15. 4
      locallib.php
  16. 2
      mod_form.php
  17. 2
      pagelib.php
  18. 2
      print.php
  19. 2
      report/overview/report.php
  20. 2
      showanswers.php
  21. 2
      showattempts.php
  22. 2
      snakes/createboard.php
  23. 10
      snakes/play.php
  24. 4
      sudoku/class.Sudoku.php
  25. 27
      sudoku/play.php
  26. 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 * @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 * Define all the restore steps that will be used by the restore_game_activity_task
*/ */

64
bookquiz/play.php

@ -172,33 +172,33 @@ 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 //--> <!-- subchapter title and upper navigation row //-->
<tr> <tr>
<td width="<?php echo 10;?>" valign="bottom"> <td width="<?php echo 10;?>" valign="bottom">
</td> </td>
<td valign="top"> <td valign="top">
<table border="0" cellspacing="0" width="100%" valign="top" cellpadding="0"> <table border="0" cellspacing="0" width="100%" valign="top" cellpadding="0">
<tr> <tr>
<td align="right"><?php echo $chnavigation ?></td> <td align="right"><?php echo $chnavigation ?></td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<!-- toc and chapter row //--> <!-- toc and chapter row //-->
<tr> <tr>
<td width="<?php echo $tocwidth ?>" valign="top" align="left"> <td width="<?php echo $tocwidth ?>" valign="top" align="left">
<?php <?php
echo $OUTPUT->box_start('generalbox'); echo $OUTPUT->box_start('generalbox');
echo $toc; echo $toc;
echo $OUTPUT->box_end(); echo $OUTPUT->box_end();
?> ?>
</td> </td>
<td valign="top" align="left"> <td valign="top" align="left">
<?php <?php
echo $OUTPUT->box_start('generalbox'); echo $OUTPUT->box_start('generalbox');
$content = ''; $content = '';
if (!$book->customtitles) { if (!$book->customtitles) {
@ -227,12 +227,12 @@ function game_bookquiz_play( $id, $game, $attempt, $bookquiz, $chapterid, $conte
echo $OUTPUT->box_end(); echo $OUTPUT->box_end();
// Lower navigation. // Lower navigation.
echo '<p align="right">'.$chnavigation.'</p>'; echo '<p align="right">'.$chnavigation.'</p>';
?> ?>
</td> </td>
</tr> </tr>
</table> </table>
<?php <?php
if ($showquestions) { if ($showquestions) {
if ($game->param3 != 0) { if ($game->param3 != 0) {
game_bookquiz_showquestions( $id, $questionid, $chapter->id, $nextid, $scoreattempt, $game, $context); 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 // You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
/* /*
Crossing Words for Crossing Words for
Codewalkers PHP Coding Contest of July 2002 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 // You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. // 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 * This class is a cross that can load and save to a table
* *

258
cross/play.php

@ -280,34 +280,34 @@ margin-top: 1em;
</head> </head>
<?php <?php
if ($print) { if ($print) {
echo '<body onload="window.print()">'; echo '<body onload="window.print()">';
} else { } else {
echo '<body>'; echo '<body>';
} }
if ($game->toptext != '') { if ($game->toptext != '') {
echo $game->toptext.'<br>'; echo $game->toptext.'<br>';
} }
?> ?>
<h1></h1> <h1></h1>
<div id="waitmessage" class="answerboxstyle"> <div id="waitmessage" class="answerboxstyle">
This interactive crossword puzzle requires JavaScript and a reasonably recent web browser, such as Internet Explorer 5.5 This interactive crossword puzzle requires JavaScript and a reasonably recent web browser, such as Internet Explorer 5.5
or later, Netscape 7, Mozilla, Firefox, or Safari. If you have disabled web page scripting, please re-enable it and refresh or later, Netscape 7, Mozilla, Firefox, or Safari. If you have disabled web page scripting, please re-enable it and refresh
the page. the page.
</div> </div>
<p><table cellpadding="0" cellspacing="0" border="0"> <p><table cellpadding="0" cellspacing="0" border="0">
<?php <?php
if ($game->param3 == 2) { if ($game->param3 == 2) {
echo "<tr>\r\n"; echo "<tr>\r\n";
game_cross_show_welcome( $game); game_cross_show_welcome( $game);
echo "</tr>\r\n"; echo "</tr>\r\n";
echo "<tr><tr><td>&nbsp</td></tr>\r\n"; echo "<tr><tr><td>&nbsp</td></tr>\r\n";
} }
?> ?>
<tr> <tr>
@ -333,138 +333,125 @@ var CrosswordFinished, Initialized;
// Check the user's browser and then initialize the puzzle. // Check the user's browser and then initialize the puzzle.
if (document.getElementById("waitmessage") != null) if (document.getElementById("waitmessage") != null)
{ {
document.getElementById("waitmessage").innerHTML = "<?php echo get_string( 'cross_pleasewait', 'game'); ?>"; document.getElementById("waitmessage").innerHTML = "<?php echo get_string( 'cross_pleasewait', 'game'); ?>";
// Current game variables // Current game variables
CurrentWord = -1; CurrentWord = -1;
PrevWordHorizontal = false; PrevWordHorizontal = false;
<?php <?php
echo $html; echo $html;
?> ?>
OnlyCheckOnce = false;
OnlyCheckOnce = false; // Create the cell-to-word arrays.
TableAcrossWord = new Array(CrosswordWidth);
// Create the cell-to-word arrays. for (var x = 0; x < CrosswordWidth; x++)
TableAcrossWord = new Array(CrosswordWidth);
for (var x = 0; x < CrosswordWidth; x++)
TableAcrossWord[x] = new Array(CrosswordHeight); TableAcrossWord[x] = new Array(CrosswordHeight);
TableDownWord = new Array(CrosswordWidth); TableDownWord = new Array(CrosswordWidth);
for (var x = 0; x < CrosswordWidth; x++){ for (var x = 0; x < CrosswordWidth; x++){
TableDownWord[x] = new Array(CrosswordHeight); TableDownWord[x] = new Array(CrosswordHeight);
} }
GuessLeter = new Array(CrosswordWidth); GuessLeter = new Array(CrosswordWidth);
for (var x = 0; x < CrosswordWidth; x++) for (var x = 0; x < CrosswordWidth; x++) {
{ GuessLeter[x] = new Array(CrosswordHeight);
GuessLeter[x] = new Array(CrosswordHeight); for (var y = 0; y < CrosswordHeight; y++) {
for (var y = 0; y < CrosswordHeight; y++) GuessLeter[ x][ y] = "_";
{ }
GuessLeter[ x][ y] = "_"; }
}
}
solu = new Array(CrosswordWidth); solu = new Array(CrosswordWidth);
for (var x = 0; x < CrosswordWidth; x++) for (var x = 0; x < CrosswordWidth; x++) {
{ solu[x] = new Array(CrosswordHeight);
solu[x] = new Array(CrosswordHeight); for (var y = 0; y < CrosswordHeight; y++) {
for (var y = 0; y < CrosswordHeight; y++) solu[ x][ y] = "";
{ }
solu[ x][ y] = ""; }
}
}
for (var y = 0; y < CrosswordHeight; y++) for (var y = 0; y < CrosswordHeight; y++) {
for (var x = 0; x < CrosswordWidth; x++) for (var x = 0; x < CrosswordWidth; x++) {
{ TableAcrossWord[x][y] = -1;
TableAcrossWord[x][y] = -1; TableDownWord[x][y] = -1;
TableDownWord[x][y] = -1; }
}
// First, add the horizontal words to the puzzle.
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++)
{
TableAcrossWord[x + j][y] = i;
if( j < s.length)
c = s.substr( j, 1);
else
c = '';
GuessLeter[ x+ j][ y] = c;
if( j < so.length)
c = so.substr( j, 1);
else
c = '';
solu[ x+j][ y] = c;
}
} }
// First, add the horizontal words to the puzzle.
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++) {
TableAcrossWord[x + j][y] = i;
if( j < s.length)
c = s.substr( j, 1);
else
c = '';
GuessLeter[ x+ j][ y] = c;
if( j < so.length)
c = so.substr( j, 1);
else
c = '';
solu[ x+j][ y] = c;
}
}
// Second, add the vertical words to the puzzle. // 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];
x = WordX[i]; y = WordY[i];
y = WordY[i]; s = Guess[ i];
s = Guess[ i]; so = Solutions[ 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)
TableDownWord[x][y + j] = i; c = s.substr( j, 1);
if( j < s.length) else
c = s.substr( j, 1); c = '';
else GuessLeter[ x][ y+j] = c;
c = ''; if( j < so.length)
GuessLeter[ x][ y+j] = c; c = so.substr( j, 1);
if( j < so.length) else
c = so.substr( j, 1); c = '';
else solu[ x][ y+j] = c;
c = ''; }
solu[ x][ y+j] = c; }
}
}
document.writeln("<tr><td></td>"); 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
document.write("<td align=center>" + (x+1) + " </td>"); //col numbers }
}
// Now, insert the row HTML into the table. // 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.writeln("<tr>"); document.write("<td>" + (y+1)+" </td>"); //line numbers
document.write("<td>" + (y+1)+" </td>"); //line numbers for (var x = 0; x < CrosswordWidth; x++) {
for (var x = 0; x < CrosswordWidth; x++) if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0) {
{
if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0)
{
var s; var s;
s = "<td id=\"c" + PadNumber(x) + PadNumber(y); s = "<td id=\"c" + PadNumber(x) + PadNumber(y);
s += "\" class=\"gamebox boxnormal_unsel\" onclick=\"SelectThisWord(event);\">"; s += "\" class=\"gamebox boxnormal_unsel\" onclick=\"SelectThisWord(event);\">";
document.write( s); document.write( s);
if( solu[x][y] != '') if( solu[x][y] != '')
document.write( solu[x][y]); document.write( solu[x][y]);
else if( GuessLeter[x][y]== "_") else if( GuessLeter[x][y]== "_")
document.write( "&nbsp;"); document.write( "&nbsp;");
else else
document.write( GuessLeter[x][y]); document.write( GuessLeter[x][y]);
document.write("</td>"); document.write("</td>");
}else } else {
document.write("<td></td>"); //empty cell document.write("<td></td>"); //empty cell
} }
document.writeln("</tr>"); }
} document.writeln("</tr>");
}
// Finally, show the crossword and hide the wait message. // Finally, show the crossword and hide the wait message.
Initialized = true; Initialized = true;
document.getElementById("waitmessage").style.display = "none"; document.getElementById("waitmessage").style.display = "none";
document.getElementById("crossword").style.display = "block"; document.getElementById("crossword").style.display = "block";
} }
// ---------- // ----------
@ -815,10 +802,8 @@ function OnPrint()
} }
<?php <?php
} }
?> ?>
<?php <?php
if ($showhtmlprintbutton) { if ($showhtmlprintbutton) {
?> ?>
@ -988,7 +973,6 @@ function CheckHtmlClick()
</tr></table> </tr></table>
<?php <?php
if ($onlyshow == false) { if ($onlyshow == false) {
echo '<div style="margin-top: 1em;">'; echo '<div style="margin-top: 1em;">';
@ -1067,7 +1051,6 @@ function CheckHtmlClick()
?> ?>
</body> </body>
<?php <?php
@ -1137,7 +1120,6 @@ function game_cross_show_welcome1() {
onkeypress="WordEntryKeyPress(event)" onchange="WordEntryKeyPress(event)" autocomplete="off"></div> onkeypress="WordEntryKeyPress(event)" onchange="WordEntryKeyPress(event)" autocomplete="off"></div>
<div id="worderror" style="color:#c00000;font-weight:bold;display:none;margin-top:1em;"></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> <table border="0" cellspacing="0" cellpadding="0" width="100%" style="margin-top:1em;"><tr>
<td align="right"> <td align="right">
<button id="okbutton" type="button" class="button" onclick="OKClick();" style="font-weight: bold;">OK</button> &nbsp; <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> </td><td>&nbsp</td><td>
<div id="answerbox2" class="answerboxstyle" style="display:none;"> <div id="answerbox2" class="answerboxstyle" style="display:none;">
<h3 id="wordlabel" style="text-transform:uppercase;margin:0;"> </h3> <h3 id="wordlabel" style="text-transform:uppercase;margin:0;"> </h3>
<div id="wordinfo" style="font-size:8pt;color:#808080"> </div> <div id="wordinfo" style="font-size:8pt;color:#808080"> </div>
<div id="wordclue" class="cluebox"> </div> <div id="wordclue" class="cluebox"> </div>
</div> </div>
</div> </div>
</td> </td>
<?php <?php
} }

2
cryptex/cryptexdb_class.php

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

2
db/access.php

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

2
exporthtml_hangman.php

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

2
exporthtml_millionaire.php

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

2
exporthtml_snakes.php

@ -21,6 +21,8 @@
* @package game * @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"> <!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"> <html xmlns="http://www.w3.org/1999/xhtml">

2
exportjavame.php

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

2
headergame.php

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
require_once(dirname(__FILE__) . '/../../config.php'); require_once(dirname(__FILE__) . '/../../config.php');
require_once($CFG->libdir.'/gradelib.php'); require_once($CFG->libdir.'/gradelib.php');
require_once($CFG->dirroot.'/mod/game/locallib.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 * This page lists all the instances of game module in a particular course
* *
* @author * @author Vasilis Daloukas
* @package game * @package game
**/ **/

27
lib.php

@ -21,6 +21,8 @@
* @package game * @package game
**/ **/
defined('MOODLE_INTERNAL') || die();
// Define CONSTANTS. // Define CONSTANTS.
/* /*
@ -51,9 +53,9 @@ define('GAME_REVIEW_SOLUTIONS', 16 * 0x1041); // Show solutions.
define('GAME_REVIEW_GENERALFEEDBACK', 32 * 0x1041); // Show general feedback. define('GAME_REVIEW_GENERALFEEDBACK', 32 * 0x1041); // Show general feedback.
/** /**
* Given an object containing all the necessary data, * Given an object containing all the necessary data,
* (defined by the form in mod.html) this function * (defined by the form in mod.html) this function
* will create a new instance and return the id number * will create a new instance and return the id number
* of the new instance. * of the new instance.
* *
* @param object $instance An object from the form in mod.html * @param object $instance An object from the form in mod.html
@ -79,8 +81,8 @@ function game_add_instance($game) {
} }
/** /**
* Given an object containing all the necessary data, * Given an object containing all the necessary data,
* (defined by the form in mod.html) this function * (defined by the form in mod.html) this function
* will update an existing instance with new data. * will update an existing instance with new data.
* *
* @param object $instance An object from the form in mod.html * @param object $instance An object from the form in mod.html
@ -178,8 +180,8 @@ function game_before_add_or_update(&$game) {
/** /**
* Given an ID of an instance of this module, * Given an ID of an instance of this module,
* this function will permanently delete the instance * this function will permanently delete the instance
* and any data that depends on it. * and any data that depends on it.
* *
* @param int $id Id of the module instance * @param int $id Id of the module instance
* @return boolean Success/Failure * @return boolean Success/Failure
@ -236,7 +238,7 @@ function game_delete_instance($gameid) {
} }
/** /**
* Return a small object with summary information about what a * Return a small object with summary information about what a
* user has done with a given particular instance of this module * user has done with a given particular instance of this module
* Used for user activity reports. * Used for user activity reports.
* $return->time = the time they did it * $return->time = the time they did it
@ -287,8 +289,8 @@ function game_user_complete($course, $user, $mod, $game) {
} }
/** /**
* Given a course and a time, this module should find recent activity * Given a course and a time, this module should find recent activity
* that has occurred in game activities and print it out. * that has occurred in game activities and print it out.
* Return true if there was output, or false is there was none. * Return true if there was output, or false is there was none.
* *
* @uses $CFG * @uses $CFG
@ -303,9 +305,10 @@ function game_print_recent_activity($course, $isteacher, $timestart) {
/** /**
* Function to be run periodically according to the moodle cron * Function to be run periodically according to the moodle cron
* This function searches for things that need to be done, such * This function searches for things that need to be done, such
* as sending out mail, toggling flags etc ... * as sending out mail, toggling flags etc ...
* *
* @uses $CFG * @uses $CFG
* @return boolean * @return boolean
* @todo Finish documenting this function * @todo Finish documenting this function

4
locallib.php

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

2
mod_form.php

@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/** /**
* Form for creating and modifying a game * Form for creating and modifying a game
* *
* @package game * @package game
* @author Alastair Munro <alastair@catalyst.net.nz> * @author Alastair Munro <alastair@catalyst.net.nz>

2
pagelib.php

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

2
print.php

@ -16,7 +16,7 @@
/** /**
* This page export the game to html * This page export the game to html
* *
* @author bdaloukas * @author bdaloukas
* @package game * @package game
**/ **/

2
report/overview/report.php

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

2
showanswers.php

@ -16,7 +16,7 @@
/** /**
* This page shows the answers of the current game * This page shows the answers of the current game
* *
* @author bdaloukas * @author bdaloukas
* @package game * @package game
**/ **/

2
showattempts.php

@ -16,7 +16,7 @@
/** /**
* This page shows the answers of the current game * This page shows the answers of the current game
* *
* @author bdaloukas * @author bdaloukas
* @package game * @package game
**/ **/

2
snakes/createboard.php

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

10
snakes/play.php

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || die();
// This files plays the game "Snakes and Ladders". // This files plays the game "Snakes and Ladders".
function game_snakes_continue( $id, $game, $attempt, $snakes, $context) { function game_snakes_continue( $id, $game, $attempt, $snakes, $context) {
@ -95,9 +97,9 @@ function game_snakes_play( $id, $game, $attempt, $snakes, $context) {
--> -->
</script> </script>
<table> <table>
<tr> <tr>
<td> <td>
<div id="board" STYLE="position:relative; left:0px;top:0px; <div id="board" STYLE="position:relative; left:0px;top:0px;
width:<?php p($board->width); ?>px; height:<?php p($board->height); ?>px;"> width:<?php p($board->width); ?>px; height:<?php p($board->height); ?>px;">
@ -109,7 +111,7 @@ function game_snakes_play( $id, $game, $attempt, $snakes, $context) {
game_snakes_showdice( $snakes, $board); game_snakes_showdice( $snakes, $board);
} }
?> ?>
</td> </td>
</tr> </tr>
</table> </table>
<?php <?php

4
sudoku/class.Sudoku.php

@ -54,6 +54,8 @@
* attempting to distribute clues more optimally. * attempting to distribute clues more optimally.
*/ */
defined('MOODLE_INTERNAL') || die();
@require_once("SDD/class.SDD.php"); @require_once("SDD/class.SDD.php");
/* /*
@ -477,7 +479,7 @@ class rcs extends ObjectS{
* @param integer $theRow the row coordinate on the board of the cell. * @param integer $theRow the row coordinate on the board of the cell.
* @param integer $theColumn the column coordinate on the board of the cell. * @param integer $theColumn the column coordinate on the board of the cell.
* @return integer the degree of coupling between the cell and the rest of the cells * @return integer the degree of coupling between the cell and the rest of the cells
* within the row/column/square. * within the row/column/square.
*/ */
public function coupling($therow, $thecolumn) { public function coupling($therow, $thecolumn) {

27
sudoku/play.php

@ -273,20 +273,19 @@ function game_sudoku_showsudoku( $data, $guess, $bshowlegend, $bshowsolution, $o
$href = $CFG->wwwroot.'/mod/game/attempt.php?action=sudokucheckn&id='.$id; $href = $CFG->wwwroot.'/mod/game/attempt.php?action=sudokucheckn&id='.$id;
?> ?>
<script language="javascript"> <script language="javascript">
function OnCheck( pos) function OnCheck( pos) {
{ s = window.prompt( "<?php echo get_string ( 'sudoku_guessnumber', 'game') ?>", "");
s = window.prompt( "<?php echo get_string ( 'sudoku_guessnumber', 'game') ?>", "");
if (s < "1")
if (s < "1") return;
return; if (s > "9")
if (s > "9") return;
return;
window.location.href = "<?php echo $href; ?>&pos=" + pos + "&num=" + s;
window.location.href = "<?php echo $href; ?>&pos=" + pos + "&num=" + s; }
} </script>
</script> <?php
<?php
// Here are the congratulations. // Here are the congratulations.
if ($attempt->timefinish) { if ($attempt->timefinish) {

2
sudoku/sdd/class.logfile.php

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

Loading…
Cancel
Save