]> git.mjollnir.org Git - moodle.git/commitdiff
set default for this element to return a '0' if unchecked and '1' if checked.
authorjamiesensei <jamiesensei>
Fri, 19 Jan 2007 08:08:50 +0000 (08:08 +0000)
committerjamiesensei <jamiesensei>
Fri, 19 Jan 2007 08:08:50 +0000 (08:08 +0000)
lib/form/advcheckbox.php

index 6a3ed1c4cdc320173bd8fced4ef53fe52b0d0a6f..3ecd28642badc84f3fa0b7561a9ae5e7a638fa24 100644 (file)
@@ -4,7 +4,10 @@ require_once('HTML/QuickForm/advcheckbox.php');
 /**
  * HTML class for a advcheckbox type element
  *
- * @author       Jamie Pratt
+ * default behavior special for Moodle is to return '0' if not checked
+ * '1' for checked.
+ *
+ * * @author       Jamie Pratt
  * @access       public
  */
 class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{
@@ -21,6 +24,29 @@ class MoodleQuickForm_advcheckbox extends HTML_QuickForm_advcheckbox{
      * @param array $help array of arguments to make a help button
      * @param string $function function name to call to get html
      */
+    /**
+     * Class constructor
+     *
+     * @param     string    $elementName    (optional)Input field name attribute
+     * @param     string    $elementLabel   (optional)Input field label
+     * @param     string    $text           (optional)Text to put after the checkbox
+     * @param     mixed     $attributes     (optional)Either a typical HTML attribute string
+     *                                      or an associative array
+     * @param     mixed     $values         (optional)Values to pass if checked or not checked
+     *
+     * @since     1.0
+     * @access    public
+     * @return    void
+     */
+    function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
+    {
+        if ($values === null){
+            $values = array(0, 1);
+        }
+        parent::HTML_QuickForm_advcheckbox($elementName, $elementLabel, $text, $attributes, $values);
+    } //end constructor
+
+
     function setHelpButton($helpbuttonargs, $function='helpbutton'){
         if (!is_array($helpbuttonargs)){
             $helpbuttonargs=array($helpbuttonargs);