Browse Source

Fix phpdocs problems

MOODLE_20_STABLE
bdaloukas 8 years ago
parent
commit
526fdd2377
  1. 3
      CHANGES.md
  2. 19
      attempt.php
  3. 20
      db/upgrade.php
  4. 33
      export.php
  5. 14
      export/html/snakes/css/game.css
  6. 10
      export/html/snakes/css/modal.css
  7. 38
      export/html/snakes/css/snakes.css
  8. 4
      export/html/snakes/css/subModal.css
  9. 39
      export/html/snakes/js/snakes-mod.js
  10. 96
      lib.php
  11. 106
      locallib.php
  12. 90
      pagelib.php
  13. 14
      print.php
  14. 14
      version.php
  15. 8
      view.php

3
CHANGES.md

@ -1,3 +1,6 @@
Changes in version 2017-06-10 (20170610)
- Fix phpdocs problems
Changes in version 2017-06-09 (20170609)
- Fix Moodle 3.4 compatibility problems
- Fix stylings problems

19
attempt.php

@ -40,6 +40,11 @@ game_do_attempt( $id, $game, $action, $course, $context);
/**
* Do the required checks and print header.
*
* @param int $id
* @param stdClass $game
* @param stdClass $course
* @param stdClass $context
*/
function game_show_header( &$id, &$game, &$course, &$context) {
global $DB, $USER, $PAGE, $OUTPUT;
@ -118,8 +123,12 @@ function game_show_header( &$id, &$game, &$course, &$context) {
/**
* Do one attempt.
*
* @param int $id
* @param stdClass $game
* @param stdClass $course
* @param stdClass $context
*/
function game_do_attempt( $id, $game, $action, $course, $context) {
global $OUTPUT;
@ -194,6 +203,12 @@ function game_do_attempt( $id, $game, $action, $course, $context) {
/**
* Creates one game.
*
* @param stdClass $game
* @param int $id
* @param int $forcenew
* @param stdClass $course
* @param stdClass $context
*/
function game_create( $game, $id, $forcenew, $course, $context) {
global $USER, $CFG, $DB;
@ -236,6 +251,8 @@ function game_create( $game, $id, $forcenew, $course, $context) {
/**
* Unpacks the cross.
*
* @param string $g
*/
function game_cross_unpackpuzzle( $g) {
$ret = "";

20
db/upgrade.php

@ -853,6 +853,16 @@ function xmldb_game_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2007111310, 'game');
}
if ($oldversion < 2007111303) {
$table = new xmldb_table('game');
$field = new xmldb_field('bottomtext', XMLDB_TYPE_TEXT);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2007111303, 'game');
}
if ($oldversion < 2007111842) {
$table = new xmldb_table( 'game_queries');
$field = new xmldb_field( 'gameinstanceid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, '0');
@ -872,16 +882,6 @@ function xmldb_game_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2007111843, 'game');
}
if ($oldversion < 2007111303) {
$table = new xmldb_table('game');
$field = new xmldb_field('bottomtext', XMLDB_TYPE_TEXT);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2007111303, 'game');
}
if ($oldversion < 2007111844) {
$table = new xmldb_table('game_queries');
$field = new xmldb_field('questiontext', XMLDB_TYPE_TEXT, null, null, null, null, '', 'glossaryentryid');

33
export.php

@ -41,6 +41,9 @@ $target = optional_param('target', "", PARAM_ALPHANUM); // The target is HTML or
class mod_game_exporthtml_form extends moodleform {
/**
* Definition of form.
*/
public function definition() {
global $CFG, $game;
@ -98,6 +101,14 @@ class mod_game_exporthtml_form extends moodleform {
$mform->closeHeaderBefore('submitbutton');
}
/**
* Validation of form.
*
* @param stdClass $data
* @param stdClass $files
*
* @return errors
*/
public function validation($data, $files) {
global $CFG, $USER, $DB;
$errors = parent::validation($data, $files);
@ -105,6 +116,9 @@ class mod_game_exporthtml_form extends moodleform {
return $errors;
}
/**
* Do the exporting.
*/
public function export() {
global $game, $DB;
@ -140,6 +154,9 @@ class mod_game_exporthtml_form extends moodleform {
class mod_game_exportjavame_form extends moodleform {
/**
* Definition of form.
*/
public function definition() {
global $CFG, $DB, $game;
@ -192,6 +209,14 @@ class mod_game_exportjavame_form extends moodleform {
$mform->closeHeaderBefore('submitbutton');
}
/**
* Validation of form.
*
* @param stdClass $data
* @param stdClass $files
*
* @return errors
*/
public function validation($data, $files) {
global $CFG, $USER, $DB;
$errors = parent::validation($data, $files);
@ -199,6 +224,9 @@ class mod_game_exportjavame_form extends moodleform {
return $errors;
}
/**
* Do the exporting.
*/
public function export() {
global $game, $DB;
@ -271,6 +299,11 @@ if ($mform->is_cancelled()) {
}
echo $OUTPUT->footer();
/**
* Sends via html a file.
*
* @param string file
*/
function game_send_stored_file($file) {
if (file_exists($file)) {
header('Content-Description: File Transfer');

14
export/html/snakes/css/game.css

@ -1,29 +1,25 @@
.nodis
{
.nodis {
list-style-type: none;
}
#cont
{
#cont {
position: relative;
display: none;
}
.img1
{
.img1 {
position: absolute;
display: none;
}
#dicecont
{
#dicecont {
float: right;
width: 250px;
background-image: url(../images/meter.png);
background-repeat: repeat;
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
color: #FFFFFF;
color: #ffffff;
border: 0.5em solid #333333;
top: 30px;
position: absolute;

10
export/html/snakes/css/modal.css

@ -7,6 +7,7 @@
opacity: .80;
z-index: 9999;
}
.popup_block {
display: none; /*--hidden by default--*/
background: #fff;
@ -18,22 +19,25 @@
top: 50%; left: 50%;
z-index: 99999;
/*--CSS3 Box Shadows--*/
-webkit-box-shadow: 0px 0px 20px #000;
-moz-box-shadow: 0px 0px 20px #000;
box-shadow: 0px 0px 20px #000;
-webkit-box-shadow: 0 0 20px #000;
-moz-box-shadow: 0 0 20px #000;
box-shadow: 0 0 20px #000;
/*--CSS3 Rounded Corners--*/
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
img.btn_close {
float: right;
margin: -55px -55px 0 0;
}
/*--Making IE6 Understand Fixed Positioning--*/
*html #fade {
position: absolute;
}
*html .popup_block {
position: absolute;
}

38
export/html/snakes/css/snakes.css

@ -2,8 +2,7 @@
Husain Limdiyawala(MSc IT DA-IICT)
Any Duplication of this code should be avoided*/
.blocks
{
.blocks {
font-family: Arial, Helvetica, sans-serif;
margin-left: 5px;
margin-top: 2px;
@ -17,65 +16,56 @@ Any Duplication of this code should be avoided*/
background-image: url(../square52.png);
}
.nodis
{
.nodis {
list-style-type: none;
}
#cont
{
#cont {
position: relative;
display: none;
}
#diceimg
{
#diceimg {
display: none;
width: 45px;
height: 44px;
}
.img1
{
.img1 {
position:absolute;
display:none;
}
body
{
background:#CCCCCC;
body {
background:#cccccc;
}
#player
{
#player {
display: none;
z-index: 5;
position: absolute;
}
#players
{
#players {
margin-top: 0.3em;
margin-bottom: 1em;
}
#dicecont
{
#dicecont {
float: right;
width: 170px;
background-image: url(../images/meter.png);
background-repeat: repeat;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #FFFFFF;
color: #ffffff;
border: 0.5em solid #333333;
top: 30px;
position: absolute;
right: 880px;
}
#playbtn
{
#playbtn {
margin-left: 0.5em;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
@ -94,6 +84,7 @@ body
opacity: .80;
z-index: 9999;
}
.popup_block{
display: none; /*--hidden by default--*/
background: #fff;
@ -113,15 +104,18 @@ body
-moz-border-radius: 10px;
border-radius: 10px;
}
img.btn_close {
float: right;
margin: -55px -55px 0 0;
border: 0;
}
/*--Making IE6 Understand Fixed Positioning--*/
*html #fade {
position: absolute;
}
*html .popup_block {
position: absolute;
}

4
export/html/snakes/css/subModal.css

@ -53,8 +53,8 @@
height: 1.3em;
padding: 5px;
border-bottom: 2px solid #000000;
border-top: 1px solid #78A3F2;
border-left: 1px solid #78A3F2;
border-top: 1px solid #7878a3f2;
border-left: 1px solid #7878a3f2;
border-right: 1px solid #204095;
position: relative;
z-index: 203;

39
export/html/snakes/js/snakes-mod.js

@ -1,11 +1,6 @@
/* This code was originally based on code by
Husain Limdiyawala(MSc IT DA-IICT) */
$(document).ready(function () {
});
// Global Variables.
var totblocks = 0;
var data = "";
@ -21,8 +16,8 @@ var destsnake = new Array(4);
var ladsrc = new Array(3);
var laddest = new Array(3);
var quest = new Array(); // Available questions along with multiple answers.
var COR_answered = new Array(); // Record all questions (along with answers) the user responded CORRECTLY.
var WRO_answered = new Array(); // Record all questions (along with answers) the user responded WRONGLY.
var cor_answered = new Array(); // Record all questions (along with answers) the user responded CORRECTLY.
var wro_answered = new Array(); // Record all questions (along with answers) the user responded WRONGLY.
var user = new Array();
// Constract table with questions and answers and pick question to display.
@ -156,7 +151,7 @@ function throwDice(i) {
// The below Function Checks The Snake Biting for a user.
function snakescheck(k) {
i = 0;
var i;
for(i = 0; i <= srcsnake.length; i++) {
if (srcsnake[i] == tots[k]) {
@ -176,7 +171,7 @@ function snakescheck(k) {
// The below function checks the ladders for a user.
function laddercheck(k) {
i = 0;
var i;
for(i = 0; i <= ladsrc.length; i++) {
if (ladsrc[i] == tots[k]) {
@ -254,11 +249,17 @@ function selectPlayer() {
// The below function starts the play.
function play() {
if (tots[l] != null) {
var s;
s = "<ul class='nodis'><li>O Paiktis " + (l + 1);
s = s + " </li><li>brisketai sto tetragwno " + tots[l] + "</li><li></li></ul>";
disableField();
document.getElementById("status").innerHTML = "<ul class='nodis'><li>O Paiktis " + (l + 1) + " </li><li>brisketai sto tetragwno " + tots[l] + "</li><li></li></ul>";
document.getElementById("status").innerHTML = s;
Question();
document.getElementById("status").innerHTML = "<ul class='nodis'><li>O Paiktis " + (l + 1) + " </li><li>vrisketai sto tetragwno " + tots[l] + "</li></ul>";
question();
s = "<ul class='nodis'><li>O Paiktis " + (l + 1);
s = s + " </li><li>vrisketai sto tetragwno " + tots[l] + "</li></ul>";
document.getElementById("status").innerHTML = s;
} else {
document.getElementById("status").innerHTML = "<ul class='nodis'><li>Molis exases...</li></ul>";
}
@ -277,7 +278,7 @@ function doit(i) {
snakescheck(i);
laddercheck(i);
} else {
alert("ÏëïêëÞñùóåò ôçí ðßóôá, óõã÷áñçôÞñéá!!!");
alert("Congatulations!!!");
}
}
@ -296,18 +297,20 @@ function disableField() {
document.getElementById("boardtype").disabled = "disabled";
}
function Question() {
function question() {
var picked, q1;
picked = selectQuest(allQuest);
alert("Randomly selected number:" + picked);
Q1 = prompt(quest[picked * 4], "Απάντηση");
if (Q1 == quest[picked * 4 + 1]) {
q1 = prompt(quest[picked * 4], "Απάντηση");
if (q1 == quest[picked * 4 + 1]) {
alert("Σωστά!")
doit(l);
COR_answered.concat(quest.splice(picked * 4, 4));
cor_answered.concat(quest.splice(picked * 4, 4));
} else {
alert("Η απάντηση δεν ήταν σωστή. Χάνεις τη σειρά σου για αυτό το γύρο!")
WRO_answered.concat(quest.splice(picked * 4, 4));
wro_answered.concat(quest.splice(picked * 4, 4));
}
// Remove question and answers from available questions - (thus not allowing to have a Repeated question).

96
lib.php

@ -61,7 +61,6 @@ define('GAME_REVIEW_GENERALFEEDBACK', 32 * 0x1041); // Show general feedback.
* @param object $instance An object from the form in mod.html
* @return int The id of the newly inserted game record
**/
function game_add_instance($game) {
global $DB;
@ -138,6 +137,11 @@ function game_update_instance($game) {
return true;
}
/**
* Updates some fields before writing to database.
*
* @param stdClass $game
*/
function game_before_add_or_update(&$game) {
if (isset( $game->questioncategoryid)) {
$pos = strpos( $game->questioncategoryid, ',');
@ -264,7 +268,12 @@ function game_user_outline($course, $user, $mod, $game) {
/**
* Print a detailed representation of what a user has done with
* a given particular instance of this module, for user activity reports.
**/
* @param stdClass $course
* @param stdClass $user
* @param string $mod
* @param stdClass $game
*/
function game_user_complete($course, $user, $mod, $game) {
global $DB;
@ -296,11 +305,17 @@ function game_user_complete($course, $user, $mod, $game) {
* @uses $CFG
* @return boolean
* @todo Finish documenting this function
**/
*
* @param stdClass $course
* @param int $isteacher
* @param int $timestart
*
* @return True if anything was printed, otherwise false.
*/
function game_print_recent_activity($course, $isteacher, $timestart) {
global $CFG;
return false; // True if anything was printed, otherwise false.
return false;
}
/**
@ -308,7 +323,6 @@ 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
@ -512,6 +526,13 @@ function game_grade_item_delete( $game) {
/**
* Returns all game graded users since a given time for specified game
* @param stdClass $activities
* @param int $index
* @param int $timestart
* @param int courseid
* @param int cmid
* @param int userid
* @param int groupid
*/
function game_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) {
global $DB, $COURSE, $USER;
@ -607,6 +628,14 @@ function game_get_recent_mod_activity(&$activities, &$index, $timestart, $course
}
}
/**
* Prints recent activity.
*
* @param stdClass $activity
* @param int $courseid
* @param stdClass $detail
* @param array $modgames
*/
function game_print_recent_mod_activity($activity, $courseid, $detail, $modnames) {
global $CFG, $OUTPUT;
@ -755,10 +784,26 @@ function game_num_attempt_summary($game, $cm, $returnzero = false, $currentgroup
return '';
}
/**
* Converts score of game to grade.
*
* @param stdClass $game
* @param float $score
*
* @return float the score
*/
function game_format_score($game, $score) {
return format_float($game->grade * $score / 100, $game->decimalpoints);
}
/**
* Converts grade to score.
*
* @param stdClass $game
* @param float $grade
*
* @return foat score
*/
function game_format_grade($game, $grade) {
return format_float($grade, $game->decimalpoints);
}
@ -1103,6 +1148,18 @@ if (defined('USE_GET_SHORTCUTS')) {
}
}
/**
* Serves the game attachents.
*
* @param stdClass $course
* @param stdClass $cm
* @param stdClass $context
* @param string filearea
* @param array args
* @param boolean forcedownload
*
* @return boolean false if not exists file
*/
function mod_game_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) {
global $CFG, $DB;
@ -1176,6 +1233,8 @@ function game_reset_course_form_definition(&$mform) {
/**
* Course reset form defaults.
* @param stdClass $course
*
* @return array
*/
function game_reset_course_form_defaults($course) {
@ -1188,6 +1247,7 @@ function game_reset_course_form_defaults($course) {
*
* @global object
* @param $data the data submitted from the reset course.
*
* @return array status array
*/
function game_reset_userdata($data) {
@ -1295,6 +1355,7 @@ function game_reset_userdata($data) {
* @param object $cm Course-module
* @param int $userid User ID
* @param bool $type Type of comparison (or/and; can be used as return value if no conditions)
*
* @return bool True if completed, false if not, $type if conditions not set.
*/
function game_get_completion_state($course, $cm, $userid, $type) {
@ -1340,6 +1401,14 @@ function game_scale_used_anywhere($scaleid) {
}
}
/**
* Returns the context instance of a Module. Is the same for all version of Moodle.
*
* This is used to find out if scale used anywhere
*
* @param int $moduleid
* @return stdClass context
*/
function game_get_context_module_instance( $moduleid) {
if (class_exists( 'context_module')) {
return context_module::instance( $moduleid);
@ -1348,6 +1417,14 @@ function game_get_context_module_instance( $moduleid) {
return get_context_instance( CONTEXT_MODULE, $moduleid);
}
/**
* Returns the context instance of a course. Is the same for all version of Moodle.
*
* This is used to find out if scale used anywhere
*
* @param int $moduleid
* @return stdClass context
*/
function game_get_context_course_instance( $courseid) {
if (class_exists( 'context_course')) {
return context_course::instance( $courseid);
@ -1356,11 +1433,18 @@ function game_get_context_course_instance( $courseid) {
return get_context_instance( CONTEXT_COURSE, $courseid);
}
/**
* Returns the url of a pix file. Is the same for all versions of Moodle.
*
* @param string $filename
* @param string module
* @return stdClass url
*/
function game_pix_url( $filename, $module='') {
global $OUTPUT;
if (game_get_moodle_version() >= '03.03') {
return $OUTPUT->image_url($filename, 'mod_game');
return $OUTPUT->image_url($filename, $module);
} else {
return $OUTPUT->pix_url($filename, $module);
}

106
locallib.php

@ -38,6 +38,11 @@ $gamegrademethod = array ( GAME_GRADEMETHOD_HIGHEST => get_string("gradehighest"
define( "CONST_GAME_TRIES_REPETITION", "3");
/**
* Returns the version of Moodle.
*
* @return string version
*/
function game_get_moodle_version() {
global $DB;
@ -56,6 +61,13 @@ function game_get_moodle_version() {
}
}
/**
* Convert a string to upper.
*
* @param string $str
* @param string $lang
* @return string the uppercase of $str
*/
function game_upper( $str, $lang='') {
if ($lang == 'user') {
return $str;
@ -80,6 +92,15 @@ function game_upper( $str, $lang='') {
return $str;
}
/**
* Returns the HTML of a select control.
*
* @param string $name
* @param array a
* @param string $input
* @param array $events
* @return string the HTML
*/
function game_showselectcontrol( $name, $a, $input, $events='') {
$ret = "<select id=\"$name\" name=\"$name\" $events>";
@ -95,6 +116,13 @@ function game_showselectcontrol( $name, $a, $input, $events='') {
return $ret;
}
/**
* Returns the HTML of a checkbox control.
*
* @param string $name
* @param string $value
* @return string the HTML
*/
function game_showcheckbox( $name, $value) {
$a = array();
$a[ 0] = get_string( 'no');
@ -103,7 +131,15 @@ function game_showcheckbox( $name, $value) {
return game_showselectcontrol( $name, $a, $value);
}
// Used by hangman.
/**
* Used by hangman. Returns a short answer.
*
* @param string $name
* @param array a
* @param string $input
* @param array $events
* @return string the HTML
*/
function game_question_shortanswer( $game, $allowspaces=false, $userepetitions=true) {
switch( $game->sourcemodule)
{
@ -118,7 +154,15 @@ function game_question_shortanswer( $game, $allowspaces=false, $userepetitions=t
return false;
}
// Used by hangman.
/**
* Used by hangman. Returns a short answer from glossary.
*
* @param string $name
* @param array a
* @param string $input
* @param array $events
* @return string the HTML
*/
function game_question_shortanswer_glossary( $game, $allowspaces, $userepetitions) {
global $DB;
@ -160,7 +204,15 @@ function game_question_shortanswer_glossary( $game, $allowspaces, $userepetition
return $rec;
}
// Used by hangman.
/**
* Used by hangman. Returns a short answer from quiz.
*
* @param string $name
* @param array a
* @param string $input
* @param array $events
* @return string the HTML
*/
function game_question_shortanswer_quiz( $game, $allowspaces, $userepetitions) {
global $DB;
@ -200,7 +252,15 @@ function game_question_shortanswer_quiz( $game, $allowspaces, $userepetitions) {
}
}
// Used by hangman.
/**
* Used by hangman. Returns a short answer from question.
*
* @param string $name
* @param stdClass $game
* @param boolean $allowspaces
* @param boolean $userepetitions
* @return the short answer record
*/
function game_question_shortanswer_question( $game, $allowspaces, $userepetitions) {
global $DB;
@ -242,7 +302,16 @@ function game_question_shortanswer_question( $game, $allowspaces, $userepetition
}
}
// Used by millionaire, game_question_shortanswer_quiz, hidden picture.
/**
* Select a random question. Used by millionaire, game_question_shortanswer_quiz, hidden picture.
*
* @param stdClass $game
* @param string $table
* @param string $select
* @param string $idfields
* @param boolean userepetitions
* @return stdClass the random question
*/
function game_question_selectrandom( $game, $table, $select, $idfields='id', $userepetitions=true) {
global $DB, $USER;
@ -307,6 +376,15 @@ function game_question_selectrandom( $game, $table, $select, $idfields='id', $us
return $minid;
}
/**
* Updates the repetition table.
*
* @param int $gameid
* @param int $userid
* @param int $questionid
* @param int $glossaryentryid
*/
function game_update_repetitions( $gameid, $userid, $questionid, $glossaryentryid) {
global $DB;
@ -338,7 +416,13 @@ function game_update_repetitions( $gameid, $userid, $questionid, $glossaryentryi
}
}
// Used by sudoku.
/**
* Select random questions for Sudoku.
*
* @param stdClass $game
* @param int count
* @param stdClass the random record(s)
*/
function game_questions_selectrandom( $game, $count=1) {
global $DB;
@ -431,7 +515,15 @@ function game_questions_selectrandom( $game, $count=1) {
return $ret;
}
// Used by game_questions_selectrandom.
/**
* Select random questions. Used by game_questions_selectrandom.
*
* @param string $table
* @param string $select
@param int $idfield
@param int $count
* @return stdClass the random record(s)
*/
function game_questions_selectrandom_detail( $table, $select, $idfield="id", $count=1) {
global $DB;

90
pagelib.php

@ -1,90 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// 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.
define('PAGE_GAME_VIEW', 'mod-game-view');
page_map_class( PAGE_GAME_VIEW, 'page_game');
/**
* Class that models the behavior of a game
*
* @author Jon Papaioannou
* @package pages
*/
class page_game extends page_generic_activity {
public function init_quick($data) {
if (empty($data->pageid)) {
print_error('Cannot quickly initialize page: empty course id');
}
$this->activityname = 'game';
parent::init_quick($data);
}
public function print_header($title, $morebreadcrumbs = null, $navigation ='') {
global $USER, $CFG;
$this->init_full();
$replacements = array(
'%fullname%' => format_string($this->activityrecord->name)
);
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
if ($this->courserecord->id == SITEID) {
$breadcrumbs = array();
} else {
$breadcrumbs = array($this->courserecord->shortname => $CFG->wwwroot.'/course/view.php?id='.$this->courserecord->id);
}
$breadcrumbs[get_string('modulenameplural', 'game')] = $CFG->wwwroot.'/mod/game/index.php?id='.$this->courserecord->id;
$breadcrumbs[format_string($this->activityrecord->name)]
= $CFG->wwwroot.'/mod/game/view.php?id='.$this->modulerecord->id;
if (!empty($morebreadcrumbs)) {
$breadcrumbs = array_merge($breadcrumbs, $morebreadcrumbs);
}
if (empty($morebreadcrumbs) && $this->user_allowed_editing()) {
$buttons = '<table><tr><td>'.
update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'game')).'</td>';
if (!empty($CFG->showblocksonmodpages)) {
$buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php">'.
'<div>'.
'<input type="hidden" name="id" value="'.$this->modulerecord->id.'" />'.
'<input type="hidden" name="edit" value="'.($this->user_is_editing() ? 'off' : 'on').'" />'.
'<input type="submit" value="'.get_string($this->user_is_editing() ? 'blockseditoff' : 'blocksediton').'" />'.
'</div></form></td>';
}
$buttons .= '</tr></table>';
} else {
$buttons = '&nbsp;';
}
print_header($title, $this->courserecord->fullname, $navigation);
}
public function get_type() {
return PAGE_GAME_VIEW;
}
}

14
print.php

@ -44,6 +44,13 @@ function game_print( $game, $update, $context) {
}
}
/**
* Prints a cross.
*
* @param stdClass $game
@param boolean $update
* @param stdClass $context
*/
function game_print_cross( $game, $update, $context) {
require( "cross/play.php");
@ -70,6 +77,13 @@ function game_print_cross( $game, $update, $context) {
$showstudentguess, $context);
}
/**
* Prints a cryptex.
*
* @param stdClass $game
@param boolean $update
* @param stdClass $context
*/
function game_print_cryptex( $game, $update, $context) {
global $DB;

14
version.php

@ -15,12 +15,12 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Code fragment to define the version of game
* This fragment is called by moodle_needs_upgrading() and /admin/index.php
* Version information
*
* @author
* @package game
**/
* @package mod_game
* @copyright 2007 Vasilis Daloukas
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
@ -35,10 +35,10 @@ if (!isset( $plugin)) {
}
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2017060901; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2017061001; // 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-06-09';
$plugin->release = '2017-06-10';
if ($useplugin != 2) {
$module = $plugin;

8
view.php

@ -14,7 +14,13 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
// This page prints a particular instance of game.
/**
* This file is the entry point to the game module. All pages are rendered from here
*
* @package mod_game
* @copyright 2007 Vasilis Daloukas
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or late
*/
require_once(dirname(__FILE__) . '/../../config.php');
require_once($CFG->libdir.'/gradelib.php');

Loading…
Cancel
Save