mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-02-04 01:09:25 -05:00
parent
e5f7e30472
commit
1bc4b377ea
1 changed files with 19 additions and 2 deletions
|
|
@ -327,9 +327,12 @@ class AddNodeForm extends QuickForm
|
|||
{
|
||||
$list = array();
|
||||
|
||||
$parents = array();
|
||||
$this->collectAllParents($this->parent, $parents);
|
||||
$parents[$this->parent->getName()] = $this->parent;
|
||||
|
||||
foreach ($this->bp->getNodes() as $node) {
|
||||
if ($node instanceof BpNode) {
|
||||
// TODO: Blacklist parents
|
||||
if ($node instanceof BpNode && ! isset($parents[$node->getName()])) {
|
||||
$list[(string) $node] = (string) $node; // display name?
|
||||
}
|
||||
}
|
||||
|
|
@ -338,6 +341,20 @@ class AddNodeForm extends QuickForm
|
|||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect the given node's parents recursively into the given array by their names
|
||||
*
|
||||
* @param BpNode $node
|
||||
* @param BpNode[] $parents
|
||||
*/
|
||||
protected function collectAllParents(BpNode $node, array & $parents)
|
||||
{
|
||||
foreach ($node->getParents() as $parent) {
|
||||
$parents[$parent->getName()] = $parent;
|
||||
$this->collectAllParents($parent, $parents);
|
||||
}
|
||||
}
|
||||
|
||||
protected function fetchObjectList()
|
||||
{
|
||||
$this->objectList = array();
|
||||
|
|
|
|||
Loading…
Reference in a new issue