* user: move the getFeatureBarMenus method from model to zen and refactor it.
This commit is contained in:
@@ -2761,43 +2761,4 @@ class userModel extends model
|
||||
}
|
||||
return $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 FeatureBar 导航。
|
||||
* Get featureBar menus.
|
||||
*
|
||||
* @param object $user
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getFeatureBarMenus(object $user): array
|
||||
{
|
||||
$moduleName = $this->app->moduleName;
|
||||
$methodName = $this->app->methodName;
|
||||
$params = $this->app->params;
|
||||
|
||||
$featureBarMenus = array();
|
||||
$featureBarMenus['todo'] = array('active' => false, 'url' => helper::createLink($moduleName, 'todo', "userID={$user->id}&type=all"), 'text' => $this->lang->user->schedule);
|
||||
$featureBarMenus['task'] = array('active' => false, 'url' => helper::createLink($moduleName, 'task', "userID={$user->id}"), 'text' => $this->lang->user->task);
|
||||
|
||||
if($this->config->URAndSR) $featureBarMenus['requirement'] = array('active' => false, 'url' => helper::createLink($moduleName, 'story', "userID={$user->id}&storyType=requirement"), 'text' => $this->lang->URCommon);
|
||||
|
||||
$featureBarMenus['story'] = array('active' => false, 'url' => helper::createLink($moduleName, 'story', "userID={$user->id}&storyType=story"), 'text' => $this->lang->SRCommon);
|
||||
$featureBarMenus['bug'] = array('active' => false, 'url' => helper::createLink($moduleName, 'bug', "userID={$user->id}"), 'text' => $this->lang->user->bug);
|
||||
$featureBarMenus['testtask'] = array('active' => false, 'url' => helper::createLink($moduleName, 'testtask', "userID={$user->id}"), 'text' => $this->lang->user->testTask);
|
||||
$featureBarMenus['testcase'] = array('active' => false, 'url' => helper::createLink($moduleName, 'testcase', "userID={$user->id}"), 'text' => $this->lang->user->testCase);
|
||||
|
||||
if($this->config->systemMode == 'ALM') $featureBarMenus['execution'] = array('active' => false, 'url' => helper::createLink($moduleName, 'execution', "userID={$user->id}"), 'text' => $this->lang->user->execution);
|
||||
if($this->config->edition == 'max') $featureBarMenus['issue'] = array('active' => false, 'url' => helper::createLink($moduleName, 'issue', "userID={$user->id}"), 'text' => $this->lang->user->issue);
|
||||
if($this->config->edition == 'max') $featureBarMenus['risk'] = array('active' => false, 'url' => helper::createLink($moduleName, 'risk', "userID={$user->id}"), 'text' => $this->lang->user->risk);
|
||||
|
||||
$featureBarMenus['dynamic'] = array('active' => false, 'url' => helper::createLink($moduleName, 'dynamic', "userID={$user->id}&type=today"), 'text' => $this->lang->user->dynamic);
|
||||
$featureBarMenus['profile'] = array('active' => false, 'url' => helper::createLink($moduleName, 'profile', "userID={$user->id}"), 'text' => $this->lang->user->profile);
|
||||
|
||||
if($methodName != 'story') $featureBarMenus[$methodName]['active'] = true;
|
||||
if($methodName == 'story' and $params['storyType'] == 'story') $featureBarMenus['story']['active'] = true;
|
||||
if($methodName == 'story' and $params['storyType'] == 'requirement') $featureBarMenus['requirement']['active'] = true;
|
||||
|
||||
return $featureBarMenus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,6 +211,46 @@ class userZen extends user
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 FeatureBar 导航。
|
||||
* Get featureBar menus.
|
||||
*
|
||||
* @param object $user
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getFeatureBarMenus(object $user): array
|
||||
{
|
||||
$moduleName = $this->app->moduleName;
|
||||
$methodName = $this->app->methodName;
|
||||
$storyType = zget($this->app->params, 'storyType', '');
|
||||
$params = "userID={$user->id}";
|
||||
|
||||
$featureBarMenus = array();
|
||||
if(common::hasPriv($moduleName, 'todo')) $featureBarMenus['todo'] = array('active' => false, 'url' => $this->createLink($moduleName, 'todo', "$params&type=all"), 'text' => $this->lang->user->schedule);
|
||||
if(common::hasPriv($moduleName, 'task')) $featureBarMenus['task'] = array('active' => false, 'url' => $this->createLink($moduleName, 'task', $params), 'text' => $this->lang->user->task);
|
||||
|
||||
if($this->config->URAndSR) $featureBarMenus['requirement'] = array('active' => false, 'url' => $this->createLink($moduleName, 'story', "$params&storyType=requirement"), 'text' => $this->lang->URCommon);
|
||||
|
||||
if(common::hasPriv($moduleName, 'story')) $featureBarMenus['story'] = array('active' => false, 'url' => $this->createLink($moduleName, 'story', "$params&storyType=story"), 'text' => $this->lang->SRCommon);
|
||||
if(common::hasPriv($moduleName, 'bug')) $featureBarMenus['bug'] = array('active' => false, 'url' => $this->createLink($moduleName, 'bug', $params), 'text' => $this->lang->user->bug);
|
||||
if(common::hasPriv($moduleName, 'testtask')) $featureBarMenus['testtask'] = array('active' => false, 'url' => $this->createLink($moduleName, 'testtask', $params), 'text' => $this->lang->user->testTask);
|
||||
if(common::hasPriv($moduleName, 'testcase')) $featureBarMenus['testcase'] = array('active' => false, 'url' => $this->createLink($moduleName, 'testcase', $params), 'text' => $this->lang->user->testCase);
|
||||
|
||||
if(common::hasPriv($moduleName, 'execution') && $this->config->systemMode == 'ALM') $featureBarMenus['execution'] = array('active' => false, 'url' => $this->createLink($moduleName, 'execution', $params), 'text' => $this->lang->user->execution);
|
||||
if(common::hasPriv($moduleName, 'issue') && $this->config->edition == 'max') $featureBarMenus['issue'] = array('active' => false, 'url' => $this->createLink($moduleName, 'issue', $params), 'text' => $this->lang->user->issue);
|
||||
if(common::hasPriv($moduleName, 'risk') && $this->config->edition == 'max') $featureBarMenus['risk'] = array('active' => false, 'url' => $this->createLink($moduleName, 'risk', $params), 'text' => $this->lang->user->risk);
|
||||
|
||||
if(common::hasPriv($moduleName, 'dynamic')) $featureBarMenus['dynamic'] = array('active' => false, 'url' => $this->createLink($moduleName, 'dynamic', "$params&type=today"), 'text' => $this->lang->user->dynamic);
|
||||
if(common::hasPriv($moduleName, 'profile')) $featureBarMenus['profile'] = array('active' => false, 'url' => $this->createLink($moduleName, 'profile', $params), 'text' => $this->lang->user->profile);
|
||||
|
||||
if($methodName != 'story') $featureBarMenus[$methodName]['active'] = true;
|
||||
if($methodName == 'story' && $storyType == 'story') $featureBarMenus['story']['active'] = true;
|
||||
if($methodName == 'story' && $storyType == 'requirement') $featureBarMenus['requirement']['active'] = true;
|
||||
|
||||
return $featureBarMenus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录。
|
||||
* Login.
|
||||
|
||||
Reference in New Issue
Block a user