From: nicolasconnault Date: Thu, 3 Sep 2009 23:31:49 +0000 (+0000) Subject: MDL-19756 Enabled use of in table headers, and added support for disabled attrib... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a4998d019a3366c7e072526e8254d40fa61d6d30;p=moodle.git MDL-19756 Enabled use of in table headers, and added support for disabled attribute for checkboxes and select options --- diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 72a4cb094f..455c7e446d 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -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() diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 6b21181df2..6eec01ca29 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -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";