diff --git a/CHANGES.md b/CHANGES.md index c94fd53..ef07474 100644 --- a/CHANGES.md +++ b/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) - Fix: Completion support diff --git a/check.php b/check.php index fb73c65..e97aa13 100644 --- a/check.php +++ b/check.php @@ -42,9 +42,12 @@ function game_check_common_problems($context, $game) { game_check_common_problems_multichoice( $game, $warnings); break; case 'hangman': + game_check_common_problems_shortanswer( $game, $warnings); + break; case 'cross': case 'cryptex': game_check_common_problems_shortanswer( $game, $warnings); + game_check_common_problems_crossword_cryptex( $game, $warnings); 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).')'; } } + +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.')'; + } +} + diff --git a/lang/en/game.php b/lang/en/game.php index bdb6839..f76bcea 100644 --- a/lang/en/game.php +++ b/lang/en/game.php @@ -41,6 +41,7 @@ $string[ 'common_problems'] = 'Common problems'; $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_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. $string[ 'eventgamecreated'] = 'Game created'; diff --git a/lib.php b/lib.php index 4789729..771ccd2 100644 --- a/lib.php +++ b/lib.php @@ -1380,11 +1380,6 @@ function game_get_completion_state($course, $cm, $userid, $type) { } 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; } /** diff --git a/mod_form.php b/mod_form.php index 1842d36..8beaf53 100644 --- a/mod_form.php +++ b/mod_form.php @@ -162,7 +162,6 @@ class mod_game_mod_form extends moodleform_mod { $mform->addElement('selectyesno', 'disablesummarize', get_string('disablesummarize', 'game')); // Grade options. - //$mform->addElement('header', 'gradeoptions', get_string('grades', 'grades')); $this->standard_grading_coursemodule_elements(); $mform->removeElement('grade'); $mform->addElement('text', 'grade', get_string( 'grademax', 'grades'), array('size' => 4)); diff --git a/showanswers.php b/showanswers.php index 0272ef0..3662b0f 100644 --- a/showanswers.php +++ b/showanswers.php @@ -519,39 +519,3 @@ function game_showanswers_bookquiz( $game, $context) { game_showanswers_question_select( $game, $table, $select, "DISTINCT q.*", "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; - } -} diff --git a/version.php b/version.php index 5091471..53f9e5e 100644 --- a/version.php +++ b/version.php @@ -35,10 +35,10 @@ if (!isset( $plugin)) { } $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->cron = 0; // Period for cron to check this module (secs). -$plugin->release = '2017-07-19'; +$plugin->release = '2017-08-06'; $plugin->maturity = MATURITY_STABLE; if ($useplugin != 2) {