Browse Source

Fix: PHP coding style problems

MOODLE_20_STABLE
bdaloukas 8 years ago
parent
commit
df488915dd
  1. 16
      attempt.php
  2. 7
      backup/moodle2/backup_game_activity_task.class.php
  3. 4
      backup/moodle2/backup_game_settingslib.php
  4. 7
      backup/moodle2/backup_game_stepslib.php
  5. 1
      backup/moodle2/restore_game_activity_task.class.php
  6. 56
      backup/moodle2/restore_game_stepslib.php
  7. 2
      bookquiz/play.php
  8. 3
      bookquiz/questions.php
  9. 2
      bookquiz/toc.php
  10. 3
      cross/cross_class.php
  11. 5
      cross/crossdb_class.php
  12. 2
      cross/play.php
  13. 1
      cryptex/play.php
  14. 1
      export.php
  15. 1
      exporthtml.php
  16. 1
      exporthtml_hangman.php
  17. 1
      exporthtml_millionaire.php
  18. 1
      exporthtml_snakes.php
  19. 1
      exportjavame.php
  20. 1
      index.php
  21. 2
      lib.php
  22. 1
      millionaire/play.php
  23. 1
      preview.php
  24. 1
      print.php
  25. 1
      report/overview/report.php
  26. 1
      showanswers.php
  27. 1
      showattempts.php
  28. 1
      sudoku/class.Sudoku.php
  29. 4
      sudoku/play.php
  30. 29
      sudoku/sdd/class.SDD.php
  31. 1
      sudoku/sdd/class.logfile.php
  32. 4
      tabs.php
  33. 7
      version.php

16
attempt.php

