1: | <?php |
2: | /** |
3: | * XOOPS form element |
4: | * |
5: | * You may not change or alter any portion of this comment or credits |
6: | * of supporting developers from this source code or any supporting source code |
7: | * which is considered copyrighted (c) material of the original comment or credit authors. |
8: | * This program is distributed in the hope that it will be useful, |
9: | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10: | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11: | * |
12: | * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
13: | * @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html) |
14: | * @package kernel |
15: | * @subpackage form |
16: | * @since 2.0.0 |
17: | * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/ |
18: | */ |
19: | |
20: | defined('XOOPS_ROOT_PATH') || exit('Restricted access'); |
21: | |
22: | xoops_load('XoopsFormRadio'); |
23: | |
24: | /** |
25: | * Yes/No radio buttons. |
26: | * |
27: | * A pair of radio buttons labelled _YES and _NO with values 1 and 0 |
28: | */ |
29: | class XoopsFormRadioYN extends XoopsFormRadio |
30: | { |
31: | /** |
32: | * Constructor |
33: | * |
34: | * @param string $caption |
35: | * @param string $name |
36: | * @param string $value Pre-selected value, can be "0" (No) or "1" (Yes) |
37: | * @param string $yes String for "Yes" |
38: | * @param string $no String for "No" |
39: | */ |
40: | public function __construct($caption, $name, $value = null, $yes = _YES, $no = _NO) |
41: | { |
42: | parent::__construct($caption, $name, $value); |
43: | $this->addOption(1, $yes); |
44: | $this->addOption(0, $no); |
45: | } |
46: | } |
47: |