Two new general-purpose fields in assignment_submissions, so that
most assignment types won't need to create new tables for data The fields are data1 and data2. Backup/restore handled, Eloy ;-)
This commit is contained in:
@@ -86,6 +86,8 @@
|
||||
fwrite ($bf,full_tag("TIMECREATED",6,false,$ass_sub->timecreated));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$ass_sub->timemodified));
|
||||
fwrite ($bf,full_tag("NUMFILES",6,false,$ass_sub->numfiles));
|
||||
fwrite ($bf,full_tag("DATA1",6,false,$ass_sub->data1));
|
||||
fwrite ($bf,full_tag("DATA2",6,false,$ass_sub->data2));
|
||||
fwrite ($bf,full_tag("GRADE",6,false,$ass_sub->grade));
|
||||
fwrite ($bf,full_tag("COMMENT",6,false,$ass_sub->comment));
|
||||
fwrite ($bf,full_tag("TEACHER",6,false,$ass_sub->teacher));
|
||||
|
||||
@@ -131,6 +131,11 @@ function assignment_upgrade($oldversion) {
|
||||
execute_sql('ALTER TABLE '.$CFG->prefix.'assignment DROP type;');
|
||||
}
|
||||
|
||||
if ($oldversion < 2005041501) { // Add two new fields for general data handling,
|
||||
// so most assignment types won't need new fields and backups stay simple
|
||||
table_column('assignment_submissions', '', 'data2', 'MEDIUMTEXT', '', '', '', 'not null', 'numfiles');
|
||||
table_column('assignment_submissions', '', 'data1', 'MEDIUMTEXT', '', '', '', 'not null', 'numfiles');
|
||||
}
|
||||
|
||||
|
||||
/// These lines ALWAYS need to be here at the end of this file. Don't mess with them. :-)
|
||||
|
||||
@@ -32,6 +32,8 @@ CREATE TABLE `prefix_assignment_submissions` (
|
||||
`timecreated` int(10) unsigned NOT NULL default '0',
|
||||
`timemodified` int(10) unsigned NOT NULL default '0',
|
||||
`numfiles` int(10) unsigned NOT NULL default '0',
|
||||
`data1` text NOT NULL,
|
||||
`data2` text NOT NULL,
|
||||
`grade` int(11) NOT NULL default '0',
|
||||
`comment` text NOT NULL,
|
||||
`teacher` int(10) unsigned NOT NULL default '0',
|
||||
|
||||
@@ -129,7 +129,11 @@ function assignment_upgrade($oldversion) {
|
||||
execute_sql('ALTER TABLE '.$CFG->prefix.'assignment DROP type;');
|
||||
}
|
||||
|
||||
|
||||
if ($oldversion < 2005041501) { // Add two new fields for general data handling,
|
||||
// so most assignment types won't need new fields and backups stay simple
|
||||
table_column('assignment_submissions', '', 'data2', 'TEXT', '', '', '', 'not null', 'numfiles');
|
||||
table_column('assignment_submissions', '', 'data1', 'TEXT', '', '', '', 'not null', 'numfiles');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ CREATE TABLE prefix_assignment_submissions (
|
||||
timecreated integer NOT NULL default '0',
|
||||
timemodified integer NOT NULL default '0',
|
||||
numfiles integer NOT NULL default '0',
|
||||
data1 text NOT NULL default '',
|
||||
data2 text NOT NULL default '',
|
||||
grade integer NOT NULL default '0',
|
||||
comment text NOT NULL default '',
|
||||
teacher integer NOT NULL default '0',
|
||||
|
||||
@@ -121,6 +121,8 @@
|
||||
$submission->timecreated = backup_todb($sub_info['#']['TIMECREATED']['0']['#']);
|
||||
$submission->timemodified = backup_todb($sub_info['#']['TIMEMODIFIED']['0']['#']);
|
||||
$submission->numfiles = backup_todb($sub_info['#']['NUMFILES']['0']['#']);
|
||||
$submission->data1 = backup_todb($sub_info['#']['DATA1']['0']['#']);
|
||||
$submission->data2 = backup_todb($sub_info['#']['DATA2']['0']['#']);
|
||||
$submission->grade = backup_todb($sub_info['#']['GRADE']['0']['#']);
|
||||
$submission->comment = backup_todb($sub_info['#']['COMMENT']['0']['#']);
|
||||
$submission->teacher = backup_todb($sub_info['#']['TEACHER']['0']['#']);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// This fragment is called by /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2005041400;
|
||||
$module->version = 2005041501;
|
||||
$module->requires = 2005031000; // Requires this Moodle version
|
||||
$module->cron = 60;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user