From 8826c67031dbe968291ae2322a9e0917ac4c9f52 Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 23 Aug 2003 15:26:10 +0000 Subject: [PATCH] New questions created via GUI or imported are now given a unique stamp, and a default version of 1. When questions are updated, the version number is incremented. --- mod/quiz/format/aon.php | 3 +++ mod/quiz/format/default.php | 2 ++ mod/quiz/question.php | 3 +++ 3 files changed, 8 insertions(+) diff --git a/mod/quiz/format/aon.php b/mod/quiz/format/aon.php index 49bac2d6629..470026d7e6f 100644 --- a/mod/quiz/format/aon.php +++ b/mod/quiz/format/aon.php @@ -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!"); } diff --git a/mod/quiz/format/default.php b/mod/quiz/format/default.php index 6666d71325f..221ad1e5a01 100644 --- a/mod/quiz/format/default.php +++ b/mod/quiz/format/default.php @@ -47,6 +47,8 @@ class quiz_default_format { echo "

$count. ".stripslashes($question->questiontext)."

"; $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!"); diff --git a/mod/quiz/question.php b/mod/quiz/question.php index 59f3ffb7f3a..d2d7623c72c 100644 --- a/mod/quiz/question.php +++ b/mod/quiz/question.php @@ -119,10 +119,13 @@ } 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!"); }