Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Model | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
| render | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2015 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | namespace oat\tao\helpers\form\elements\xhtml; |
| 24 | |
| 25 | use oat\tao\helpers\form\elements\Model as AbstractModel; |
| 26 | |
| 27 | /** |
| 28 | * Based on tao_helpers_form_elements_xhtml_Radiobox |
| 29 | */ |
| 30 | class Model extends AbstractModel |
| 31 | { |
| 32 | use XhtmlRenderingTrait; |
| 33 | |
| 34 | /** |
| 35 | * |
| 36 | * @see tao_helpers_form_FormElement::render |
| 37 | */ |
| 38 | public function render() |
| 39 | { |
| 40 | $returnValue = $this->renderLabel(); |
| 41 | |
| 42 | $i = 0; |
| 43 | $returnValue .= '<div class="form_radlst">'; |
| 44 | foreach ($this->getOptions() as $optionId => $optionLabel) { |
| 45 | $returnValue .= "<input type='radio' name='{$this->name}' id='{$this->name}_{$i}' value='{$optionId}' "; |
| 46 | $returnValue .= $this->renderAttributes(); |
| 47 | if ($this->value == $optionId) { |
| 48 | $returnValue .= " checked='checked' "; |
| 49 | } |
| 50 | $returnValue .= " /><label class='elt_desc' for='{$this->name}_{$i}'>" . _dh($optionLabel) |
| 51 | . "</label><br />"; |
| 52 | $i++; |
| 53 | } |
| 54 | $returnValue .= "</div>"; |
| 55 | |
| 56 | return (string) $returnValue; |
| 57 | } |
| 58 | } |