mambax7 /
pedigree
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | namespace XoopsModules\Pedigree; |
||
| 4 | |||
| 5 | /* |
||
| 6 | * You may not change or alter any portion of this comment or credits |
||
| 7 | * of supporting developers from this source code or any supporting source code |
||
| 8 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | * |
||
| 10 | * This program is distributed in the hope that it will be useful, |
||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 13 | */ |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @package XoopsModules\Pedigree |
||
| 17 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 18 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||
| 19 | * @author XOOPS Module Dev Team |
||
| 20 | */ |
||
| 21 | |||
| 22 | use XoopsModules\Pedigree; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Class Pedigree\RadioButton |
||
| 26 | */ |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Class Pedigree\RadioButton |
||
| 30 | */ |
||
| 31 | class RadioButton extends Pedigree\HtmlInputAbstract |
||
| 32 | { |
||
| 33 | // Define class variables |
||
| 34 | private $fieldnumber; |
||
| 35 | private $fieldname; |
||
| 36 | private $value; |
||
| 37 | private $defaultvalue; |
||
| 38 | private $lookuptable; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Constructor |
||
| 42 | * |
||
| 43 | * @param \XoopsModules\Pedigree\Field $parentObject |
||
| 44 | * @param \XoopsModules\Pedigree\Animal $animalObject |
||
| 45 | * @todo move hard coded language string to language file |
||
| 46 | */ |
||
| 47 | public function __construct(Pedigree\Field $parentObject, Pedigree\Animal $animalObject) |
||
| 48 | { |
||
| 49 | $this->fieldnumber = $parentObject->getId(); |
||
| 50 | $this->fieldname = $parentObject->fieldname; |
||
| 51 | $this->value = $animalObject->{'user' . $this->fieldnumber}; |
||
| 52 | $this->defaultvalue = $parentObject->defaultvalue; |
||
| 53 | $this->lookuptable = $parentObject->LookupTable; |
||
| 54 | if (0 == $this->lookuptable) { |
||
| 55 | echo "<span style='color: #ff0000;'><h3>A lookuptable must be specified for userfield" . $this->fieldnumber . '</h3></span>'; |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return object {@see XoopsFormRadio} |
||
| 61 | */ |
||
| 62 | public function editField() |
||
| 63 | { |
||
| 64 | $radio = new \XoopsFormRadio('<b>' . $this->fieldname . '</b>', 'user' . $this->fieldnumber, $value = $this->value); |
||
| 65 | $lookupcontents = parent::lookupField($this->fieldnumber); |
||
| 66 | $lcCount = \count($lookupcontents); |
||
| 67 | foreach ($lookupcontents as $i => $iValue) { |
||
| 68 | $radio->addOption($lookupcontents[$i]['id'], $lookupcontents[$i]['value']); |
||
| 69 | } |
||
| 70 | |||
| 71 | return $radio; |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @param string $name |
||
| 76 | * |
||
| 77 | * @return object {@see XoopsFormRadio) |
||
| 78 | */ |
||
| 79 | public function newField($name = '') |
||
| 80 | { |
||
| 81 | $radio = new \XoopsFormRadio('<b>' . $this->fieldname . '</b>', "{$name}user" . $this->fieldnumber, $value = $this->defaultvalue); |
||
| 82 | $lookupcontents = parent::lookupField($this->fieldnumber); |
||
| 83 | $lcCount = \count($lookupcontents); |
||
| 84 | foreach ($lookupcontents as $i => $iValue) { |
||
| 85 | $radio->addOption($lookupcontents[$i]['id'], $lookupcontents[$i]['value']); |
||
| 86 | } |
||
| 87 | |||
| 88 | return $radio; |
||
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @return object {@see XoopsFormLabel} |
||
| 93 | */ |
||
| 94 | public function viewField() |
||
| 95 | { |
||
| 96 | $lookupcontents = parent::lookupField($this->fieldnumber); |
||
| 97 | $lcCount = \count($lookupcontents); |
||
| 98 | foreach ($lookupcontents as $i => $iValue) { |
||
| 99 | if ($lookupcontents[$i]['id'] == $this->value) { |
||
| 100 | $choosenvalue = $lookupcontents[$i]['value']; |
||
| 101 | } |
||
| 102 | } |
||
| 103 | $view = new \XoopsFormLabel($this->fieldname, $choosenvalue); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 104 | |||
| 105 | return $view; |
||
| 106 | } |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @return string |
||
| 110 | * @todo error checking |
||
| 111 | */ |
||
| 112 | public function showField() |
||
| 113 | { |
||
| 114 | $lookupcontents = parent::lookupField($this->fieldnumber); |
||
| 115 | $lcCount = \count($lookupcontents); |
||
| 116 | foreach ($lookupcontents as $i => $iValue) { |
||
| 117 | if ($lookupcontents[$i]['id'] == $this->value) { |
||
| 118 | $choosenvalue = $lookupcontents[$i]['value']; |
||
| 119 | } |
||
| 120 | } |
||
| 121 | |||
| 122 | return $this->fieldname . ' : ' . $choosenvalue; |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 123 | } |
||
| 124 | |||
| 125 | /** |
||
| 126 | * @return mixed |
||
| 127 | */ |
||
| 128 | public function showValue() |
||
| 129 | { |
||
| 130 | $lookupcontents = parent::lookupField($this->fieldnumber); |
||
| 131 | foreach ($lookupcontents as $i => $iValue) { |
||
| 132 | if ($lookupcontents[$i]['id'] == $this->value) { |
||
| 133 | $choosenvalue = $lookupcontents[$i]['value']; |
||
| 134 | } |
||
| 135 | } |
||
| 136 | |||
| 137 | return $choosenvalue; |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 138 | } |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @return string HTML <select> for this field |
||
| 142 | */ |
||
| 143 | public function searchField() |
||
| 144 | { |
||
| 145 | $select = "<select size='1' name='query' style='width: 140px;'>"; |
||
| 146 | $lookupcontents = parent::lookupField($this->fieldnumber); |
||
| 147 | $lcCount = \count($lookupcontents); |
||
| 148 | foreach ($lookupcontents as $i => $iValue) { |
||
| 149 | $select .= "<option value='" . $lookupcontents[$i]['id'] . "'>" . $lookupcontents[$i]['value'] . '</option>'; |
||
| 150 | } |
||
| 151 | $select .= '</select>'; |
||
| 152 | |||
| 153 | return $select; |
||
| 154 | } |
||
| 155 | } |
||
| 156 |