Merge branch 'MDL-68189' of https://github.com/NeillM/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 15 Apr 2020 22:13:32 +0000 (00:13 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 15 Apr 2020 22:13:32 +0000 (00:13 +0200)
1  2 
course/format/renderer.php

@@@ -184,6 -184,8 +184,6 @@@ abstract class format_section_renderer_
       * @return string HTML to output.
       */
      protected function section_header($section, $course, $onsectionpage, $sectionreturn=null) {
 -        global $PAGE;
 -
          $o = '';
          $currenttext = '';
          $sectionstyle = '';
  
          $o.= html_writer::start_tag('li', array('id' => 'section-'.$section->section,
              'class' => 'section main clearfix'.$sectionstyle, 'role'=>'region',
-             'aria-label'=> get_section_name($course, $section)));
-         // Create a span that contains the section title to be used to create the keyboard section move menu.
-         $o .= html_writer::tag('span', get_section_name($course, $section), array('class' => 'hidden sectionname'));
+             'aria-labelledby' => "sectionid-{$section->id}-title"));
  
          $leftcontent = $this->section_left_content($section, $course, $onsectionpage);
          $o.= html_writer::tag('div', $leftcontent, array('class' => 'left side'));
              $classes = '';
          }
          $sectionname = html_writer::tag('span', $this->section_title($section, $course));
-         $o.= $this->output->heading($sectionname, 3, 'sectionname' . $classes);
+         $o .= $this->output->heading($sectionname, 3, 'sectionname' . $classes, "sectionid-{$section->id}-title");
  
          $o .= $this->section_availability($section);
  
       * @return array of edit control items
       */
      protected function section_edit_control_items($course, $section, $onsectionpage = false) {
 -        global $PAGE;
 -
 -        if (!$PAGE->user_is_editing()) {
 +        if (!$this->page->user_is_editing()) {
              return array();
          }
  
       * @param int $displaysection The section number in the course which is being displayed
       */
      public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection) {
 -        global $PAGE;
 -
          $modinfo = get_fast_modinfo($course);
          $course = course_get_format($course)->get_course();
  
          // Copy activity clipboard..
          echo $this->course_activity_clipboard($course, $displaysection);
          $thissection = $modinfo->get_section_info(0);
 -        if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
 +        if ($thissection->summary or !empty($modinfo->sections[0]) or $this->page->user_is_editing()) {
              echo $this->start_section_list();
              echo $this->section_header($thissection, $course, true, $displaysection);
              echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
       * @param array $modnamesused (argument not used)
       */
      public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused) {
 -        global $PAGE;
 -
          $modinfo = get_fast_modinfo($course);
          $course = course_get_format($course)->get_course();
  
          foreach ($modinfo->get_section_info_all() as $section => $thissection) {
              if ($section == 0) {
                  // 0-section is displayed a little different then the others
 -                if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
 +                if ($thissection->summary or !empty($modinfo->sections[0]) or $this->page->user_is_editing()) {
                      echo $this->section_header($thissection, $course, false, 0);
                      echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
                      echo $this->courserenderer->course_section_add_cm_control($course, 0, 0);
                  continue;
              }
  
 -            if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
 +            if (!$this->page->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
                  // Display section summary only.
                  echo $this->section_summary($thissection, $course, null);
              } else {
              }
          }
  
 -        if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
 +        if ($this->page->user_is_editing() and has_capability('moodle/course:update', $context)) {
              // Print stealth sections if present.
              foreach ($modinfo->get_section_info_all() as $section => $thissection) {
                  if ($section <= $numsections or empty($modinfo->sections[$section])) {