From fb05776cafd5a0e1fcf12532c00e53c74e4a59e5 Mon Sep 17 00:00:00 2001 From: bdaloukas Date: Mon, 15 Jul 2013 00:19:53 +0300 Subject: [PATCH] New: Writes the version of game at the form of editing the game --- locallib.php | 10 ++++++++++ mod_form.php | 7 +++++-- version.php | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/locallib.php b/locallib.php index 9d0263d..3a8bf83 100755 --- a/locallib.php +++ b/locallib.php @@ -1897,3 +1897,13 @@ function game_debug_array( $title, $a) print_r( $a); echo '
'; } + +function game_get_version() +{ + global $DB; + + if( ($rec = $DB->get_record( 'modules', array( 'name' => 'game'), 'id,version')) === false) + return ''; + + return $rec->version; +} diff --git a/mod_form.php b/mod_form.php index f74c26d..c68fd1e 100755 --- a/mod_form.php +++ b/mod_form.php @@ -30,7 +30,7 @@ class mod_game_mod_form extends moodleform_mod { else { $gamekind = required_param('type', PARAM_ALPHA); } - + //Hidden elements $mform->addElement('hidden', 'gamekind', $gamekind); $mform->setDefault('gamekind', $gamekind); @@ -38,9 +38,12 @@ class mod_game_mod_form extends moodleform_mod { $mform->addElement('hidden', 'type', $gamekind); $mform->setDefault('type', $gamekind); $mform->setType('type', PARAM_ALPHA); + + $mform->addElement( 'hidden', 'gameversion', game_get_version()); + $mform->setType('gameversion', PARAM_INT); $mform->addElement('header', 'general', get_string('general', 'form')); - + $mform->addElement('text', 'name', 'Name', array('size'=>'64')); if (!empty($CFG->formatstringstriptags)){ $mform->setType('name', PARAM_TEXT); diff --git a/version.php b/version.php index 716bc91..ef67200 100755 --- a/version.php +++ b/version.php @@ -11,7 +11,7 @@ defined('MOODLE_INTERNAL') || die(); $module->component = 'mod_game'; // Full name of the plugin (used for diagnostics) -$module->version = 2013071301; // The current module version (Date: YYYYMMDDXX) +$module->version = 2013071501; // The current module version (Date: YYYYMMDDXX) $module->requires = 2010112400; // Requires Moodle 2.0 $module->cron = 0; // Period for cron to check this module (secs) -$module->release = '3.7.13.1 (2013071301)'; +$module->release = '3.7.15';