diff --git a/module/tree/control.php b/module/tree/control.php index 81a5ca993b..a1d2837072 100644 --- a/module/tree/control.php +++ b/module/tree/control.php @@ -155,7 +155,7 @@ class tree extends control $this->view->currentProject = $currentProject; $this->view->projectModules = $this->tree->getTaskOptionMenu($currentProject, $productID); $this->view->currentModuleID = $currentModuleID; - $this->view->tree = $this->tree->getFullTaskTree($rootID, $productID); + $this->view->tree = $this->tree->getFullTaskTree($rootID, $productID, 0, $newModule); $this->display(); } diff --git a/module/tree/model.php b/module/tree/model.php index 1f94cc9500..8bc2bd99a9 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -429,26 +429,36 @@ class treeModel extends model /** * Get full task tree - * @param integer $rootID, common value is project id + * @param integer $projectID, common value is project id * @param integer $productID * @param integer $moduleID * @access public * @return object */ - public function getFullTaskTree($rootID, $productID, $moduleID = 0) + public function getFullTaskTree($projectID, $productID, $moduleID = 0, $newModule = false) { - $tree = array_values($this->getTaskSons($rootID, $productID, $moduleID)); + $tree = array_values($this->getTaskSons($projectID, $productID, $moduleID)); if(!$moduleID) { + $products = $this->loadModel('project')->getProducts($projectID); + if($newModule and $products) + { + $productModulesTree = array(); + foreach ($products as $product) + { + $productModulesTree[] = array('type' => 'product', 'name' => $product->name, 'actions' => false, 'id' => 'product' . $product->id, 'children' => $this->getFullTree($product->id, 'story')); + } + $tree = array_merge($productModulesTree, $tree); + } + // TODO: get product moduels for the project - $productModulesTree = array(); - $tree = array_merge($tree, $productModulesTree); + } if(count($tree)) { foreach ($tree as $node) { - $children = $this->getFullTaskTree($rootID, $productID, $node->id); + $children = $this->getFullTaskTree($projectID, $productID, $node->id); if(count($children)) { $node->children = $children; diff --git a/module/tree/view/browsetask.html.php b/module/tree/view/browsetask.html.php index 5a49ca8bda..7810e11409 100644 --- a/module/tree/view/browsetask.html.php +++ b/module/tree/view/browsetask.html.php @@ -55,6 +55,11 @@ +