</TABLE>
<TABLE NAME="grade_grades_text" COMMENT="This table keeps additional textual information about each individual grade, whether it be automatically generated from the module or entered manually by the teacher. It's here separate from the all-numeric grade_grades for database efficiency reasons." PREVIOUS="grade_grades_raw" NEXT="grade_outcomes">
<FIELDS>
- <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="gradesid"/>
- <FIELD NAME="gradesid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="The exact grade in grade_grades_raw this corresponds to" PREVIOUS="id" NEXT="information"/>
- <FIELD NAME="information" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Further information like forum rating distribution 4/5/7/0/1" PREVIOUS="gradesid" NEXT="informationformat"/>
+ <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="itemid"/>
+ <FIELD NAME="itemid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="item id" PREVIOUS="id" NEXT="userid"/>
+ <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="itemid" NEXT="information"/>
+ <FIELD NAME="information" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Further information like forum rating distribution 4/5/7/0/1" PREVIOUS="userid" NEXT="informationformat"/>
<FIELD NAME="informationformat" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Text format for information" PREVIOUS="information" NEXT="feedback"/>
<FIELD NAME="feedback" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" ENUM="false" COMMENT="Manual feedback from the teacher. Could be a code like 'mi'." PREVIOUS="informationformat" NEXT="feedbackformat"/>
<FIELD NAME="feedbackformat" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" COMMENT="Text format for feedback" PREVIOUS="feedback" NEXT="timecreated"/>
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" ENUM="false" COMMENT="the userid of the person who last modified this entry" PREVIOUS="timemodified"/>
</FIELDS>
<KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me" NEXT="gradesid"/>
- <KEY NAME="gradesid" TYPE="foreign" FIELDS="gradesid" REFTABLE="grade_grades_raw" REFFIELDS="id" PREVIOUS="primary" NEXT="usermodified"/>
- <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id" PREVIOUS="gradesid"/>
+ <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me" NEXT="usermodified"/>
+ <KEY NAME="usermodified" TYPE="foreign" FIELDS="usermodified" REFTABLE="user" REFFIELDS="id" PREVIOUS="primary" NEXT="itemid"/>
+ <KEY NAME="itemid" TYPE="foreign" FIELDS="itemid" REFTABLE="grade_item" REFFIELDS="id" PREVIOUS="usermodified" NEXT="userid"/>
+ <KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id" COMMENT="userid" PREVIOUS="itemid"/>
</KEYS>
</TABLE>
<TABLE NAME="grade_outcomes" COMMENT="This table describes the outcomes used in the system. An outcome is a statement tied to a rubric scale from low to high, such as “Not met, Borderline, Met” (stored as 0,1 or 2)" PREVIOUS="grade_grades_text" NEXT="grade_history">
/// Launch drop field gradescale
$result = $result && drop_field($table, $field);
}
+
+ /// fixing the problem of grade_grades_text can't be referenced directly from grade_grades_final
+ if ($result && $oldversion < 2007050901) {
+
+ /// Define key gradesid (foreign) to be dropped form grade_grades_text
+ $table = new XMLDBTable('grade_grades_text');
+ $key = new XMLDBKey('gradesid');
+ $key->setAttributes(XMLDB_KEY_FOREIGN, array('gradesid'), 'grade_grades_raw', array('id'));
+
+ /// Launch drop key gradesid
+ $result = $result && drop_key($table, $key);
+
+ /// Define field gradesid to be dropped from grade_grades_text
+ $table = new XMLDBTable('grade_grades_text');
+ $field = new XMLDBField('gradesid');
+
+ /// Launch drop field gradesid
+ $result = $result && drop_field($table, $field);
+
+ /// Define field itemid to be added to grade_grades_text
+ $table = new XMLDBTable('grade_grades_text');
+ $field = new XMLDBField('itemid');
+ $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'id');
+
+ /// Launch add field itemid
+ $result = $result && add_field($table, $field);
+
+ /// Define field userid to be added to grade_grades_text
+ $table = new XMLDBTable('grade_grades_text');
+ $field = new XMLDBField('userid');
+ $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'itemid');
+
+ /// Launch add field userid
+ $result = $result && add_field($table, $field);
+
+ /// Define key itemid (foreign) to be added to grade_grades_text
+ $table = new XMLDBTable('grade_grades_text');
+ $key = new XMLDBKey('itemid');
+ $key->setAttributes(XMLDB_KEY_FOREIGN, array('itemid'), 'grade_item', array('id'));
+
+ /// Launch add key itemid
+ $result = $result && add_key($table, $key);
+
+ /// Define key userid (foreign) to be added to grade_grades_text
+ $table = new XMLDBTable('grade_grades_text');
+ $key = new XMLDBKey('userid');
+ $key->setAttributes(XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
+
+ /// Launch add key userid
+ $result = $result && add_key($table, $key);
+
+ }
return $result;
}