diff --git a/module/execution/model.php b/module/execution/model.php
index cac3abf4a6..e09eb10c36 100755
--- a/module/execution/model.php
+++ b/module/execution/model.php
@@ -5123,49 +5123,68 @@ class executionModel extends model
*/
public function printTree($trees, $hasProduct = true)
{
- $html = '';
- foreach($trees as $tree)
+ $treeData = array();
+ foreach($trees as $index => $tree)
{
- if(is_array($tree)) $tree = (object)$tree;
+ if(is_array($tree))
+ {
+ $treeData[$index] = $this->printTree($tree, $hasProduct);
+ continue;
+ }
+
+ $treeData[$index] = array('className' => 'py-2 cursor-pointer');
switch($tree->type)
{
case 'task':
- $link = helper::createLink('execution', 'treeTask', "taskID={$tree->id}");
- $html .= '
';
- $html .= '' . ($tree->parent > 0 ? $this->lang->task->children : $this->lang->task->common) . "" . $tree->title . ' ' . (empty($tree->assignedTo) ? $tree->openedBy : $tree->assignedTo) . '' . $tree->id . '';
+ $label = $tree->parent > 0 ? $this->lang->task->children : $this->lang->task->common;
+ $treeData[$index]['content'] = array(
+ 'html' => "{$label}{$tree->id}" . $tree->title . ' ' . (empty($tree->assignedTo) ? $tree->openedBy : $tree->assignedTo) . '
',
+ 'link' => helper::createLink('execution', 'treeTask', "taskID={$tree->id}"),
+ );
break;
case 'product':
$this->app->loadLang('product');
$productName = $hasProduct ? $this->lang->productCommon : $this->lang->projectCommon;
- $html .= '';
- $html .= '' . $productName . "" . $tree->name . '';
+
+ $treeData[$index] = array(
+ 'content' => array(
+ 'html' => '' . $productName . "" . $tree->name . '
'
+ )
+ );
break;
case 'story':
$this->app->loadLang('story');
- $link = helper::createLink('execution', 'treeStory', "storyID={$tree->storyId}");
- $html .= '';
- $html .= '' . $this->lang->story->common . "" . $tree->title . ' ' . (empty($tree->assignedTo) ? $tree->openedBy : $tree->assignedTo) . '' . $tree->storyId . '';
+ $treeData[$index] = array(
+ 'content' => array(
+ 'html' => "{$this->lang->story->common}{$tree->title} " . (empty($tree->assignedTo) ? $tree->openedBy : $tree->assignedTo) . "{$tree->storyId}
",
+ 'link' => helper::createLink('execution', 'treeStory', "taskID={$tree->storyId}"),
+ )
+ );
break;
case 'branch':
$this->app->loadLang('branch');
- $html .= "";
- $html .= "{$this->lang->branch->common}{$tree->name}";
+ $treeData[$index] = array(
+ 'content' => array(
+ 'html' => "{$this->lang->branch->common}{$tree->name}
"
+ )
+ );
break;
default:
$this->app->loadLang('tree');
- $html .= "";
- $html .= "" . $tree->name . '';
+ $treeData[$index] = array(
+ 'content' => array(
+ 'html' => "" . $tree->name . ''
+ )
+ );
break;
}
if(isset($tree->children))
{
- $html .= '';
- $html .= $this->printTree($tree->children, $hasProduct);
- $html .= '
';
+ if(in_array($tree->type, array('task', 'story'))) $treeData[$index]['content']['html'] = "{$tree->title}
";
+ $treeData[$index]['children'] = $this->printTree($tree->children, $hasProduct);
}
- $html .= '';
}
- return $html;
+ return $treeData;
}
/**