]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19756 Enabled use of <td> in table headers, and added support for disabled attrib...
authornicolasconnault <nicolasconnault>
Thu, 3 Sep 2009 23:31:49 +0000 (23:31 +0000)
committernicolasconnault <nicolasconnault>
Thu, 3 Sep 2009 23:31:49 +0000 (23:31 +0000)
lib/outputcomponents.php
lib/outputrenderers.php

index 72a4cb094fd1fe83ccd2f101ef4fbc2b85a5d672..455c7e446dee9c8edb1a1ae714c4c7e9a95a03c9 100644 (file)
@@ -777,6 +777,10 @@ class html_select_option extends labelled_html_component {
      * @var boolean $selected Whether or not this option is selected
      */
     public $selected = false;
+    /**
+     * @var boolean $disabled Whether or not this option is disabled
+     */
+    public $disabled = false;
 
     public function __construct() {
         $this->label = new html_label();
@@ -1213,7 +1217,7 @@ class html_table_cell extends moodle_html_component {
     /**
      * @var boolean $header Whether or not this cell is a header cell
      */
-    public $header = false;
+    public $header = null;
 
     /**
      * @see lib/moodle_html_component#prepare()
index 6b21181df2401d4a88976298653d060d2a4ca5d2..6eec01ca2936a9023c43bf31db106848b40ba5f8 100644 (file)
@@ -1784,6 +1784,7 @@ class moodle_core_renderer extends moodle_renderer_base {
                 'name' => $name,
                 'id' => $option->id,
                 'alt' => $option->alt,
+                'disabled' => $option->disabled,
                 'class' => $option->get_classes_string(),
                 'checked' => $option->selected));
         $output .= $this->label($option->label);
@@ -1808,6 +1809,7 @@ class moodle_core_renderer extends moodle_renderer_base {
         if ($option instanceof html_select_option) {
             return $this->output_tag('option', array(
                     'value' => $option->value,
+                    'disabled' => $option->disabled,
                     'class' => $option->get_classes_string(),
                     'selected' => $option->selected), $option->text);
         } else if ($option instanceof html_select_optgroup) {
@@ -2051,6 +2053,10 @@ class moodle_core_renderer extends moodle_renderer_base {
                     $heading->text = $headingtext;
                     $heading->header = true;
                 }
+                
+                if ($heading->header !== false) {
+                    $heading->header = true;
+                }
 
                 $this->prepare_event_handlers($heading);
 
@@ -2077,7 +2083,11 @@ class moodle_core_renderer extends moodle_renderer_base {
                         'scope'     => $heading->scope,
                         'colspan'   => $heading->colspan);
 
-                $output .= $this->output_tag('th', $attributes, $heading->text) . "\n";
+                $tagtype = 'td';
+                if ($heading->header === true) {
+                    $tagtype = 'th';
+                }
+                $output .= $this->output_tag($tagtype, $attributes, $heading->text) . "\n";
             }
             $output .= $this->output_end_tag('tr') . "\n";
             $output .= $this->output_end_tag('thead') . "\n";
@@ -2153,7 +2163,7 @@ class moodle_core_renderer extends moodle_renderer_base {
                                 'abbr' => $cell->abbr,
                                 'scope' => $cell->scope);
                         $tagtype = 'td';
-                        if ($cell->header) {
+                        if ($cell->header === true) {
                             $tagtype = 'th';
                         }
                         $output .= $this->output_tag($tagtype, $tdattributes, $cell->text) . "\n";