diff --git a/module/project/view/story.html.php b/module/project/view/story.html.php
index 57c1a0198e..f36130e780 100644
--- a/module/project/view/story.html.php
+++ b/module/project/view/story.html.php
@@ -69,7 +69,7 @@
id}&story={$story->id}";
+ $param = "projectID={$project->id}&story={$story->id}&moduleID={$story->module}";
$lang->task->create = $lang->project->wbs;
common::printIcon('task', 'create', $param, '', 'list');
diff --git a/module/task/control.php b/module/task/control.php
index a7159804b3..e17dc1de69 100644
--- a/module/task/control.php
+++ b/module/task/control.php
@@ -95,7 +95,7 @@ class task extends control
$stories = $this->story->getProjectStoryPairs($projectID);
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$contactLists = $this->user->getContactLists($this->app->user->account, 'withnote');
- $moduleOptionMenu = $this->tree->getTaskOptionMenu($projectID, $viewType = 'task');
+ $moduleOptionMenu = $this->tree->getTaskOptionMenu($projectID);
$title = $project->name . $this->lang->colon . $this->lang->task->create;
$position[] = html::a($taskLink, $project->name);
@@ -392,6 +392,7 @@ class task extends control
$this->view->actions = $this->loadModel('action')->getList('task', $taskID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('task', $taskID);
+ $this->view->product = $this->tree->getProduct($task->module);
$this->view->modulePath = $this->tree->getParents($task->module);
$this->display();
}
diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php
index 1e2618ef02..3e62cad783 100644
--- a/module/task/view/view.html.php
+++ b/module/task/view/view.html.php
@@ -95,6 +95,7 @@
}
else
{
+ if($product) echo $product->name . $lang->arrow;
foreach($modulePath as $key => $module)
{
if(!common::printLink('project', 'task', "projectID=$task->project&browseType=byModule¶m=$module->id", $module->name)) echo $module->name;
diff --git a/module/tree/model.php b/module/tree/model.php
index 6f187f0b7f..eaf355f056 100644
--- a/module/tree/model.php
+++ b/module/tree/model.php
@@ -165,7 +165,7 @@ class treeModel extends model
{
$startModulePath = $startModule->path . '%';
$modulePaths = explode(",", $startModulePath);
- $rootModule = $this->getById($modulePahts[0]);
+ $rootModule = $this->getById($modulePaths[0]);
$productID = $rootModule->root;
}
}
@@ -181,7 +181,6 @@ class treeModel extends model
->fetchAll('id');
foreach($modules as $module)
{
- if(!isset($projectModules[$module->id])) continue;
$parentModules = explode(',', $module->path);
$moduleName = '/' . $product;
foreach($parentModules as $parentModuleID)
@@ -222,7 +221,11 @@ class treeModel extends model
{
if(!strpos($menu, '|')) continue;
list($label, $moduleID) = explode('|', $menu);
- $lastMenu[$moduleID] = $label;
+ if(isset($projectModules[$moduleID])) $lastMenu[$moduleID] = $label;
+ }
+ foreach($topMenu as $moduleID => $moduleName)
+ {
+ if(!isset($projectModules[$moduleID])) unset($treeMenu[$moduleID]);
}
}
return $lastMenu;
@@ -746,6 +749,25 @@ class treeModel extends model
return $this->dao->select('*')->from(TABLE_MODULE)->where('id')->in($path)->orderBy('grade')->fetchAll();
}
+ /**
+ * Get product by moduleID.
+ *
+ * @param int $moduleID
+ * @access public
+ * @return void
+ */
+ public function getProduct($moduleID)
+ {
+ if($moduleID == 0) return '';
+ $path = $this->dao->select('path')->from(TABLE_MODULE)->where('id')->eq((int)$moduleID)->fetch('path');
+ $paths = explode(',', trim($path, ','));
+ if(!$path) return '';
+ $moduleID = $paths[0];
+ $module = $this->dao->select('*')->from(TABLE_MODULE)->where('id')->eq($moduleID)->fetch();
+ if($module->type != 'story' or !$module->root) return '';
+ return $this->dao->select('name')->from(TABLE_PRODUCT)->where('id')->eq($module->root)->fetch();
+ }
+
/**
* Update modules' order.
*
|