]> git.mjollnir.org Git - moodle.git/commitdiff
applying the same patch to advcheckbox - Fixes MDL-8627, "HTML QuickForm displays...
authorskodak <skodak>
Sat, 15 Sep 2007 19:43:01 +0000 (19:43 +0000)
committerskodak <skodak>
Sat, 15 Sep 2007 19:43:01 +0000 (19:43 +0000)
lib/form/advcheckbox.php

index 63f46357fd4917ee9a88c0d3ecba9a68e0c856eb..2c048c0d3d6ca2109e2d9aca62ebafc116a93da9 100644 (file)
@@ -88,23 +88,28 @@ class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{
             $this->updateAttributes(array('id' => 'id_'.substr(md5(microtime() . $idx++), 0, 6)));
         }
     } // end func _generateId
-    /**
-     * Slightly different container template when frozen. Don't want to use a label tag
-     * with a for attribute in that case for the element label but instead use a div.
-     * Templates are defined in renderer constructor.
-     *
-     * @return string
-     */
-    function getElementTemplateType(){
-        if ($this->_flagFrozen){
-            return 'static';
-        } else {
-            return 'default';
-        }
-    }
+
     function toHtml()
     {
         return '<span>' . parent::toHtml() . '</span>';
     }
+
+    /**
+     * Returns the disabled field. Accessibility: the return "[ ]" from parent
+     * class is not acceptable for screenreader users, and we DO want a label.
+     * @return    string
+     */
+    function getFrozenHtml()
+    {
+        //$this->_generateId();
+        $output = '<input type="checkbox" disabled="disabled" id="'.$this->getAttribute('id').'" ';
+        if ($this->getChecked()) {
+            $output .= 'checked="checked" />'.$this->_getPersistantData();
+        } else {
+            $output .= '/>';
+        }
+        return $output;
+    } //end func getFrozenHtml
+
 }
 ?>
\ No newline at end of file