From: stronk7 Date: Thu, 21 Sep 2006 09:35:20 +0000 (+0000) Subject: Moved assignment_submission->comment to submissioncomment X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ea6432fede9f28e177cb9234a3faac5b5cc61329;p=moodle.git Moved assignment_submission->comment to submissioncomment (because comment is DB reserved word) --- diff --git a/mod/assignment/backuplib.php b/mod/assignment/backuplib.php index e02e9fa052..747df2bb94 100644 --- a/mod/assignment/backuplib.php +++ b/mod/assignment/backuplib.php @@ -112,7 +112,7 @@ 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("SUBMISSIONCOMMENT",6,false,$ass_sub->submissioncomment)); fwrite ($bf,full_tag("FORMAT",6,false,$ass_sub->format)); fwrite ($bf,full_tag("TEACHER",6,false,$ass_sub->teacher)); fwrite ($bf,full_tag("TIMEMARKED",6,false,$ass_sub->timemarked)); diff --git a/mod/assignment/db/install.xml b/mod/assignment/db/install.xml index bc95d668c2..68515329c6 100644 --- a/mod/assignment/db/install.xml +++ b/mod/assignment/db/install.xml @@ -1,5 +1,8 @@ - + @@ -40,9 +43,9 @@ - - - + + + diff --git a/mod/assignment/db/migrate2utf8.xml b/mod/assignment/db/migrate2utf8.xml index dcd75f8a08..4122cf3c63 100755 --- a/mod/assignment/db/migrate2utf8.xml +++ b/mod/assignment/db/migrate2utf8.xml @@ -30,7 +30,7 @@ AND ass.id = RECORDID - + SELECT ass.teacher as userid FROM {$CFG->prefix}assignment_submissions ass diff --git a/mod/assignment/db/mysql.php b/mod/assignment/db/mysql.php index e25a709c43..54704ac755 100644 --- a/mod/assignment/db/mysql.php +++ b/mod/assignment/db/mysql.php @@ -159,6 +159,10 @@ function assignment_upgrade($oldversion) { assignment_refresh_events(); } + if ($oldversion < 2006092100) { + table_column('assignment_submissions', 'comment', 'submissioncomment', 'text', '', '', ''); + } + /// These lines ALWAYS need to be here at the end of this file. Don't mess with them. :-) include_once("$CFG->dirroot/mod/assignment/lib.php"); diff --git a/mod/assignment/db/mysql.sql b/mod/assignment/db/mysql.sql index cac154c50b..7ddd944598 100644 --- a/mod/assignment/db/mysql.sql +++ b/mod/assignment/db/mysql.sql @@ -41,7 +41,7 @@ CREATE TABLE `prefix_assignment_submissions` ( `data1` text NOT NULL default '', `data2` text NOT NULL default '', `grade` int(11) NOT NULL default '0', - `comment` text NOT NULL default '', + `submissioncomment` text NOT NULL default '', `format` tinyint(4) unsigned NOT NULL default '0', `teacher` int(10) unsigned NOT NULL default '0', `timemarked` int(10) unsigned NOT NULL default '0', diff --git a/mod/assignment/db/postgres7.php b/mod/assignment/db/postgres7.php index 0a2e1fc752..3734058279 100644 --- a/mod/assignment/db/postgres7.php +++ b/mod/assignment/db/postgres7.php @@ -167,6 +167,10 @@ function assignment_upgrade($oldversion) { modify_database('','ALTER TABLE prefix_assignment_submissions ALTER format SET NOT NULL'); } + if ($oldversion < 2006092100) { + table_column('assignment_submissions', 'comment', 'submissioncomment', 'text', '', '', ''); + } + /// These lines ALWAYS need to be here at the end of this file. Don't mess with them. :-) include_once("$CFG->dirroot/mod/assignment/lib.php"); assignment_upgrade_submodules(); diff --git a/mod/assignment/db/postgres7.sql b/mod/assignment/db/postgres7.sql index de2001e8db..3cb739ece3 100644 --- a/mod/assignment/db/postgres7.sql +++ b/mod/assignment/db/postgres7.sql @@ -42,7 +42,7 @@ CREATE TABLE prefix_assignment_submissions ( data1 text NOT NULL default '', data2 text NOT NULL default '', grade integer NOT NULL default '0', - comment text NOT NULL default '', + submissioncomment text NOT NULL default '', format integer NOT NULL default '0', teacher integer NOT NULL default '0', timemarked integer NOT NULL default '0', diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index b27fcbae3d..621075c789 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -209,7 +209,7 @@ class assignment_base { * Display the feedback to the student * * This default method prints the teacher picture and name, date when marked, - * grade and teacher comment. + * grade and teacher submissioncomment. * * @param $submission object The submission object or NULL in which case it will be loaded */ @@ -257,7 +257,7 @@ class assignment_base { } echo '
'; - echo format_text($submission->comment, $submission->format); + echo format_text($submission->submissioncomment, $submission->format); echo '
'; echo ''; @@ -582,8 +582,8 @@ class assignment_base { $grading = false; $commenting = false; $col = false; - if (isset($_POST['comment'])) { - $col = 'comment'; + if (isset($_POST['submissioncomment'])) { + $col = 'submissioncomment'; $commenting = true; } if (isset($_POST['menu'])) { @@ -591,7 +591,7 @@ class assignment_base { $grading = true; } if (!$col) { - //both comment and grade columns collapsed.. + //both submissioncomment and grade columns collapsed.. $this->display_submissions(); break; } @@ -620,11 +620,11 @@ class assignment_base { } } if ($commenting) { - $commentvalue = trim($_POST['comment'][$id]); - $updatedb = $updatedb || ($submission->comment != stripslashes($commentvalue)); - $submission->comment = $commentvalue; + $commentvalue = trim($_POST['submissioncomment'][$id]); + $updatedb = $updatedb || ($submission->submissioncomment != stripslashes($commentvalue)); + $submission->submissioncomment = $commentvalue; } else { - unset($submission->comment); // Don't need to update this. + unset($submission->submissioncomment); // Don't need to update this. } $submission->teacher = $USER->id; @@ -632,7 +632,7 @@ class assignment_base { $submission->timemarked = time(); //if it is not an update, we don't change the last modified time etc. - //this will also not write into database if no comment and grade is entered. + //this will also not write into database if no submissioncomment and grade is entered. if ($updatedb){ if ($newsubmission) { @@ -698,13 +698,13 @@ class assignment_base { /// Run some Javascript to try and update the parent page $output .= '