X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fform%2FCheckboxGroup.class.php;h=9488b5cce24bcb180d0562ce6a2a256ee2459183;hb=75a1eedb8977b8f2db459128bab9aaf367e3b58b;hp=46ea284bce62b874dbc86fa80d842b78c2ab719a;hpb=33399ff6a8bdfe9b989810dafe9c4dbf3cf3b685;p=timetracker.git diff --git a/WEB-INF/lib/form/CheckboxGroup.class.php b/WEB-INF/lib/form/CheckboxGroup.class.php index 46ea284b..9488b5cc 100644 --- a/WEB-INF/lib/form/CheckboxGroup.class.php +++ b/WEB-INF/lib/form/CheckboxGroup.class.php @@ -33,17 +33,15 @@ class CheckboxGroup extends FormElement { var $mOptions = array(); var $mLayout = "V"; var $mGroupIn = 1; - var $cClassName = "CheckboxGroup"; var $mDataKeys = array(); var $mDataDeep = 1; var $lSelAll = "All"; var $lSelNone = "None"; - function CheckboxGroup($name,$value="") - { - $this->mName = $name; - $this->mValue = $value; - } + function __construct($name) { + $this->class = 'CheckboxGroup'; + $this->name = $name; + } function setChecked($value) { $this->mChecked = $value; } function isChecked() { return $this->mChecked; } @@ -60,16 +58,15 @@ class CheckboxGroup extends FormElement { function setGroupIn($value) { $this->mGroupIn = $value; if ($this->mGroupIn<1) $this->mGroupIn = 1;} function getGroupIn() { return $this->mGroupIn; } - function setLocalization($i18n) { - FormElement::setLocalization($i18n); - $this->lSelAll = $i18n->getKey('label.select_all'); - $this->lSelNone = $i18n->getKey('label.select_none'); + function localize() { + global $i18n; + $this->lSelAll = $i18n->get('label.select_all'); + $this->lSelNone = $i18n->get('label.select_none'); } - function toStringControl() { - if (!$this->isRenderable()) return ""; - - if ($this->mId=="") $this->mId = $this->mName; + function getHtml() { + + if ($this->id=="") $this->id = $this->name; $renderArray = array(); $renderCols = 0; @@ -86,14 +83,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 +111,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,8 +129,8 @@ class CheckboxGroup extends FormElement { } - $html = "\n\tmStyle."\">
\n"; - $html .= ''.$this->lSelAll.' / '.$this->lSelNone.''; + $html = "\n\tstyle."\">\n"; $html .= "
\n"; + $html .= ''.$this->lSelAll.' / '.$this->lSelNone.''; $html .= "
"; $html .= "\n\t\n"; @@ -148,10 +145,10 @@ class CheckboxGroup extends FormElement { $html .= "
\n"; $str = "