mName = $name; $this->mValue = $value; } function setChecked($value) { $this->mChecked = $value; } function isChecked() { return $this->mChecked; } function setData($value) { $this->mOptions = $value; } function getData() { return $this->mOptions; } function setDataKeys($keys) { $this->mDataKeys = $keys; $this->mDataDeep = 2; } function getDataKeys() { return $this->mDataKeys; } function setLayout($value) { $this->mLayout = $value; } function getLayout() { return $this->mLayout; } 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 toStringControl() { if (!$this->isRenderable()) return ""; if ($this->mId=="") $this->mId = $this->mName; $renderArray = array(); $renderCols = 0; $renderRows = 0; if ($this->mLayout=="H") { $i = 0; if (is_array($this->mOptions)) { $renderCols = $this->mGroupIn; $renderRows = ceil(count($this->mOptions) / $this->mGroupIn); $col = $row = 0; foreach ($this->mOptions as $optkey=>$optval) { if ($this->mDataDeep>1) { $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 .= " checked=\"true\""; } } $html .= " value=\"".htmlspecialchars($optkey)."\"> "; $renderArray[$col][$row] = $html; $col++; if ($col==$this->mGroupIn) { $col = 0; $row++; } $i++; } } } if ($this->mLayout=="V") { $i = 0; if (is_array($this->mOptions)) { $renderCols = ceil(count($this->mOptions) / $this->mGroupIn); $renderRows = $this->mGroupIn; $col = $row = 0; foreach ($this->mOptions as $optkey=>$optval) { if ($this->mDataDeep>1) { $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 .= " checked=\"true\""; } } $html .= " value=\"".htmlspecialchars($optkey)."\"> "; $renderArray[$col][$row] = $html; $row++; if ($row==$this->mGroupIn) { $row = 0; $col++; } $i++; } } } $html = "\n\t
\n"; $html .= ''.$this->lSelAll.' / '.$this->lSelNone.''; $html .= " | |
";
$html .= "\n\t
|