MDL-66143 course: Integration review fixes

This commit is contained in:
Jun Pataleta 2019-07-22 11:51:20 +08:00
parent a676250f97
commit b850ddfdd5
5 changed files with 10 additions and 7 deletions

View File

@ -130,7 +130,9 @@ class course_edit_form extends moodleform {
$mform->addHelpButton('enddate', 'enddate');
if (!empty($CFG->enablecourserelativedates)) {
$attributes = [];
$attributes = [
'aria-describedby' => 'relativedatesmode_warning'
];
if (!empty($course->id)) {
$attributes['disabled'] = true;
}
@ -141,7 +143,8 @@ class course_edit_form extends moodleform {
$relativedatesmodegroup = [];
$relativedatesmodegroup[] = $mform->createElement('select', 'relativedatesmode', get_string('relativedatesmode'),
$relativeoptions, $attributes);
$relativedatesmodegroup[] = $mform->createElement('html', html_writer::span(get_string('relativedatesmode_warning')));
$relativedatesmodegroup[] = $mform->createElement('html', html_writer::span(get_string('relativedatesmode_warning'),
'', ['id' => 'relativedatesmode_warning']));
$mform->addGroup($relativedatesmodegroup, 'relativedatesmodegroup', get_string('relativedatesmode'), null, false);
$mform->addHelpButton('relativedatesmodegroup', 'relativedatesmode');
}

View File

@ -26,7 +26,7 @@ Feature: Courses can be set up to display dates relative to the user's enrolment
When I press "Add a new course"
And I wait until the page is ready
Then I should see "Relative dates mode"
And I should see "This cannot be changed once the course has been created."
And I should see "Relative dates mode cannot be changed once the course has been created."
Scenario: Edit courses with relative dates feature enabled
Given I log in as "admin"

View File

@ -772,7 +772,7 @@ class core_course_courselib_testcase extends advanced_testcase {
set_config('enablecourserelativedates', $setting);
// Generate a course with relative dates mode set to 1.
// Generate a course with relative dates mode set to $mode.
$course = $this->getDataGenerator()->create_course(['relativedatesmode' => $mode]);
// Verify that the relative dates match what's expected.

View File

@ -517,7 +517,7 @@ $string['enableblogs'] = 'Enable blogs';
$string['enablecalendarexport'] = 'Enable calendar export';
$string['enablecomments'] = 'Enable comments';
$string['enablecourserelativedates'] = 'Enable course relative dates';
$string['enablecourserelativedates_desc'] = 'Allow courses to be set up to display dates relative to the user\'s enrolment date in the course.';
$string['enablecourserelativedates_desc'] = 'Allow courses to be set up to display dates relative to the user\'s start date in the course.';
$string['enablecourserequests'] = 'Enable course requests';
$string['enabled'] = 'Enabled';
$string['enabledevicedetection'] = 'Enable device detection';

View File

@ -1634,8 +1634,8 @@ $string['registrationyes'] = 'Yes, notify me about important news (e.g. security
$string['reject'] = 'Reject';
$string['rejectdots'] = 'Reject...';
$string['relativedatesmode'] = 'Relative dates mode';
$string['relativedatesmode_help'] = 'Display course or activity dates relative to the user\'s start date in the course .<br />The user\'s course start date will be their enrolment start date, unless they are enrolled before the course begins in which case their start date will be the course start date.<br/><strong>WARNING: This is an experimental feature and not all activities may support it. Once the course has been created, this course setting can no longer be changed.</strong>';
$string['relativedatesmode_warning'] = '<strong>Warning:</strong> This cannot be changed once the course has been created.';
$string['relativedatesmode_help'] = 'Display course or activity dates relative to the user\'s start date in the course.<br />The user\'s course start date will be their enrolment start date, unless they are enrolled before the course begins in which case their start date will be the course start date.<br/><strong>WARNING: This is an experimental feature and not all activities may support it. Once the course has been created, this course setting can no longer be changed.</strong>';
$string['relativedatesmode_warning'] = '<strong>Warning:</strong> Relative dates mode cannot be changed once the course has been created.';
$string['reload'] = 'Reload';
$string['remoteappuser'] = 'Remote {$a} User';
$string['remove'] = 'Remove';