77 parent::__construct(
$name, $parameters, $form);
79 $this->list = (isset($parameters[
'list']) && is_array($parameters[
'list'])) ? $parameters[
'list'] : array();
93 parent::setDefaults();
96 $this->defaults[
'defaultValue'] =
'';
97 $this->defaults[
'skin'] =
'radio';
118 if ($this->skin ===
"select") {
119 foreach ($options as $index => $option) {
120 if (is_array($option)) {
121 $list .=
"<optgroup label=\"{$index}\">" . $this->
htmlList($option,
$value) .
"</optgroup>";
123 $selected = ((string) $index === (
string)
$value) ?
' selected' :
'';
124 $list .=
"<option value=\"{$index}\"{$selected}>{$option}</option>";
130 foreach ($options as $index => $option) {
132 $selected = ((string) $index === (
string)
$value) ?
" checked=\"yes\"" :
'';
133 $class = htmlentities(
"input-single-option-" . str_replace(
" ",
"-", $index));
136 "<label class=\"{$class}\" title=\"{$option}\">" .
137 "<input type=\"radio\" name=\"{$this->name}\"{$inputAttributes} value=\"{$index}\"{$selected}>" .
138 "<span>{$option}</span>" .
155 $label = $this->htmlLabel();
161 if ($this->skin ===
"select") {
165 return "<p {$wrapperAttributes}>" .
167 "<span class=\"depage-label\">{$label}{$marker}</span>" .
168 "<select name=\"{$this->name}\"{$inputAttributes}>{$list}</select>" .
175 return "<p {$wrapperAttributes}>" .
176 "<span class=\"depage-label\">{$label}{$marker}</span>" .
177 "<span>{$list}</span>" .
194 if (in_array($this->value, array_keys($this->list))) {
198 foreach($this->list as $sub) {
199 if (is_array($sub) && in_array($this->value, array_keys($sub))) {
208 $this->value = (string) $this->value;
htmlEscape($options=array())
Escapes HTML in strings and arrays of strings.
htmlInputAttributes()
Returns string of HTML attributes for input element.
$value
Input elements's value.
$label
Input element - HTML label.
$class
class for paragraph
$errorMessage
Message that gets displayed in case of invalid input.
htmlHelpMessage()
Returns HTML-rendered helpMessage.
htmlWrapperAttributes()
Returns string of HTML attributes for element wrapper paragraph.
htmlMarker()
Returns elements' required-indicator.
$helpMessage
Extra help message.
htmlValue()
Returns HTML-rendered element value.
$marker
Input element - HTML marker text that marks required fields.
htmlErrorMessage()
Returns HTML-rendered error message.
HTML-single-choice input type i.e.
htmlList($options=null, $value=null)
Renders HTML - option list part of select/radio single element.
$list
Contains list of selectable options.
__construct($name, $parameters, $form)
single class constructor
$skin
HTML skin type (radio or select).
typeCastValue()
Converts value to element specific type.
__toString()
Renders element to HTML.
setDefaults()
collects initial values across subclasses
Abstract element classes.
Classes for HTML input-elements.