mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Abolished the qtype integers. The question types are now indexed by their name as specified by their directory name. This will avoid a lot of confusion in future when we have plugable question types.
This commit is contained in:
parent
069b6daf76
commit
6040798269
6 changed files with 47 additions and 15 deletions
|
@ -38,18 +38,18 @@ define('QUESTION_EVENTCLOSE', '8'); // The response has been submitted and t
|
||||||
/**#@+
|
/**#@+
|
||||||
* The core question types
|
* The core question types
|
||||||
*/
|
*/
|
||||||
define("SHORTANSWER", "1");
|
define("SHORTANSWER", "shortanswer");
|
||||||
define("TRUEFALSE", "2");
|
define("TRUEFALSE", "truefalse");
|
||||||
define("MULTICHOICE", "3");
|
define("MULTICHOICE", "multichoice");
|
||||||
define("RANDOM", "4");
|
define("RANDOM", "random");
|
||||||
define("MATCH", "5");
|
define("MATCH", "match");
|
||||||
define("RANDOMSAMATCH", "6");
|
define("RANDOMSAMATCH", "randomsamatch");
|
||||||
define("DESCRIPTION", "7");
|
define("DESCRIPTION", "description");
|
||||||
define("NUMERICAL", "8");
|
define("NUMERICAL", "numerical");
|
||||||
define("MULTIANSWER", "9");
|
define("MULTIANSWER", "multianswer");
|
||||||
define("CALCULATED", "10");
|
define("CALCULATED", "calculated");
|
||||||
define("RQP", "11");
|
define("RQP", "rqp");
|
||||||
define("ESSAY", "12");
|
define("ESSAY", "essay");
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -972,6 +972,22 @@ function quiz_upgrade($oldversion) {
|
||||||
execute_sql("ALTER TABLE {$CFG->prefix}quiz_essay_states RENAME {$CFG->prefix}question_essay_states", false);
|
execute_sql("ALTER TABLE {$CFG->prefix}quiz_essay_states RENAME {$CFG->prefix}question_essay_states", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($oldversion < 2006032100) {
|
||||||
|
table_column('question', 'qtype', 'qtype', 'varchar', 20, '', '', 'not null');
|
||||||
|
set_field('question', 'qtype', 'shortanswer', 'qtype', 1);
|
||||||
|
set_field('question', 'qtype', 'truefalse', 'qtype', 2);
|
||||||
|
set_field('question', 'qtype', 'multichoice', 'qtype', 3);
|
||||||
|
set_field('question', 'qtype', 'random', 'qtype', 4);
|
||||||
|
set_field('question', 'qtype', 'match', 'qtype', 5);
|
||||||
|
set_field('question', 'qtype', 'randomsamatch', 'qtype', 6);
|
||||||
|
set_field('question', 'qtype', 'description', 'qtype', 7);
|
||||||
|
set_field('question', 'qtype', 'numerical', 'qtype', 8);
|
||||||
|
set_field('question', 'qtype', 'multianswer', 'qtype', 9);
|
||||||
|
set_field('question', 'qtype', 'calculated', 'qtype', 10);
|
||||||
|
set_field('question', 'qtype', 'rqp', 'qtype', 11);
|
||||||
|
set_field('question', 'qtype', 'essay', 'qtype', 12);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -392,7 +392,7 @@ CREATE TABLE prefix_question (
|
||||||
image varchar(255) NOT NULL default '',
|
image varchar(255) NOT NULL default '',
|
||||||
defaultgrade int(10) unsigned NOT NULL default '1',
|
defaultgrade int(10) unsigned NOT NULL default '1',
|
||||||
penalty float NOT NULL default '0.1',
|
penalty float NOT NULL default '0.1',
|
||||||
qtype smallint(6) NOT NULL default '0',
|
qtype varchar(20) NOT NULL default '',
|
||||||
length int(10) unsigned NOT NULL default '1',
|
length int(10) unsigned NOT NULL default '1',
|
||||||
stamp varchar(255) NOT NULL default '',
|
stamp varchar(255) NOT NULL default '',
|
||||||
version int(10) NOT NULL default '1',
|
version int(10) NOT NULL default '1',
|
||||||
|
|
|
@ -1141,6 +1141,22 @@ function quiz_upgrade($oldversion) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($oldversion < 2006032100) {
|
||||||
|
table_column('question', 'qtype', 'qtype', 'varchar', 20, '', '', 'not null');
|
||||||
|
set_field('question', 'qtype', 'shortanswer', 'qtype', 1);
|
||||||
|
set_field('question', 'qtype', 'truefalse', 'qtype', 2);
|
||||||
|
set_field('question', 'qtype', 'multichoice', 'qtype', 3);
|
||||||
|
set_field('question', 'qtype', 'random', 'qtype', 4);
|
||||||
|
set_field('question', 'qtype', 'match', 'qtype', 5);
|
||||||
|
set_field('question', 'qtype', 'randomsamatch', 'qtype', 6);
|
||||||
|
set_field('question', 'qtype', 'description', 'qtype', 7);
|
||||||
|
set_field('question', 'qtype', 'numerical', 'qtype', 8);
|
||||||
|
set_field('question', 'qtype', 'multianswer', 'qtype', 9);
|
||||||
|
set_field('question', 'qtype', 'calculated', 'qtype', 10);
|
||||||
|
set_field('question', 'qtype', 'rqp', 'qtype', 11);
|
||||||
|
set_field('question', 'qtype', 'essay', 'qtype', 12);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,7 @@ CREATE TABLE prefix_question (
|
||||||
image varchar(255) NOT NULL default '',
|
image varchar(255) NOT NULL default '',
|
||||||
defaultgrade integer NOT NULL default '1',
|
defaultgrade integer NOT NULL default '1',
|
||||||
penalty real NOT NULL default '0.1',
|
penalty real NOT NULL default '0.1',
|
||||||
qtype integer NOT NULL default '0',
|
qtype varchar(20) NOT NULL default '0',
|
||||||
length integer NOT NULL DEFAULT '1',
|
length integer NOT NULL DEFAULT '1',
|
||||||
stamp varchar(255) NOT NULL default '',
|
stamp varchar(255) NOT NULL default '',
|
||||||
version integer NOT NULL default '1',
|
version integer NOT NULL default '1',
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
$module->version = 2006031202; // The (date) version of this module
|
$module->version = 2006032100; // The (date) version of this module
|
||||||
$module->requires = 2006022400; // Requires this Moodle version
|
$module->requires = 2006022400; // Requires this Moodle version
|
||||||
$module->cron = 0; // How often should cron check this module (seconds)?
|
$module->cron = 0; // How often should cron check this module (seconds)?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue