Some renaming.
[timetracker.git] / WEB-INF / lib / form / CheckboxGroup.class.php
index 6fef231..bbb7135 100644 (file)
@@ -33,16 +33,16 @@ class CheckboxGroup extends FormElement {
     var $mOptions      = array();
     var $mLayout       = "V";
     var $mGroupIn      = 1;
-    var $cClassName    = "CheckboxGroup";
+    var $class = 'CheckboxGroup';
     var $mDataKeys     = array();
     var $mDataDeep     = 1;
     var $lSelAll       = "All";
     var $lSelNone      = "None";
 
-       function CheckboxGroup($name,$value="")
+       function __construct($name,$value="")
        {
-               $this->mName                    = $name;
-               $this->mValue                   = $value;
+               $this->name = $name;
+               $this->value = $value;
        }
 
        function setChecked($value)     { $this->mChecked = $value; }
@@ -66,10 +66,9 @@ class CheckboxGroup extends FormElement {
                $this->lSelNone = $i18n->getKey('label.select_none');
        }
                
-       function toStringControl()      {
-               if (!$this->isRenderable()) return "";
-           
-           if ($this->mId=="") $this->mId = $this->mName;
+       function toStringControl() {
+
+           if ($this->id=="") $this->id = $this->name;
            
            $renderArray = array();
            $renderCols = 0;
@@ -86,14 +85,14 @@ class CheckboxGroup extends FormElement {
                                                $optkey = $optval[$this->mDataKeys[0]];
                                                $optval = $optval[$this->mDataKeys[1]];
                                        }
-                               $html = "<input type=\"checkbox\" name=\"$this->mName[]\" id=\"$this->mId"."_".$i."\"";
-                               if (is_array($this->mValue)) {
-                                       foreach ($this->mValue as $value) {
-                                               if (($value == $optkey) && ($value != null))
+                               $html = "<input type=\"checkbox\" name=\"$this->name[]\" id=\"$this->id"."_".$i."\"";
+                               if (is_array($this->value)) {
+                                       foreach ($this->value as $element) {
+                                               if (($element == $optkey) && ($element != null))
                                                        $html .= " checked=\"true\"";
                                        }
                                }
-                                       $html .= " value=\"".htmlspecialchars($optkey)."\">&nbsp;<label for=\"$this->mId"."_".$i."\">".htmlspecialchars($optval)."</label>";
+                                       $html .= " value=\"".htmlspecialchars($optkey)."\">&nbsp;<label for=\"$this->id"."_".$i."\">".htmlspecialchars($optval)."</label>";
                                        $renderArray[$col][$row] = $html;
                                        
                                $col++;                         
@@ -114,14 +113,14 @@ class CheckboxGroup extends FormElement {
                                                $optkey = $optval[$this->mDataKeys[0]];
                                                $optval = $optval[$this->mDataKeys[1]];
                                        }
-                               $html = "<input type=\"checkbox\" name=\"$this->mName[]\" id=\"$this->mId"."_".$i."\"";
-                               if (is_array($this->mValue)) {
-                                       foreach ($this->mValue as $value) {
-                                               if (($value == $optkey) && ($value != null))
+                               $html = "<input type=\"checkbox\" name=\"$this->name[]\" id=\"$this->id"."_".$i."\"";
+                               if (is_array($this->value)) {
+                                       foreach ($this->value as $element) {
+                                               if (($element == $optkey) && ($element != null))
                                                        $html .= " checked=\"true\"";
                                        }
                                }
-                                       $html .= " value=\"".htmlspecialchars($optkey)."\">&nbsp;<label for=\"$this->mId"."_".$i."\">".htmlspecialchars($optval)."</label>";
+                                       $html .= " value=\"".htmlspecialchars($optkey)."\">&nbsp;<label for=\"$this->id"."_".$i."\">".htmlspecialchars($optval)."</label>";
                                        $renderArray[$col][$row] = $html;
 
                                        $row++;
@@ -132,7 +131,7 @@ class CheckboxGroup extends FormElement {
            }
            
            
-           $html = "\n\t<table style=\"".$this->mStyle."\"><tr><td align=\"center\" bgcolor=\"eeeeee\">\n";
+           $html = "\n\t<table style=\"".$this->style."\"><tr><td align=\"center\" bgcolor=\"eeeeee\">\n";
            $html .= '<a href="#" onclick="setAll'.$this->getName().'(true);return false;">'.$this->lSelAll.'</a>&nbsp;/&nbsp;<a href="#" onclick="setAll'.$this->getName().'(false);return false;">'.$this->lSelNone.'</a>';
            $html .= "</td></tr>\n";
            $html .= "<tr><td>";
@@ -160,4 +159,3 @@ class CheckboxGroup extends FormElement {
                return $html.$str;
        }
 }
-?>
\ No newline at end of file