/** * Vrátí HTML strukturu pro zobrazní fieldu * * @author Tomáš Kocifaj * @link http://www.ktstudio.cz * * @return string */ public function getField() { if (KT::notIssetOrEmpty($this->getOptionsData())) { return "<span class=\"input-wrap checkbox\">" . KT_EMPTY_SYMBOL . "</span>"; } $data = $this->getValue(); $html = ""; foreach ($this->getOptionsData() as $key => $val) { $html .= "<span class=\"input-wrap\">"; $html .= "<input type=\"checkbox\" "; $html .= $this->getBasicHtml($key); $html .= " value=\"{$key}\" "; if (KT::issetAndNotEmpty($data) && is_array($data)) { if (in_array($key, array_keys($data))) { $html .= " checked=\"checked\""; } } $html .= "> <span class=\"desc-checkbox-{$this->getAttrValueByName("id")}\"><label for=\"{$this->getName()}-{$key}\">{$val}</label></span> "; if ($this->hasErrorMsg()) { $html .= parent::getHtmlErrorMsg(); } $html .= "</span>"; } return $html; }
/** * Vrátí HTML strukturu pro zobrazní fieldu * * @author Tomáš Kocifaj * @link http://www.ktstudio.cz * * @return string */ public function getField() { $html = "<select {$this->getBasicHtml()}>"; $html .= static::getOptionsContent(); $html .= "</select>"; if ($this->hasErrorMsg()) { $html .= parent::getHtmlErrorMsg(); } return $html; }
/** * Vrátí HTML strukturu pro zobrazní fieldu * * @author Tomáš Kocifaj * @link http://www.ktstudio.cz * * @return string */ public function getField() { $html = ""; if (KT::notIssetOrEmpty($this->getOptionsData())) { return $html = KT_EMPTY_SYMBOL; } foreach ($this->getOptionsData() as $key => $value) { $html .= "<span class=\"input-wrap radio\">"; $html .= "<input type=\"radio\" "; $html .= $this->getBasicHtml($key); $html .= " value=\"{$key}\" "; if ($key == $this->getValue() && $this->getValue() !== null) { $html .= "checked=\"checked\""; } $html .= "> <span class=\"radio radio-name-{$this->getAttrValueByName("id")} radio-key-{$key} \"><label for=\"{$this->getName()}-{$key}\">{$value}</label></span> "; $html .= "</span>"; } if ($this->hasErrorMsg()) { $html .= parent::getHtmlErrorMsg(); } return $html; }