table_column("quiz", "eachattemptbuildsonthelast", "attemptonlast", "TINYINT", "4", "UNSIGNED", "0", "NOT NULL", "");
}
+ if ($oldversion < 2003082300) {
+ table_column("quiz_questions", "", "stamp", "varchar", "255", "", "qtype");
+
+ if ($questions = get_records("quiz_questions")) {
+ foreach ($questions as $question) {
+ $stamp = make_unique_id_code();
+ if (!set_field("quiz_questions", "stamp", $stamp, "id", $question->id)) {
+ notify("Error while adding stamp to question id = $question->id");
+ }
+ }
+ }
+ }
+
return true;
}
`image` varchar(255) NOT NULL default '',
`defaultgrade` INT UNSIGNED DEFAULT '1' NOT NULL,
`qtype` smallint(6) NOT NULL default '0',
+ `stamp` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM COMMENT='The quiz questions themselves';
# --------------------------------------------------------
execute_sql(" INSERT INTO {$CFG->prefix}log_display VALUES ('quiz', 'review', 'quiz', 'name') ");
}
+ if ($oldversion < 2003082300) {
+ modify_database ("", " CREATE TABLE prefix_quiz_multianswers (
+ id SERIAL PRIMARY KEY,
+ question integer NOT NULL default '0',
+ answers varchar(255) NOT NULL default '',
+ positionkey varchar(255) NOT NULL default '',
+ answertype integer NOT NULL default '0',
+ norm integer NOT NULL default '1'
+ ); ");
+ modify_database ("", "CREATE INDEX prefix_quiz_multianswers_question_idx ON prefix_quiz_multianswers (question);");
+
+ table_column("quiz", "", "attemptonlast", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "attempts");
+
+ table_column("quiz_questions", "", "stamp", "varchar", "255", "", "qtype");
+
+ if ($questions = get_records("quiz_questions")) {
+ foreach ($questions as $question) {
+ $stamp = make_unique_id_code();
+ if (!set_field("quiz_questions", "stamp", $stamp, "id", $question->id)) {
+ notify("Error while adding stamp to question id = $question->id");
+ }
+ }
+ }
+ }
+
return true;
}
timeopen integer NOT NULL default '0',
timeclose integer NOT NULL default '0',
attempts integer NOT NULL default '0',
+ attemptonlast integer NOT NULL default '0',
feedback integer NOT NULL default '0',
correctanswers integer NOT NULL default '1',
grademethod integer NOT NULL default '1',
# --------------------------------------------------------
CREATE INDEX prefix_quiz_match_sub_question_idx ON prefix_quiz_match_sub (question);
+
+#
+# Table structure for table `quiz_multianswers`
+#
+
+CREATE TABLE prefix_quiz_multianswers (
+ id SERIAL PRIMARY KEY,
+ question integer NOT NULL default '0',
+ answers varchar(255) NOT NULL default '',
+ positionkey varchar(255) NOT NULL default '',
+ answertype integer NOT NULL default '0',
+ norm integer NOT NULL default '1'
+);
+CREATE INDEX prefix_quiz_multianswers_question_idx ON prefix_quiz_multianswers (question);
+
#
# Table structure for table quiz_multichoice
#
questiontext text NOT NULL default '',
image varchar(255) NOT NULL default '',
defaultgrade integer NOT NULL default '1',
- qtype integer NOT NULL default '0'
+ qtype integer NOT NULL default '0',
+ stamp varchar(255) NOT NULL default ''
);
# --------------------------------------------------------
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2003080400; // The (date) version of this module
+$module->version = 2003082300; // The (date) version of this module
$module->cron = 0; // How often should cron check this module (seconds)?
?>