id, $crossm); game_updateattempts( $game, $attempt, 0, 0); return game_cross_play( $id, $game, $attempt, $crossm, '', false, false, false, false, false, false, false); } 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_new( $game, $attemptid, &$crossm) { global $USER; $textlib = textlib_get_instance(); $cross = new CrossDB(); $questions = array(); $infos = array(); $answers = array(); $recs = game_questions_shortanswer( $game); if( $recs == false){ 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); $select = "gameid=$game->id AND userid='$USER->id' AND questionid='$rec->questionid' AND glossaryentryid='$rec->glossaryentryid'"; if(($rec2 = get_record_select('game_repetitions', $select, 'id,repetitions r')) != false){ $reps[ $rec->answertext] = $rec2->r; } } $cross->setwords( $answers, $game->param1, $reps); if( $cross->computedata( $crossm, $crossd, $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->save( $game, $crossm, $new_crossd, $attemptid); return true; } if( count( $crossd) == 0){ error( 'game_cross_continue: '.get_string( 'no_words', 'game')); } } function game_cross_play( $id, $game, $attempt, $crossrec, $g, $onlyshow, $showsolution, $endofgame, $print, $checkbutton, $showhtmlsolutions, $showhtmlprintbutton,$showstudentguess=true) { global $CFG; $cross = new CrossDB(); $language = $attempt->language; $info = $cross->load( $g, $done, $html, $game, $attempt, $crossrec, $onlyshow, $showsolution, $finishattempt, $showhtmlsolutions, $attempt->language, $showstudentguess); if( $language != $attempt->language){ if( !set_field( 'game_attempts', 'language', $attempt->language, 'id', $attempt->id)){ error( "game_cross_play: Can't set language"); } } if( $done or $finishattempt){ if (! $cm = get_record('course_modules', 'id', $id)) { error("Course Module ID was incorrect id=$id"); } if( $done or $finishattempt){ echo ''.get_string( 'win', 'game').'
'; } echo '
'; echo "wwwroot/mod/game/attempt.php?id=$id&forcenew=1\">".get_string( 'nextgame', 'game').'         '; echo "wwwroot/course/view.php?id=$cm->course\">".get_string( 'finish', 'game').'
'; }else if( $info != ''){ echo "
$info
"; } game_compute_reserve_print( $attempt, $wordrtl, $reverseprint); 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 ''; }