Merge branch 'MDL-68343-master' of git://github.com/rezaies/moodle
authorSara Arjona <sara@moodle.com>
Wed, 27 May 2020 13:09:39 +0000 (15:09 +0200)
committerSara Arjona <sara@moodle.com>
Wed, 27 May 2020 13:09:39 +0000 (15:09 +0200)
1  2 
lib/outputcomponents.php

diff --combined lib/outputcomponents.php
@@@ -2207,8 -2207,9 +2207,9 @@@ class html_writer 
                      $heading->header = true;
                  }
  
-                 if ($heading->header && empty($heading->scope)) {
-                     $heading->scope = 'col';
+                 $tagtype = 'td';
+                 if ($heading->header && (string)$heading->text != '') {
+                     $tagtype = 'th';
                  }
  
                  $heading->attributes['class'] .= ' header c' . $key;
                      $heading->attributes['class'] .= ' ' . $table->colclasses[$key];
                  }
                  $heading->attributes['class'] = trim($heading->attributes['class']);
-                 $attributes = array_merge($heading->attributes, array(
-                         'style'     => $table->align[$key] . $table->size[$key] . $heading->style,
-                         'scope'     => $heading->scope,
-                         'colspan'   => $heading->colspan,
-                     ));
+                 $attributes = array_merge($heading->attributes, [
+                     'style'     => $table->align[$key] . $table->size[$key] . $heading->style,
+                     'colspan'   => $heading->colspan,
+                 ]);
  
-                 $tagtype = 'td';
-                 if ($heading->header === true) {
-                     $tagtype = 'th';
+                 if ($tagtype == 'th') {
+                     $attributes['scope'] = !empty($heading->scope) ? $heading->scope : 'col';
                  }
                  $output .= html_writer::tag($tagtype, $heading->text, $attributes) . "\n";
              }
              $output .= html_writer::end_tag('tr') . "\n";
@@@ -3093,7 -3093,7 +3093,7 @@@ class paging_bar implements renderable
  
          if ($this->page > 0) {
              $data->previous = [
 -                'page' => $this->page - 1,
 +                'page' => $this->page,
                  'url' => (new moodle_url($this->baseurl, [$this->pagevar => $this->page - 1]))->out(false)
              ];
          }
  
          if ($this->page + 1 != $lastpage) {
              $data->next = [
 -                'page' => $this->page + 1,
 +                'page' => $this->page + 2,
                  'url' => (new moodle_url($this->baseurl, [$this->pagevar => $this->page + 1]))->out(false)
              ];
          }