PluginProbe
User Access Manager / 2.2.3
User Access Manager v2.2.3
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 +69 -59 trunk2.2.3 View file →
@@ -1,13 +1,27 @@
1 1 <?php
2 2 /**
3 + * Radio.php
4 + *
5 + * Radio button form field.
6 + *
7 + * PHP versions 5
8 + *
9 + * @author Alexander Schneider <alexanderschneider85@gmail.com>
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/
14 + */
15 +
16 +/**
3 17 * @var Radio $radio
4 18 */
5 19
6 -use UserAccessManager\Form\Element\Input;
7 -use UserAccessManager\Form\Element\Radio;
8 -use UserAccessManager\Form\Element\Select;
9 -use UserAccessManager\Form\Element\Textarea;
20 +use UserAccessManager\Form\Input;
21 +use UserAccessManager\Form\Radio;
22 +use UserAccessManager\Form\Select;
23 +use UserAccessManager\Form\Textarea;
10 24
11 25 ?>
12 26 <th scope="row"><?php echo $radio->getLabel(); ?></th>
13 27 <td>
@@ -19,67 +33,63 @@
19 33 $formValue = (is_bool($rawValue) === true) ?
20 34 (($rawValue === true) ? 'true' : 'false') : $rawValue;
21 35
22 36 ?>
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();
37 + <label for="uam_<?php echo $radio->getId() . '_' . $formValue; ?>">
38 + <input id="uam_<?php echo $radio->getId() . '_' . $formValue; ?>"
39 + type="radio"
40 + name="config_parameters[<?php echo $radio->getId(); ?>]"
41 + value="<?php echo $formValue; ?>"
42 + <?php
43 + if ($radio->getValue() === $possibleValue->getValue()) {
44 + echo 'checked="checked"';
45 + }
46 + ?>
47 + />
48 + <?php echo $possibleValue->getLabel(); ?>
49 + </label>&nbsp;&nbsp;&nbsp;
50 + <?php
51 + $subElement = $possibleValue->getSubElement();
39 52
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(); ?>"/>
53 + if ($subElement !== null) {
54 + if ($subElement instanceof Input) {
55 + ?>
56 + <input id="uam_<?php echo $subElement->getId(); ?>"
57 + name="config_parameters[<?php echo $subElement->getId(); ?>]"
58 + value="<?php echo $subElement->getValue(); ?>"/>
59 + <?php
60 + } elseif ($subElement instanceof Textarea) {
61 + ?>
62 + <textarea id="uam_<?php echo $subElement->getId(); ?>"
63 + style="width:100%;min-height:120px;"
64 + name="config_parameters[<?php echo $subElement->getId(); ?>]"><?php
65 + echo htmlentities($subElement->getValue());
66 + ?></textarea>
67 + <?php
68 + } elseif ($subElement instanceof Select) {
69 + ?>
70 + <select id="uam_<?php echo $subElement->getId(); ?>"
71 + name="config_parameters[<?php echo $subElement->getId(); ?>]">
47 72 <?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();
73 + $subPossibleValues = $subElement->getPossibleValues();
62 74
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
75 + foreach ($subPossibleValues as $subPossibleValue) {
76 + ?>
77 + <option value="<?php echo $subPossibleValue->getValue(); ?>" <?php
78 + if ($subElement->getValue() === $subPossibleValue->getValue()) {
79 + echo 'selected="selected"';
73 80 }
74 - ?>
75 - </select>
76 - <?php
77 - }
81 + ?> >
82 + <?php echo $subPossibleValue->getLabel(); ?>
83 + </option>
84 + <?php
85 + }
86 + ?>
87 + </select>
88 + <?php
78 89 }
79 - ?>
80 - </div>
81 - <?php
90 + }
82 91 }
83 92 ?>
84 - <p class="description"><?php echo $radio->getDescription(); ?></p>
93 + <br/>
94 + <p><?php echo $radio->getDescription(); ?></p>
85 95 </td>