* Finish task #8797.
This commit is contained in:
+13
-3
@@ -412,7 +412,7 @@ class my extends control
|
||||
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->project;
|
||||
$this->view->position[] = $this->lang->my->project;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->projects = $this->user->getProjects($this->app->user->account, 'project', $pager);
|
||||
$this->view->projects = $this->user->getProjects($this->app->user->account, 'project', 'all', $pager);
|
||||
$this->view->pager = $pager;
|
||||
$this->view->status = $status;
|
||||
$this->display();
|
||||
@@ -420,18 +420,28 @@ class my extends control
|
||||
|
||||
/**
|
||||
* My executions.
|
||||
* @param string $status undone|done
|
||||
* @param int $recTotal
|
||||
* @param int $recPerPage
|
||||
* @param int $pageID
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function execution()
|
||||
public function execution($status = 'undone', $recTotal = 0, $recPerPage = 15, $pageID = 1)
|
||||
{
|
||||
$this->app->loadLang('project');
|
||||
|
||||
/* Set the pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->execution;
|
||||
$this->view->position[] = $this->lang->my->execution;
|
||||
$this->view->tabID = 'project';
|
||||
$this->view->executions = $this->user->getProjects($this->app->user->account, 'execution');
|
||||
$this->view->executions = $this->user->getProjects($this->app->user->account, 'execution', $status, $pager);
|
||||
$this->view->status = $status;
|
||||
$this->view->pager = $pager;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -32,6 +32,10 @@ $lang->my->name = 'Name';
|
||||
$lang->my->code = 'Code';
|
||||
$lang->my->projects = 'Project';
|
||||
|
||||
$lang->my->executionMenu = new stdclass();
|
||||
$lang->my->executionMenu->undone = 'Undone';
|
||||
$lang->my->executionMenu->done = 'Done';
|
||||
|
||||
$lang->my->taskMenu = new stdclass();
|
||||
$lang->my->taskMenu->assignedToMe = 'AssignedToMe';
|
||||
$lang->my->taskMenu->openedByMe = 'CreatedByMe';
|
||||
|
||||
@@ -32,6 +32,10 @@ $lang->my->name = '名称';
|
||||
$lang->my->code = '代号';
|
||||
$lang->my->projects = '项目';
|
||||
|
||||
$lang->my->executionMenu = new stdclass();
|
||||
$lang->my->executionMenu->undone = '未结束';
|
||||
$lang->my->executionMenu->done = '已完成';
|
||||
|
||||
$lang->my->taskMenu = new stdclass();
|
||||
$lang->my->taskMenu->assignedToMe = '指派给我';
|
||||
$lang->my->taskMenu->openedByMe = '由我创建';
|
||||
|
||||
@@ -13,7 +13,11 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div class="btn-toolbar pull-left">
|
||||
<span class='btn btn-link btn-active-text'><span class='text'><?php echo $lang->my->myExecutions;?></span></span>
|
||||
<?php
|
||||
$recTotalLabel = " <span class='label label-light label-badge'>{$pager->recTotal}</span>";
|
||||
echo html::a(inlink('execution', "type=undone"), "<span class='text'>{$lang->my->executionMenu->undone}</span>" . ($status == 'undone' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($status == 'undone' ? ' btn-active-text' : '') . "'");
|
||||
echo html::a(inlink('execution', "type=done"), "<span class='text'>{$lang->my->executionMenu->done}</span>" . ($status == 'done' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($status == 'done' ? ' btn-active-text' : '') . "'");
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mainContent" class='main-table'>
|
||||
@@ -26,11 +30,9 @@
|
||||
<?php else:?>
|
||||
<table class="table has-sort-head table-fixed" id='projectList'>
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
<tr class='text-left'>
|
||||
<th class='w-id'><?php echo $lang->idAB;?></th>
|
||||
<th class='c-name text-left'><?php echo $lang->my->name;?></th>
|
||||
<th class='w-160px text-left'><?php echo $lang->my->code;?></th>
|
||||
<th class='w-160px text-left'><?php echo $lang->typeAB;?></th>
|
||||
<th class='c-name text-left'><?php echo $lang->my->projects;?></th>
|
||||
<th class='c-date'><?php echo $lang->project->begin;?></th>
|
||||
<th class='c-date'><?php echo $lang->project->end;?></th>
|
||||
@@ -38,16 +40,21 @@
|
||||
<th class='c-user'><?php echo $lang->team->role;?></th>
|
||||
<th class='c-date'><?php echo $lang->team->join;?></th>
|
||||
<th class='w-110px'><?php echo $lang->team->hours;?></th>
|
||||
<th class='w-60px'><?php echo $lang->project->waitTasks;?></th>
|
||||
<th class='c-progress'><?php echo $lang->project->progress;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($executions as $execution):?>
|
||||
<?php $link = $this->createLink('project', 'browse', "id=$execution->id", '', '', $execution->project);?>
|
||||
<tr class='text-center'>
|
||||
<tr class='text-left'>
|
||||
<td><?php echo html::a($link, $execution->id);?></td>
|
||||
<td class='c-name text-left'><?php echo html::a($link, $execution->name);?></td>
|
||||
<td class='text-left'><?php echo $execution->code;?></td>
|
||||
<td class='text-left'><?php echo zget($lang->project->typeList, $execution->type);?></td>
|
||||
<td class='c-name text-left'>
|
||||
<span class='project-type-label label label-info label-outline'>
|
||||
<?php echo zget($lang->project->typeList, $execution->type);?>
|
||||
</span>
|
||||
<?php echo html::a($link, $execution->name);?>
|
||||
</td>
|
||||
<td class='c-name text-left'><?php echo html::a($this->createLink('project', 'browse', "id=$execution->project", '', '', $execution->project), $execution->projectName, '', "title='$execution->projectName'");?></td>
|
||||
<td><?php echo $execution->begin;?></td>
|
||||
<td><?php echo $execution->end;?></td>
|
||||
@@ -62,10 +69,15 @@
|
||||
<td><?php echo $execution->role;?></td>
|
||||
<td><?php echo $execution->join;?></td>
|
||||
<td><?php echo $execution->hours;?></td>
|
||||
<td><?php echo $execution->waitTasks;?></td>
|
||||
<td><?php echo "<span class='pie-icon' data-percent='{$execution->progress}' data-border-color='#ddd' data-back-color='#f1f1f1'></span> {$execution->progress}%";?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="table-footer">
|
||||
<?php $pager->show('right', 'pagerjs');?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -76,6 +76,7 @@ $lang->project->relatedMember = 'Team';
|
||||
$lang->project->watermark = 'Exported by ZenTao';
|
||||
$lang->project->burnXUnit = '(Date)';
|
||||
$lang->project->burnYUnit = '(Hours)';
|
||||
$lang->project->waitTasks = 'Waiting Tasks';
|
||||
$lang->project->viewByUser = 'By User';
|
||||
$lang->project->oneProduct = "Only one stage can be linked {$lang->productCommon}";
|
||||
$lang->project->noLinkProduct = "Stage not linked {$lang->productCommon}";
|
||||
|
||||
@@ -76,6 +76,7 @@ $lang->project->relatedMember = '相关成员';
|
||||
$lang->project->watermark = '由禅道导出';
|
||||
$lang->project->burnXUnit = '(日期)';
|
||||
$lang->project->burnYUnit = '(工时)';
|
||||
$lang->project->waitTasks = '待处理';
|
||||
$lang->project->viewByUser = '按用户查看';
|
||||
$lang->project->oneProduct = "阶段只能关联一个{$lang->productCommon}";
|
||||
$lang->project->noLinkProduct = "阶段没有关联{$lang->productCommon}";
|
||||
|
||||
+51
-1
@@ -957,21 +957,67 @@ class userModel extends model
|
||||
* Get projects a user participated.
|
||||
*
|
||||
* @param string $account
|
||||
* @param string $type
|
||||
* @param string $status all|undone|done
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjects($account, $type = 'project', $pager = null)
|
||||
public function getProjects($account, $type = 'project', $status = 'all', $pager = null)
|
||||
{
|
||||
if($type == 'execution') $type = 'sprint,stage';
|
||||
$myProjectsList = $this->dao->select('t1. *,t2. *')->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.root = t2.id')
|
||||
->where('t1.type')->in($type)
|
||||
->beginIF($status == 'done')->andWhere('status')->in('done,closed')->fi()
|
||||
->beginIF($status == 'undone')->andWhere('status')->notin('done,closed')->fi()
|
||||
->andWhere('t1.account')->eq($account)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->orderBy('t2.id_desc')
|
||||
->page($pager)
|
||||
->fetchGroup('project');
|
||||
|
||||
$projectIdList = array();
|
||||
foreach($myProjectsList as $projects)
|
||||
{
|
||||
foreach($projects as $project) $projectIdList[] = $project->id;
|
||||
}
|
||||
|
||||
/* Get all tasks and compute totalConsumed, totalLeft, totalWait, progress according to them. */
|
||||
$hours = array();
|
||||
$emptyHour = array('totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0, 'waitTasks' => 0);
|
||||
$searchField = $type == 'project' ? 'PRJ' : 'project';
|
||||
$tasks = $this->dao->select('id, PRJ, project, consumed, `left`, status')
|
||||
->from(TABLE_TASK)
|
||||
->where('parent')->lt(1)
|
||||
->andWhere($searchField)->in($projectIdList)->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchGroup($searchField, 'id');
|
||||
|
||||
/* Compute totalEstimate, totalConsumed, totalLeft. */
|
||||
foreach($tasks as $projectID => $projectTasks)
|
||||
{
|
||||
$hour = (object)$emptyHour;
|
||||
foreach($projectTasks as $task)
|
||||
{
|
||||
if($task->status == 'wait')
|
||||
{
|
||||
$hour->waitTasks += 1;
|
||||
$hour->totalConsumed += $task->consumed;
|
||||
}
|
||||
if($task->status != 'cancel' and $task->status != 'closed') $hour->totalLeft += $task->left;
|
||||
}
|
||||
$hours[$projectID] = $hour;
|
||||
}
|
||||
|
||||
/* Compute totalReal and progress. */
|
||||
foreach($hours as $hour)
|
||||
{
|
||||
$hour->totalConsumed = round($hour->totalConsumed, 1);
|
||||
$hour->totalLeft = round($hour->totalLeft, 1);
|
||||
$hour->totalReal = $hour->totalConsumed + $hour->totalLeft;
|
||||
$hour->progress = $hour->totalReal ? round($hour->totalConsumed / $hour->totalReal, 3) * 100 : 0;
|
||||
}
|
||||
|
||||
$projectIdList = array_keys($myProjectsList);
|
||||
$projectList = $this->loadModel('program')->getPRJByIdList($projectIdList);
|
||||
|
||||
@@ -987,6 +1033,10 @@ class userModel extends model
|
||||
if($delay > 0) $project->delay = $delay;
|
||||
}
|
||||
|
||||
/* Process the hours. */
|
||||
$project->progress = isset($hours[$project->id]) ? $hours[$project->id]->progress : 0;
|
||||
$project->waitTasks = isset($hours[$project->id]) ? $hours[$project->id]->waitTasks : 0;
|
||||
|
||||
if($project->project) $project->projectName = $projectList[$project->project]->name;
|
||||
$myProjects[$project->id] = $project;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user