@ -16,9 +16,8 @@
/**
* This page prints a particular attempt of game
*
*
* @author bdaloukas
* @version $Id: attempt.php,v 1.22 2012/07/25 23:07:43 bdaloukas Exp $
* @package game
**/
require_once( "../../config.php");
@ -39,6 +38,9 @@ $action = optional_param('action', "", PARAM_ALPHANUM); // Is the param action
game_show_header( $id, $game, $course, $context);
game_do_attempt( $id, $game, $action, $course, $context);
/**
* Do the required checks and print header.
*/
function game_show_header( &$id, &$game, &$course, &$context) {
global $DB, $USER, $PAGE, $OUTPUT;
@ -114,6 +116,10 @@ function game_show_header( &$id, &$game, &$course, &$context) {
echo $OUTPUT->header();
}
/**
* Do one attempt.
*/
function game_do_attempt( $id, $game, $action, $course, $context) {
global $OUTPUT;
@ -186,6 +192,9 @@ function game_do_attempt( $id, $game, $action, $course, $context) {
echo $OUTPUT->footer();
}
/**
* Creates one game.
*/
function game_create( $game, $id, $forcenew, $course, $context) {
global $USER, $CFG, $DB;
@ -225,6 +234,9 @@ function game_create( $game, $id, $forcenew, $course, $context) {
}
}
/**
* Unpacks the cross.
*/
function game_cross_unpackpuzzle( $g) {
$ret = "";
$len = game_strlen( $g);

7
backup/moodle2/backup_game_activity_task.class.php

@ -17,12 +17,13 @@
/**
* @package mod_game
* @subpackage backup-moodle2
* class backup_game_activity_task
* @author
* @version $Id: backup_game_activity_task.class.php,v 1.2 2012/07/25 11:16:04 bdaloukas Exp $
* class backup_game_activity_task
* @author
* @package game
**/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/mod/game/backup/moodle2/backup_game_stepslib.php'); // Because it exists (must).
require_once($CFG->dirroot . '/mod/game/backup/moodle2/backup_game_settingslib.php'); // Because it exists (optional).

4
backup/moodle2/backup_game_settingslib.php

@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package moodlecore
* @package game
* @subpackage backup-moodle2
* @copyright 2010 onwards YOUR_NAME_GOES_HERE {@link YOUR_URL_GOES_HERE}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@ -25,3 +25,5 @@
* backup_activity_task so here there isn't any class definition, like the ones
* existing in /backup/moodle2/backup_settingslib.php (activities section)
*/
defined('MOODLE_INTERNAL') || die();

7
backup/moodle2/backup_game_stepslib.php

@ -18,7 +18,6 @@
* @package mod_game
* @subpackage backup-moodle2
* @author bdaloukas
* @version $Id: backup_game_stepslib.php,v 1.5 2012/07/25 11:16:04 bdaloukas Exp $
*/
/**
@ -28,8 +27,14 @@
/**
* Define the complete game structure for backup, with file and id annotations
*/
defined('MOODLE_INTERNAL') || die();
class backup_game_activity_structure_step extends backup_activity_structure_step {
/**
* Defines the needed structures.
*/
protected function define_structure() {
// To know if we are including userinfo.

1
backup/moodle2/restore_game_activity_task.class.php

@ -18,7 +18,6 @@
* @package mod_game
* @subpackage backup-moodle2
* @author bdaloukas
* @version $Id: restore_game_activity_task.class.php,v 1.3 2012/07/25 11:16:04 bdaloukas Exp $
*/
defined('MOODLE_INTERNAL') || die();

56
backup/moodle2/restore_game_stepslib.php

@ -29,6 +29,9 @@
*/
class restore_game_activity_structure_step extends restore_activity_structure_step {
/**
* Defines the neeeded structures.
*/
protected function define_structure() {
$paths = array();
@ -60,6 +63,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
return $this->prepare_activity_structure($paths);
}
/**
* Restores the game table.
*/
protected function process_game($data) {
global $DB;
@ -75,6 +81,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$this->apply_activity_instance($newitemid);
}
/**
* Restores the game_export_html table.
*/
protected function process_game_export_html($data) {
global $DB;
@ -86,6 +95,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
}
}
/**
* Restores the game_export_javame table.
*/
protected function process_game_export_javame($data) {
global $DB;
@ -97,6 +109,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
}
}
/**
* Restores the game_grades table.
*/
protected function process_game_grade($data) {
global $DB;
@ -109,6 +124,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_grades', $data);
}
/**
* Restores the game_repetitions table.
*/
protected function process_game_repetition($data) {
global $DB;
@ -121,6 +139,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_repetitions', $data);
}
/**
* Restores the game_attempts table.
*/
protected function process_game_attempt($data) {
global $DB;
@ -148,6 +169,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$this->set_mapping('game_attempt', $oldid, $newitemid);
}
/**
* Restores the game_queries table.
*/
protected function process_game_query($data) {
global $DB;
@ -162,6 +186,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$this->set_mapping('game_query', $oldid, $newitemid);
}
/**
* Restores the game_bookquiz table.
*/
protected function process_game_bookquiz($data) {
global $DB;
@ -172,6 +199,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_bookquiz', $data);
}
/**
* Restores the game_bookauiz_chapters table.
*/
protected function process_game_bookquiz_chapter($data) {
global $DB;
@ -182,6 +212,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_bookquiz_chapters', $data);
}
/**
* Restores the game_bookquiz_questions table.
*/
protected function process_game_bookquiz_question($data) {
global $DB;
@ -192,6 +225,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_bookquiz_questions', $data);
}
/**
* Restores the game_cross table.
*/
protected function process_game_cross($data) {
global $DB;
@ -202,6 +238,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_cross', $data);
}
/**
* Restores the game_cryptex table.
*/
protected function process_game_cryptex($data) {
global $DB;
@ -212,6 +251,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_cryptex', $data);
}
/**
* Restores the game_hangman table.
*/
protected function process_game_hangman($data) {
global $DB;
@ -223,6 +265,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_hangman', $data);
}
/**
* Restores the game_hiddenpicture table.
*/
protected function process_game_hiddenpicture($data) {
global $DB;
@ -233,6 +278,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_hiddenpicture', $data);
}
/**
* Restores the game_millionaire table.
*/
protected function process_game_millionaire($data) {
global $DB;
@ -244,6 +292,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_millionaire', $data);
}
/**
* Restores the game_snakes table.
*/
protected function process_game_snake($data) {
global $DB;
@ -255,6 +306,9 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_snakes', $data);
}
/**
* Restores the game_sudoku table.
*/
protected function process_game_sudoku($data) {
global $DB;
@ -265,8 +319,8 @@ class restore_game_activity_structure_step extends restore_activity_structure_st
$DB->insert_record('game_sudoku', $data);
}
// Add Game related files, no need to match by itemname (just internally handled context).
protected function after_execute() {
// Add Game related files, no need to match by itemname (just internally handled context).
$this->add_related_files('mod_game', 'snakes_file', null);
$this->add_related_files('mod_game', 'snakes_board', null);
}

2
bookquiz/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();
function game_bookquiz_continue( $id, $game, $attempt, $bookquiz, $chapterid, $context) {
if ($attempt != false and $bookquiz != false) {
return game_bookquiz_play( $id, $game, $attempt, $bookquiz, $chapterid, $context);

3
bookquiz/questions.php

@ -17,11 +17,12 @@
/**
* The script supports book
*
* @version $Id: questions.php,v 1.6 2012/07/25 11:16:05 bdaloukas Exp $
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package game
**/
defined('MOODLE_INTERNAL') || die();
require_once("../../../config.php");
require_once( "../headergame.php");
require_once("../locallib.php");

2
bookquiz/toc.php

@ -14,7 +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/>.
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
defined('MOODLE_INTERNAL') || die();
define('NUM_NONE', '0');
define('NUM_NUMBERS', '1');

3
cross/cross_class.php

@ -23,6 +23,9 @@ Codewalkers PHP Coding Contest of July 2002
Author Àngel Fenoy from Arenys de Mar, Barcelona.
*/
defined('MOODLE_INTERNAL') || die();
class Cross
{
public $minputanswers; // Contains the words and the answers.

5
cross/crossdb_class.php

@ -18,12 +18,13 @@
/**
* This class is a cross that can load and save to a table
*
*
* @author bdaloukas
* @version $Id: crossdb_class.php,v 1.17 2012/07/25 11:16:05 bdaloukas Exp $
* @package game
**/
defined('MOODLE_INTERNAL') || die();
class CrossDB extends Cross {
public function savecross( $game, &$crossm, $crossd, $id) {
global $DB, $USER;

2
cross/play.php

@ -18,6 +18,8 @@
// This files plays the game "Crossword".
defined('MOODLE_INTERNAL') || die();
require( "cross_class.php");
require( "crossdb_class.php");

1
cryptex/play.php

@ -18,7 +18,6 @@
* This page plays the cryptex game
*
* @author bdaloukas
* @version $Id: play.php,v 1.20 2012/08/03 05:52:50 bdaloukas Exp $
* @package game
**/

1
export.php

@ -18,7 +18,6 @@
* This page exports a game to another platform e.g. html, jar
*
* @author bdaloukas
* @version $Id: export.php,v 1.22 2012/07/25 11:16:03 bdaloukas Exp $
* @package game
**/

1
exporthtml.php

@ -18,7 +18,6 @@
* This page export the game to html for games: cross, hangman
*
* @author bdaloukas
* @version $Id: exporthtml.php,v 1.23 2012/07/25 11:16:03 bdaloukas Exp $
* @package game
**/

1
exporthtml_hangman.php

@ -18,7 +18,6 @@
* This page export the game hangman to html
*
* @author bdaloukas
* @version $Id: exporthtml_hangman.php,v 1.10 2012/07/25 11:16:03 bdaloukas Exp $
* @package game
**/

1
exporthtml_millionaire.php

@ -18,7 +18,6 @@
* This page export the game millionaire to html
*
* @author bdaloukas
* @version $Id: exporthtml_millionaire.php,v 1.14 2012/07/25 11:16:03 bdaloukas Exp $
* @package game
**/

1
exporthtml_snakes.php

@ -18,7 +18,6 @@
* This page export the game snakes to html
*
* @author bdaloukas
* @version $Id: exporthtml_snakes.php,v 1.4 2011/07/23 12:34:08 bdaloukas Exp $
* @package game
**/

1
exportjavame.php

@ -18,7 +18,6 @@
* This page export the game to javame for mobile phones
*
* @author bdaloukas
* @version $Id: exportjavame.php,v 1.18 2012/07/25 11:16:03 bdaloukas Exp $
* @package game
**/

1
index.php

@ -18,7 +18,6 @@
* This page lists all the instances of game module in a particular course
*
* @author
* @version $Id: index.php,v 1.8 2012/08/29 20:55:25 bdaloukas Exp $
* @package game
**/

2
lib.php

@ -18,11 +18,9 @@
* Library of functions and constants for module game
*
* @author
* @version $Id: lib.php,v 1.36 2012/07/25 11:16:03 bdaloukas Exp $
* @package game
**/
// Define CONSTANTS.
/*

1
millionaire/play.php

@ -18,7 +18,6 @@
* This file plays the game millionaire
*
* @author bdaloukas
* @version $Id: play.php,v 1.31 2012/07/25 11:16:05 bdaloukas Exp $
* @package game
**/

1
preview.php

@ -18,7 +18,6 @@
* This page prints a particular attempt of game
*
* @author bdaloukas
* @version $Id: preview.php,v 1.10 2012/07/25 11:16:04 bdaloukas Exp $
* @package game
**/

1
print.php

@ -18,7 +18,6 @@
* This page export the game to html
*
* @author bdaloukas
* @version $Id: print.php,v 1.7 2012/07/25 11:16:04 bdaloukas Exp $
* @package game
**/
require_once("../../config.php");

1
report/overview/report.php

@ -17,7 +17,6 @@
/**
* This script lists student attempts
*
* @version $Id: report.php,v 1.5 2012/07/25 11:16:07 bdaloukas Exp $
* @author bdaloukas.
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package game

1
showanswers.php

@ -18,7 +18,6 @@
* This page shows the answers of the current game
*
* @author bdaloukas
* @version $Id: showanswers.php,v 1.7 2012/07/25 22:46:42 bdaloukas Exp $
* @package game
**/

1
showattempts.php

@ -18,7 +18,6 @@
* This page shows the answers of the current game
*
* @author bdaloukas
* @version $Id: showattempts.php,v 1.6 2012/07/25 11:16:04 bdaloukas Exp $
* @package game
**/

1
sudoku/class.Sudoku.php

@ -60,7 +60,6 @@
* @author Dick Munroe <munroe@csworks.com>
* @copyright copyright @ 2005 by Dick Munroe, Cottage Software Works, Inc.
* @license http://www.csworks.com/publications/ModifiedNetBSD.html
* @version 2.2.0
* @package Sudoku
*/

4
sudoku/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();
require_once( "../../lib/questionlib.php");
function game_sudoku_continue( $id, $game, $attempt, $sudoku, $endofgame, $context) {
@ -284,7 +286,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) {

29
sudoku/sdd/class.SDD.php

@ -26,36 +26,9 @@
* @copyright copyright @ by Dick Munroe, 2004
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @package StructuredDataDumper
* @version 1.0.4
*/
//
// Edit History:
//
// Dick Munroe munroe@cworks.com 04-Dec-2004
// Initial version created.
//
// Dick Munroe munroe@csworks.com 08-Dec-2004
// Translate < to &lt; for html output.
//
// Dick Munroe munroe@csworks.com 23-Dec-2004
// Add interface for writing "stuff". Extend SDD
// to get things "written".
//
// Dick Munroe munroe@csworks.com 25-Dec-2004
// If a class extends a base class, but doesn't add
// data members, a warning winds up appearing when
// printing.
// Added a memeber to fetch the state of the logging
// flag.
//
// Dick Munroe munroe@csworks.com 11-Mar-2006
// The test for html flag should have assumed that
// $this can be defined for objects calling SDD::dump.
//
// Dick Munroe (munroe@csworks.com) 22-Mar-2006
// Add a function to generate "newlines".
//
defined('MOODLE_INTERNAL') || die();
class sdd {
/*

1
sudoku/sdd/class.logfile.php

@ -19,7 +19,6 @@
* @copyright copyright @ by Dick Munroe, 2004
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @package StructuredDataDumper
* @version 1.0.1
*/
/*

4
tabs.php

@ -22,6 +22,8 @@
* @package game
*/
defined('MOODLE_INTERNAL') || die();
if (empty($game)) {
print_error('You cannot call this script in that way');
}
@ -71,7 +73,7 @@ if ($currenttab == 'reports' and isset($mode)) {
$allreports = get_list_of_plugins("mod/game/report");
// Standard reports we want to show first
$reportlist = array ('overview' /*, 'regrade' , 'grading' , 'analysis'*/);
$reportlist = array ('overview');
foreach ($allreports as $report) {
if (!in_array($report, $reportlist)) {

7
version.php

@ -18,8 +18,7 @@
* Code fragment to define the version of game
* This fragment is called by moodle_needs_upgrading() and /admin/index.php
*
* @author
* @version $Id: version.php,v 1.49 2012/07/25 22:46:42 bdaloukas Exp $
* @author
* @package game
**/
@ -36,10 +35,10 @@ if (!isset( $plugin)) {
}
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2017053001; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2017053002; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2010112400; // Requires Moodle 2.0.
$plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->release = '2017-05-30';
$plugin->release = '2017-05-30-02';
if ($useplugin != 2) {
$module = $plugin;

Loading…
Cancel
Save