| 1 |
<?php |
| 2 |
/** |
| 3 |
* @var Radio $radio |
| 4 |
*/ |
| 5 |
|
| 6 |
use UserAccessManager\Form\Element\Input; |
| 7 |
use UserAccessManager\Form\Element\Radio; |
| 8 |
use UserAccessManager\Form\Element\Select; |
| 9 |
use UserAccessManager\Form\Element\Textarea; |
| 10 |
|
| 11 |
?> |
| 12 |
<th scope="row"><?php echo $radio->getLabel(); ?></th> |
| 13 |
<td> |
| 14 |
<?php |
| 15 |
$possibleValues = $radio->getPossibleValues(); |
| 16 |
|
| 17 |
foreach ($possibleValues as $possibleValue) { |
| 18 |
$rawValue = $possibleValue->getValue(); |
| 19 |
$formValue = (is_bool($rawValue) === true) ? |
| 20 |
(($rawValue === true) ? 'true' : 'false') : $rawValue; |
| 21 |
|
| 22 |
?> |
| 23 |
<div class="uam_radio_option"> |
| 24 |
<label for="uam_<?php echo $radio->getId() . '_' . $formValue; ?>"> |
| 25 |
<input id="uam_<?php echo $radio->getId() . '_' . $formValue; ?>" |
| 26 |
type="radio" |
| 27 |
name="config_parameters[<?php echo $radio->getId(); ?>]" |
| 28 |
value="<?php echo $formValue; ?>" |
| 29 |
<?php |
| 30 |
if ($radio->getValue() === $possibleValue->getValue()) { |
| 31 |
echo 'checked="checked"'; |
| 32 |
} |
| 33 |
?> |
| 34 |
/> |
| 35 |
<?php echo $possibleValue->getLabel(); ?> |
| 36 |
</label> |
| 37 |
<?php |
| 38 |
$subElement = $possibleValue->getSubElement(); |
| 39 |
|
| 40 |
if ($subElement !== null) { |
| 41 |
if ($subElement instanceof Input) { |
| 42 |
?> |
| 43 |
<input id="uam_<?php echo $subElement->getId(); ?>" |
| 44 |
type="text" |
| 45 |
name="config_parameters[<?php echo $subElement->getId(); ?>]" |
| 46 |
value="<?php echo $subElement->getValue(); ?>"/> |
| 47 |
<?php |
| 48 |
} elseif ($subElement instanceof Textarea) { |
| 49 |
?> |
| 50 |
<textarea id="uam_<?php echo $subElement->getId(); ?>" |
| 51 |
class="uam_textarea" |
| 52 |
name="config_parameters[<?php echo $subElement->getId(); ?>]"><?php |
| 53 |
echo htmlentities($subElement->getValue()); |
| 54 |
?></textarea> |
| 55 |
<?php |
| 56 |
} elseif ($subElement instanceof Select) { |
| 57 |
?> |
| 58 |
<select id="uam_<?php echo $subElement->getId(); ?>" |
| 59 |
name="config_parameters[<?php echo $subElement->getId(); ?>]"> |
| 60 |
<?php |
| 61 |
$subPossibleValues = $subElement->getPossibleValues(); |
| 62 |
|
| 63 |
foreach ($subPossibleValues as $subPossibleValue) { |
| 64 |
?> |
| 65 |
<option value="<?php echo $subPossibleValue->getValue(); ?>" <?php |
| 66 |
if ($subElement->getValue() === $subPossibleValue->getValue()) { |
| 67 |
echo 'selected="selected"'; |
| 68 |
} |
| 69 |
?> > |
| 70 |
<?php echo $subPossibleValue->getLabel(); ?> |
| 71 |
</option> |
| 72 |
<?php |
| 73 |
} |
| 74 |
?> |
| 75 |
</select> |
| 76 |
<?php |
| 77 |
} |
| 78 |
} |
| 79 |
?> |
| 80 |
</div> |
| 81 |
<?php |
| 82 |
} |
| 83 |
?> |
| 84 |
<p class="description"><?php echo $radio->getDescription(); ?></p> |
| 85 |
</td> |