]> git.mjollnir.org Git - moodle.git/commitdiff
Abolished the qtype integers. The question types are now indexed by their name as...
authorgustav_delius <gustav_delius>
Tue, 21 Mar 2006 23:08:36 +0000 (23:08 +0000)
committergustav_delius <gustav_delius>
Tue, 21 Mar 2006 23:08:36 +0000 (23:08 +0000)
lib/questionlib.php
mod/quiz/db/mysql.php
mod/quiz/db/mysql.sql
mod/quiz/db/postgres7.php
mod/quiz/db/postgres7.sql
mod/quiz/version.php

index ce837a6a69c825ba97a04e6e3a603a82c8e85cb8..0235b735dbd932a586ac93603737a656880aadd8 100644 (file)
@@ -38,18 +38,18 @@ define('QUESTION_EVENTCLOSE', '8');     // The response has been submitted and t
 /**#@+
  * The core question types
  */
-define("SHORTANSWER",   "1");
-define("TRUEFALSE",     "2");
-define("MULTICHOICE",   "3");
-define("RANDOM",        "4");
-define("MATCH",         "5");
-define("RANDOMSAMATCH", "6");
-define("DESCRIPTION",   "7");
-define("NUMERICAL",     "8");
-define("MULTIANSWER",   "9");
-define("CALCULATED",   "10");
-define("RQP",          "11");
-define("ESSAY",        "12");
+define("SHORTANSWER",   "shortanswer");
+define("TRUEFALSE",     "truefalse");
+define("MULTICHOICE",   "multichoice");
+define("RANDOM",        "random");
+define("MATCH",         "match");
+define("RANDOMSAMATCH", "randomsamatch");
+define("DESCRIPTION",   "description");
+define("NUMERICAL",     "numerical");
+define("MULTIANSWER",   "multianswer");
+define("CALCULATED",    "calculated");
+define("RQP",           "rqp");
+define("ESSAY",         "essay");
 /**#@-*/
 
 /**
index 737235246adb928580909142e165bdf3bb42ec58..69a112f27955d98764c4b2fb2074ad2ba50d5e7b 100644 (file)
@@ -972,6 +972,22 @@ function quiz_upgrade($oldversion) {
         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;
 }
 
index 593412ce27f9deb6a4e9c4ad2472d192762623bd..711f555a05df1695d1ad13340feb2b49f162d2bf 100644 (file)
@@ -392,7 +392,7 @@ CREATE TABLE prefix_question (
   image varchar(255) NOT NULL default '',
   defaultgrade int(10) unsigned NOT NULL default '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',
   stamp varchar(255) NOT NULL default '',
   version int(10) NOT NULL default '1',
index 264f0c983c3e0bdfa72a62cb0dcb2b48a451b2cc..dbc3abf80ca5bfe931f09f2fc930333ca7d63753 100644 (file)
@@ -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;
 }
 
index 42a02049907fa7d90c9294c0fb2f502378954455..a663b851937b41a4b46812c6719b66d8f2a5cd2d 100644 (file)
@@ -382,7 +382,7 @@ CREATE TABLE prefix_question (
   image varchar(255) NOT NULL default '',
   defaultgrade integer NOT NULL default '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',
   stamp varchar(255) NOT NULL default '',
   version integer NOT NULL default '1',
index e89d3cb569d893a063bad3e64b1dbf20f34a1f29..0d9be8ed15453de5013541bc15dcc02a4b4aefbd 100644 (file)
@@ -5,7 +5,7 @@
 //  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->cron     = 0;            // How often should cron check this module (seconds)?