MDL-70781 course: setting for displaying completion conditions

Part of MDL-70817
This commit is contained in:
Simey Lameze 2021-03-09 06:42:09 +08:00 committed by Jun Pataleta
parent c0d0679c8a
commit a4f7c1d91f
7 changed files with 44 additions and 1 deletions

View file

@ -104,6 +104,7 @@
<FIELD NAME="cacherev" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Incrementing revision for validating the course content cache"/>
<FIELD NAME="originalcourseid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="the id of the source course when a new course originates from a restore of another course on the same site."/>
<FIELD NAME="showactivitydates" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether to display activity dates to user. 0 = do not display, 1 = display activity dates"/>
<FIELD NAME="showcompletionconditions" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Whether to display completion conditions to user. 0 = do not display, 1 = display conditions"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>

View file

@ -2531,5 +2531,19 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2021052500.74);
}
if ($oldversion < 2021052500.75) {
// Define field 'showcompletionconditions' to be added to course.
$table = new xmldb_table('course');
$field = new xmldb_field('showcompletionconditions', XMLDB_TYPE_INTEGER, '1', null,
XMLDB_NOTNULL, null, '1', 'completionnotify');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2021052500.75);
}
return true;
}