Browse Source

New: check params of crossword/cryptex

MOODLE_20_STABLE
bdaloukas 7 years ago
parent
commit
7d6471ebd0
  1. 3
      CHANGES.md
  2. 13
      check.php
  3. 1
      lang/en/game.php
  4. 5
      lib.php
  5. 1
      mod_form.php
  6. 36
      showanswers.php
  7. 4
      version.php

3
CHANGES.md

@ -1,3 +1,6 @@
Changes in version 2017-08-08 (2017080601)
- New: check params of crossword/cryptex
Changes in version 2017-07-19 (2017071902) Changes in version 2017-07-19 (2017071902)
- Fix: Completion support - Fix: Completion support

13
check.php

@ -42,9 +42,12 @@ function game_check_common_problems($context, $game) {
game_check_common_problems_multichoice( $game, $warnings); game_check_common_problems_multichoice( $game, $warnings);
break; break;
case 'hangman': case 'hangman':
game_check_common_problems_shortanswer( $game, $warnings);
break;
case 'cross': case 'cross':
case 'cryptex': case 'cryptex':
game_check_common_problems_shortanswer( $game, $warnings); game_check_common_problems_shortanswer( $game, $warnings);
game_check_common_problems_crossword_cryptex( $game, $warnings);
break; break;
} }
@ -278,3 +281,13 @@ function game_check_common_problems_shortanswer_hangman( $game, &$warnings, $a)
$warnings[] = get_string( 'common_problems_shortanswer_hangman', 'game').': '.count($ret).' ('.implode( ', ', $ret).')'; $warnings[] = get_string( 'common_problems_shortanswer_hangman', 'game').': '.count($ret).' ('.implode( ', ', $ret).')';
} }
} }
function game_check_common_problems_crossword_cryptex($game, &$warnings) {
global $CFG, $DB;
if ($game->param1 < 10) {
$warnings[] = get_string( 'common_problems_crossword_param1', 'game').' (='.$game->param1.')';
}
}

1
lang/en/game.php

@ -41,6 +41,7 @@ $string[ 'common_problems'] = 'Common problems';
$string[ 'millionaire_also_multichoice'] = 'Multichoice answers without single correct answer'; $string[ 'millionaire_also_multichoice'] = 'Multichoice answers without single correct answer';
$string[ 'common_problems_allowspaces'] = 'There are words with spaces but in the game, spaces are not allowed'; $string[ 'common_problems_allowspaces'] = 'There are words with spaces but in the game, spaces are not allowed';
$string[ 'common_problems_shortanswer_hangman'] = 'Not all characters are in the language of game'; $string[ 'common_problems_shortanswer_hangman'] = 'Not all characters are in the language of game';
$string[ 'common_problems_crossword_param1'] = "'Maximum number of cols/rows' is too small";
// Classes. // Classes.
$string[ 'eventgamecreated'] = 'Game created'; $string[ 'eventgamecreated'] = 'Game created';

5
lib.php

@ -1380,11 +1380,6 @@ function game_get_completion_state($course, $cm, $userid, $type) {
} }
return false; return false;
//$sql = "SELECT MAX(score) as score FROM {$CFG->prefix}game_grades WHERE gameid=$cm->instance AND userid=$userid";
//$grade = $DB->get_record_sql( $sql);
//return $grade && $grade->score > 0;
} }
/** /**

1
mod_form.php

@ -162,7 +162,6 @@ class mod_game_mod_form extends moodleform_mod {
$mform->addElement('selectyesno', 'disablesummarize', get_string('disablesummarize', 'game')); $mform->addElement('selectyesno', 'disablesummarize', get_string('disablesummarize', 'game'));
// Grade options. // Grade options.
//$mform->addElement('header', 'gradeoptions', get_string('grades', 'grades'));
$this->standard_grading_coursemodule_elements(); $this->standard_grading_coursemodule_elements();
$mform->removeElement('grade'); $mform->removeElement('grade');
$mform->addElement('text', 'grade', get_string( 'grademax', 'grades'), array('size' => 4)); $mform->addElement('text', 'grade', get_string( 'grademax', 'grades'), array('size' => 4));

36
showanswers.php

@ -519,39 +519,3 @@ function game_showanswers_bookquiz( $game, $context) {
game_showanswers_question_select( $game, $table, $select, "DISTINCT q.*", game_showanswers_question_select( $game, $table, $select, "DISTINCT q.*",
"bc.pagenum,questiontext", $showcategories, $game->course, $context); "bc.pagenum,questiontext", $showcategories, $game->course, $context);
} }
/**
* Show extra info for answers in millionaire
*
* @param stdClass $game
*/
function game_showanswers_extra_millionaire( $game) {
global $CFG, $DB;
if ($game->questioncategoryid == 0) {
print_error( get_string( 'must_select_questioncategory', 'game'));
}
// Include subcategories.
$select = 'category='.$game->questioncategoryid;
if ($game->subcategories) {
$cats = question_categorylist( $game->questioncategoryid);
if (count( $cats)) {
$select = 'q.category in ('.implode(',', $cats).')';
}
}
if (game_get_moodle_version() < '02.06') {
$table = "{$CFG->prefix}question q, {$CFG->prefix}question_multichoice qmo";
$select .= " AND qtype='multichoice' AND qmo.single <> 1 AND qmo.question=q.id";
} else {
$table = "{$CFG->prefix}question q, {$CFG->prefix}qtype_multichoice_options qmo";
$select .= " AND qtype='multichoice' AND qmo.single <> 1 AND qmo.questionid=q.id";
}
$sql = "SELECT COUNT(*) as c FROM $table WHERE $select";
$rec = $DB->get_record_sql( $sql);
if ($rec->c != 0) {
echo get_string( 'millionaire_also_multichoice', 'game').': '.$rec->c;
}
}

4
version.php

@ -35,10 +35,10 @@ 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 = 2017071902; // The current module version (Date: YYYYMMDDXX). $plugin->version = 2017080601; // 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-07-19'; $plugin->release = '2017-08-06';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
if ($useplugin != 2) { if ($useplugin != 2) {

Loading…
Cancel
Save