MDL-70782 course: add setting to show activity dates

Part of MDL-70817
This commit is contained in:
Simey Lameze 2021-03-08 20:46:52 +08:00 committed by Jun Pataleta
parent 98f44ac00d
commit 680018c95d
6 changed files with 30 additions and 1 deletions

View File

@ -139,6 +139,13 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
new lang_string('coursehelpshowgrades'), 1, array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/showreports', new lang_string('showreports'), '', 0,
array(0 => new lang_string('no'), 1 => new lang_string('yes'))));
$temp->add(new admin_setting_configselect('moodlecourse/showactivitydates',
new lang_string('showactivitydates'),
new lang_string('showactivitydates_help'), 1, [
0 => new lang_string('no'),
1 => new lang_string('yes')
]
));
// Files and uploads.
$temp->add(new admin_setting_heading('filesanduploadshdr', new lang_string('filesanduploads'), ''));

View File

@ -278,6 +278,11 @@ class course_edit_form extends moodleform {
$mform->addHelpButton('showreports', 'showreports');
$mform->setDefault('showreports', $courseconfig->showreports);
// Show activity dates.
$mform->addElement('selectyesno', 'showactivitydates', get_string('showactivitydates'));
$mform->addHelpButton('showactivitydates', 'showactivitydates');
$mform->setDefault('showactivitydates', $courseconfig->showactivitydates);
// Files and uploads.
$mform->addElement('header', 'filehdr', get_string('filesanduploads'));

View File

@ -1907,6 +1907,8 @@ $string['shortnameuser'] = 'User short name';
$string['shortsitename'] = 'Short name for site (eg single word)';
$string['show'] = 'Show';
$string['showactions'] = 'Show actions';
$string['showactivitydates'] = 'Show activity dates';
$string['showactivitydates_help'] = 'The activity dates are displayed in the list of activities on the course page.';
$string['showadvancededitor'] = 'Advanced';
$string['showadvancedsettings'] = 'Show advanced settings';
$string['showall'] = 'Show all {$a}';

View File

@ -103,6 +103,7 @@
<FIELD NAME="completionnotify" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Notify users when they complete this course"/>
<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"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>

View File

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

View File

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die();
$version = 2021052500.73; // YYYYMMDD = weekly release date of this DEV branch.
$version = 2021052500.74; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
$release = '4.0dev (Build: 20210330)'; // Human-friendly version name