|
@ -127,7 +127,7 @@ function game_cryptex_check( $id, $game, $attempt, $cryptexrec, $q, $answer, $co |
|
|
game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, true, $onlyshow, $showsolution, $context); |
|
|
game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, true, $onlyshow, $showsolution, $context); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, $updateattempt=false, $onlyshow=false, $showsolution=false, $context) |
|
|
function game_cryptex_play( $id, $game, $attempt, $cryptexrec, $crossm, $updateattempt=false, $onlyshow=false, $showsolution=false, $context, $print=false, $showhtmlprintbutton=true) |
|
|
{ |
|
|
{ |
|
|
global $DB; |
|
|
global $DB; |
|
|
|
|
|
|
|
@ -219,6 +219,11 @@ width: 240pt; |
|
|
--></style> |
|
|
--></style> |
|
|
<?php |
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
$grade = round( 100 * $gradeattempt); |
|
|
|
|
|
echo get_string( 'grade', 'game').' '.$grade.' %'; |
|
|
|
|
|
|
|
|
|
|
|
echo '<br>'; |
|
|
|
|
|
|
|
|
echo '<table border=0>'; |
|
|
echo '<table border=0>'; |
|
|
echo '<tr><td>'; |
|
|
echo '<tr><td>'; |
|
|
$cryptex->displaycryptex( $crossm->cols, $crossm->rows, $cryptexrec->letters, $mask, $showsolution, $textdir); |
|
|
$cryptex->displaycryptex( $crossm->cols, $crossm->rows, $cryptexrec->letters, $mask, $showsolution, $textdir); |
|
@ -239,7 +244,7 @@ width: 240pt; |
|
|
style="font-weight: bold; text-transform:uppercase;" autocomplete="off"></div> |
|
|
style="font-weight: bold; text-transform:uppercase;" autocomplete="off"></div> |
|
|
|
|
|
|
|
|
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="margin-top:1em;"><tr> |
|
|
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="margin-top:1em;"><tr> |
|
|
<td align="right"> |
|
|
<td align="right">print |
|
|
<button id="okbutton" type="submit" class="button" style="font-weight: bold;">OK</button> |
|
|
<button id="okbutton" type="submit" class="button" style="font-weight: bold;">OK</button> |
|
|
<button id="cancelbutton" type="button" class="button" onclick="DeselectCurrentWord();">Cancel</button> |
|
|
<button id="cancelbutton" type="button" class="button" onclick="DeselectCurrentWord();">Cancel</button> |
|
|
</td></tr></table> |
|
|
</td></tr></table> |
|
@ -248,12 +253,37 @@ width: 240pt; |
|
|
</tr> |
|
|
</tr> |
|
|
</table> |
|
|
</table> |
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
if( $showhtmlprintbutton){ |
|
|
|
|
|
echo ' <button id="printbutton" type="button" onclick="OnPrint();" style="display: block;">'.get_string( 'print', 'game'); |
|
|
|
|
|
echo '</button>'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( $showhtmlprintbutton){ |
|
|
|
|
|
?> |
|
|
|
|
|
<script> |
|
|
|
|
|
function PrintHtmlClick() |
|
|
|
|
|
{ |
|
|
|
|
|
document.getElementById("printbutton").style.display = "none"; |
|
|
|
|
|
|
|
|
|
|
|
window.print(); |
|
|
|
|
|
|
|
|
|
|
|
document.getElementById("printbutton").style.display = "block"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function OnPrint() |
|
|
|
|
|
{ |
|
|
<?php |
|
|
<?php |
|
|
$grade = round( 100 * $gradeattempt); |
|
|
global $CFG; |
|
|
echo '<br>'.get_string( 'grade', 'game').' '.$grade.' %'; |
|
|
$params = "id=$id&gameid=$game->id"; |
|
|
|
|
|
echo "window.open( \"{$CFG->wwwroot}/mod/game/print.php?$params\")"; |
|
|
|
|
|
?> |
|
|
|
|
|
} |
|
|
|
|
|
</script> |
|
|
|
|
|
<?php |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
echo "<br><br>"; |
|
|
|
|
|
$i = 0; |
|
|
$i = 0; |
|
|
$else = ''; |
|
|
$else = ''; |
|
|
$contextglossary = false; |
|
|
$contextglossary = false; |
|
@ -305,8 +335,15 @@ width: 240pt; |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
<?php |
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
if( $print){ |
|
|
|
|
|
echo '<body onload="window.print()">'; |
|
|
|
|
|
}else{ |
|
|
|
|
|
echo '<body>'; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function game_cryptex_onfinished( $id, $game, $attempt, $cryptexrec) |
|
|
function game_cryptex_onfinished( $id, $game, $attempt, $cryptexrec) |
|
|
{ |
|
|
{ |
|
|
global $CFG, $DB; |
|
|
global $CFG, $DB; |
|
|