]> git.mjollnir.org Git - moodle.git/commitdiff
Some preparation for manual grading
authorgustav_delius <gustav_delius>
Mon, 27 Mar 2006 17:38:30 +0000 (17:38 +0000)
committergustav_delius <gustav_delius>
Mon, 27 Mar 2006 17:38:30 +0000 (17:38 +0000)
lib/questionlib.php

index 0ec78fcc58c2c641ab2857f1d4fd1378c525104b..975f28584fdb4f40c693ade045fce8d97daa1b0d 100644 (file)
@@ -33,6 +33,7 @@ define('QUESTION_EVENTVALIDATE', '5');  // The student has requested a validatio
 define('QUESTION_EVENTCLOSEANDGRADE', '6'); // Moodle has graded the responses. A CLOSE event can be changed to a CLOSEANDGRADE event by Moodle.
 define('QUESTION_EVENTSUBMIT', '7');    // The student response has been submitted but it has not yet been marked
 define('QUESTION_EVENTCLOSE', '8');     // The response has been submitted and the session has been closed, either because the student requested it or because Moodle did it (e.g. because of a timelimit). The responses have not been graded.
+define('QUESTION_EVENTMANUALGRADE', '9');   // Grade was entered by teacher
 /**#@-*/
 
 /**#@+
@@ -668,7 +669,7 @@ function restore_question_state(&$question, &$state) {
 * to the answer field of the database table. The information in the
 * question_sessions table is updated.
 * The question type specific data is then saved.
-* @return boolean         Indicates success or failure.
+* @return mixed           The id of the saved or updated state or false
 * @param object $question The question for which session is to be saved.
 * @param object $state    The state information to be saved. In particular the
 *                         most recent responses are in ->responses. The object
@@ -678,7 +679,7 @@ function save_question_session(&$question, &$state) {
     global $QTYPES;
     // Check if the state has changed
     if (!$state->changed && isset($state->id)) {
-        return true;
+        return $state->id;
     }
     // Set the legacy answer field
     $state->answer = isset($state->responses['']) ? $state->responses[''] : '';
@@ -728,7 +729,7 @@ function save_question_session(&$question, &$state) {
     }
     // Reset the changed flag
     $state->changed = false;
-    return true;
+    return $state->id;
 }
 
 /**
@@ -738,7 +739,9 @@ function save_question_session(&$question, &$state) {
 * @param object $state
 */
 function question_state_is_graded($state) {
-    return ($state->event == QUESTION_EVENTGRADE or $state->event == QUESTION_EVENTCLOSEANDGRADE);
+    return ($state->event == QUESTION_EVENTGRADE
+         or $state->event == QUESTION_EVENTCLOSEANDGRADE
+         or $state->event == QUESTION_EVENTMANUALGRADE);
 }
 
 /**