]> git.mjollnir.org Git - moodle.git/commitdiff
New questions created via GUI or imported are now given a unique
authormoodler <moodler>
Sat, 23 Aug 2003 15:26:10 +0000 (15:26 +0000)
committermoodler <moodler>
Sat, 23 Aug 2003 15:26:10 +0000 (15:26 +0000)
stamp, and a default version of 1.

When questions are updated, the version number is incremented.

mod/quiz/format/aon.php
mod/quiz/format/default.php
mod/quiz/question.php

index 49bac2d66298df7163a2526c9a854e6aae7e14b7..470026d7e6f8ecf9bd1205078b4ae9f279985c33 100644 (file)
@@ -169,6 +169,9 @@ class quiz_file_format extends quiz_default_format {
                  continue;
              }
 
+             $question->stamp = make_unique_id_code();  // Set the unique code (not to be changed)
+             $question->version = 1;                    // Original version of this question
+
              if (!$question->id = insert_record("quiz_questions", $question)) {
                  error("Could not insert new question!");
              }
index 6666d71325f6475595bd9c8627c3f8df8d9889d4..221ad1e5a01f84c870efb1c99fd4e8106e844270 100644 (file)
@@ -47,6 +47,8 @@ class quiz_default_format {
             echo "<hr><p><b>$count</b>. ".stripslashes($question->questiontext)."</p>";
 
             $question->category = $this->category->id;
+            $question->stamp = make_unique_id_code();  // Set the unique code (not to be changed)
+            $question->version = 1;                    // Original version of this question
 
             if (!$question->id = insert_record("quiz_questions", $question)) {
                 error("Could not insert new question!");
index 59f3ffb7f3a7eac8d136d3951f736de7eeeb77d2..d2d7623c72c9300564b1e179355b4c390ce6a30f 100644 (file)
         } else {
 
             if (!empty($question->id)) { // Question already exists
+                $question->version ++;    // Update version number of question
                 if (!update_record("quiz_questions", $question)) {
                     error("Could not update question!");
                 }
             } else {         // Question is a new one
+                $question->stamp = make_unique_id_code();  // Set the unique code (not to be changed)
+                $question->version = 1;
                 if (!$question->id = insert_record("quiz_questions", $question)) {
                     error("Could not insert new question!");
                 }