Skip to content

Commit

Permalink
MDL-72706 core_course: Change default value of Hidden sections setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Amaia Anabitarte committed Oct 15, 2021
1 parent 9145d80 commit 1b1735f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion admin/settings/courses.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
$choices['0'] = new lang_string('hiddensectionscollapsed');
$choices['1'] = new lang_string('hiddensectionsinvisible');
$temp->add(new admin_setting_configselect('moodlecourse/hiddensections', new lang_string('hiddensections'),
new lang_string('coursehelphiddensections'), 0, $choices));
new lang_string('coursehelphiddensections'), 1, $choices));

$choices = array();
$choices[COURSE_DISPLAY_SINGLEPAGE] = new lang_string('coursedisplay_single');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function get_info(\renderer_base $output): array {
if ($canviewhidden) {
$info[] = $this->availability_info(get_string('hiddenfromstudents'), 'ishidden');
} else {
// We are here because of the setting "Hidden sections are shown in collapsed form".
// We are here because of the setting "Hidden sections are shown as not available".
// Student can not see the section contents but can see its name.
$info[] = $this->availability_info(get_string('notavailable'), 'ishidden');
}
Expand Down
4 changes: 2 additions & 2 deletions course/format/classes/output/section_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ protected function section_header($section, $course, $onsectionpage, $sectionret
if ($section->uservisible || $section->visible) {
// Show summary if section is available or has availability restriction information.
// Do not show summary if section is hidden but we still display it because of course setting
// "Hidden sections are shown in collapsed form".
// "Hidden sections are shown as not available".
$o .= $this->format_summary_text($section);
}
$o .= html_writer::end_tag('div');
Expand Down Expand Up @@ -503,7 +503,7 @@ protected function section_summary($section, $course, $mods) {
if ($section->uservisible || $section->visible) {
// Show summary if section is available or has availability restriction information.
// Do not show summary if section is hidden but we still display it because of course setting
// "Hidden sections are shown in collapsed form".
// "Hidden sections are shown as not available".
$o .= $this->format_summary_text($section);
}
$o .= html_writer::end_tag('div');
Expand Down
1 change: 1 addition & 0 deletions course/tests/behat/course_collapse_sections.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Feature: Collapse course sections
| numsections | 5 |
| startdate | 957139200 |
| enablecompletion | 1 |
| hiddensections | 0 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section | completion |
| assign | Assignment 1 | Test assignment description1 | C1 | assign1 | 1 | 1 |
Expand Down
4 changes: 2 additions & 2 deletions course/tests/behat/section_visibility.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Feature: Show/hide course sections
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
| fullname | shortname | format | hiddensections |
| Course 1 | C1 | topics | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Expand Down
2 changes: 1 addition & 1 deletion course/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2651,7 +2651,7 @@ public function test_get_courses_by_field() {
$this->assertCount(2, $result['courses'][0]['courseformatoptions']);
foreach ($result['courses'][0]['courseformatoptions'] as $option) {
if ($option['name'] == 'hiddensections') {
$this->assertEquals(0, $option['value']);
$this->assertEquals(1, $option['value']);
} else {
$this->assertEquals('coursedisplay', $option['name']);
$this->assertEquals(0, $option['value']);
Expand Down
4 changes: 2 additions & 2 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -990,8 +990,8 @@
$string['hiddenfromstudents'] = 'Hidden from students';
$string['hiddenoncoursepage'] = 'Available but not shown on course page';
$string['hiddensections'] = 'Hidden sections';
$string['hiddensections_help'] = 'This setting determines whether hidden sections are displayed to students in collapsed form (perhaps for a course in weekly format to indicate holidays) or are completely hidden.';
$string['hiddensectionscollapsed'] = 'Hidden sections are shown in collapsed form';
$string['hiddensections_help'] = 'Whether hidden sections are displayed to students as not available (perhaps for a course in weekly format to indicate holidays) or are completely hidden.';
$string['hiddensectionscollapsed'] = 'Hidden sections are shown as not available';
$string['hiddensectionsinvisible'] = 'Hidden sections are completely invisible';
$string['hiddenwithbrackets'] = '(hidden)';
$string['hide'] = 'Hide';
Expand Down

0 comments on commit 1b1735f

Please sign in to comment.