2002-12-15 02:41:07 +00:00
|
|
|
<?PHP // $Id$
|
|
|
|
|
|
|
|
function quiz_upgrade($oldversion) {
|
|
|
|
// This function does anything necessary to upgrade
|
|
|
|
// older versions to match current functionality
|
|
|
|
|
|
|
|
global $CFG;
|
|
|
|
|
2003-01-01 13:17:27 +00:00
|
|
|
if ($oldversion < 2003010100) {
|
|
|
|
execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD review integer DEFAULT '0' NOT NULL AFTER `grademethod` ");
|
|
|
|
}
|
|
|
|
|
2003-01-03 16:01:48 +00:00
|
|
|
if ($oldversion < 2003010301) {
|
2003-02-16 07:08:57 +00:00
|
|
|
table_column("quiz_truefalse", "true", "trueanswer", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "");
|
|
|
|
table_column("quiz_truefalse", "false", "falseanswer", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "");
|
|
|
|
table_column("quiz_questions", "type", "qtype", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "");
|
2003-01-03 16:01:48 +00:00
|
|
|
}
|
|
|
|
|
2003-02-24 10:42:07 +00:00
|
|
|
if ($oldversion < 2003022303) {
|
|
|
|
modify_database ("", "CREATE TABLE prefix_quiz_randommatch (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
question integer NOT NULL default '0',
|
2003-04-27 17:35:54 +00:00
|
|
|
choose integer NOT NULL default '4'
|
2003-02-24 10:42:07 +00:00
|
|
|
);");
|
|
|
|
}
|
2003-03-03 17:48:39 +00:00
|
|
|
if ($oldversion < 2003030303) {
|
2003-03-03 17:43:13 +00:00
|
|
|
table_column("quiz_questions", "", "defaultgrade", "INTEGER", "6", "UNSIGNED", "1", "NOT NULL", "image");
|
|
|
|
}
|
2003-02-24 10:42:07 +00:00
|
|
|
|
2003-03-30 16:46:50 +00:00
|
|
|
if ($oldversion < 2003033100) {
|
|
|
|
modify_database ("", "ALTER TABLE prefix_quiz_randommatch RENAME prefix_quiz_randomsamatch ");
|
2003-04-18 21:05:12 +00:00
|
|
|
modify_database ("", "CREATE TABLE prefix_quiz_match_sub (
|
2003-03-30 16:46:50 +00:00
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
question integer NOT NULL default '0',
|
|
|
|
questiontext text NOT NULL default '',
|
|
|
|
answertext varchar(255) NOT NULL default ''
|
|
|
|
);");
|
|
|
|
modify_database ("", "CREATE INDEX question_prefix_quiz_match_sub_idx ON prefix_quiz_match_sub (question);");
|
|
|
|
|
|
|
|
modify_database ("", "CREATE TABLE prefix_quiz_multichoice (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
question integer NOT NULL default '0',
|
|
|
|
layout integer NOT NULL default '0',
|
|
|
|
answers varchar(255) NOT NULL default '',
|
|
|
|
single integer NOT NULL default '0'
|
|
|
|
);");
|
|
|
|
modify_database ("", "CREATE INDEX question_quiz_multichoice_idx ON prefix_quiz_multichoice (question);");
|
|
|
|
}
|
|
|
|
|
2003-04-09 13:57:08 +00:00
|
|
|
if ($oldversion < 2003040901) {
|
2003-04-27 15:33:31 +00:00
|
|
|
table_column("quiz", "", "shufflequestions", "INTEGER", "5", "UNSIGNED", "0", "NOT NULL", "review");
|
2003-04-09 13:57:08 +00:00
|
|
|
table_column("quiz", "", "shuffleanswers", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "shufflequestions");
|
|
|
|
}
|
2003-04-27 15:33:31 +00:00
|
|
|
if ($oldversion < 2003042702) {
|
|
|
|
modify_database ("", "CREATE TABLE prefix_quiz_match (
|
|
|
|
id SERIAL PRIMARY KEY,
|
|
|
|
question integer NOT NULL default '0',
|
|
|
|
subquestions varchar(255) NOT NULL default ''
|
|
|
|
);");
|
|
|
|
modify_database ("", "CREATE INDEX question ON prefix_quiz_match (question);");
|
|
|
|
}
|
2002-12-15 02:41:07 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|