/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to DuggaSys/quizAjax/answerQuiz.php

  • Committer: Gustav Hatvigsson
  • Date: 2013-05-28 13:47:11 UTC
  • mfrom: (116.1.1 lenasys)
  • Revision ID: gustav.hartvigsson@gmail.com-20130528134711-3lx8qwgx3nu380lg
Merged franssons changes:
Fixed a error in controllers/codeviewer.php

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
session_start();
10
10
//Check if the sent login name is the same as the one stored in the session
11
 
if($_POST['loginName']==$_SESSION['loginName'] && $_POST['courseName']==$_SESSION['courseName'] && $_POST['quizNr']==$_SESSION['quizNr']){ 
12
 
 
 
11
if($_POST['loginName']==$_SESSION['loginName'] && $_POST['courseName']==$_SESSION['courseName'] && $_POST['quizNr']==$_SESSION['quizNr']) { 
 
12
        include "../../php/dbconnect.php";
13
13
        //Store answer and loginName+answer hash
14
 
        function storeAnswer($loginName,$courseName,$courseOccasion,$quizNr,$qVarRr,$quizAnswer,$grade,$gradeComment,$ip,$userAgent,$pdo){
 
14
        function storeAnswer($loginName,$courseName,$courseOccasion,$quizNr,$qVarRr,$quizAnswer,$grade,$gradeComment,$ip,$userAgent,$pdo) {
15
15
                $updateQuery="UPDATE AssignedQuizzes 
16
16
                                          SET AssignedQuizzes.answer=:ANSWER, 
17
17
                                                  AssignedQuizzes.answerHash=:ANSWERHASH, 
49
49
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
50
50
        header('Content-type: application/json; charset=utf-8'); 
51
51
 
52
 
        include "dbconnect.php";
 
52
        
53
53
        
54
54
        //TODO: Store ALL answer attempts in answerlog
55
55
        // CREATE TABLE AssignedQuizzesAnswerLog(
131
131
        $stmt->bindParam(':COCCASION', $_SESSION['courseOccasion']);
132
132
        $stmt->execute();
133
133
 
134
 
        if($stmt->fetchColumn()==1){ //Student is registered for the course - COUNT result read from the first column of the next unread row (i.e. the first row) 
 
134
        if($stmt->fetchColumn()==1) { //Student is registered for the course - COUNT result read from the first column of the next unread row (i.e. the first row) 
135
135
                //Check if quiz is open (and fetch auto correction setting)
136
136
                $queryString="SELECT Quiz.opening, Quiz.closing, Quiz.autoCorrected, Quiz.allowMultipleReplies
137
137
                                           FROM Quiz