* Finish task #84596.
This commit is contained in:
@@ -3779,35 +3779,22 @@ class execution extends control
|
||||
$projectPairs[$project->id] = $project->name;
|
||||
}
|
||||
|
||||
$nameList = $this->execution->getFullNameList($orderedExecutions);
|
||||
|
||||
$projectExecutions = array();
|
||||
$parentIdList = array();
|
||||
$childrenIdList = array();
|
||||
foreach($orderedExecutions as $execution)
|
||||
{
|
||||
if($execution->type != 'stage') continue;
|
||||
if($execution->grade == 2 and $execution->project != $execution->parent)
|
||||
{
|
||||
$parentIdList[$execution->parent] = $execution->parent;
|
||||
$childrenIdList[$execution->parent][] = $execution->id;
|
||||
}
|
||||
}
|
||||
foreach($orderedExecutions as $id => $execution)
|
||||
{
|
||||
$execution->children = isset($childrenIdList[$execution->id]) ? $childrenIdList[$execution->id] : array();
|
||||
$execution->name = $nameList[$execution->id];
|
||||
$projectExecutions[$execution->project][] = $execution;
|
||||
}
|
||||
|
||||
$parents = array();
|
||||
if($parentIdList) $parents = $this->execution->getByIdList($parentIdList);
|
||||
|
||||
$this->view->link = $this->execution->getLink($module, $method, $extra);
|
||||
$this->view->module = $module;
|
||||
$this->view->method = $method;
|
||||
$this->view->executionID = $executionID;
|
||||
$this->view->extra = $extra;
|
||||
$this->view->projects = $projectPairs;
|
||||
$this->view->executions = $projectExecutions;
|
||||
$this->view->parents = $parents;
|
||||
$this->view->link = $this->execution->getLink($module, $method, $extra);
|
||||
$this->view->module = $module;
|
||||
$this->view->method = $method;
|
||||
$this->view->executionID = $executionID;
|
||||
$this->view->extra = $extra;
|
||||
$this->view->projects = $projectPairs;
|
||||
$this->view->projectExecutions = $projectExecutions;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -1940,6 +1940,61 @@ class executionModel extends model
|
||||
return array_values($fullTrees);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full name by path.
|
||||
* @param string $executionPath
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getFullNameByPath($executionPath)
|
||||
{
|
||||
$paths = explode(',', trim($executionPath, ','));
|
||||
$executions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in($paths)->andWhere('type')->notin('program,project')->fetchPairs();
|
||||
$executionName = array();
|
||||
foreach($paths as $path)
|
||||
{
|
||||
if(isset($executions[$path])) $executionName[] = $executions[$path];
|
||||
}
|
||||
|
||||
return implode('/', $executionName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full name of executons.
|
||||
* @param array $executions
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getFullNameList($executions)
|
||||
{
|
||||
$allExecutions = $this->dao->select('id,name,parent')->from(TABLE_EXECUTION)
|
||||
->where('type')->notin(array('program', 'project'))
|
||||
->andWhere('deleted')->eq('0')
|
||||
->fetchAll('id');
|
||||
|
||||
$nameList = array();
|
||||
foreach($executions as $executionID => $execution)
|
||||
{
|
||||
if($execution->grade <= 1)
|
||||
{
|
||||
$nameList[$executionID] = $execution->name;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Set execution name. */
|
||||
$paths = array_slice(explode(',', trim($execution->path, ',')), 1);
|
||||
$executionName = array();
|
||||
foreach($paths as $path)
|
||||
{
|
||||
if(isset($allExecutions[$path])) $executionName[] = $allExecutions[$path]->name;
|
||||
}
|
||||
|
||||
$nameList[$executionID] = implode('/', $executionName);
|
||||
}
|
||||
|
||||
return $nameList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get related executions
|
||||
*
|
||||
|
||||
@@ -37,13 +37,13 @@ $myExecutions = 0;
|
||||
$others = 0;
|
||||
$dones = 0;
|
||||
|
||||
foreach($executions as $projectID => $projectExecutions)
|
||||
foreach($projectExecutions as $projectID => $executions)
|
||||
{
|
||||
$executionCounts[$projectID]['myExecution'] = 0;
|
||||
$executionCounts[$projectID]['others'] = 0;
|
||||
$executionCounts[$projectID]['closed'] = 0;
|
||||
|
||||
foreach($projectExecutions as $execution)
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account]))) $executionCounts[$projectID]['myExecution'] ++;
|
||||
if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account])) $executionCounts[$projectID]['others'] ++;
|
||||
@@ -64,7 +64,7 @@ $closedExecutionsHtml = '<ul class="tree tree-angles" data-ride="tree">';
|
||||
|
||||
$kanbanLink = $this->createLink('execution', 'kanban', "executionID=%s");
|
||||
$taskLink = $this->createLink('execution', 'task', "executionID=%s");
|
||||
foreach($executions as $projectID => $projectExecutions)
|
||||
foreach($projectExecutions as $projectID => $executions)
|
||||
{
|
||||
/* Adapt to the old version. */
|
||||
if($projectID)
|
||||
@@ -76,7 +76,7 @@ foreach($executions as $projectID => $projectExecutions)
|
||||
if($executionCounts[$projectID]['closed']) $closedExecutionsHtml .= '<li><div class="hide-in-search"><a class="text-muted not-list-item" title="' . $projectName . '">' . $projectName . '</a> <label class="label">' . $lang->project->common . '</label></div><ul>';
|
||||
}
|
||||
|
||||
foreach($projectExecutions as $index => $execution)
|
||||
foreach($executions as $index => $execution)
|
||||
{
|
||||
$executionLink = $link;
|
||||
$isKanbanMethod = ((in_array($method, $config->execution->kanbanMethod) and $module == 'execution') or (strpos(',create,edit,', ",$method,") !== false and $module == 'build'));
|
||||
@@ -86,64 +86,31 @@ foreach($executions as $projectID => $projectExecutions)
|
||||
|
||||
if($execution->id == $executionID) $currentExecution = $execution;
|
||||
$selected = $execution->id == $executionID ? 'selected' : '';
|
||||
if(!empty($execution->children))
|
||||
if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account])))
|
||||
{
|
||||
foreach($execution->children as $id)
|
||||
{
|
||||
if($execution->id == $executionID) $currentExecution = $execution;
|
||||
$selected = $id == $executionID ? 'selected' : '';
|
||||
if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account])))
|
||||
{
|
||||
$myExecutionsHtml .= '<li>' . html::a(sprintf($executionLink, $id), $executionNames[$id], '', "class='$selected clickable' title='{$executionNames[$id]}' data-key='" . zget($executionsPinYin, $executionNames[$id], '') . "' data-app='{$this->app->tab}'") . '</li>';
|
||||
$myExecutionsHtml .= '<li>' . html::a(sprintf($executionLink, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$executionNames[$execution->id]}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '</li>';
|
||||
|
||||
if($selected == 'selected') $tabActive = 'myExecution';
|
||||
if($selected == 'selected') $tabActive = 'myExecution';
|
||||
|
||||
$myExecutions ++;
|
||||
}
|
||||
else if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account]))
|
||||
{
|
||||
$normalExecutionsHtml .= '<li>' . html::a(sprintf($executionLink, $id), $executionNames[$id], '', "class='$selected clickable' title='{$executionNames[$id]}' data-key='" . zget($executionsPinYin, $executionNames[$id], '') . "' data-app='{$this->app->tab}'") . '</li>';
|
||||
|
||||
if($selected == 'selected') $tabActive = 'other';
|
||||
|
||||
$others ++;
|
||||
}
|
||||
else if($execution->status == 'done' or $execution->status == 'closed')
|
||||
{
|
||||
$closedExecutionsHtml .= '<li>' . html::a(sprintf($executionLink, $id), $executionNames[$id], '', "class='$selected clickable' title='{$executionNames[$id]}' data-key='" . zget($executionsPinYin, $executionNames[$id], '') . "' data-app='{$this->app->tab}'") . '</li>';
|
||||
|
||||
if($selected == 'selected') $tabActive = 'closed';
|
||||
}
|
||||
}
|
||||
$myExecutions ++;
|
||||
}
|
||||
else if($execution->grade == 1)
|
||||
else if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account]))
|
||||
{
|
||||
if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account])))
|
||||
{
|
||||
$myExecutionsHtml .= '<li>' . html::a(sprintf($executionLink, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$executionNames[$execution->id]}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '</li>';
|
||||
$normalExecutionsHtml .= '<li>' . html::a(sprintf($executionLink, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$executionNames[$execution->id]}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '</li>';
|
||||
|
||||
if($selected == 'selected') $tabActive = 'myExecution';
|
||||
if($selected == 'selected') $tabActive = 'other';
|
||||
|
||||
$myExecutions ++;
|
||||
}
|
||||
else if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account]))
|
||||
{
|
||||
$normalExecutionsHtml .= '<li>' . html::a(sprintf($executionLink, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$executionNames[$execution->id]}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '</li>';
|
||||
$others ++;
|
||||
}
|
||||
else if($execution->status == 'done' or $execution->status == 'closed')
|
||||
{
|
||||
$closedExecutionsHtml .= '<li>' . html::a(sprintf($executionLink, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$executionNames[$execution->id]}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '</li>';
|
||||
|
||||
if($selected == 'selected') $tabActive = 'other';
|
||||
|
||||
$others ++;
|
||||
}
|
||||
else if($execution->status == 'done' or $execution->status == 'closed')
|
||||
{
|
||||
$closedExecutionsHtml .= '<li>' . html::a(sprintf($executionLink, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$executionNames[$execution->id]}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '</li>';
|
||||
|
||||
if($selected == 'selected') $tabActive = 'closed';
|
||||
}
|
||||
if($selected == 'selected') $tabActive = 'closed';
|
||||
}
|
||||
|
||||
/* If the execution is the last one in the project, print the closed label. */
|
||||
if(!isset($projectExecutions[$index + 1]))
|
||||
if(!isset($executions[$index + 1]))
|
||||
{
|
||||
if($executionCounts[$projectID]['myExecution']) $myExecutionsHtml .= '</ul></li>';
|
||||
if($executionCounts[$projectID]['others']) $normalExecutionsHtml .= '</ul></li>';
|
||||
|
||||
Reference in New Issue
Block a user