Browse Source

New: Ability to use only approved glossary entries

MOODLE_20_STABLE
Vasilis Daloukas 9 years ago
parent
commit
8ffa4077d9
  1. 9
      db/upgrade.php
  2. 1
      lang/en/game.php
  3. 5
      locallib.php
  4. 4
      mod_form.php
  5. 4
      showanswers.php
  6. 4
      version.php

9
db/upgrade.php

@ -1535,5 +1535,14 @@ function xmldb_game_upgrade($oldversion) {
upgrade_mod_savepoint(true, $ver, 'game');
}
if ($oldversion < ($ver = 2016031202)) {
$table = new xmldb_table('game');
$field = new xmldb_field('glossaryonlyapproved', 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

@ -245,6 +245,7 @@ $string[ 'gameopen'] = 'Open the game';
$string[ 'gameopenclose'] = 'Open and close dates';
$string[ 'gameopenclose_help'] = 'Students can only start their attempt(s) after the open time and they must complete their attempts before the close time.';
$string[ 'grademethod'] = 'Grading method';
$string[ 'glossary_only_approved'] = "Only approved or teacher's glossary entries";
$string[ 'hangman_allowspaces'] = 'Allow spaces in words';
$string[ 'hangman_allowsub'] = 'Allow the symbol - in words';
$string[ 'hangman_imageset'] = 'Select the images of hangman';

5
locallib.php

@ -139,6 +139,11 @@ function game_question_shortanswer_glossary( $game, $allowspaces, $userepetition
$select .= " AND concept NOT LIKE '% %' ";
}
if ($game->glossaryonlyapproved) {
// Only approved glossary entries will be used.
$select .= ' AND (ge.approved=1 OR teacherentry=1)';
}
if (($id = game_question_selectrandom( $game, $table, $select, 'ge.id', $userepetitions)) == false) {
return false;
}

4
mod_form.php

@ -116,6 +116,10 @@ class mod_game_mod_form extends moodleform_mod {
}
$mform->addElement('select', 'glossarycategoryid', get_string('sourcemodule_glossarycategory', 'game'), $a);
$mform->disabledIf('glossarycategoryid', 'sourcemodule', 'neq', 'glossary');
// Only approved.
$mform->addElement('selectyesno', 'glossaryonlyapproved', get_string('glossary_only_approved', 'game'));
$mform->disabledIf('subcategories', 'sourcemodule', 'neq', 'glossary');
}
// Question Category - Short Answer.

4
showanswers.php

@ -362,6 +362,10 @@ function game_showanswers_glossary( $game) {
" AND gec.categoryid = {$game->glossarycategoryid}";
$table .= ",{glossary_entries_categories} gec";
}
if ($game->glossaryonlyapproved) {
// Only approved glossary entries will be used.
$select .= ' AND (ge.approved=1 OR teacherentry=1)';
}
$sql = "SELECT ge.id,definition,concept FROM $table WHERE $select ORDER BY definition";
if (($questions = $DB->get_records_sql( $sql)) === false) {
return;

4
version.php

@ -36,10 +36,10 @@ if (!isset( $plugin)) {
}
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2016030201; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2016031202; // 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 = '2016-03-02';
$plugin->release = '2016-03-12';
if ($useplugin != 2) {
$module = $plugin;

Loading…
Cancel
Save