1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Extgallery; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* ExtGallery Class Manager |
7
|
|
|
* |
8
|
|
|
* You may not change or alter any portion of this comment or credits |
9
|
|
|
* of supporting developers from this source code or any supporting source code |
10
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
14
|
|
|
* |
15
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
16
|
|
|
* @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
17
|
|
|
* @author Zoullou (http://www.zoullou.net) |
18
|
|
|
* @package ExtGallery |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use XoopsGroupFormCheckBox; |
22
|
|
|
use XoopsModules\Extgallery; |
23
|
|
|
|
24
|
|
|
|
25
|
|
|
|
26
|
|
|
|
27
|
|
|
//require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class Extgallery\GroupFormCheckBox |
31
|
|
|
*/ |
32
|
|
|
class GroupFormCheckBox extends XoopsGroupFormCheckBox |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* Extgallery\GroupFormCheckBox constructor. |
36
|
|
|
* @param $caption |
37
|
|
|
* @param $name |
38
|
|
|
* @param $groupId |
39
|
|
|
* @param null $values |
|
|
|
|
40
|
|
|
*/ |
41
|
|
|
public function __construct($caption, $name, $groupId, $values = null) |
42
|
|
|
{ |
43
|
|
|
parent::__construct($caption, $name, $groupId, $values); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return string|void |
48
|
|
|
*/ |
49
|
|
|
public function render() |
50
|
|
|
{ |
51
|
|
|
$ele_name = $this->getName(); |
52
|
|
|
echo '<table class="outer"><tr><td class="odd"><table><tr>'; |
53
|
|
|
$cols = 1; |
54
|
|
|
if (isset($this->_optionTree[0])) { |
55
|
|
|
foreach ($this->_optionTree[0]['children'] as $topitem) { |
56
|
|
|
if ($cols > 4) { |
57
|
|
|
echo '</tr><tr>'; |
58
|
|
|
$cols = 1; |
59
|
|
|
} |
60
|
|
|
$tree = '<td valign="top">'; |
61
|
|
|
$prefix = ''; |
62
|
|
|
$this->_renderOptionTree($tree, $this->_optionTree[$topitem], $prefix); |
63
|
|
|
echo $tree; |
64
|
|
|
echo '</td>'; |
65
|
|
|
++$cols; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
echo '</tr></table></td><td class="even" valign="top">'; |
69
|
|
|
$option_ids = []; |
70
|
|
|
foreach (\array_keys($this->_optionTree) as $id) { |
71
|
|
|
if (!empty($id)) { |
72
|
|
|
$option_ids[] = '\'' . $ele_name . '[groups][' . $this->_groupId . '][' . $id . ']' . '\''; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
$checkallbtn_id = $ele_name . '[checkallbtn][' . $this->_groupId . ']'; |
76
|
|
|
$option_ids_str = \implode(', ', $option_ids); |
77
|
|
|
echo _ALL . ' <input id="' . $checkallbtn_id . '" type="checkbox" value="" onclick="var optionids = new Array(' . $option_ids_str . "); xoopsCheckAllElements(optionids, '" . $checkallbtn_id . '\');">'; |
78
|
|
|
echo '</td></tr></table>'; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|