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!"); }