diff --git a/lang/en/game.php b/lang/en/game.php index b9e13c6..566384a 100755 --- a/lang/en/game.php +++ b/lang/en/game.php @@ -281,6 +281,25 @@ $string[ 'showall'] = 'Show all'; $string[ 'startagain'] = 'Start again'; $string[ 'timetaken'] = 'Time taken'; +//settings.php +$string[ 'hidebookquiz'] = 'Hide the "Book with questions" game'; +$string[ 'hidecross'] = 'Hide the Crossword game'; +$string[ 'hidecryptex'] = 'Hide the Cryptex game'; +$string[ 'hidehangman'] = 'Hide the Hangman game'; +$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[ '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'; +$string[ 'confighidehangman'] = 'Configs if the Hangman game is shown to teachers or not'; +$string[ 'confighidehiddenpicture'] = 'Configs if the "Hidden Picture" game is shown to teachers or not'; +$string[ 'confighidemillionaire'] = 'Configs if the Millionaire game is shown to teachers or not'; +$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/lib.php b/lib.php index 96d8d97..e1cb929 100755 --- a/lib.php +++ b/lib.php @@ -928,6 +928,8 @@ function game_extend_settings_navigation($settings, $gamenode) { function game_get_types(){ global $DB; + $config = get_config('game'); + $types = array(); $type = new object(); @@ -936,56 +938,112 @@ function game_get_types(){ $type->typestr = '--'.get_string( 'modulenameplural', 'game'); $types[] = $type; - $type = new object(); - $type->modclass = MOD_CLASS_ACTIVITY; - $type->type = "game&type=hangman"; - $type->typestr = get_string('game_hangman', 'game'); - $types[] = $type; + if( isset( $config->hidehangman)) + $hide = ($config->hidehangman != 0); + else + $hide = false; + if( $hide == false) + { + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=hangman"; + $type->typestr = get_string('game_hangman', 'game'); + $types[] = $type; + } - $type = new object(); - $type->modclass = MOD_CLASS_ACTIVITY; - $type->type = "game&type=cross"; - $type->typestr = get_string('game_cross', 'game'); - $types[] = $type; + if( isset( $config->hidecross)) + $hide = ($config->hidecross != 0); + else + $hide = false; + if( $hide == false) + { + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=cross"; + $type->typestr = get_string('game_cross', 'game'); + $types[] = $type; + } - $type = new object(); - $type->modclass = MOD_CLASS_ACTIVITY; - $type->type = "game&type=cryptex"; - $type->typestr = get_string('game_cryptex', 'game'); - $types[] = $type; + if( isset( $config->hidecryptex)) + $hide = ($config->hidecryptex != 0); + else + $hide = false; + if( $hide == false) + { + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=cryptex"; + $type->typestr = get_string('game_cryptex', 'game'); + $types[] = $type; + } - $type = new object(); - $type->modclass = MOD_CLASS_ACTIVITY; - $type->type = "game&type=millionaire"; - $type->typestr = get_string('game_millionaire', 'game'); - $types[] = $type; + if( isset( $config->hidemillionaire)) + $hide = ($config->hidemillionaire != 0); + else + $hide = false; + if( $hide == false) + { + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=millionaire"; + $type->typestr = get_string('game_millionaire', 'game'); + $types[] = $type; + } - $type = new object(); - $type->modclass = MOD_CLASS_ACTIVITY; - $type->type = "game&type=sudoku"; - $type->typestr = get_string('game_sudoku', 'game'); - $types[] = $type; - - $type = new object(); - $type->modclass = MOD_CLASS_ACTIVITY; - $type->type = "game&type=snakes"; - $type->typestr = get_string('game_snakes', 'game'); - $types[] = $type; + if( isset( $config->hidesudoku)) + $hide = ($config->hidesudoku != 0); + else + $hide = false; + if( $hide == false) + { + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=sudoku"; + $type->typestr = get_string('game_sudoku', 'game'); + $types[] = $type; + } - $type = new object(); - $type->modclass = MOD_CLASS_ACTIVITY; - $type->type = "game&type=hiddenpicture"; - $type->typestr = get_string('game_hiddenpicture', 'game'); - $types[] = $type; + if( isset( $config->hidesnakes)) + $hide = ($config->hidesnakes != 0); + else + $hide = false; + if( $hide == false) + { + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=snakes"; + $type->typestr = get_string('game_snakes', 'game'); + $types[] = $type; + } - if($DB->get_record( 'modules', array( 'name' => 'book'), 'id,id')){ + if( isset( $config->hidehiddenpicture)) + $hide = ($config->hidehiddenpicture != 0); + else + $hide = false; + if( $hide == false) + { $type = new object(); $type->modclass = MOD_CLASS_ACTIVITY; - $type->type = "game&type=bookquiz"; - $type->typestr = get_string('game_bookquiz', 'game'); + $type->type = "game&type=hiddenpicture"; + $type->typestr = get_string('game_hiddenpicture', 'game'); $types[] = $type; } + if( isset( $config->hidebookquiz)) + $hide = ($config->hidebookquiz != 0); + else + $hide = false; + if( $hide == false) + { + if($DB->get_record( 'modules', array( 'name' => 'book'), 'id,id')){ + $type = new object(); + $type->modclass = MOD_CLASS_ACTIVITY; + $type->type = "game&type=bookquiz"; + $type->typestr = get_string('game_bookquiz', 'game'); + $types[] = $type; + } + } + $type = new object(); $type->modclass = MOD_CLASS_ACTIVITY; $type->type = "game_group_end"; @@ -993,7 +1051,6 @@ function game_get_types(){ $types[] = $type; return $types; - } function mod_game_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) diff --git a/settings.php b/settings.php new file mode 100644 index 0000000..2c20e9b --- /dev/null +++ b/settings.php @@ -0,0 +1,41 @@ +fulltree) { + require_once(dirname(__FILE__).'/lib.php'); + + // General settings + + $settings->add(new admin_setting_configcheckbox('game/hidebookquiz', + get_string('hidebookquiz', 'mod_game'), get_string('confighidebookquiz', 'mod_game'), 0)); + + $settings->add(new admin_setting_configcheckbox('game/hidecross', + get_string('hidecross', 'mod_game'), get_string('confighidecross', 'mod_game'), 0)); + + $settings->add(new admin_setting_configcheckbox('game/hidehiddenpicture', + get_string('hidehiddenpicture', 'mod_game'), get_string('confighidehiddenpicture', 'mod_game'), 0)); + + $settings->add(new admin_setting_configcheckbox('game/hidecryptex', + get_string('hidecryptex', 'mod_game'), get_string('confighidecryptex', 'mod_game'), 0)); + + $settings->add(new admin_setting_configcheckbox('game/hidehangman', + get_string('hidehangman', 'mod_game'), get_string('confighidehangman', 'mod_game'), 0)); + + $settings->add(new admin_setting_configcheckbox('game/hidemillionaire', + get_string('hidemillionaire', 'mod_game'), get_string('confighidemillionaire', 'mod_game'), 0)); + + $settings->add(new admin_setting_configcheckbox('game/hidesnakes', + get_string('hidesnakes', 'mod_game'), get_string('confighidesnakes', 'mod_game'), 0)); + + $settings->add(new admin_setting_configcheckbox('game/hidesudoku', + get_string('hidesudoku', 'mod_game'), get_string('confighidesudoku', 'mod_game'), 0)); + +} diff --git a/version.php b/version.php index e6fcd41..75b9be1 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 = 2013120202; // The current module version (Date: YYYYMMDDXX) +$module->version = 2013122501; // 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.12.2.2'; +$module->release = '3.12.25';