|
1
|
|
|
<?php namespace XoopsModules\Newbb; |
|
2
|
|
|
|
|
3
|
|
|
use XoopsModules\Newbb; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* TODO: synchronize cascade permissions for multi-level |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Add category navigation to forum casscade structure |
|
11
|
|
|
* <ol>Special points: |
|
12
|
|
|
* <li> Use negative values for category IDs to avoid conflict between category and forum |
|
13
|
|
|
* <li> Disabled checkbox for categories to avoid unnecessary permission items for categories in forum permission table |
|
14
|
|
|
* </ol> |
|
15
|
|
|
* |
|
16
|
|
|
* Note: this is a __patchy__ solution. We should have a more extensible and flexible group permission management: not only for data architecture but also for management interface |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Class GroupFormCheckBox |
|
21
|
|
|
* @package XoopsModules\Newbb |
|
22
|
|
|
*/ |
|
23
|
|
|
class GroupFormCheckBox extends \XoopsGroupFormCheckBox |
|
|
|
|
|
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @param $caption |
|
27
|
|
|
* @param $name |
|
28
|
|
|
* @param $groupId |
|
29
|
|
|
* @param null $values |
|
|
|
|
|
|
30
|
|
|
*/ |
|
31
|
|
|
public function __construct($caption, $name, $groupId, $values = null) |
|
32
|
|
|
{ |
|
33
|
|
|
parent::__construct($caption, $name, $groupId, $values); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @param string $tree |
|
38
|
|
|
* @param array $option |
|
39
|
|
|
* @param string $prefix |
|
40
|
|
|
* @param array $parentIds |
|
41
|
|
|
*/ |
|
42
|
|
|
public function _renderOptionTree(&$tree, $option, $prefix, $parentIds = []) |
|
43
|
|
|
{ |
|
44
|
|
|
if ($option['id'] > 0) { |
|
45
|
|
|
$tree .= $prefix . '<input type="checkbox" name="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" onclick="'; |
|
46
|
|
|
foreach ($parentIds as $pid) { |
|
47
|
|
|
if ($pid <= 0) { |
|
48
|
|
|
continue; |
|
49
|
|
|
} |
|
50
|
|
|
$parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
|
51
|
|
|
$tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if (ele.checked !== true) {ele.checked = this.checked;}"; |
|
52
|
|
|
} |
|
53
|
|
|
foreach ($option['allchild'] as $cid) { |
|
54
|
|
|
$child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; |
|
55
|
|
|
$tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if (this.checked !== true) {ele.checked = false;}"; |
|
56
|
|
|
} |
|
57
|
|
|
$tree .= '" value="1"'; |
|
58
|
|
|
if (in_array($option['id'], $this->_value)) { |
|
59
|
|
|
$tree .= ' checked'; |
|
60
|
|
|
} |
|
61
|
|
|
$tree .= ' />' |
|
62
|
|
|
. $option['name'] |
|
63
|
|
|
. '<input type="hidden" name="' |
|
64
|
|
|
. $this->getName() |
|
65
|
|
|
. '[parents][' |
|
66
|
|
|
. $option['id'] |
|
67
|
|
|
. ']" value="' |
|
68
|
|
|
. implode(':', $parentIds) |
|
69
|
|
|
. '" /><input type="hidden" name="' |
|
70
|
|
|
. $this->getName() |
|
71
|
|
|
. '[itemname][' |
|
72
|
|
|
. $option['id'] |
|
73
|
|
|
. ']" value="' |
|
74
|
|
|
. htmlspecialchars($option['name'], ENT_QUOTES | ENT_HTML5) |
|
75
|
|
|
. "\" /><br>\n"; |
|
76
|
|
|
} else { |
|
77
|
|
|
$tree .= $prefix . $option['name'] . '<input type="hidden" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\" /><br>\n"; |
|
78
|
|
|
} |
|
79
|
|
|
if (isset($option['children'])) { |
|
80
|
|
|
foreach ($option['children'] as $child) { |
|
81
|
|
|
if ($option['id'] > 0) { |
|
82
|
|
|
// array_push($parentIds, $option['id']); |
|
|
|
|
|
|
83
|
|
|
$parentIds[] = $option['id']; |
|
84
|
|
|
} |
|
85
|
|
|
$this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths