* remove product for execution treeview.

This commit is contained in:
tanghucheng
2022-02-11 10:02:52 +08:00
parent 02481f3d97
commit bc3fc9e4eb
@@ -32,3 +32,48 @@ public function setMenu($executionID, $buildID = 0, $extra = '')
$this->lang->modulePageNav = $modulePageNav;
}
public function getTree($executionID)
{
$fullTrees = $this->loadModel('tree')->getTaskStructure($executionID, 0);
array_unshift($fullTrees, array('id' => 0, 'name' => '/', 'type' => 'task', 'actions' => false, 'root' => $executionID));
foreach($fullTrees as $i => $tree)
{
$tree = (object)$tree;
if($tree->type == 'product') array_unshift($tree->children, array('id' => 0, 'name' => '/', 'type' => 'story', 'actions' => false, 'root' => $tree->root));
$fullTree = $this->fillTasksInTree($tree, $executionID);
if(empty($fullTree->children))
{
unset($fullTrees[$i]);
}
else
{
$fullTrees[$i] = $fullTree;
}
}
if(isset($fullTrees[0]) and empty($fullTrees[0]->children)) array_shift($fullTrees);
$newTrees = array();
foreach($fullTrees as $i => $tree)
{
if($tree->type == 'product')
{
foreach($tree->children as $value)
{
$newTrees[] = $value;
}
}
else
{
$newTrees[] = $tree;
}
}
return array_values($newTrees);
}