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.
This commit is contained in:
moodler 2003-08-23 15:26:10 +00:00
parent 1923285635
commit 8826c67031
3 changed files with 8 additions and 0 deletions

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

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

View File

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