Example #1
0
    if ($_POST['type'] == 1 || $_POST['type'] == 3) {
        $incorrect = $question->get_answer_mc($_POST['idval']);
    } else {
        if ($_POST['type'] == 2 || $_POST['type'] == 4) {
            $incorrect = $question->get_answer_short($_POST['idval']);
        }
    }
    $number_attempts = $_POST['attempts'];
    $questionArray = $question->get_question($event, $_POST['idval']);
} elseif ($_POST['check']) {
    if ($_POST['type'] == 1 || $_POST['type'] == 3) {
        if ($status = $question->check_mc($_POST['idval'], $_POST['response'], $_POST['attempts'], $event)) {
            $status = 1;
        } else {
            $status = 2;
            $incorrect = $question->rationalize_response($_POST['idval'], $_POST['response']);
        }
    } elseif ($_POST['type'] == 2 || $_POST['type'] == 4) {
        if ($status = $question->check_short($_POST['idval'], $_POST['response'], $_POST['attempts'], $event)) {
            $status = 1;
        } else {
            $status = 2;
            $incorrect = $_POST['response'];
        }
    }
    $number_attempts = $_POST['attempts'] + 1;
    $questionArray = $question->get_question($event, $_POST['idval']);
} else {
    $questionArray = $question->get_question($event, null);
    $status = 4;
}