Browse Source

Disable summarize of attempts

MOODLE_20_STABLE
Vasilis Daloukas 9 years ago
parent
commit
0203d1ecb9
  1. 4
      CHANGES.md
  2. 3
      db/install.xml
  3. 10
      db/upgrade.php
  4. 1
      lang/en/game.php
  5. 3
      mod_form.php
  6. 5
      version.php
  7. 8
      view.php

4
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

3
db/install.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/game/db" VERSION="20151221" COMMENT="XMLDB file for Moodle mod/game"
<XMLDB PATH="mod/game/db" VERSION="20151229" COMMENT="XMLDB file for Moodle mod/game"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
@ -45,6 +45,7 @@
<FIELD NAME="subcategories" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="maxattempts" TYPE="int" LENGTH="3" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="userlanguage" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="disablesummarize" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>

10
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;
}

1
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';

3
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));

5
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;

8
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));

Loading…
Cancel
Save