|
|
@ -85,12 +85,21 @@ function game_cryptex_continue( $id, $game, $attempt, $cryptexrec, $endofgame, $ |
|
|
|
} |
|
|
|
|
|
|
|
//q means game_queries.id |
|
|
|
function game_cryptex_check( $id, $game, $attempt, $cryptexrec, $q, $answer, $context) |
|
|
|
function game_cryptex_check( $id, $game, $attempt, $cryptexrec, $q, $answer, $finishattempt, $context) |
|
|
|
{ |
|
|
|
global $DB; |
|
|
|
|
|
|
|
if( $attempt === false){ |
|
|
|
game_cryptex_continue( $id, $game, $attempt, $cryptexrec, false); |
|
|
|
|
|
|
|
if( $finishattempt) |
|
|
|
{ |
|
|
|
game_updateattempts( $game, $attempt, -1, true); |
|
|
|
game_cryptex_continue( $id, $game, false, false, true, $context); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if( $attempt === false) |
|
|
|
{ |
|
|
|
game_cryptex_continue( $id, $game, $attempt, $cryptexrec, false, $context); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@ -256,8 +265,10 @@ width: 240pt; |
|
|
|
<?php |
|
|
|
|
|
|
|
if( $showhtmlprintbutton){ |
|
|
|
echo ' <button id="printbutton" type="button" onclick="OnPrint();" style="display: block;">'.get_string( 'print', 'game'); |
|
|
|
echo '</button>'; |
|
|
|
echo '<br><button id="finishattemptbutton" type="button" onclick="OnEndGame();" >'.get_string( 'finish', 'game'); |
|
|
|
echo '</button>'; |
|
|
|
echo '<button id="printbutton" type="button" onclick="OnPrint();" >'.get_string( 'print', 'game'); |
|
|
|
echo '</button><br>'; |
|
|
|
} |
|
|
|
|
|
|
|
if( $showhtmlprintbutton){ |
|
|
@ -272,14 +283,23 @@ if( $showhtmlprintbutton){ |
|
|
|
document.getElementById("printbutton").style.display = "block"; |
|
|
|
} |
|
|
|
|
|
|
|
function OnPrint() |
|
|
|
{ |
|
|
|
<?php |
|
|
|
global $CFG; |
|
|
|
$params = "id=$id&gameid=$game->id"; |
|
|
|
echo "window.open( \"{$CFG->wwwroot}/mod/game/print.php?$params\")"; |
|
|
|
?> |
|
|
|
} |
|
|
|
function OnPrint() |
|
|
|
{ |
|
|
|
<?php |
|
|
|
global $CFG; |
|
|
|
$params = "id=$id&gameid=$game->id"; |
|
|
|
echo "window.open( \"{$CFG->wwwroot}/mod/game/print.php?$params\");"; |
|
|
|
?> |
|
|
|
} |
|
|
|
|
|
|
|
function OnEndGame() |
|
|
|
{ |
|
|
|
<?php |
|
|
|
global $CFG; |
|
|
|
$params = 'id='.$id.'&action=cryptexcheck&g=&finishattempt=1'; |
|
|
|
echo "window.location = \"{$CFG->wwwroot}/mod/game/attempt.php?$params\";\r\n"; |
|
|
|
?> |
|
|
|
} |
|
|
|
</script> |
|
|
|
<?php |
|
|
|
} |
|
|
@ -336,11 +356,10 @@ function OnPrint() |
|
|
|
</script> |
|
|
|
<?php |
|
|
|
|
|
|
|
if( $print){ |
|
|
|
if( $print) |
|
|
|
echo '<body onload="window.print()">'; |
|
|
|
}else{ |
|
|
|
echo '<body>'; |
|
|
|
} |
|
|
|
else |
|
|
|
echo '<body>'; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|