|
@ -1,24 +1,40 @@ |
|
|
<?php // $Id: play.php,v 1.23 2012/08/15 14:38:06 bdaloukas Exp $
|
|
|
<?php |
|
|
|
|
|
// This file is part of Moodle - http://moodle.org/ |
|
|
// This files plays the game "Crossword" |
|
|
// |
|
|
|
|
|
// Moodle is free software: you can redistribute it and/or modify |
|
|
|
|
|
// it under the terms of the GNU General Public License as published by |
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or |
|
|
|
|
|
// (at your option) any later version. |
|
|
|
|
|
// |
|
|
|
|
|
// Moodle is distributed in the hope that it will be useful, |
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
|
|
// GNU General Public License for more details. |
|
|
|
|
|
// |
|
|
|
|
|
// You should have received a copy of the GNU General Public License |
|
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
|
|
// You should have received a copy of the GNU General Public License |
|
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. |
|
|
|
|
|
|
|
|
|
|
|
// This files plays the game "Crossword". |
|
|
|
|
|
|
|
|
require( "cross_class.php"); |
|
|
require( "cross_class.php"); |
|
|
require( "crossdb_class.php"); |
|
|
require( "crossdb_class.php"); |
|
|
|
|
|
|
|
|
function game_cross_continue( $id, $game, $attempt, $cross, $g, $endofgame, $context) |
|
|
function game_cross_continue( $id, $game, $attempt, $cross, $g, $endofgame, $context) { |
|
|
{ |
|
|
if ($endofgame) { |
|
|
if( $endofgame){ |
|
|
if ($g == '') { |
|
|
if( $g == ''){ |
|
|
|
|
|
game_updateattempts( $game, $attempt, -1, true); |
|
|
game_updateattempts( $game, $attempt, -1, true); |
|
|
$endofgame = false; |
|
|
$endofgame = false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $attempt != false and $cross != false){ |
|
|
if ($attempt != false and $cross != false) { |
|
|
return game_cross_play( $id, $game, $attempt, $cross, $g, false, false, $endofgame, false, false, false, false, true, $context); |
|
|
return game_cross_play( $id, $game, $attempt, $cross, $g, false, false, $endofgame, |
|
|
|
|
|
false, false, false, false, true, $context); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $attempt == false){ |
|
|
if ($attempt == false) { |
|
|
$attempt = game_addattempt( $game); |
|
|
$attempt = game_addattempt( $game); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -27,8 +43,7 @@ function game_cross_continue( $id, $game, $attempt, $cross, $g, $endofgame, $con |
|
|
return game_cross_play( $id, $game, $attempt, $crossm, '', false, false, false, false, false, false, false, true, $context); |
|
|
return game_cross_play( $id, $game, $attempt, $crossm, '', false, false, false, false, false, false, false, true, $context); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function game_cross_new( $game, $attemptid, &$crossm) |
|
|
function game_cross_new( $game, $attemptid, &$crossm) { |
|
|
{ |
|
|
|
|
|
global $DB, $USER; |
|
|
global $DB, $USER; |
|
|
|
|
|
|
|
|
$cross = new CrossDB(); |
|
|
$cross = new CrossDB(); |
|
@ -38,15 +53,15 @@ function game_cross_new( $game, $attemptid, &$crossm) |
|
|
|
|
|
|
|
|
$answers = array(); |
|
|
$answers = array(); |
|
|
$recs = game_questions_shortanswer( $game); |
|
|
$recs = game_questions_shortanswer( $game); |
|
|
if( $recs == false){ |
|
|
if ($recs == false) { |
|
|
print_error( 'game_cross_continue: '.get_string( 'no_words', 'game')); |
|
|
print_error( 'game_cross_continue: '.get_string( 'no_words', 'game')); |
|
|
} |
|
|
} |
|
|
$infos = array(); |
|
|
$infos = array(); |
|
|
$reps = array(); |
|
|
$reps = array(); |
|
|
foreach( $recs as $rec){ |
|
|
foreach ($recs as $rec) { |
|
|
if( $game->param7 == false){ |
|
|
if ($game->param7 == false) { |
|
|
if( game_strpos( $rec->answertext, ' ')){ |
|
|
if (game_strpos( $rec->answertext, ' ')) { |
|
|
continue; //spaces not allowed |
|
|
continue; // Spaces not allowed. |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -54,91 +69,95 @@ function game_cross_new( $game, $attemptid, &$crossm) |
|
|
$answers[ $rec->answertext] = game_repairquestion( $rec->questiontext); |
|
|
$answers[ $rec->answertext] = game_repairquestion( $rec->questiontext); |
|
|
$infos[ $rec->answertext] = array( $game->sourcemodule, $rec->questionid, $rec->glossaryentryid, $rec->attachment); |
|
|
$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); |
|
|
$a = array( 'gameid' => $game->id, 'userid' => $USER->id, |
|
|
if(($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions AS r')) != false){ |
|
|
'questionid' => $rec->questionid, 'glossaryentryid' => $rec->glossaryentryid); |
|
|
|
|
|
if (($rec2 = $DB->get_record('game_repetitions', $a, 'id,repetitions AS r')) != false) { |
|
|
$reps[ $rec->answertext] = $rec2->r; |
|
|
$reps[ $rec->answertext] = $rec2->r; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$cross->setwords( $answers, $game->param1, $reps); |
|
|
$cross->setwords( $answers, $game->param1, $reps); |
|
|
|
|
|
|
|
|
//game->param4 is minimum words in crossword |
|
|
// The game->param4 is minimum words in crossword. |
|
|
//game->param2 is maximum words in crossword |
|
|
// The game->param2 is maximum words in crossword. |
|
|
if( $cross->computedata( $crossm, $crossd, $lettets, $game->param4, $game->param2)){ |
|
|
if ($cross->computedata( $crossm, $crossd, $lettets, $game->param4, $game->param2)) { |
|
|
$new_crossd = array(); |
|
|
$newcrossd = array(); |
|
|
foreach( $crossd as $rec) |
|
|
foreach ($crossd as $rec) { |
|
|
{ |
|
|
|
|
|
$info = $infos[ $rec->answertext]; |
|
|
$info = $infos[ $rec->answertext]; |
|
|
if( $info != false){ |
|
|
if ($info != false) { |
|
|
$rec->sourcemodule = $info[ 0]; |
|
|
$rec->sourcemodule = $info[ 0]; |
|
|
$rec->questionid = $info[ 1]; |
|
|
$rec->questionid = $info[ 1]; |
|
|
$rec->glossaryentryid = $info[ 2]; |
|
|
$rec->glossaryentryid = $info[ 2]; |
|
|
$rec->attachment = $info[ 3]; |
|
|
$rec->attachment = $info[ 3]; |
|
|
} |
|
|
} |
|
|
$new_crossd[] = $rec; |
|
|
$newcrossd[] = $rec; |
|
|
} |
|
|
} |
|
|
$cross->savecross( $game, $crossm, $new_crossd, $attemptid); |
|
|
$cross->savecross( $game, $crossm, $newcrossd, $attemptid); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( count( $crossd) == 0){ |
|
|
if (count( $crossd) == 0) { |
|
|
print_error( 'game_cross_continue: '.get_string( 'no_words', 'game')); |
|
|
print_error( 'game_cross_continue: '.get_string( 'no_words', 'game')); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function showlegend( $legend, $title) |
|
|
function showlegend( $legend, $title) { |
|
|
{ |
|
|
if (count( $legend) == 0) { |
|
|
if( count( $legend) == 0) |
|
|
|
|
|
return; |
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
echo "<br><b>$title</b><br>"; |
|
|
echo "<br><b>$title</b><br>"; |
|
|
foreach( $legend as $key => $line) |
|
|
foreach ($legend as $key => $line) { |
|
|
{ |
|
|
|
|
|
$line = game_repairquestion( $line); |
|
|
$line = game_repairquestion( $line); |
|
|
echo game_filtertext( "$key: $line<br>", 0); |
|
|
echo game_filtertext( "$key: $line<br>", 0); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function game_cross_play( $id, $game, $attempt, $crossrec, $g, $onlyshow, $showsolution, $endofgame, $print, $checkbutton, $showhtmlsolutions, $showhtmlprintbutton,$showstudentguess, $context) |
|
|
function game_cross_play( $id, $game, $attempt, $crossrec, $g, $onlyshow, $showsolution, |
|
|
{ |
|
|
$endofgame, $print, $checkbutton, $showhtmlsolutions, $showhtmlprintbutton, $showstudentguess, $context) { |
|
|
global $CFG, $DB; |
|
|
global $CFG, $DB; |
|
|
|
|
|
|
|
|
$cross = new CrossDB(); |
|
|
$cross = new CrossDB(); |
|
|
|
|
|
|
|
|
$language = $attempt->language; |
|
|
$language = $attempt->language; |
|
|
$info = $cross->loadcross( $g, $done, $html, $game, $attempt, $crossrec, $onlyshow, $showsolution, $endofgame, $showhtmlsolutions, $attempt->language,$showstudentguess, $context); |
|
|
$info = $cross->loadcross( $g, $done, $html, $game, $attempt, $crossrec, $onlyshow, |
|
|
|
|
|
$showsolution, $endofgame, $showhtmlsolutions, $attempt->language, |
|
|
|
|
|
$showstudentguess, $context); |
|
|
|
|
|
|
|
|
if( $language != $attempt->language){ |
|
|
if ($language != $attempt->language) { |
|
|
if( !$DB->set_field( 'game_attempts', 'language', $attempt->language, array( 'id' => $attempt->id))){ |
|
|
if (!$DB->set_field( 'game_attempts', 'language', $attempt->language, array( 'id' => $attempt->id))) { |
|
|
print_error( "game_cross_play: Can't set language"); |
|
|
print_error( "game_cross_play: Can't set language"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $done or $endofgame){ |
|
|
if ($done or $endofgame) { |
|
|
if (! $cm = $DB->get_record( 'course_modules', array( 'id' => $id))) { |
|
|
if (! $cm = $DB->get_record( 'course_modules', array( 'id' => $id))) { |
|
|
print_error("Course Module ID was incorrect id=$id"); |
|
|
print_error("Course Module ID was incorrect id=$id"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $endofgame == false){ |
|
|
if ($endofgame == false) { |
|
|
echo '<B>'.get_string( 'win', 'game').'</B><BR>'; |
|
|
echo '<B>'.get_string( 'win', 'game').'</B><BR>'; |
|
|
} |
|
|
} |
|
|
if( game_can_start_new_attempt( $game)) |
|
|
if (game_can_start_new_attempt( $game)) { |
|
|
{ |
|
|
|
|
|
echo '<br>'; |
|
|
echo '<br>'; |
|
|
echo "<a href=\"{$CFG->wwwroot}/mod/game/attempt.php?id=$id&forcenew=1\">".get_string( 'nextgame', 'game').'</a> '; |
|
|
echo "<a href=\"{$CFG->wwwroot}/mod/game/attempt.php?id=$id&forcenew=1\">". |
|
|
|
|
|
get_string( 'nextgame', 'game').'</a> '; |
|
|
} |
|
|
} |
|
|
}else if( $info != ''){ |
|
|
} else if ($info != '') { |
|
|
echo "<br>$info<br>"; |
|
|
echo "<br>$info<br>"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $attempt->language != '') |
|
|
if ($attempt->language != '') { |
|
|
$wordrtl = game_right_to_left( $attempt->language); |
|
|
$wordrtl = game_right_to_left( $attempt->language); |
|
|
else |
|
|
} else { |
|
|
$wordrtl = right_to_left(); |
|
|
$wordrtl = right_to_left(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$reverseprint = ($wordrtl != right_to_left()); |
|
|
$reverseprint = ($wordrtl != right_to_left()); |
|
|
if( $reverseprint) |
|
|
if ($reverseprint) { |
|
|
$textdir = 'dir="'.($wordrtl ? 'rtl' : 'ltr').'"'; |
|
|
$textdir = 'dir="'.($wordrtl ? 'rtl' : 'ltr').'"'; |
|
|
else |
|
|
} else { |
|
|
$textdir = ''; |
|
|
$textdir = ''; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
?> |
|
|
?> |
|
|
<style type="text/css"><!-- |
|
|
<style type="text/css"><!-- |
|
@ -257,17 +276,16 @@ margin-top: 1em; |
|
|
</head> |
|
|
</head> |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if( $print){ |
|
|
if ($print) { |
|
|
echo '<body onload="window.print()">'; |
|
|
echo '<body onload="window.print()">'; |
|
|
}else{ |
|
|
} else { |
|
|
echo '<body>'; |
|
|
echo '<body>'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $game->toptext != ''){ |
|
|
if ($game->toptext != '') { |
|
|
echo $game->toptext.'<br>'; |
|
|
echo $game->toptext.'<br>'; |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
|
<h1></h1> |
|
|
<h1></h1> |
|
|
|
|
|
|
|
|
<div id="waitmessage" class="answerboxstyle"> |
|
|
<div id="waitmessage" class="answerboxstyle"> |
|
@ -280,7 +298,7 @@ if( $print){ |
|
|
<p><table cellpadding="0" cellspacing="0" border="0"> |
|
|
<p><table cellpadding="0" cellspacing="0" border="0"> |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if( $game->param3 == 2){ |
|
|
if ($game->param3 == 2) { |
|
|
echo "<tr>\r\n"; |
|
|
echo "<tr>\r\n"; |
|
|
game_cross_show_welcome( $game); |
|
|
game_cross_show_welcome( $game); |
|
|
echo "</tr>\r\n"; |
|
|
echo "</tr>\r\n"; |
|
@ -289,7 +307,8 @@ if( $print){ |
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
|
<tr> |
|
|
<tr> |
|
|
<td class="crosswordarea"><table id="crossword" cellpadding="3" cellspacing="0" style="display: none; border-collapse: collapse;" <?php echo $textdir;?>> |
|
|
<td class="crosswordarea"> |
|
|
|
|
|
<table id="crossword" cellpadding="3" cellspacing="0" style="display: none; border-collapse: collapse;" <?php echo $textdir;?>> |
|
|
|
|
|
|
|
|
<script language="JavaScript" type="text/javascript"><!-- |
|
|
<script language="JavaScript" type="text/javascript"><!-- |
|
|
|
|
|
|
|
@ -316,7 +335,7 @@ if (document.getElementById("waitmessage") != null) |
|
|
CurrentWord = -1; |
|
|
CurrentWord = -1; |
|
|
PrevWordHorizontal = false; |
|
|
PrevWordHorizontal = false; |
|
|
|
|
|
|
|
|
<?PHP |
|
|
<?php |
|
|
echo $html; |
|
|
echo $html; |
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
@ -419,7 +438,10 @@ if (document.getElementById("waitmessage") != null) |
|
|
{ |
|
|
{ |
|
|
if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0) |
|
|
if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0) |
|
|
{ |
|
|
{ |
|
|
document.write("<td id=\"c" + PadNumber(x) + PadNumber(y) + "\" class=\"gamebox boxnormal_unsel\" onclick=\"SelectThisWord(event);\">"); |
|
|
var s; |
|
|
|
|
|
s = "<td id=\"c" + PadNumber(x) + PadNumber(y); |
|
|
|
|
|
s += "\" class=\"gamebox boxnormal_unsel\" onclick=\"SelectThisWord(event);\">"; |
|
|
|
|
|
document.write( s); |
|
|
|
|
|
|
|
|
if( solu[x][y] != '') |
|
|
if( solu[x][y] != '') |
|
|
document.write( solu[x][y]); |
|
|
document.write( solu[x][y]); |
|
@ -579,12 +601,12 @@ function SelectThisWord(event) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
document.getElementById("wordlabel").innerHTML = TheirWord; |
|
|
document.getElementById("wordlabel").innerHTML = TheirWord; |
|
|
<?php |
|
|
<?php |
|
|
$msg = "\"".get_string( 'cross_across', 'game').", \" : \"". |
|
|
$msg = "\"".get_string( 'cross_across', 'game').", \" : \"". |
|
|
get_string( 'cross_down', 'game').", \""; |
|
|
get_string( 'cross_down', 'game').", \""; |
|
|
$letters = "\" ".get_string( 'letter', 'game').".\" : \" ". |
|
|
$letters = "\" ".get_string( 'letter', 'game').".\" : \" ". |
|
|
get_string( 'letters', 'game').".\""; |
|
|
get_string( 'letters', 'game').".\""; |
|
|
?> |
|
|
?> |
|
|
document.getElementById("wordinfo").innerHTML = ((CurrentWord <= LastHorizontalWord) ? <?php echo $msg ?>) + WordLength[CurrentWord] + (WordLength[CurrentWord] == 1 ? <?php echo $letters;?>); |
|
|
document.getElementById("wordinfo").innerHTML = ((CurrentWord <= LastHorizontalWord) ? <?php echo $msg ?>) + WordLength[CurrentWord] + (WordLength[CurrentWord] == 1 ? <?php echo $letters;?>); |
|
|
document.getElementById("wordclue").innerHTML = Clue[CurrentWord]; |
|
|
document.getElementById("wordclue").innerHTML = Clue[CurrentWord]; |
|
|
document.getElementById("worderror").style.display = "none"; |
|
|
document.getElementById("worderror").style.display = "none"; |
|
@ -653,7 +675,7 @@ function OKClick() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if( $showhtmlsolutions == false){ |
|
|
if ($showhtmlsolutions == false) { |
|
|
?> |
|
|
?> |
|
|
function PackPuzzle( sData) |
|
|
function PackPuzzle( sData) |
|
|
{ |
|
|
{ |
|
@ -742,16 +764,15 @@ function CheckServerClick( endofgame) |
|
|
sData += "&finishattempt=1"; |
|
|
sData += "&finishattempt=1"; |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if( $onlyshow == false){ |
|
|
if ($onlyshow == false) { |
|
|
global $CFG; |
|
|
global $CFG; |
|
|
$params = 'id='.$id.'&action=crosscheck&g='; |
|
|
$params = 'id='.$id.'&action=crosscheck&g='; |
|
|
echo "window.location = \"{$CFG->wwwroot}/mod/game/attempt.php?$params\"+ sData;\r\n"; |
|
|
echo "window.location = \"{$CFG->wwwroot}/mod/game/attempt.php?$params\"+ sData;\r\n"; |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
|
function OnPrint() |
|
|
function OnPrint() |
|
@ -764,33 +785,33 @@ function OnPrint() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if( $showhtmlprintbutton){ |
|
|
if ($showhtmlprintbutton) { |
|
|
?> |
|
|
?> |
|
|
function PrintHtmlClick() |
|
|
function PrintHtmlClick() |
|
|
{ |
|
|
{ |
|
|
document.getElementById("printhtmlbutton").style.display = "none"; |
|
|
document.getElementById("printhtmlbutton").style.display = "none"; |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if( $showhtmlsolutions){ |
|
|
if ($showhtmlsolutions) { |
|
|
?> document.getElementById("checkhtmlbutton").style.display = "none"; <?php |
|
|
?> document.getElementById("checkhtmlbutton").style.display = "none"; <?php |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
|
window.print(); |
|
|
window.print(); |
|
|
<?php |
|
|
<?php |
|
|
if( $showhtmlsolutions){ |
|
|
if ($showhtmlsolutions) { |
|
|
?> document.getElementById("checkhtmlbutton").style.display = "block"; <?php |
|
|
?> document.getElementById("checkhtmlbutton").style.display = "block"; <?php |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
|
document.getElementById("printhtmlbutton").style.display = "block"; |
|
|
document.getElementById("printhtmlbutton").style.display = "block"; |
|
|
} |
|
|
} |
|
|
<?php |
|
|
<?php |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if( $showhtmlprintbutton){ |
|
|
if ($showhtmlprintbutton) { |
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -905,11 +926,9 @@ function CheckHtmlClick() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
<?php |
|
|
<?php |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( $showhtmlsolutions) |
|
|
if ($showhtmlsolutions) { |
|
|
{ |
|
|
|
|
|
?> |
|
|
?> |
|
|
function decodeutf8(utftext) { |
|
|
function decodeutf8(utftext) { |
|
|
var string = ""; |
|
|
var string = ""; |
|
@ -941,7 +960,7 @@ if( $showhtmlsolutions) |
|
|
return string; |
|
|
return string; |
|
|
} |
|
|
} |
|
|
<?php |
|
|
<?php |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
|
//--> |
|
|
//--> |
|
@ -950,10 +969,10 @@ if( $showhtmlsolutions) |
|
|
</table></td> |
|
|
</table></td> |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if( $game->param3 == 2){ |
|
|
if ($game->param3 == 2) { |
|
|
echo '<td>     </td>'; |
|
|
echo '<td>     </td>'; |
|
|
game_cross_show_legends( $cross); |
|
|
game_cross_show_legends( $cross); |
|
|
}else{ |
|
|
} else { |
|
|
game_cross_show_welcome( $game); |
|
|
game_cross_show_welcome( $game); |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
@ -962,16 +981,17 @@ if( $showhtmlsolutions) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if( $onlyshow == false){ |
|
|
if ($onlyshow == false) { |
|
|
echo '<div style="margin-top: 1em;">'; |
|
|
echo '<div style="margin-top: 1em;">'; |
|
|
|
|
|
|
|
|
echo '<button id="checkbutton" type="button" onclick="CheckServerClick( 0);" style="display: none;">'.get_string( 'cross_checkbutton', 'game'); |
|
|
echo '<button id="checkbutton" type="button" onclick="CheckServerClick( 0);" style="display: none;">'. |
|
|
|
|
|
get_string( 'cross_checkbutton', 'game'); |
|
|
echo '</button>'; |
|
|
echo '</button>'; |
|
|
|
|
|
|
|
|
echo ' <button id="finishattemptbutton" type="button" onclick="CheckServerClick( 1);" style="display: none;">'.get_string( 'cross_endofgamebutton', 'game'); |
|
|
echo ' <button id="finishattemptbutton" type="button" onclick="CheckServerClick( 1);" style="display: none;">'. |
|
|
|
|
|
get_string( 'cross_endofgamebutton', 'game'); |
|
|
echo '</button>'; |
|
|
echo '</button>'; |
|
|
if( $game->param5 == 1 or $game->param5 == NULL) |
|
|
if ($game->param5 == 1 or $game->param5 == NULL) { |
|
|
{ |
|
|
|
|
|
echo ' <button id="printbutton" type="button" onclick="OnPrint( 0);" style="display: none;">'.get_string( 'print', 'game'); |
|
|
echo ' <button id="printbutton" type="button" onclick="OnPrint( 0);" style="display: none;">'.get_string( 'print', 'game'); |
|
|
echo '</button>'; |
|
|
echo '</button>'; |
|
|
} |
|
|
} |
|
@ -979,63 +999,59 @@ if( $showhtmlsolutions) |
|
|
echo "</div>\r\n"; |
|
|
echo "</div>\r\n"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $showhtmlsolutions or $showhtmlprintbutton){ |
|
|
if ($showhtmlsolutions or $showhtmlprintbutton) { |
|
|
echo '<br>'; |
|
|
echo '<br>'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $showhtmlsolutions){ |
|
|
if ($showhtmlsolutions) { |
|
|
echo '<button id="checkhtmlbutton" type="button" onclick="CheckHtmlClick();" visible=true>'.get_string( 'cross_checkbutton', 'game'); |
|
|
echo '<button id="checkhtmlbutton" type="button" onclick="CheckHtmlClick();" visible=true>'.get_string( 'cross_checkbutton', 'game'); |
|
|
echo '</button>'; |
|
|
echo '</button>'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $showhtmlprintbutton){ |
|
|
if ($showhtmlprintbutton) { |
|
|
if( $showhtmlsolutions){ |
|
|
if ($showhtmlsolutions) { |
|
|
echo " "; |
|
|
echo " "; |
|
|
} |
|
|
} |
|
|
echo '<button id="printhtmlbutton" type="button" onclick="PrintHtmlClick( 0);" visible=true>'.get_string( 'print', 'game'); |
|
|
echo '<button id="printhtmlbutton" type="button" onclick="PrintHtmlClick( 0);" visible=true>'.get_string( 'print', 'game'); |
|
|
echo '</button>'; |
|
|
echo '</button>'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $game->param3 == 2){ |
|
|
if ($game->param3 == 2) { |
|
|
echo '<td>     </td>'; |
|
|
echo '<td>     </td>'; |
|
|
game_cross_show_welcome( $game); |
|
|
game_cross_show_welcome( $game); |
|
|
}else{ |
|
|
} else { |
|
|
game_cross_show_legends( $cross); |
|
|
game_cross_show_legends( $cross); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $game->bottomtext != ''){ |
|
|
if ($game->bottomtext != '') { |
|
|
echo '<br><br>'.$game->bottomtext; |
|
|
echo '<br><br>'.$game->bottomtext; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($attempt != false) { |
|
|
if( $attempt != false){ |
|
|
if ($attempt->timefinish == 0 and $endofgame == 0) { |
|
|
if( $attempt->timefinish == 0 and $endofgame == 0) |
|
|
?> |
|
|
{ |
|
|
|
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
<script language="JavaScript" type="text/javascript"><!-- |
|
|
<script language="JavaScript" type="text/javascript"><!-- |
|
|
if (Initialized) |
|
|
if (Initialized) |
|
|
{ |
|
|
{ |
|
|
<?php |
|
|
<?php |
|
|
if( $print == false){ |
|
|
if ($print == false) { |
|
|
echo "document.getElementById(\"welcomemessage\").style.display = \"\";"; |
|
|
echo "document.getElementById(\"welcomemessage\").style.display = \"\";"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( $showsolution == false) |
|
|
if ($showsolution == false) { |
|
|
{ |
|
|
|
|
|
?> |
|
|
?> |
|
|
document.getElementById("checkbutton").style.display = ""; |
|
|
document.getElementById("checkbutton").style.display = ""; |
|
|
document.getElementById("finishattemptbutton").style.display = ""; |
|
|
document.getElementById("finishattemptbutton").style.display = ""; |
|
|
document.getElementById("printbutton").style.display = ""; |
|
|
document.getElementById("printbutton").style.display = ""; |
|
|
<?php |
|
|
<?php |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
|
} |
|
|
} |
|
|
//--> |
|
|
//--> |
|
|
</script> |
|
|
</script> |
|
|
<?php |
|
|
<?php |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
?> |
|
|
?> |
|
|
|
|
|
|
|
@ -1045,16 +1061,15 @@ if( $attempt != false){ |
|
|
<?php |
|
|
<?php |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function game_cross_show_welcome( $game){ |
|
|
function game_cross_show_welcome( $game) { |
|
|
if( $game->param3 <> 2){ |
|
|
if ($game->param3 <> 2) { |
|
|
game_cross_show_welcome0( $game); |
|
|
game_cross_show_welcome0( $game); |
|
|
}else{ |
|
|
} else { |
|
|
game_cross_show_welcome1(); |
|
|
game_cross_show_welcome1(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function game_cross_show_welcome0( $game){ |
|
|
function game_cross_show_welcome0( $game) { |
|
|
?> |
|
|
?> |
|
|
<td valign="top" style="padding-left: 1em;"> |
|
|
<td valign="top" style="padding-left: 1em;"> |
|
|
|
|
|
|
|
@ -1071,7 +1086,7 @@ function game_cross_show_welcome0( $game){ |
|
|
style="font-weight: bold; <? if( $game->param6 == 0) echo 'text-transform:uppercase;'; ?>" |
|
|
style="font-weight: bold; <? if( $game->param6 == 0) echo 'text-transform:uppercase;'; ?>" |
|
|
onkeypress="WordEntryKeyPress(event)" onchange="WordEntryKeyPress(event)" autocomplete="off"></div> |
|
|
onkeypress="WordEntryKeyPress(event)" onchange="WordEntryKeyPress(event)" autocomplete="off"></div> |
|
|
<?php |
|
|
<?php |
|
|
if( $game->param3 == 2){ |
|
|
if ($game->param3 == 2) { |
|
|
game_cross_show_welcome( $game); |
|
|
game_cross_show_welcome( $game); |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
@ -1090,7 +1105,7 @@ function game_cross_show_welcome0( $game){ |
|
|
<?php |
|
|
<?php |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function game_cross_show_welcome1(){ |
|
|
function game_cross_show_welcome1() { |
|
|
?> |
|
|
?> |
|
|
<td valign="top" style="padding-left: 1em;"> |
|
|
<td valign="top" style="padding-left: 1em;"> |
|
|
|
|
|
|
|
@ -1129,7 +1144,7 @@ function game_cross_show_welcome1(){ |
|
|
<?php |
|
|
<?php |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function game_cross_show_legends( $cross){ |
|
|
function game_cross_show_legends( $cross) { |
|
|
echo '<td>'; |
|
|
echo '<td>'; |
|
|
ShowLegend( $cross->m_LegendH, get_string( 'cross_across', 'game')); |
|
|
ShowLegend( $cross->m_LegendH, get_string( 'cross_across', 'game')); |
|
|
ShowLegend( $cross->m_LegendV, get_string( 'cross_down', 'game')); |
|
|
ShowLegend( $cross->m_LegendV, get_string( 'cross_down', 'game')); |
|
|