| @@ -1,27 +1,27 @@ | ||
| 1 | -<?php | |
| 2 | -class AccuaForm_Element_Select extends AccuaForm_OptionElement { | |
| 3 | - protected $attributes = array("class" => "pfbc-select"); | |
| 4 | - | |
| 5 | - public function render() { | |
| 6 | - if(isset($this->attributes["value"])) { | |
| 7 | - if(!is_array($this->attributes["value"])) | |
| 8 | - $this->attributes["value"] = array($this->attributes["value"]); | |
| 9 | - } | |
| 10 | - else | |
| 11 | - $this->attributes["value"] = array(); | |
| 12 | - | |
| 13 | - if(!empty($this->attributes["multiple"]) && substr($this->attributes["name"], -2) != "[]") | |
| 14 | - $this->attributes["name"] .= "[]"; | |
| 15 | - | |
| 16 | - echo '<select', $this->getAttributes(array("value", "selected")), '>'; | |
| 17 | - foreach($this->options as $value => $text) { | |
| 18 | - $value = $this->getOptionValue($value); | |
| 19 | - echo '<option value="', $this->filter($value), '"'; | |
| 20 | - $selected = false; | |
| 21 | - if(in_array($value, $this->attributes["value"])) | |
| 22 | - echo ' selected="selected"'; | |
| 23 | - echo '>', $text, '</option>'; | |
| 24 | - } | |
| 25 | - echo '</select>'; | |
| 26 | - } | |
| 27 | -} | |
| 1 | +<?php | |
| 2 | +class AccuaForm_Element_Select extends AccuaForm_OptionElement { | |
| 3 | + protected $attributes = array("class" => "pfbc-select"); | |
| 4 | + | |
| 5 | + public function render() { | |
| 6 | + if(isset($this->attributes["value"])) { | |
| 7 | + if(!is_array($this->attributes["value"])) | |
| 8 | + $this->attributes["value"] = array($this->attributes["value"]); | |
| 9 | + } | |
| 10 | + else | |
| 11 | + $this->attributes["value"] = array(); | |
| 12 | + | |
| 13 | + if(!empty($this->attributes["multiple"]) && substr($this->attributes["name"], -2) != "[]") | |
| 14 | + $this->attributes["name"] .= "[]"; | |
| 15 | + | |
| 16 | + echo '<select', $this->getAttributes(array("value", "selected")), '>'; | |
| 17 | + foreach($this->options as $value => $text) { | |
| 18 | + $value = $this->getOptionValue($value); | |
| 19 | + echo '<option value="', $this->filter($value), '"'; | |
| 20 | + $selected = false; | |
| 21 | + if(in_array($value, $this->attributes["value"])) | |
| 22 | + echo ' selected="selected"'; | |
| 23 | + echo '>', $text, '</option>'; | |
| 24 | + } | |
| 25 | + echo '</select>'; | |
| 26 | + } | |
| 27 | +} | |