function game_do_attempt($id, $game, $action, $course, $context) { global $OUTPUT; $forcenew = optional_param('forcenew', false, PARAM_BOOL); // Teacher has requested new preview $continue = false; /// Print the main part of the page switch ($action) { case 'crosscheck': $attempt = game_getattempt($game, $detail); $g = game_cross_unpackpuzzle($_GET['g']); $finishattempt = array_key_exists('finishattempt', $_GET); game_cross_continue($id, $game, $attempt, $detail, $g, $finishattempt, $context); break; case 'crossprint': $attempt = game_getattempt($game, $detail); game_cross_play($id, $game, $attempt, $detail, '', true, false, false, true, $context); break; case 'sudokucheck': //the student tries to answer a question $attempt = game_getattempt($game, $detail); $finishattempt = array_key_exists('finishattempt', $_POST); game_sudoku_check_questions($id, $game, $attempt, $detail, $finishattempt, $course, $context); $continue = true; break; case 'sudokucheckg': //the student tries to guess a glossaryenry $attempt = game_getattempt($game, $detail); $endofgame = array_key_exists('endofgame', $_GET); $continue = game_sudoku_check_glossaryentries($id, $game, $attempt, $detail, $endofgame, $course); $continue = true; break; case 'sudokucheckn': //the user tries to guess a number $attempt = game_getattempt($game, $detail); $pos = $_GET['pos']; $num = $_GET['num']; game_sudoku_check_number($id, $game, $attempt, $detail, $pos, $num, $context); $continue = false; break; case 'cryptexcheck': //the user tries to guess a question $attempt = game_getattempt($game, $detail); $q = $_GET['q']; $answer = $_GET['answer']; game_cryptex_check($id, $game, $attempt, $detail, $q, $answer, $context); break; case 'bookquizcheck': //the student tries to answer a question $attempt = game_getattempt($game, $detail); game_bookquiz_check_questions($id, $game, $attempt, $detail); break; case 'snakescheck': //the student tries to answer a question $attempt = game_getattempt($game, $detail); game_snakes_check_questions($id, $game, $attempt, $detail, $context); break; case 'snakescheckg': //the student tries to answer a question from glossary $attempt = game_getattempt($game, $detail); game_snakes_check_glossary($id, $game, $attempt, $detail, $context); break; case 'hiddenpicturecheck': //the student tries to answer a question $attempt = game_getattempt($game, $detail); $finishattempt = array_key_exists('finishattempt', $_POST); $continue = game_hiddenpicture_check_questions($id, $game, $attempt, $detail, $finishattempt, $context); break; case 'hiddenpicturecheckg': //the student tries to guess a glossaryenry $attempt = game_getattempt($game, $detail); $endofgame = array_key_exists('endofgame', $_GET); game_hiddenpicture_check_mainquestion($id, $game, $attempt, $detail, $endofgame, $context); break; default: $continue = true; break; } if ($continue) { game_create($game, $id, $forcenew, $course, $context); } /// Finish the page echo $OUTPUT->footer(); }
break; case 'crossprint': $attempt = game_getattempt($game, $detail); game_cross_play($id, $game, $attempt, $detail, '', true, false, false, true); break; case 'sudokucheck': //the student tries to answer a question $attempt = game_getattempt($game, $detail); $finishattempt = array_key_exists('finishattempt', $_POST); game_sudoku_check_questions($id, $game, $attempt, $detail, $finishattempt); break; case 'sudokucheckg': //the student tries to guess a glossaryenry $attempt = game_getattempt($game, $detail); $endofgame = array_key_exists('endofgame', $_GET); game_sudoku_check_glossaryentries($id, $game, $attempt, $detail, $endofgame); break; case 'sudokucheckn': //the user tries to guess a number $attempt = game_getattempt($game, $detail); $pos = $_GET['pos']; $num = $_GET['num']; game_sudoku_check_number($id, $game, $attempt, $detail, $pos, $num); break; case 'cryptexcheck': //the user tries to guess a question $attempt = game_getattempt($game, $detail); $q = $_GET['q']; $answer = $_GET['answer']; game_cryptex_check($id, $game, $attempt, $detail, $q, $answer); break;