* finish task #2551.

This commit is contained in:
wangyidong
2016-04-01 16:24:38 +08:00
parent a4c6bfb114
commit 2e72d5724b
5 changed files with 137 additions and 42 deletions
+10 -15
View File
@@ -226,8 +226,9 @@ class project extends control
$this->view->position[] = $this->lang->project->task;
/* Get tasks and group them. */
$tasks = $this->loadModel('task')->getProjectTasks($projectID, $status = 'all', $modules = 0, $groupBy ? $groupBy : 'story');
$groupBy = strtolower(str_replace('`', '', $groupBy));
if(empty($groupBy))$groupBy = 'story';
$tasks = $this->loadModel('task')->getProjectTasks($projectID, $status = 'all', $modules = 0, $groupBy);
$groupBy = str_replace('`', '', $groupBy);
$taskLang = $this->lang->task;
$groupByList = array();
$groupTasks = array();
@@ -236,12 +237,7 @@ class project extends control
$users = $this->loadModel('user')->getPairs('noletter');
foreach($tasks as $task)
{
if($groupBy == '')
{
$groupTasks[$task->story][] = $task;
$groupByList[$task->story] = $task->storyTitle;
}
elseif($groupBy == 'story')
if($groupBy == 'story')
{
$groupTasks[$task->story][] = $task;
$groupByList[$task->story] = $task->storyTitle;
@@ -250,19 +246,15 @@ class project extends control
{
$groupTasks[$taskLang->statusList[$task->status]][] = $task;
}
elseif($groupBy == 'assignedto')
elseif($groupBy == 'assignedTo')
{
$groupTasks[$task->assignedToRealName][] = $task;
}
elseif($groupBy == 'openedby')
{
$groupTasks[$users[$task->openedBy]][] = $task;
}
elseif($groupBy == 'finishedby')
elseif($groupBy == 'finishedBy')
{
$groupTasks[$users[$task->finishedBy]][] = $task;
}
elseif($groupBy == 'closedby')
elseif($groupBy == 'closedBy')
{
$groupTasks[$users[$task->closedBy]][] = $task;
}
@@ -277,6 +269,7 @@ class project extends control
}
/* Assign. */
$this->app->loadLang('tree');
$this->view->members = $this->project->getTeamMembers($projectID);
$this->view->tasks = $groupTasks;
$this->view->tabID = 'task';
@@ -286,6 +279,8 @@ class project extends control
$this->view->orderBy = $groupBy;
$this->view->projectID = $projectID;
$this->view->users = $users;
$this->view->moduleID = 0;
$this->view->moduleName = $this->lang->tree->all;
$this->display();
}
+5 -5
View File
@@ -1,6 +1,6 @@
.table-borderless td.groupdivider, .groupdivider{border-bottom:1px solid #ccc}
.highlight-warning {background: #FBF5C6!important}
.outer .table tr > td.group-name, .outer .table tr > td.group-name:first-child{padding-left: 30px;}
.group-title td {background: #f1f1f1!important; border-bottom: 1px solid #ddd!important}
.groupdivider > .text {color: #808080}
.groupdivider > .text strong {color: #333}
.group-title td {background: #f1f1f1!important; border-bottom: 1px solid #ccc!important}
tr.groupdivider td {background: #fff!important;}
.groupdivider .text {color: #808080}
.groupdivider .text strong {color: #333}
.groupby{background:#f1f1f1!important; border-right:1px solid #ddd;cursor: pointer;}
+42
View File
@@ -0,0 +1,42 @@
$(function()
{
setTimeout(function(){fixedTheadOfList('#groupTable')}, 100);
$(document).on('click', '.expandAll', function()
{
$('.expandAll').addClass('hidden');
$('.collapseAll').removeClass('hidden');
$('table#groupTable').find('tbody').each(function()
{
$(this).find('tr').addClass('hidden');
$(this).find('tr.group-collapse').removeClass('hidden');
})
});
$(document).on('click', '.collapseAll', function()
{
$('.collapseAll').addClass('hidden');
$('.expandAll').removeClass('hidden');
$('table#groupTable').find('tbody').each(function()
{
$(this).find('tr').removeClass('hidden');
$(this).find('tr.group-collapse').addClass('hidden');
})
});
$('.expandGroup').closest('.groupby').click(function()
{
$tbody = $(this).closest('tbody');
$tbody.find('tr').addClass('hidden');
$tbody.find('tr.group-collapse').removeClass('hidden');
});
$('.collapseGroup').click(function()
{
$tbody = $(this).closest('tbody');
$tbody.find('tr').removeClass('hidden');
$tbody.find('tr.group-collapse').addClass('hidden');
});
})
function setFilter(groupBy, setting)
{
$.cookie('groupFilter_' + groupBy, setting, {expires:config.cookieLife, path:config.webRoot});
location.href = removeAnchor(location.href);
}
+17 -6
View File
@@ -136,20 +136,30 @@ $lang->project->statusSelects['closed'] = '已关闭';
$lang->project->statusSelects['delayed'] = '已延期';
$lang->project->statusSelects['needconfirm'] = '需求变动';
$lang->project->statusSelects['cancel'] = '已取消';
$lang->project->groups[''] = '分组查看';
$lang->project->groups['story'] = '需求分组';
$lang->project->groups['status'] = '状态分组';
$lang->project->groups['pri'] = '优先级分组';
$lang->project->groups['openedby'] = '创建者分组';
$lang->project->groups['assignedTo'] = '指派给分组';
$lang->project->groups['finishedby'] = '完成者分组';
$lang->project->groups['closedby'] = '关闭者分组';
$lang->project->groups['estimate'] = '预计分组';
$lang->project->groups['consumed'] = '已消耗分组';
$lang->project->groups['left'] = '剩余分组';
$lang->project->groups['finishedBy'] = '完成者分组';
$lang->project->groups['closedBy'] = '关闭者分组';
$lang->project->groups['type'] = '类型分组';
$lang->project->groups['deadline'] = '截止分组';
$lang->project->groupFilter['story']['all'] = $lang->project->all;
$lang->project->groupFilter['story']['linked'] = '已关联需求';
$lang->project->groupFilter['pri']['all'] = $lang->project->all;
$lang->project->groupFilter['pri']['setted'] = '已设置';
$lang->project->groupFilter['assignedTo']['undone'] = '未完成';
$lang->project->groupFilter['assignedTo']['all'] = $lang->project->all;
$lang->project->groupFilter['finishedBy']['all'] = $lang->project->all;
$lang->project->groupFilter['finishedBy']['done'] = '已完成';
$lang->project->groupFilter['closedBy']['all'] = $lang->project->all;
$lang->project->groupFilter['closedBy']['closed'] = '已关闭';
$lang->project->groupFilter['deadline']['all'] = $lang->project->all;
$lang->project->groupFilter['deadline']['setted'] = '已设置';
$lang->project->byQuery = '搜索';
/* 查询条件列表。*/
@@ -165,6 +175,7 @@ $lang->project->stats = '可用工时<strong>%s</strong>工时<br />
$lang->project->taskSummary = "本页共 <strong>%s</strong> 个任务,未开始<strong>%s</strong>,进行中<strong>%s</strong>,总预计<strong>%s</strong>工时,已消耗<strong>%s</strong>工时,剩余<strong>%s</strong>工时。";
$lang->project->memberHours = "%s共有 <strong>%s</strong> 个可用工时,";
$lang->project->groupSummary = "本组共 <strong>%s</strong> 个任务,未开始<strong>%s</strong>,进行中<strong>%s</strong>,总预计<strong>%s</strong>工时,已消耗<strong>%s</strong>工时,剩余<strong>%s</strong>工时。";
$lang->project->noTimeSummary = "本组共 <strong>%s</strong> 个任务,未开始<strong>%s</strong>,进行中<strong>%s</strong>";
$lang->project->wbs = "分解任务";
$lang->project->batchWBS = "批量分解";
$lang->project->howToUpdateBurn = "<a href='http://api.zentao.net/goto.php?item=burndown&lang=zh-cn' target='_blank' title='如何更新燃尽图?' class='btn btn-sm'>帮助</a>";
+63 -16
View File
@@ -11,12 +11,27 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/treetable.html.php';?>
<?php include './taskheader.html.php';?>
<table class='table table-fixed' id='treetable'>
<?php if(isset($lang->project->groupFilter[$groupBy])):?>
<?php $currentFilter = isset($_COOKIE["groupFilter_$groupBy"]) ? $_COOKIE["groupFilter_$groupBy"] : key($lang->project->groupFilter[$groupBy]);?>
<style>
.nav-tabs{border-bottom:0px!important;}
.nav-tabs>li{margin-bottom:0px!important;}
#featurebar{margin-bottom:5px!important;}
</style>
<ul class="nav nav-tabs">
<?php foreach($lang->project->groupFilter[$groupBy] as $filterKey => $name):?>
<li <?php if($filterKey == $currentFilter) echo "class='active'"?>><a href="javascript:setFilter('<?php echo $groupBy?>', '<?php echo $filterKey?>')"><?php echo $name?></a></li>
<?php endforeach;?>
</ul>
<?php endif;?>
<table class='table active-disabled table-condensed table-fixed table-striped table-custom' id='groupTable'>
<thead>
<tr>
<th class='w-120px'></th>
<th class='w-120px'>
<?php echo html::a('###', "<i class='icon-caret-down'></i> " . $lang->task->$groupBy, '', "class='expandAll' data-action='expand'")?>
<?php echo html::a('###', "<i class='icon-caret-right'></i> " . $lang->task->$groupBy, '', "class='collapseAll hidden' data-action='collapse'")?>
</th>
<th><?php echo $lang->task->name;?></th>
<th class='w-pri'> <?php echo $lang->priAB;?></th>
<th class='w-user'><?php echo $lang->task->assignedTo;?></th>
@@ -40,13 +55,8 @@
$totalConsumed = 0.0;
$totalLeft = 0.0;
?>
<?php $i = 0;?>
<?php foreach($tasks as $groupKey => $groupTasks):?>
<?php $groupClass = ($i % 2 == 0) ? 'even' : 'highlight-warning'; $i ++;?>
<tr id='node-<?php echo $groupKey;?>' class='actie-disabled group-title'>
<td class='<?php echo $groupClass;?> text-left large strong group-name'><?php echo $groupKey;?></td>
<td colspan='11'><?php if($groupByList) echo $groupByList[$groupKey];?></td>
</tr>
<?php $i = 0;?>
<?php
$groupWait = 0;
$groupDone = 0;
@@ -55,9 +65,24 @@
$groupEstimate = 0.0;
$groupConsumed = 0.0;
$groupLeft = 0.0;
$groupName = $groupKey;
if(!empty($groupByList[$groupKey])) $groupName .= '::' . $groupByList[$groupKey];
?>
<tbody>
<?php foreach($groupTasks as $task):?>
<?php $assignedToClass = $task->assignedTo == $app->user->account ? 'style=color:red' : '';?>
<?php
if(isset($currentFilter) and $currentFilter != 'all')
{
if($groupBy == 'story' and $currentFilter == 'linked' and empty($task->story)) continue;
if($groupBy == 'pri' and $currentFilter == 'setted' and empty($task->pri)) continue;
if($groupBy == 'assignedTo' and $currentFilter == 'undone' and $task->status != 'wait' and $task->status != 'doing') continue;
if($groupBy == 'finishedBy' and $currentFilter == 'done' and $task->status != 'done') continue;
if($groupBy == 'closedBy' and $currentFilter == 'closed' and $task->status != 'closed') continue;
if($groupBy == 'deadline' and $currentFilter == 'setted' and $task->deadline == '0000-00-00') continue;
}
?>
<?php $assignedToClass = $task->assignedTo == $app->user->account ? "style='color:red'" : '';?>
<?php $taskLink = $this->createLink('task','view',"taskID=$task->id"); ?>
<?php
$totalEstimate += $task->estimate;
@@ -91,8 +116,12 @@
$groupSum = count($groupTasks);
$taskSum += count($tasks);
?>
<tr id='<?php echo $task->id;?>' class='a-center child-of-node-<?php echo $groupKey;?>'>
<td class='<?php echo $groupClass;?>'></td>
<tr class='text-center'>
<?php if($i == 0):?>
<td rowspan='<?php echo count($groupTasks) + 1?>' class='groupby text-left'>
<?php echo html::a('###', "<i class='icon-caret-down'></i> " . $groupName, '', "class='expandGroup' data-action='expand' title='$groupName'");?>
</td>
<?php endif;?>
<td class='text-left'>&nbsp;<?php echo $task->id . $lang->colon; if(!common::printLink('task', 'view', "task=$task->id", $task->name)) echo $task->name;?></td>
<td><span class='<?php echo 'pri' . zget($lang->task->priList, $task->pri, $task->pri)?>'><?php echo zget($lang->task->priList, $task->pri, $task->pri);?></span></td>
<td <?php echo $assignedToClass;?>><?php echo $task->assignedToRealName;?></td>
@@ -108,14 +137,32 @@
<?php common::printIcon('task', 'delete', "projectID=$task->project&taskid=$task->id", '', 'list', '', 'hiddenwin');?>
</td>
</tr>
<?php $i++;?>
<?php endforeach;?>
<tr class='child-of-node-<?php echo $groupKey;?> <?php echo $groupClass;?>'>
<td colspan='12' class='a-right groupdivider'>
<?php if($i != 0):?>
<tr class='text-center groupdivider'>
<td colspan='4' class='text-left'>
<div class='text'>
<?php if($groupBy == 'assignedto' and isset($members[$task->assignedTo])) printf($lang->project->memberHours, $users[$task->assignedTo], $members[$task->assignedTo]->totalHours);?>
<?php printf($lang->project->groupSummary, $groupSum, $groupWait, $groupDoing, $groupEstimate, $groupConsumed, $groupLeft);?></div>
<?php if($groupBy == 'assignedTo' and isset($members[$task->assignedTo])) printf($lang->project->memberHours, $users[$task->assignedTo], $members[$task->assignedTo]->totalHours);?>
<?php printf($lang->project->noTimeSummary, $groupSum, $groupWait, $groupDoing);?></div>
</td>
<td><?php echo $groupEstimate;?></td>
<td><?php echo $groupConsumed;?></td>
<td><?php echo $groupLeft;?></td>
<td colspan='4'></td>
</tr>
<tr class='actie-disabled group-collapse hidden text-center group-title'>
<td colspan='5' class='text-left'>
<?php echo html::a('###', "<i class='icon-caret-right'></i> " . $groupName, '', "class='collapseGroup' data-action='collapse' title='$groupName'");?>
<span class='groupdivider' style='margin-left:10px;'><span class='text'> <?php printf($lang->project->noTimeSummary, $groupSum, $groupWait, $groupDoing);?></span></span>
</td>
<td><?php echo $groupEstimate;?></td>
<td><?php echo $groupConsumed;?></td>
<td><?php echo $groupLeft;?></td>
<td colspan='4'></td>
</tr>
<?php endif;?>
</tbody>
<?php endforeach;?>
</table>
<script language='Javascript'>$('#<?php echo $browseType;?>Tab').addClass('active');</script>