diff --git a/CHANGES.md b/CHANGES.md index aa07fd6..15f6f86 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +Changes in version 3.36.31.1 (2015123101) +------------------------------------------------------------------ +- New: Disable summarize of attempts + Changes in version 3.36.29.1 (2015122901) ------------------------------------------------------------------ - Fix: Coding style diff --git a/db/install.xml b/db/install.xml index 6294ef4..74fe050 100755 --- a/db/install.xml +++ b/db/install.xml @@ -1,5 +1,5 @@ - @@ -45,6 +45,7 @@ + diff --git a/db/upgrade.php b/db/upgrade.php index ad4152e..a08108b 100755 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -1525,5 +1525,15 @@ function xmldb_game_upgrade($oldversion) { upgrade_mod_savepoint(true, 2015122105, 'game'); } + if ($oldversion < ($ver = 2015123101)) { + $table = new xmldb_table('game'); + $field = new xmldb_field('disablesummarize', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, '0'); + if (!$dbman->field_exists($table, $field)) { + $dbman->add_field($table, $field); + } + + upgrade_mod_savepoint(true, $ver, 'game'); + } + return true; } diff --git a/lang/en/game.php b/lang/en/game.php index b14511f..5773d9a 100755 --- a/lang/en/game.php +++ b/lang/en/game.php @@ -240,6 +240,7 @@ $string[ 'cross_options'] = 'Crossword options'; $string[ 'cross_showprint'] = 'Show print button'; $string[ 'cryptex_maxtries'] = 'Max tries'; $string[ 'cryptex_options'] = 'Cryptex options'; +$string[ 'disablesummarize'] = 'Disable summarize'; $string[ 'gameclose'] = 'Close the game'; $string[ 'gameopen'] = 'Open the game'; $string[ 'gameopenclose'] = 'Open and close dates'; diff --git a/mod_form.php b/mod_form.php index 1777f0a..5a48e01 100755 --- a/mod_form.php +++ b/mod_form.php @@ -169,6 +169,9 @@ class mod_game_mod_form extends moodleform_mod { $mform->addElement('text', 'maxattempts', get_string('cross_max_attempts', 'game')); $mform->setType('maxattempts', PARAM_INT); + // Disable summarize. + $mform->addElement('selectyesno', 'disablesummarize', get_string('disablesummarize', 'game')); + // Grade options. $mform->addElement('header', 'gradeoptions', get_string('grades', 'grades')); $mform->addElement('text', 'grade', get_string( 'grademax', 'grades'), array('size' => 4)); diff --git a/version.php b/version.php index 55c4b1c..6f00300 100755 --- a/version.php +++ b/version.php @@ -36,10 +36,11 @@ if (!isset( $plugin)) { } $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics). -$plugin->version = 2015122901; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2015123101; // 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 = '3.36.29.1'; +$plugin->release = '3.36.31 +.1'; if ($useplugin != 2) { $module = $plugin; diff --git a/view.php b/view.php index ff211a2..3ec778a 100755 --- a/view.php +++ b/view.php @@ -72,6 +72,14 @@ if (game_use_events()) { $completion = new completion_info($course); $completion->set_module_viewed($cm); +// Here have to check if not need summarize +if ($game->disablesummarize) { + if (game_can_start_new_attempt( $game)) { + require_once( 'attempt.php'); + die; + } +} + // Initialize $PAGE, compute blocks. $PAGE->set_url('/mod/game/view.php', array('id' => $cm->id));