|
@ -863,12 +863,15 @@ function game_extend_settings_navigation($settings, $gamenode) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/* Returns an array of game type objects to construct |
|
|
* Returns an array of game type objects to construct |
|
|
menu list when adding new game */ |
|
|
* menu list when adding new game |
|
|
require_once($CFG->dirroot.'/version.php'); |
|
|
* |
|
|
if ($branch >= '31') { |
|
|
*/ |
|
|
define('USE_GET_SHORTCUTS', '1'); |
|
|
function game_get_types() { |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!defined('USE_GET_SHORTCUTS')) { |
|
|
|
|
|
function game_get_types() { |
|
|
global $DB; |
|
|
global $DB; |
|
|
|
|
|
|
|
|
$config = get_config('game'); |
|
|
$config = get_config('game'); |
|
@ -973,6 +976,143 @@ function game_get_types() { |
|
|
$types[] = $type; |
|
|
$types[] = $type; |
|
|
|
|
|
|
|
|
return $types; |
|
|
return $types; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (defined('USE_GET_SHORTCUTS')) { |
|
|
|
|
|
/** |
|
|
|
|
|
* Returns an array of game type objects to construct |
|
|
|
|
|
* menu list when adding new game |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
function game_get_shortcuts($defaultitem) { |
|
|
|
|
|
global $DB, $CFG; |
|
|
|
|
|
$config = get_config('game'); |
|
|
|
|
|
$types = array(); |
|
|
|
|
|
$hide = ( isset( $config->hidehangman) ? ($config->hidehangman != 0) : false); |
|
|
|
|
|
if ($hide == false) { |
|
|
|
|
|
$type = new stdClass; |
|
|
|
|
|
$type->archetype = MOD_CLASS_ACTIVITY; |
|
|
|
|
|
$type->type = "game&type=hangman"; |
|
|
|
|
|
$type->name = preg_replace('/.*type=/', '', $type->type); |
|
|
|
|
|
$type->title = get_string('game_hangman', 'game'); |
|
|
|
|
|
$type->link = new moodle_url($defaultitem->link, array('type' => $type->name)); |
|
|
|
|
|
if (empty($type->help) && !empty($type->name) && |
|
|
|
|
|
get_string_manager()->string_exists('help' . $type->name, 'game')) { |
|
|
|
|
|
$type->help = get_string('help' . $type->name, 'game'); |
|
|
|
|
|
} |
|
|
|
|
|
$types[] = $type; |
|
|
|
|
|
} |
|
|
|
|
|
if (isset( $config->hidecross)) { |
|
|
|
|
|
$hide = ($config->hidecross != 0); |
|
|
|
|
|
} else { |
|
|
|
|
|
$hide = false; |
|
|
|
|
|
} |
|
|
|
|
|
if ($hide == false) { |
|
|
|
|
|
$type = new stdClass; |
|
|
|
|
|
$type->archetype = MOD_CLASS_ACTIVITY; |
|
|
|
|
|
$type->type = "game&type=cross"; |
|
|
|
|
|
$type->name = preg_replace('/.*type=/', '', $type->type); |
|
|
|
|
|
$type->title = get_string('game_cross', 'game'); |
|
|
|
|
|
$type->link = new moodle_url($defaultitem->link, array('type' => $type->name)); |
|
|
|
|
|
if (empty($type->help) && !empty($type->name) && |
|
|
|
|
|
get_string_manager()->string_exists('help' . $type->name, 'game')) { |
|
|
|
|
|
$type->help = get_string('help' . $type->name, 'game'); |
|
|
|
|
|
} |
|
|
|
|
|
$types[] = $type; |
|
|
|
|
|
} |
|
|
|
|
|
if (isset( $config->hidecryptex)) { |
|
|
|
|
|
$hide = ($config->hidecryptex != 0); |
|
|
|
|
|
} else { |
|
|
|
|
|
$hide = false; |
|
|
|
|
|
} |
|
|
|
|
|
if ($hide == false) { |
|
|
|
|
|
$type = new stdClass; |
|
|
|
|
|
$type->archetype = MOD_CLASS_ACTIVITY; |
|
|
|
|
|
$type->type = "game&type=cryptex"; |
|
|
|
|
|
$type->title = get_string('game_cryptex', 'game'); |
|
|
|
|
|
$type->name = preg_replace('/.*type=/', '', $type->type); |
|
|
|
|
|
$type->link = new moodle_url($defaultitem->link, array('type' => $type->name)); |
|
|
|
|
|
if (empty($type->help) && !empty($type->name) && |
|
|
|
|
|
get_string_manager()->string_exists('help' . $type->name, 'game')) { |
|
|
|
|
|
$type->help = get_string('help' . $type->name, 'game'); |
|
|
|
|
|
} |
|
|
|
|
|
$types[] = $type; |
|
|
|
|
|
} |
|
|
|
|
|
$hide = (isset( $config->hidemillionaire) ? ($config->hidemillionaire != 0) : false); |
|
|
|
|
|
if ($hide == false) { |
|
|
|
|
|
$type = new stdClass; |
|
|
|
|
|
$type->archetype = MOD_CLASS_ACTIVITY; |
|
|
|
|
|
$type->type = "game&type=millionaire"; |
|
|
|
|
|
$type->title = get_string('game_millionaire', 'game'); |
|
|
|
|
|
$type->name = preg_replace('/.*type=/', '', $type->type); |
|
|
|
|
|
$type->link = new moodle_url($defaultitem->link, array('type' => $type->name)); |
|
|
|
|
|
if (empty($type->help) && !empty($type->name) && |
|
|
|
|
|
get_string_manager()->string_exists('help' . $type->name, 'game')) { |
|
|
|
|
|
$type->help = get_string('help' . $type->name, 'game'); |
|
|
|
|
|
} |
|
|
|
|
|
$types[] = $type; |
|
|
|
|
|
} |
|
|
|
|
|
$hide = (isset( $config->hidesudoku) ? ($config->hidesudoku != 0) : false); |
|
|
|
|
|
if ($hide == false) { |
|
|
|
|
|
$type = new stdClass; |
|
|
|
|
|
$type->archetype = MOD_CLASS_ACTIVITY; |
|
|
|
|
|
$type->type = "game&type=sudoku"; |
|
|
|
|
|
$type->title = get_string('game_sudoku', 'game'); |
|
|
|
|
|
$type->name = preg_replace('/.*type=/', '', $type->type); |
|
|
|
|
|
$type->link = new moodle_url($defaultitem->link, array('type' => $type->name)); |
|
|
|
|
|
if (empty($type->help) && !empty($type->name) && |
|
|
|
|
|
get_string_manager()->string_exists('help' . $type->name, 'game')) { |
|
|
|
|
|
$type->help = get_string('help' . $type->name, 'game'); |
|
|
|
|
|
} |
|
|
|
|
|
$types[] = $type; |
|
|
|
|
|
} |
|
|
|
|
|
$hide = (isset( $config->hidesnakes) ? ($config->hidesnakes != 0) : false); |
|
|
|
|
|
if ($hide == false) { |
|
|
|
|
|
$type = new stdClass; |
|
|
|
|
|
$type->archetype = MOD_CLASS_ACTIVITY; |
|
|
|
|
|
$type->type = "game&type=snakes"; |
|
|
|
|
|
$type->title = get_string('game_snakes', 'game'); |
|
|
|
|
|
$type->name = preg_replace('/.*type=/', '', $type->type); |
|
|
|
|
|
$type->link = new moodle_url($defaultitem->link, array('type' => $type->name)); |
|
|
|
|
|
if (empty($type->help) && !empty($type->name) && |
|
|
|
|
|
get_string_manager()->string_exists('help' . $type->name, 'game')) { |
|
|
|
|
|
$type->help = get_string('help' . $type->name, 'game'); |
|
|
|
|
|
} |
|
|
|
|
|
$types[] = $type; |
|
|
|
|
|
} |
|
|
|
|
|
$hide = (isset( $config->hidehiddenpicture) ? ($config->hidehiddenpicture != 0) : false); |
|
|
|
|
|
if ($hide == false) { |
|
|
|
|
|
$type = new stdClass; |
|
|
|
|
|
$type->archetype = MOD_CLASS_ACTIVITY; |
|
|
|
|
|
$type->type = "game&type=hiddenpicture"; |
|
|
|
|
|
$type->title = get_string('game_hiddenpicture', 'game'); |
|
|
|
|
|
$type->name = preg_replace('/.*type=/', '', $type->type); |
|
|
|
|
|
$type->link = new moodle_url($defaultitem->link, array('type' => $type->name)); |
|
|
|
|
|
if (empty($type->help) && !empty($type->name) && |
|
|
|
|
|
get_string_manager()->string_exists('help' . $type->name, 'game')) { |
|
|
|
|
|
$type->help = get_string('help' . $type->name, 'game'); |
|
|
|
|
|
} |
|
|
|
|
|
$types[] = $type; |
|
|
|
|
|
} |
|
|
|
|
|
$hide = (isset( $config->hidebookquiz) ? ($config->hidebookquiz != 0) : false); |
|
|
|
|
|
if ($hide == false) { |
|
|
|
|
|
if ($DB->get_record( 'modules', array( 'name' => 'book'), 'id,id')) { |
|
|
|
|
|
$type = new stdClass; |
|
|
|
|
|
$type->archetype = MOD_CLASS_ACTIVITY; |
|
|
|
|
|
$type->type = "game&type=bookquiz"; |
|
|
|
|
|
$type->title = get_string('game_bookquiz', 'game'); |
|
|
|
|
|
$type->name = preg_replace('/.*type=/', '', $type->type); |
|
|
|
|
|
$type->link = new moodle_url($defaultitem->link, array('type' => $type->name)); |
|
|
|
|
|
if (empty($type->help) && !empty($type->name) && |
|
|
|
|
|
get_string_manager()->string_exists('help' . $type->name, 'game')) { |
|
|
|
|
|
$type->help = get_string('help' . $type->name, 'game'); |
|
|
|
|
|
} |
|
|
|
|
|
$types[] = $type; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return $types; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function mod_game_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { |
|
|
function mod_game_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { |
|
|