Merge branch 'MDL-72706-master' of git://github.com/aanabit/moodle

This commit is contained in:
Shamim Rezaie 2021-10-18 17:19:10 +11:00
commit 20d9ea7e05
7 changed files with 10 additions and 9 deletions

View file

@ -109,7 +109,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$choices['0'] = new lang_string('hiddensectionscollapsed'); $choices['0'] = new lang_string('hiddensectionscollapsed');
$choices['1'] = new lang_string('hiddensectionsinvisible'); $choices['1'] = new lang_string('hiddensectionsinvisible');
$temp->add(new admin_setting_configselect('moodlecourse/hiddensections', new lang_string('hiddensections'), $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 = array();
$choices[COURSE_DISPLAY_SINGLEPAGE] = new lang_string('coursedisplay_single'); $choices[COURSE_DISPLAY_SINGLEPAGE] = new lang_string('coursedisplay_single');

View file

@ -106,7 +106,7 @@ class availability implements renderable, templatable {
if ($canviewhidden) { if ($canviewhidden) {
$info[] = $this->availability_info(get_string('hiddenfromstudents'), 'ishidden'); $info[] = $this->availability_info(get_string('hiddenfromstudents'), 'ishidden');
} else { } 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. // Student can not see the section contents but can see its name.
$info[] = $this->availability_info(get_string('notavailable'), 'ishidden'); $info[] = $this->availability_info(get_string('notavailable'), 'ishidden');
} }

View file

@ -374,7 +374,7 @@ abstract class section_renderer extends core_course_renderer {
if ($section->uservisible || $section->visible) { if ($section->uservisible || $section->visible) {
// Show summary if section is available or has availability restriction information. // 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 // 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 .= $this->format_summary_text($section);
} }
$o .= html_writer::end_tag('div'); $o .= html_writer::end_tag('div');
@ -503,7 +503,7 @@ abstract class section_renderer extends core_course_renderer {
if ($section->uservisible || $section->visible) { if ($section->uservisible || $section->visible) {
// Show summary if section is available or has availability restriction information. // 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 // 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 .= $this->format_summary_text($section);
} }
$o .= html_writer::end_tag('div'); $o .= html_writer::end_tag('div');

View file

@ -17,6 +17,7 @@ Feature: Collapse course sections
| numsections | 5 | | numsections | 5 |
| startdate | 957139200 | | startdate | 957139200 |
| enablecompletion | 1 | | enablecompletion | 1 |
| hiddensections | 0 |
And the following "activities" exist: And the following "activities" exist:
| activity | name | intro | course | idnumber | section | completion | | activity | name | intro | course | idnumber | section | completion |
| assign | Assignment 1 | Test assignment description1 | C1 | assign1 | 1 | 1 | | assign | Assignment 1 | Test assignment description1 | C1 | assign1 | 1 | 1 |

View file

@ -10,8 +10,8 @@ Feature: Show/hide course sections
| teacher1 | Teacher | 1 | teacher1@example.com | | teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com | | student1 | Student | 1 | student1@example.com |
And the following "courses" exist: And the following "courses" exist:
| fullname | shortname | format | | fullname | shortname | format | hiddensections |
| Course 1 | C1 | topics | | Course 1 | C1 | topics | 0 |
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |

View file

@ -2651,7 +2651,7 @@ class externallib_test extends externallib_advanced_testcase {
$this->assertCount(2, $result['courses'][0]['courseformatoptions']); $this->assertCount(2, $result['courses'][0]['courseformatoptions']);
foreach ($result['courses'][0]['courseformatoptions'] as $option) { foreach ($result['courses'][0]['courseformatoptions'] as $option) {
if ($option['name'] == 'hiddensections') { if ($option['name'] == 'hiddensections') {
$this->assertEquals(0, $option['value']); $this->assertEquals(1, $option['value']);
} else { } else {
$this->assertEquals('coursedisplay', $option['name']); $this->assertEquals('coursedisplay', $option['name']);
$this->assertEquals(0, $option['value']); $this->assertEquals(0, $option['value']);

View file

@ -990,8 +990,8 @@ $string['hiddenassign'] = 'Hidden assignment';
$string['hiddenfromstudents'] = 'Hidden from students'; $string['hiddenfromstudents'] = 'Hidden from students';
$string['hiddenoncoursepage'] = 'Available but not shown on course page'; $string['hiddenoncoursepage'] = 'Available but not shown on course page';
$string['hiddensections'] = 'Hidden sections'; $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['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 in collapsed form'; $string['hiddensectionscollapsed'] = 'Hidden sections are shown as not available';
$string['hiddensectionsinvisible'] = 'Hidden sections are completely invisible'; $string['hiddensectionsinvisible'] = 'Hidden sections are completely invisible';
$string['hiddenwithbrackets'] = '(hidden)'; $string['hiddenwithbrackets'] = '(hidden)';
$string['hide'] = 'Hide'; $string['hide'] = 'Hide';