* Finish task #5258.

This commit is contained in:
Yagami
2019-01-29 10:31:34 +08:00
parent f76185bab5
commit 4e897f0914
+4 -14
View File
@@ -444,12 +444,7 @@ class treeModel extends model
->orderBy('grade desc, type, `order`')
->get();
$stmt = $this->dbh->query($query);
while($module = $stmt->fetch())
{
/* if not manage, ignore unused modules. */
if(!$manage and !isset($projectModules[$module->id])) continue;
$this->buildTree($treeMenu, $module, 'task', $userFunc, $extra);
}
while($module = $stmt->fetch()) $this->buildTree($treeMenu, $module, 'task', $userFunc, $extra);
if(isset($treeMenu[0]) and $branch) $treeMenu[0] = "<li><a>$branchName</a><ul>{$treeMenu[0]}</ul></li>";
$tree .= isset($treeMenu[0]) ? $treeMenu[0] : '';
}
@@ -465,12 +460,7 @@ class treeModel extends model
$treeMenu = array();
$query = $this->dao->select('*')->from(TABLE_MODULE)->where("root = '" . (int)$rootID . "' and type = 'task'")->andWhere('deleted')->eq(0)->orderBy('grade desc, type, `order`')->get();
$stmt = $this->dbh->query($query);
while($module = $stmt->fetch())
{
/* if not manage, ignore unused modules. */
if(!$manage and !isset($projectModules[$module->id])) continue;
$this->buildTree($treeMenu, $module, 'task', $userFunc, $extra);
}
while($module = $stmt->fetch()) $this->buildTree($treeMenu, $module, 'task', $userFunc, $extra);
$tree = isset($treeMenu[0]) ? $treeMenu[0] : '';
$menu .= $tree . '</li>';
@@ -520,10 +510,10 @@ class treeModel extends model
->orderBy('grade desc, type, `order`')
->get();
$stmt = $this->dbh->query($query);
if($branch == 0) $productTree = $this->getDataStructure($stmt, 'task', $projectModules);
if($branch == 0) $productTree = $this->getDataStructure($stmt, 'task');
if($branch != 0)
{
$children = $this->getDataStructure($stmt, 'task', $projectModules);
$children = $this->getDataStructure($stmt, 'task');
if($children) $branchTrees[] = array('name' => $branchName, 'root' => $id, 'type' => 'branch', 'actions' => false, 'children' => $children);
}
}