* finish task #7648.

This commit is contained in:
z
2020-08-24 11:33:37 +08:00
parent ccfe5c5ada
commit 1a9c007fec
5 changed files with 32 additions and 9 deletions
+4 -2
View File
@@ -935,11 +935,12 @@ class project extends control
* @access public
* @return void
*/
public function burn($projectID = 0, $type = 'noweekend', $interval = 0)
public function burn($projectID = 0, $type = 'noweekend', $interval = 0, $burnBy = 'left')
{
$this->loadModel('report');
$project = $this->commonAction($projectID);
$projectID = $project->id;
$burnBy = $this->cookie->burnBy ? $this->cookie->burnBy : $burnBy;
/* Header and position. */
$title = $project->name . $this->lang->colon . $this->lang->project->burn;
@@ -949,7 +950,7 @@ class project extends control
/* Get date list. */
$projectInfo = $this->project->getByID($projectID);
list($dateList, $interval) = $this->project->getDateList($projectInfo->begin, $projectInfo->end, $type, $interval, 'Y-m-d');
$chartData = $this->project->buildBurnData($projectID, $dateList, $type);
$chartData = $this->project->buildBurnData($projectID, $dateList, $type, $burnBy);
$dayList = array_fill(1, floor($project->days / $this->config->project->maxBurnDay) + 5, '');
foreach($dayList as $key => $val) $dayList[$key] = $this->lang->project->interval . ($key + 1) . $this->lang->day;
@@ -958,6 +959,7 @@ class project extends control
$this->view->title = $title;
$this->view->position = $position;
$this->view->tabID = 'burn';
$this->view->burnBy = $burnBy;
$this->view->projectID = $projectID;
$this->view->projectName = $project->name;
$this->view->type = $type;
+2
View File
@@ -5,3 +5,5 @@
#burnLegend > div {position: relative; padding-left: 30px;}
#burnLegend > div > .barline {position: absolute; width: 20px; left: 0; top: 13px; height: 3px; background: #EEEEEE;}
#burnLegend .line-real .bg-primary{background: #1183fb}
.pull-left .input-control{margin-right: 10px}
+6
View File
@@ -117,6 +117,12 @@ $lang->project->aclList['open'] = "默认设置(有{$lang->projectCommon}视
$lang->project->aclList['private'] = "私有{$lang->projectCommon}(只有{$lang->projectCommon}团队成员才能访问)";
$lang->project->aclList['custom'] = "自定义白名单(团队成员和白名单的成员可以访问)";
$lang->project->storyPoint = '故事点';
$lang->project->burnByList['left'] = '按剩余工时查看';
$lang->project->burnByList['estimate'] = '按计划工时查看';
$lang->project->burnByList['storyPoint'] = '按故事点查看';
/* 方法列表。*/
$lang->project->index = "{$lang->projectCommon}主页";
$lang->project->task = '任务列表';
+8 -5
View File
@@ -2013,16 +2013,17 @@ class projectModel extends model
* Get burn data for flot
*
* @param int $projectID
* @param string $burnBy
* @access public
* @return array
*/
public function getBurnDataFlot($projectID = 0)
public function getBurnDataFlot($projectID = 0, $burnBy = '')
{
/* Get project and burn counts. */
$project = $this->getById($projectID);
/* If the burnCounts > $itemCounts, get the latest $itemCounts records. */
$sets = $this->dao->select('date AS name, `left` AS value, estimate')->from(TABLE_BURN)->where('project')->eq((int)$projectID)->andWhere('task')->eq(0)->orderBy('date DESC')->fetchAll('name');
$sets = $this->dao->select("date AS name, `left` AS value, `$burnBy`")->from(TABLE_BURN)->where('project')->eq((int)$projectID)->andWhere('task')->eq(0)->orderBy('date DESC')->fetchAll('name');
$count = 0;
$burnData = array();
@@ -2757,19 +2758,21 @@ class projectModel extends model
* @param int $projectID
* @param array $dateList
* @param string $type
* @param string $burnBy
* @access public
* @return array
*/
public function buildBurnData($projectID, $dateList, $type)
public function buildBurnData($projectID, $dateList, $type, $burnBy = 'left')
{
$this->loadModel('report');
$burnBy = $burnBy ? $burnBy : 'left';
$sets = $this->getBurnDataFlot($projectID);
$sets = $this->getBurnDataFlot($projectID, $burnBy);
$limitJSON = '[]';
$baselineJSON = '[]';
$firstBurn = empty($sets) ? 0 : reset($sets);
$firstTime = !empty($firstBurn->estimate) ? $firstBurn->estimate : (!empty($firstBurn->value) ? $firstBurn->value : 0);
$firstTime = !empty($firstBurn->$burnBy) ? $firstBurn->$burnBy : (!empty($firstBurn->value) ? $firstBurn->value : 0);
$days = count($dateList) - 1;
$rate = $firstTime / $days;
$baselineJSON = '[';
+12 -2
View File
@@ -26,6 +26,9 @@
common::printLink('project', 'fixFirst', "project=$project->id", $lang->project->fixFirst, '', "class='btn btn-link iframe' data-width='700'");
echo $lang->project->howToUpdateBurn;
?>
<div class='input-control w-150px'>
<?php echo html::select('burnBy', $lang->project->burnByList, $burnBy, "class='form-control chosen'");?>
</div>
<?php if($interval):?>
<div class='input-control thWidth'>
<?php echo html::select('interval', $dayList, $interval, "class='form-control chosen'");?>
@@ -37,12 +40,12 @@
</div>
</div>
<div id='mainContent' class='main-content'>
<h2 class='text-center'><?php echo $projectName . ' ' . $this->lang->project->burn;?></h2>
<h2 class='text-center'><?php echo $projectName . ' ' . $this->lang->project->burn . '(' . zget($lang->project->burnByList, $burnBy) . ')';?></h2>
<div id="burnWrapper">
<div id="burnChart">
<canvas id="burnCanvas"></canvas>
</div>
<div id="burnYUnit"><?php echo "({$lang->project->workHour})";?></div>
<div id="burnYUnit"><?php echo $burnBy == 'storyPoint' ? "({$lang->project->storyPoint})" : "({$lang->project->workHour})";?></div>
<div id="burnLegend">
<div class="line-ref"><div class='barline'></div><?php echo $lang->project->charts->burn->graph->reference;?></div>
<div class="line-real"><div class='barline bg-primary'></div><?php echo $lang->project->charts->burn->graph->actuality;?></div>
@@ -50,6 +53,13 @@
</div>
</div>
<script>
$('#burnBy').change(function()
{
$.cookie('burnBy', $(this).val(), {expires:config.cookieLife, path:config.webRoot});
var interval = typeof($('#interval').val()) == 'undefined' ? 0 : $('#interval').val() ;
location.href = createLink('project', 'burn', 'projectID=' + projectID + '&type=' + type + '&interval=' + interval + '&burnBy=' + $(this).val());
});
function initBurnChar()
{
var themePrimaryColor = $.getThemeColor('primary');