Browse Source

my messag

MOODLE_20_STABLE
bdaloukas 12 years ago
parent
commit
e96f74222b
  1. 22
      cross/crossdb_class.php
  2. 4
      version.php

22
cross/crossdb_class.php

@ -65,9 +65,7 @@ class CrossDB extends Cross
$html = ''; $html = '';
$done = false; $done = false;
if( $g == ""){ $loadfromdb = ( $g == "");
$game_questions = false;
}
$this->m_mincol = $this->m_minrow = 0; $this->m_mincol = $this->m_minrow = 0;
$this->m_maxcol = $crossrec->cols; $this->m_maxcol = $crossrec->cols;
@ -98,7 +96,7 @@ class CrossDB extends Cross
$correctletters = $wrongletters = $restletters = 0; $correctletters = $wrongletters = $restletters = 0;
foreach( $a as $rec){ foreach( $a as $rec){
$this->updatecrossquestions( $rec, $g, $pos, $correctletters, $wrongletters, $restletters, $game, $attempt, $crossrec); $this->updatecrossquestions( $rec, $g, $pos, $correctletters, $wrongletters, $restletters, $game, $attempt, $crossrec, $loadfromdb);
$b[] = $rec; $b[] = $rec;
if( ($rec->col != 0) and ($rec->row != 0)){ if( ($rec->col != 0) and ($rec->row != 0)){
@ -138,10 +136,11 @@ function game_cross_computecheck( $correctletters, $wrongletters, $restletters,
if( $correctletters > 1 or $wrongletters > 1) { if( $correctletters > 1 or $wrongletters > 1) {
$ret = get_string( 'cross_found_many', 'game'); $ret = get_string( 'cross_found_many', 'game');
}else }else if( count( $a))
{ {
$ret = get_string( 'cross_found_one', 'game'); $ret = get_string( 'cross_found_one', 'game');
} }else
$ret = '';
$i = 0; $i = 0;
foreach( $a as $msg) foreach( $a as $msg)
@ -178,13 +177,18 @@ function game_cross_computecheck( $correctletters, $wrongletters, $restletters,
} }
//rec is a record of cross_questions //rec is a record of cross_questions
function updatecrossquestions( &$rec, &$g, &$pos, &$correctletters, &$wrongletters, &$restletters, $game, $attempt, $crossrec) function updatecrossquestions( &$rec, &$g, &$pos, &$correctletters, &$wrongletters, &$restletters, $game, $attempt, $crossrec, $loadfromdb)
{ {
global $DB, $USER; global $DB, $USER;
$word = $rec->answertext; $word = $rec->answertext;
$len = textlib::strlen( $word); $len = textlib::strlen( $word);
$guess = textlib::substr( $g, $pos, $len);
if( $loadfromdb)
$guess = $rec->studentanswer;
else
$guess = textlib::substr( $g, $pos, $len);
$len_guess = textlib::strlen( $guess);; $len_guess = textlib::strlen( $guess);;
$pos += $len; $pos += $len;
@ -202,7 +206,7 @@ function game_cross_computecheck( $correctletters, $wrongletters, $restletters,
$letterword= textlib::substr( $word, $i, 1); $letterword= textlib::substr( $word, $i, 1);
if( $letterword != $letterguess) if( $letterword != $letterguess)
{ {
if( ($letterguess != ' ' and $letterguess != '_') or ($letterword == ' ')){ if( ($letterguess != ' ' and $letterguess != '_')){
$wrongletters++; $wrongletters++;
} }
game_setchar( $guess, $i, '_'); game_setchar( $guess, $i, '_');

4
version.php

@ -11,7 +11,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$module->component = 'mod_game'; // Full name of the plugin (used for diagnostics) $module->component = 'mod_game'; // Full name of the plugin (used for diagnostics)
$module->version = 2013072603; // The current module version (Date: YYYYMMDDXX) $module->version = 2013072604; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2010112400; // Requires Moodle 2.0 $module->requires = 2010112400; // Requires Moodle 2.0
$module->cron = 0; // Period for cron to check this module (secs) $module->cron = 0; // Period for cron to check this module (secs)
$module->release = '3.7.26.3'; $module->release = '3.7.26.4';

Loading…
Cancel
Save