Browse Source

New: Ability to hide some games

MOODLE_20_STABLE
ubuntu 11 years ago
parent
commit
5084c94d40
  1. 19
      lang/en/game.php
  2. 137
      lib.php
  3. 41
      settings.php
  4. 4
      version.php

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

137
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)

41
settings.php

@ -0,0 +1,41 @@
<?php // $Id: settings.php
/**
* Form for creating and modifying a game
*
* @package game
* @author Vasilis Daloukas
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->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));
}

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

Loading…
Cancel
Save