X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fform%2FCheckboxGroup.class.php;h=bbb7135b81c5414bad88325c30600ad0a0a1ac3d;hb=ac5189157ef60820dd125400baee9f408a9ba2ea;hp=6fef23171993a2495cecdb2efd990d6c6b4cdd0a;hpb=9a23a8c0a51b7ec38a96f525484134f3cb85dc7e;p=timetracker.git diff --git a/WEB-INF/lib/form/CheckboxGroup.class.php b/WEB-INF/lib/form/CheckboxGroup.class.php index 6fef2317..bbb7135b 100644 --- a/WEB-INF/lib/form/CheckboxGroup.class.php +++ b/WEB-INF/lib/form/CheckboxGroup.class.php @@ -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 = "mName[]\" id=\"$this->mId"."_".$i."\""; - if (is_array($this->mValue)) { - foreach ($this->mValue as $value) { - if (($value == $optkey) && ($value != null)) + $html = "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)."\"> "; + $html .= " value=\"".htmlspecialchars($optkey)."\"> "; $renderArray[$col][$row] = $html; $col++; @@ -114,14 +113,14 @@ class CheckboxGroup extends FormElement { $optkey = $optval[$this->mDataKeys[0]]; $optval = $optval[$this->mDataKeys[1]]; } - $html = "mName[]\" id=\"$this->mId"."_".$i."\""; - if (is_array($this->mValue)) { - foreach ($this->mValue as $value) { - if (($value == $optkey) && ($value != null)) + $html = "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)."\"> "; + $html .= " value=\"".htmlspecialchars($optkey)."\"> "; $renderArray[$col][$row] = $html; $row++; @@ -132,7 +131,7 @@ class CheckboxGroup extends FormElement { } - $html = "\n\tmStyle."\">
\n"; + $html = "\n\tstyle."\">\n"; $html .= "
\n"; $html .= ''.$this->lSelAll.' / '.$this->lSelNone.''; $html .= "
"; @@ -160,4 +159,3 @@ class CheckboxGroup extends FormElement { return $html.$str; } } -?> \ No newline at end of file