Browse Source

In mod_form.php checks if the selected category corresponds to selected glossary

MOODLE_20_STABLE
Vasilis Daloukas 8 years ago
parent
commit
e4f9841f37
  1. 1
      lang/en/game.php
  2. 15
      mod_form.php
  3. 2
      version.php

1
lang/en/game.php

@ -300,6 +300,7 @@ $string[ 'sudoku_maxquestions'] = 'Maximum number of questions';
$string[ 'sudoku_options'] = 'Sudoku options'; $string[ 'sudoku_options'] = 'Sudoku options';
$string[ 'toptext'] = 'Text at the top of page'; $string[ 'toptext'] = 'Text at the top of page';
$string[ 'userdefined'] = 'User defined'; $string[ 'userdefined'] = 'User defined';
$string[ 'different_glossary_category'] = "The selected category doesn't corespond to selected glossary";
// File preview.php. // File preview.php.
$string[ 'only_teachers'] = 'Only teacher can see this page'; $string[ 'only_teachers'] = 'Only teacher can see this page';

15
mod_form.php

@ -442,6 +442,8 @@ class mod_game_mod_form extends moodleform_mod {
* @return moodle_url * @return moodle_url
*/ */
public function validation($data, $files) { public function validation($data, $files) {
global $CFG, $DB;
$errors = parent::validation($data, $files); $errors = parent::validation($data, $files);
// Check open and close times are consistent. // Check open and close times are consistent.
@ -450,6 +452,19 @@ class mod_game_mod_form extends moodleform_mod {
$errors['timeclose'] = get_string('closebeforeopen', 'quiz'); $errors['timeclose'] = get_string('closebeforeopen', 'quiz');
} }
if( $data['glossarycategoryid'] != 0) {
$sql = "SELECT glossaryid FROM {$CFG->prefix}glossary_categories ".
" WHERE id=".$data[ 'glossarycategoryid'];
$rec = $DB->get_record_sql( $sql);
if( $rec != false) {
if( $data[ 'glossaryid'] != $rec->glossaryid) {
$s = get_string( 'different_glossary_category', 'game');
$errors['glossaryid'] = $s;
$errors['glossarycategoryid'] = $s;
}
}
}
return $errors; return $errors;
} }

2
version.php

@ -35,7 +35,7 @@ if (!isset( $plugin)) {
} }
$plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics). $plugin->component = 'mod_game'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2017062901; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2017062902; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2010112400; // Requires Moodle 2.0. $plugin->requires = 2010112400; // Requires Moodle 2.0.
$plugin->cron = 0; // Period for cron to check this module (secs). $plugin->cron = 0; // Period for cron to check this module (secs).
$plugin->release = '2017-06-29'; $plugin->release = '2017-06-29';

Loading…
Cancel
Save