id, $crossm); game_updateattempts( $game, $attempt, 0, 0); return game_cross_play( $id, $game, $attempt, $crossm, '', false, false, false, false, false, false, false, true, $context); } function game_cross_new( $game, $attemptid, &$crossm) { global $DB, $USER; $cross = new CrossDB(); $questions = array(); $infos = array(); $answers = array(); $recs = game_questions_shortanswer( $game); if( $recs == false){ print_error( 'game_cross_continue: '.get_string( 'no_words', 'game')); } $infos = array(); $reps = array(); foreach( $recs as $rec){ if( $game->param7 == false){ if( textlib::strpos( $rec->answertext, ' ')){ continue; //spaces not allowed } } $rec->answertext = game_upper( $rec->answertext); $answers[ $rec->answertext] = game_repairquestion( $rec->questiontext); $infos[ $rec->answertext] = array( $game->sourcemodule, $rec->questionid, $rec->glossaryentryid, $rec->attachment); $a = array( 'gameid' => $game->id, 'userid' => $USER->id, 'questionid' => $rec->questionid, 'glossaryentryid' => $rec->glossaryentryid); if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions r')) != false){ $reps[ $rec->answertext] = $rec2->r; } } $cross->setwords( $answers, $game->param1, $reps); //game->param4 is minimum words in crossword //game->param2 is maximum words in crossword if( $cross->computedata( $crossm, $crossd, $lettets, $game->param4, $game->param2)){ $new_crossd = array(); foreach( $crossd as $rec) { $info = $infos[ $rec->answertext]; if( $info != false){ $rec->sourcemodule = $info[ 0]; $rec->questionid = $info[ 1]; $rec->glossaryentryid = $info[ 2]; $rec->attachment = $info[ 3]; } $new_crossd[] = $rec; } $cross->savecross( $game, $crossm, $new_crossd, $attemptid); } if( count( $crossd) == 0){ print_error( 'game_cross_continue: '.get_string( 'no_words', 'game')); } } function showlegend( $legend, $title) { if( count( $legend) == 0) return; echo "
$title
"; foreach( $legend as $key => $line) echo game_filtertext( "$key: $line
", 0); } function game_cross_play( $id, $game, $attempt, $crossrec, $g, $onlyshow, $showsolution, $endofgame, $print, $checkbutton, $showhtmlsolutions, $showhtmlprintbutton,$showstudentguess, $context) { global $CFG, $DB; $cross = new CrossDB(); $language = $attempt->language; $info = $cross->loadcross( $g, $done, $html, $game, $attempt, $crossrec, $onlyshow, $showsolution, $endofgame, $showhtmlsolutions, $attempt->language,$showstudentguess, $context); if( $language != $attempt->language){ if( !$DB->set_field( 'game_attempts', 'language', $attempt->language, array( 'id' => $attempt->id))){ print_error( "game_cross_play: Can't set language"); } } if( $done or $endofgame){ if (! $cm = $DB->get_record( 'course_modules', array( 'id' => $id))) { print_error("Course Module ID was incorrect id=$id"); } if( $endofgame == false){ echo ''.get_string( 'win', 'game').'
'; } if( game_can_start_new_attempt( $game)) { echo '
'; echo "wwwroot}/mod/game/attempt.php?id=$id&forcenew=1\">".get_string( 'nextgame', 'game').'         '; } }else if( $info != ''){ echo "
$info
"; } if( $attempt->language != '') $wordrtl = game_right_to_left( $attempt->language); else $wordrtl = right_to_left(); $reverseprint = ($wordrtl != right_to_left()); if( $reverseprint) $textdir = 'dir="'.($wordrtl ? 'rtl' : 'ltr').'"'; else $textdir = ''; ?> '; }else{ echo ''; } if( $game->toptext != ''){ echo $game->toptext.'
'; } ?>

This interactive crossword puzzle requires JavaScript and a reasonably recent web browser, such as Internet Explorer 5.5 or later, Netscape 7, Mozilla, Firefox, or Safari. If you have disabled web page scripting, please re-enable it and refresh the page.

param3 == 2){ echo "\r\n"; game_cross_show_welcome( $game); echo "\r\n"; echo "\r\n"; } ?> param3 == 2){ echo ''; game_cross_show_legends( $cross); }else{ game_cross_show_welcome( $game); } ?>
 
>      
'; echo ''; echo '     '; echo '     '; echo "\r\n"; } if( $showhtmlsolutions or $showhtmlprintbutton){ echo '
'; } if( $showhtmlsolutions){ echo ''; } if( $showhtmlprintbutton){ if( $showhtmlsolutions){ echo "    "; } echo ''; } if( $game->param3 == 2){ echo '     '; game_cross_show_welcome( $game); }else{ game_cross_show_legends( $cross); } if( $game->bottomtext != ''){ echo '

'.$game->bottomtext; } if( $attempt != false){ if( $attempt->timefinish == 0 and $endofgame == 0) { ?> param3 <> 2){ game_cross_show_welcome0( $game); }else{ game_cross_show_welcome1(); } } function game_cross_show_welcome0( $game){ ?>

'; ShowLegend( $cross->m_LegendH, get_string( 'cross_across', 'game')); ShowLegend( $cross->m_LegendV, get_string( 'cross_down', 'game')); echo ''; }