Exemplo n.º 1
0
if ($action == 'FinalTest') {
    $qtotal = $_GET["qtotal"];
    $q = new Questions();
    $json = $q->getFinalExamQuestions('1', $qtotal);
    echo $json;
}
if ($action == 'SendFinalAnswers') {
    $userId = $_SESSION[constant("SESSION_USER_REGID")];
    $testType = $_GET["testType"];
    $ans_user = $_GET["answers"];
    $questions = $_GET["questions"];
    $testId = 0;
    $testName = 'All';
    // Get Answers for Questions;
    $q = new Questions();
    $ans_sys = $q->getAnswersList($questions);
    echo $ans_sys;
    echo $ans_user;
    $userobj = json_decode($ans_user);
    $sysobj = json_decode($ans_sys);
    $count = 0;
    for ($uind = 0; $uind < count($userobj); $uind++) {
        $status = "F";
        for ($sind = 0; $sind < count($sysobj); $sind++) {
            if ($userobj[$uind]->{'QuestionId'} == $sysobj[$sind]->{'idTestQuestions'}) {
                if ($userobj[$uind]->{'UserAnswer'} == $sysobj[$sind]->{'answer'}) {
                    $status = "P";
                    $count++;
                }
            }
        }