From ac6b79ad5bc4ae5fc45673db6705469da19e751e Mon Sep 17 00:00:00 2001 From: Vasilis Daloukas Date: Sun, 13 Jul 2014 22:36:01 +0300 Subject: [PATCH] New: Image set in hangman --- lang/en/game.php | 3 ++- mod_form.php | 16 ++++++++++++++-- settings.php | 19 +++++++++++-------- version.php | 4 ++-- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/lang/en/game.php b/lang/en/game.php index 55e94a0..52cecc1 100755 --- a/lang/en/game.php +++ b/lang/en/game.php @@ -290,6 +290,7 @@ $string[ 'startagain'] = 'Start again'; $string[ 'timetaken'] = 'Time taken'; //settings.php +$string[ 'hangmanimagesets'] = 'Number of image sets used by hangman'; $string[ 'hidebookquiz'] = 'Hide the "Book with questions" game'; $string[ 'hidecross'] = 'Hide the Crossword game'; $string[ 'hidecryptex'] = 'Hide the Cryptex game'; @@ -298,6 +299,7 @@ $string[ 'hidehiddenpicture'] = 'Hide the "Hidden Picture" game'; $string[ 'hidemillionaire'] = 'Hide the Millionaire game'; $string[ 'hidesnakes'] = 'Hide the "Snakes and Ladders" game'; $string[ 'hidesudoku'] = 'Hide the Sudoku game'; +$string[ 'confighangmanimagesets'] = 'Configs how many set of images are used by hangman'; $string[ 'confighidebookquiz'] = 'Configs if the "Book with questions" game is shown to teachers or not'; $string[ 'confighidecross'] = 'Configs if the Crossword game is shown to teachers or not'; $string[ 'confighidecryptex'] = 'Configs if the Cryptex game is shown to teachers or not'; @@ -307,7 +309,6 @@ $string[ 'confighidemillionaire'] = 'Configs if the Millionaire game is shown to $string[ 'confighidesnakes'] = 'Configs if the "Snakes and Ladders" game is shown to teachers or not'; $string[ 'confighidesudoku'] = 'Configs if the Sudoku game is shown to teachers or not'; - //showanswers.php $string[ 'clearrepetitions'] = 'Clear statistics'; $string[ 'computerepetitions'] = 'Compute statistics again'; diff --git a/mod_form.php b/mod_form.php index c2c6239..7f414d3 100755 --- a/mod_form.php +++ b/mod_form.php @@ -15,6 +15,9 @@ class mod_game_mod_form extends moodleform_mod { function definition() { global $CFG, $DB, $COURSE; + + $config = get_config('game'); + $mform =& $this->_form; $id = $this->_instance; @@ -210,8 +213,17 @@ class mod_game_mod_form extends moodleform_mod { $mform->addElement('text', 'param10', get_string( 'hangman_maximum_number_of_errors', 'game'), array('size' => 4)); $mform->setType('param10', PARAM_INT); - $a = array( 1 => 1); - $mform->addElement('select', 'param3', get_string('hangman_imageset','game'), $a); + if( !isset( $config->hangmanimagesets)) + $number = 1; + else + $number = $config->hangmanimagesets; + if( $number > 1) + { + $a = array(); + for( $i=1; $i <= $number; $i++) + $a[ $i] = $i; + $mform->addElement('select', 'param3', get_string('hangman_imageset','game'), $a); + } $mform->addElement('selectyesno', 'param5', get_string('hangman_showquestion', 'game')); $mform->setDefault('param5', 1); diff --git a/settings.php b/settings.php index 2c20e9b..ed99261 100644 --- a/settings.php +++ b/settings.php @@ -15,27 +15,30 @@ if ($ADMIN->fulltree) { // General settings $settings->add(new admin_setting_configcheckbox('game/hidebookquiz', - get_string('hidebookquiz', 'mod_game'), get_string('confighidebookquiz', 'mod_game'), 0)); + get_string('hidebookquiz', 'game'), get_string('confighidebookquiz', 'game'), 0)); $settings->add(new admin_setting_configcheckbox('game/hidecross', - get_string('hidecross', 'mod_game'), get_string('confighidecross', 'mod_game'), 0)); + get_string('hidecross', 'game'), get_string('confighidecross', 'game'), 0)); $settings->add(new admin_setting_configcheckbox('game/hidehiddenpicture', - get_string('hidehiddenpicture', 'mod_game'), get_string('confighidehiddenpicture', 'mod_game'), 0)); + get_string('hidehiddenpicture', 'game'), get_string('confighidehiddenpicture', 'game'), 0)); $settings->add(new admin_setting_configcheckbox('game/hidecryptex', - get_string('hidecryptex', 'mod_game'), get_string('confighidecryptex', 'mod_game'), 0)); + get_string('hidecryptex', 'game'), get_string('confighidecryptex', 'game'), 0)); $settings->add(new admin_setting_configcheckbox('game/hidehangman', - get_string('hidehangman', 'mod_game'), get_string('confighidehangman', 'mod_game'), 0)); + get_string('hidehangman', 'game'), get_string('confighidehangman', 'game'), 0)); $settings->add(new admin_setting_configcheckbox('game/hidemillionaire', - get_string('hidemillionaire', 'mod_game'), get_string('confighidemillionaire', 'mod_game'), 0)); + get_string('hidemillionaire', 'game'), get_string('confighidemillionaire', 'game'), 0)); $settings->add(new admin_setting_configcheckbox('game/hidesnakes', - get_string('hidesnakes', 'mod_game'), get_string('confighidesnakes', 'mod_game'), 0)); + get_string('hidesnakes', 'game'), get_string('confighidesnakes', 'game'), 0)); $settings->add(new admin_setting_configcheckbox('game/hidesudoku', - get_string('hidesudoku', 'mod_game'), get_string('confighidesudoku', 'mod_game'), 0)); + get_string('hidesudoku', 'game'), get_string('confighidesudoku', 'game'), 0)); + + $settings->add(new admin_setting_configtext('game/hangmanimagesets', get_string('hangmanimagesets', 'game'), + get_string('confighangmanimagesets', 'game'), 1, PARAM_INT)); } diff --git a/version.php b/version.php index e19edc1..455a879 100755 --- a/version.php +++ b/version.php @@ -22,10 +22,10 @@ if( !isset( $plugin)) $useplugin = 2; $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics) -$plugin->version = 2014071315; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 2014071317; // 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.19.13'; +$plugin->release = '3.19.17'; if( $useplugin != 2) $module = $plugin;