From 1b1735f7638e6f3405d70ab984c6af5ea5af4c4b Mon Sep 17 00:00:00 2001 From: Amaia Anabitarte Date: Thu, 14 Oct 2021 10:09:48 +0200 Subject: [PATCH] MDL-72706 core_course: Change default value of Hidden sections setting --- admin/settings/courses.php | 2 +- .../classes/output/local/content/section/availability.php | 2 +- course/format/classes/output/section_renderer.php | 4 ++-- course/tests/behat/course_collapse_sections.feature | 1 + course/tests/behat/section_visibility.feature | 4 ++-- course/tests/externallib_test.php | 2 +- lang/en/moodle.php | 4 ++-- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/admin/settings/courses.php b/admin/settings/courses.php index 2037a6372d8..aff5e0f8a63 100644 --- a/admin/settings/courses.php +++ b/admin/settings/courses.php @@ -109,7 +109,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { $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'); diff --git a/course/format/classes/output/local/content/section/availability.php b/course/format/classes/output/local/content/section/availability.php index 6b96aee582f..94dc6ea97c0 100644 --- a/course/format/classes/output/local/content/section/availability.php +++ b/course/format/classes/output/local/content/section/availability.php @@ -106,7 +106,7 @@ class availability implements renderable, templatable { 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'); } diff --git a/course/format/classes/output/section_renderer.php b/course/format/classes/output/section_renderer.php index 6e9c1714464..5d638e1cc6f 100644 --- a/course/format/classes/output/section_renderer.php +++ b/course/format/classes/output/section_renderer.php @@ -374,7 +374,7 @@ abstract class section_renderer extends core_course_renderer { 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'); @@ -503,7 +503,7 @@ abstract class section_renderer extends core_course_renderer { 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'); diff --git a/course/tests/behat/course_collapse_sections.feature b/course/tests/behat/course_collapse_sections.feature index b4955aa5aab..9e346713ffd 100644 --- a/course/tests/behat/course_collapse_sections.feature +++ b/course/tests/behat/course_collapse_sections.feature @@ -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 | diff --git a/course/tests/behat/section_visibility.feature b/course/tests/behat/section_visibility.feature index 49677fc27a2..d83dd9840c2 100644 --- a/course/tests/behat/section_visibility.feature +++ b/course/tests/behat/section_visibility.feature @@ -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 | diff --git a/course/tests/externallib_test.php b/course/tests/externallib_test.php index abe3635d0d7..48650aa6cc7 100644 --- a/course/tests/externallib_test.php +++ b/course/tests/externallib_test.php @@ -2651,7 +2651,7 @@ class externallib_test extends externallib_advanced_testcase { $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']); diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 56205be2b7e..d57e02e276e 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -990,8 +990,8 @@ $string['hiddenassign'] = 'Hidden assignment'; $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';