mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixing tree display for ACL CLI (thanks phishy)
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5616 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a81f7d00ce
commit
79beef1a36
1 changed files with 17 additions and 16 deletions
|
@ -288,23 +288,24 @@ class AclShell extends Shell {
|
||||||
}
|
}
|
||||||
$this->out($class . " tree:");
|
$this->out($class . " tree:");
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$nodeCount = count($nodes);
|
$stack = array();
|
||||||
$right = $left = array();
|
$last = null;
|
||||||
for ($i = 0; $i < $nodeCount; $i++) {
|
foreach ($nodes as $n) {
|
||||||
$count = 0;
|
$stack[] = $n;
|
||||||
$right[$i] = $nodes[$i][$class]['rght'];
|
if (!empty($last)) {
|
||||||
$left[$i] = $nodes[$i][$class]['lft'];
|
$end = end($stack);
|
||||||
if (isset($left[$i]) && isset($left[$i-1]) && $left[$i] > $left[$i-1]) {
|
if ($end[$class]['rght'] > $last) {
|
||||||
array_pop($left);
|
foreach ($stack as $k => $v) {
|
||||||
$count = count($left);
|
$end = end($stack);
|
||||||
|
if ($v[$class]['rght'] < $end[$class]['rght']) {
|
||||||
|
unset($stack[$k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($right[$i]) && isset($right[$i-1]) && $right[$i] < $right[$i-1]) {
|
$last = $n[$class]['rght'];
|
||||||
array_pop($right);
|
$count = count($stack);
|
||||||
$count = count($right);
|
$this->out(str_repeat(' ', $count) . "[" . $n[$class]['id'] . "]" . $n[$class]['alias']."\n");
|
||||||
}
|
|
||||||
|
|
||||||
$this->out(str_repeat(' ', $count) . "[" . $nodes[$i][$class]['id'] . "]" . $nodes[$i][$class]['alias']."\n");
|
|
||||||
$right[] = $nodes[$i][$class]['rght'];
|
|
||||||
}
|
}
|
||||||
$this->hr();
|
$this->hr();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue