* code for task#1375.
This commit is contained in:
@@ -114,8 +114,9 @@ class project extends control
|
||||
|
||||
/* Set browseType, productID, moduleID and queryID. */
|
||||
$browseType = strtolower($status);
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
$moduleID = ($status == 'byModule') ? (int)$param : 0;
|
||||
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
|
||||
$moduleID = ($browseType == 'bymodule') ? (int)$param : 0;
|
||||
$productID = ($browseType == 'byproduct') ? (int)$param : 0;
|
||||
$project = $this->commonAction($projectID, $status);
|
||||
$projectID = $project->id;
|
||||
|
||||
@@ -139,7 +140,12 @@ class project extends control
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$tasks = array();
|
||||
if($status == 'byModule')
|
||||
if($status == 'byProduct')
|
||||
{
|
||||
$modules = $this->tree->getProjectModule($projectID, $productID);
|
||||
$tasks = $this->loadModel('task')->getTasksByModule($projectID, $modules, $orderBy, $pager);
|
||||
}
|
||||
elseif($status == 'byModule')
|
||||
{
|
||||
$tasks = $this->loadModel('task')->getTasksByModule($projectID, $this->tree->getAllChildID($moduleID), $orderBy, $pager);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ class treeModel extends model
|
||||
}
|
||||
$treeMenu = array();
|
||||
$lastMenu[] = '/';
|
||||
$projectModules = $this->getProjectModules($rootID);
|
||||
$projectModules = $this->getTaskTreeModules($rootID);
|
||||
foreach($products as $id => $product)
|
||||
{
|
||||
$modules = $this->dao->select('*')->from(TABLE_MODULE)
|
||||
@@ -306,7 +306,7 @@ class treeModel extends model
|
||||
}
|
||||
|
||||
$manage = $userFunc[1] == 'createTaskManageLink' ? true : false;
|
||||
if(!$manage) $projectModules = $this->getProjectModules($rootID, true);
|
||||
if(!$manage) $projectModules = $this->getTaskTreeModules($rootID, true);
|
||||
|
||||
foreach($products as $id => $product)
|
||||
{
|
||||
@@ -365,7 +365,7 @@ class treeModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectModules($projectID, $parent = false)
|
||||
public function getTaskTreeModules($projectID, $parent = false)
|
||||
{
|
||||
$projectModules = array();
|
||||
$field = $parent ? 'path' : 'id';
|
||||
@@ -705,6 +705,31 @@ class treeModel extends model
|
||||
return $this->dao->select('id')->from(TABLE_MODULE)->where('path')->like($module->path . '%')->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project module.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProjectModule($projectID, $productID = 0)
|
||||
{
|
||||
$modules = array();
|
||||
$rootModules = $this->dao->select('path')->from(TABLE_MODULE)
|
||||
->where('root')->eq($productID)
|
||||
->andWhere('type')->eq('story')
|
||||
->andWhere('parent')->eq(0)
|
||||
->fetchAll();
|
||||
foreach($rootModules as $module)
|
||||
{
|
||||
$modules += $this->dao->select('id')->from(TABLE_MODULE)
|
||||
->where('path')->like($module->path . '%')
|
||||
->fetchPairs();
|
||||
}
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parents of a module.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user