1: <?php
2:
3: /*
4: You may not change or alter any portion of this comment or credits
5: of supporting developers from this source code or any supporting source code
6: which is considered copyrighted (c) material of the original comment or credit authors.
7:
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:
13: /**
14: * Xoops Form Class Elements
15: *
16: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
17: * @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html)
18: * @package kernel
19: * @subpackage form
20: * @since 2.3.0
21: * @author John Neill <catzwolf@xoops.org>
22: */
23: defined('XOOPS_ROOT_PATH') || exit('Restricted access');
24:
25: xoops_load('XoopsFormCheckBox');
26:
27: /**
28: * Xoops Form Select Check Groups
29: *
30: * @author John Neill <catzwolf@xoops.org>
31: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
32: * @package kernel
33: * @subpackage form
34: * @access public
35: */
36: class XoopsFormSelectCheckGroup extends XoopsFormCheckBox
37: {
38: /**
39: * Constructor
40: *
41: * @param string $caption
42: * @param string $name
43: * @param mixed $value Pre-selected value (or array of them).
44: */
45: public function __construct($caption, $name, $value = null)
46: {
47: /** @var XoopsMemberHandler $member_handler */
48: $member_handler = xoops_getHandler('member');
49: $userGroups = $member_handler->getGroupList();
50: parent::__construct($caption, $name, $value);
51: $this->columns = 3;
52: foreach ($userGroups as $group_id => $group_name) {
53: $this->addOption($group_id, $group_name);
54: }
55: }
56: }
57: