Ejemplo n.º 1
0
function game_bookquiz_showquestions($id, $questionid, $chapterid, $nextchapterid, $scoreattempt, $game, $context)
{
    $onlyshow = false;
    $showsolution = false;
    $questionlist = $questionid;
    $questions = game_sudoku_getquestions($questionlist);
    global $CFG;
    /// Start the form
    echo "<form id=\"responseform\" method=\"post\" action=\"{$CFG->wwwroot}/mod/game/attempt.php\" onclick=\"this.autocomplete='off'\">\n";
    if ($onlyshow === false and $showsolution === false) {
        echo "<center><input type=\"submit\" name=\"finishattempt\" value=\"" . get_string('sudoku_submit', 'game') . "\"></center>\n";
    }
    // Add a hidden field with the quiz id
    echo '<div>';
    echo '<input type="hidden" name="id" value="' . s($id) . "\" />\n";
    echo '<input type="hidden" name="action" value="bookquizcheck" />';
    echo '<input type="hidden" name="chapterid" value="' . $chapterid . '" />';
    echo '<input type="hidden" name="scoreattempt" value="' . $scoreattempt . '" />';
    echo '<input type="hidden" name="nextchapterid" value="' . $nextchapterid . '" />';
    /// Print all the questions
    // Add a hidden field with questionids
    echo '<input type="hidden" name="questionids" value="' . $questionlist . "\" />\n";
    $number = 0;
    foreach ($questions as $question) {
        game_print_question($game, $question, $context);
    }
    echo "</div>";
    // Finish the form
    echo '</div>';
    if ($onlyshow === false and $showsolution === false) {
        echo "<center><input type=\"submit\" name=\"finishattempt\" value=\"" . get_string('sudoku_submit', 'game') . "\"></center>\n";
    }
    echo "</form>\n";
}
Ejemplo n.º 2
0
function game_sudoku_showquestions_quiz($id, $game, $attempt, $sudoku, $offsetquestions, $numbers, $correctquestions, $onlyshow, $showsolution, $context)
{
    global $CFG;
    $questionlist = game_sudoku_getquestionlist($offsetquestions);
    $questions = game_sudoku_getquestions($questionlist);
    //I will sort with the number of each question
    $questions2 = array();
    foreach ($questions as $q) {
        $ofs = $numbers[$q->id];
        $questions2[$ofs] = $q;
    }
    ksort($questions2);
    if (count($questions2) == 0) {
        game_sudoku_showquestion_onfinish($id, $game, $attempt, $sudoku);
        return;
    }
    $number = 0;
    $found = false;
    foreach ($questions2 as $question) {
        $ofs = $numbers[$question->id];
        if (array_key_exists($ofs, $correctquestions)) {
            continue;
            //I don't show the correct answers
        }
        if ($found == false) {
            $found = true;
            // Start the form
            echo "<form id=\"responseform\" method=\"post\" action=\"{$CFG->wwwroot}/mod/game/attempt.php\" onclick=\"this.autocomplete='off'\">\n";
            if ($onlyshow === false and $showsolution === false) {
                echo "<br><center><input type=\"submit\" name=\"submit\" value=\"" . get_string('sudoku_submit', 'game') . "\">";
                echo " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"submit\" name=\"finishattempt\" value=\"" . get_string('sudoku_finishattemptbutton', 'game') . "\">";
            }
            // Add a hidden field with the quiz id
            echo '<div>';
            echo '<input type="hidden" name="id" value="' . s($id) . "\" />\n";
            echo '<input type="hidden" name="action" value="sudokucheck" />';
            // Print all the questions
            // Add a hidden field with questionids
            echo '<input type="hidden" name="questionids" value="' . $questionlist . "\" />\n";
        }
        $number = "<a name=\"a{$ofs}\">A{$ofs}</a>";
        game_print_question($game, $question, $context);
    }
    if ($found) {
        echo "</div>";
        // Finish the form
        echo '</div>';
        if ($onlyshow === false and $showsolution === false) {
            echo "<center><input type=\"submit\" name=\"submit\" value=\"" . get_string('sudoku_submit', 'game') . "\"></center>\n";
        }
        echo "</form>\n";
    }
}
Ejemplo n.º 3
0
function game_snakes_showquestion_question($game, $id, $snakes, $query, $context)
{
    global $CFG;
    $questionlist = $query->questionid;
    $questions = game_sudoku_getquestions($questionlist);
    /// Start the form
    echo "<form id=\"responseform\" method=\"post\" action=\"{$CFG->wwwroot}/mod/game/attempt.php\" onclick=\"this.autocomplete='off'\">\n";
    echo "<center><input type=\"submit\" name=\"finishattempt\" value=\"" . get_string('sudoku_submit', 'game') . "\"></center>\n";
    // Add a hidden field with the quiz id
    echo '<input type="hidden" name="id" value="' . s($id) . "\" />\n";
    echo '<input type="hidden" name="action" value="snakescheck" />';
    echo '<input type="hidden" name="queryid" value="' . $query->id . "\" />\n";
    /// Print all the questions
    foreach ($questions as $question) {
        game_print_question($game, $question, $context);
    }
    // Add a hidden field with questionids
    echo '<input type="hidden" name="questionids" value="' . $questionlist . "\" />\n";
    echo "</form>\n";
}