PluginProbe
User Access Manager / 2.1.11
User Access Manager v2.1.11
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
← All changes | src/View/AdminForm/Radio.php +65 -61 2.3.19 → 2.1.11 View file →
@@ -1,14 +1,22 @@
1 1 <?php
2 2 /**
3 - * @var Radio $radio
3 + * Radio.php
4 + *
5 + * Radio button form field.
6 + *
7 + * PHP versions 5
8 + *
9 + * @author Alexander Schneider <[email protected]>
10 + * @copyright 2008-2017 Alexander Schneider
11 + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
12 + * @version SVN: $id$
13 + * @link http://wordpress.org/extend/plugins/user-access-manager/
4 14 */
5 15
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 -
16 +/**
17 + * @var \UserAccessManager\Form\Radio $radio
18 + */
11 19 ?>
12 20 <th scope="row"><?php echo $radio->getLabel(); ?></th>
13 21 <td>
14 22 <?php
@@ -19,67 +27,63 @@
19 27 $formValue = (is_bool($rawValue) === true) ?
20 28 (($rawValue === true) ? 'true' : 'false') : $rawValue;
21 29
22 30 ?>
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();
31 + <label for="uam_<?php echo $radio->getId().'_'.$formValue; ?>">
32 + <input id="uam_<?php echo $radio->getId().'_'.$formValue; ?>"
33 + type="radio"
34 + name="config_parameters[<?php echo $radio->getId(); ?>]"
35 + value="<?php echo $formValue; ?>"
36 + <?php
37 + if ($radio->getValue() === $possibleValue->getValue()) {
38 + echo 'checked="checked"';
39 + }
40 + ?>
41 + />
42 + <?php echo $possibleValue->getLabel(); ?>
43 + </label>&nbsp;&nbsp;&nbsp;
44 + <?php
45 + $subElement = $possibleValue->getSubElement();
39 46
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 + if ($subElement !== null) {
48 + if ($subElement instanceof \UserAccessManager\Form\Input) {
49 + ?>
50 + <input id="uam_<?php echo $subElement->getId(); ?>"
51 + name="config_parameters[<?php echo $subElement->getId(); ?>]"
52 + value="<?php echo $subElement->getValue(); ?>"/>
53 + <?php
54 + } elseif ($subElement instanceof \UserAccessManager\Form\Textarea) {
55 + ?>
56 + <textarea id="uam_<?php echo $subElement->getId(); ?>"
57 + style="width:100%;min-height:120px;"
58 + name="config_parameters[<?php echo $subElement->getId(); ?>]"><?php
59 + echo htmlentities($subElement->getValue());
60 + ?></textarea>
61 + <?php
62 + } elseif ($subElement instanceof \UserAccessManager\Form\Select) {
63 + ?>
64 + <select id="uam_<?php echo $subElement->getId(); ?>"
65 + name="config_parameters[<?php echo $subElement->getId(); ?>]">
47 66 <?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();
67 + $subPossibleValues = $subElement->getPossibleValues();
62 68
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
69 + foreach ($subPossibleValues as $subPossibleValue) {
70 + ?>
71 + <option value="<?php echo $subPossibleValue->getValue(); ?>" <?php
72 + if ($subElement->getValue() === $subPossibleValue->getValue()) {
73 + echo 'selected="selected"';
73 74 }
74 - ?>
75 - </select>
76 - <?php
77 - }
75 + ?> >
76 + <?php echo $subPossibleValue->getLabel(); ?>
77 + </option>
78 + <?php
79 + }
80 + ?>
81 + </select>
82 + <?php
78 83 }
79 - ?>
80 - </div>
81 - <?php
84 + }
82 85 }
83 86 ?>
84 - <p class="description"><?php echo $radio->getDescription(); ?></p>
87 + <br/>
88 + <p><?php echo $radio->getDescription(); ?></p>
85 89 </td>