* Finish task#53666.
This commit is contained in:
+38
-38
@@ -9,14 +9,14 @@
|
||||
* @version $Id: date.class.php 2605 2013-01-09 07:22:58Z wwccss $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class date
|
||||
class date
|
||||
{
|
||||
/**
|
||||
* Build hour time list.
|
||||
*
|
||||
* @param int $begin
|
||||
* @param int $end
|
||||
* @param int $delta
|
||||
*
|
||||
* @param int $begin
|
||||
* @param int $end
|
||||
* @param int $delta
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ class date
|
||||
|
||||
/**
|
||||
* Get today.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
@@ -47,8 +47,8 @@ class date
|
||||
}
|
||||
|
||||
/**
|
||||
* Get yesterday
|
||||
*
|
||||
* Get yesterday
|
||||
*
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ class date
|
||||
|
||||
/**
|
||||
* Get tomorrow.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ class date
|
||||
|
||||
/**
|
||||
* Get the day before yesterday.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return date
|
||||
*/
|
||||
@@ -81,8 +81,8 @@ class date
|
||||
|
||||
/**
|
||||
* Get now time period.
|
||||
*
|
||||
* @param int $delta
|
||||
*
|
||||
* @param int $delta
|
||||
* @access public
|
||||
* @return string the current time period, like 0915
|
||||
*/
|
||||
@@ -114,8 +114,8 @@ class date
|
||||
|
||||
/**
|
||||
* Format time 0915 to 09:15
|
||||
*
|
||||
* @param string $time
|
||||
*
|
||||
* @param string $time
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ class date
|
||||
|
||||
/**
|
||||
* Get the begin and end date of this week.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -141,7 +141,7 @@ class date
|
||||
|
||||
/**
|
||||
* Get the begin and end date of last week.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -155,7 +155,7 @@ class date
|
||||
|
||||
/**
|
||||
* Get the time at the middle of this week.
|
||||
*
|
||||
*
|
||||
* If today in week is 1, move it one day in future. Else is 7, move it back one day. To keep the time geted in this week.
|
||||
*
|
||||
* @access public
|
||||
@@ -172,7 +172,7 @@ class date
|
||||
|
||||
/**
|
||||
* Get middle of last week.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return time
|
||||
*/
|
||||
@@ -188,7 +188,7 @@ class date
|
||||
|
||||
/**
|
||||
* Get begin and end time of this month.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -201,7 +201,7 @@ class date
|
||||
|
||||
/**
|
||||
* Get begin and end time of last month.
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -213,11 +213,11 @@ class date
|
||||
}
|
||||
|
||||
/**
|
||||
* Get begin and end time of this season.
|
||||
*
|
||||
* Get begin and end time of this season.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public static function getThisSeason()
|
||||
{
|
||||
@@ -230,11 +230,11 @@ class date
|
||||
}
|
||||
|
||||
/**
|
||||
* Get begin and end time of last season.
|
||||
*
|
||||
* Get begin and end time of last season.
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public static function getLastSeason()
|
||||
{
|
||||
@@ -242,43 +242,43 @@ class date
|
||||
$begin = date('Y-m-d H:i:s', mktime(0, 0, 0, $season * 3 - 2, 1, date('Y')));
|
||||
$endDay = date('t', mktime(0, 0 , 0, $season * 3, 1, date("Y"))); // Get end day.
|
||||
$end = date('Y-m-d H:i:s', mktime(23, 59, 59, $season * 3, $endDay, date('Y')));
|
||||
|
||||
|
||||
return array('begin' => $begin, 'end' => $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get begin and end time of this year.
|
||||
*
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public static function getThisYear()
|
||||
{
|
||||
$begin = date(DT_DATE1, strtotime('1/1 this year')) . ' 00:00:00';
|
||||
$end = date(DT_DATE1, strtotime('1/1 next year -1 day')) . ' 23:59:59';
|
||||
$end = date(DT_DATE1, strtotime('1/1 next year -1 day')) . ' 23:59:59';
|
||||
return array('begin' => $begin, 'end' => $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get begin and end time of last year.
|
||||
*
|
||||
*
|
||||
* @static
|
||||
* @access public
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
public static function getLastYear()
|
||||
{
|
||||
$begin = date(DT_DATE1, strtotime('1/1 last year')) . ' 00:00:00';
|
||||
$end = date(DT_DATE1, strtotime('1/1 this year -1 day')) . ' 23:59:59';
|
||||
$end = date(DT_DATE1, strtotime('1/1 this year -1 day')) . ' 23:59:59';
|
||||
return array('begin' => $begin, 'end' => $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get date list
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* Get date list
|
||||
*
|
||||
* @param string $begin
|
||||
* @param string $end
|
||||
* @param string $format m/d/Y|Y-m-d
|
||||
* @param string $type noweekend|withweekend
|
||||
* @param int $weekend 2|1
|
||||
@@ -295,7 +295,7 @@ class date
|
||||
for($date = $begin; $date <= $end; $date += 24 * 3600)
|
||||
{
|
||||
$weekDay = date('w', $date);
|
||||
if($type == 'noweekend' and (($weekend == 2 and $weekDay == 6) or $weekDay == 0)) continue;
|
||||
if(strpos($type, 'noweekend') !== false and (($weekend == 2 and $weekDay == 6) or $weekDay == 0)) continue;
|
||||
|
||||
$dateList[] = date($format, $date);
|
||||
}
|
||||
|
||||
@@ -1149,12 +1149,12 @@ class execution extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function burn($executionID = 0, $type = 'noweekend', $interval = 0, $burnBy = 'left')
|
||||
public function burn($executionID = 0, $type = 'noweekend,nodelay', $interval = 0, $burnBy = 'left')
|
||||
{
|
||||
$this->loadModel('report');
|
||||
$execution = $this->commonAction($executionID);
|
||||
$executionID = $execution->id;
|
||||
$burnBy = $this->cookie->burnBy ? $this->cookie->burnBy : $burnBy;
|
||||
$burnBy = $this->cookie->burnBy ? $this->cookie->burnBy : $burnBy;
|
||||
|
||||
/* Header and position. */
|
||||
$title = $execution->name . $this->lang->colon . $this->lang->execution->burn;
|
||||
@@ -1163,7 +1163,8 @@ class execution extends control
|
||||
|
||||
/* Get date list. */
|
||||
$executionInfo = $this->execution->getByID($executionID);
|
||||
list($dateList, $interval) = $this->execution->getDateList($executionInfo->begin, $executionInfo->end, $type, $interval, 'Y-m-d');
|
||||
$endDate = strpos($type, 'withdelay') !== false ? helper::today() : $executionInfo->end;
|
||||
list($dateList, $interval) = $this->execution->getDateList($executionInfo->begin, $endDate, $type, $interval, 'Y-m-d');
|
||||
$chartData = $this->execution->buildBurnData($executionID, $dateList, $type, $burnBy);
|
||||
|
||||
$dayList = array_fill(1, floor((int)$execution->days / $this->config->execution->maxBurnDay) + 5, '');
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
#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;}
|
||||
#burnLegend .line-real .bg-delay {background: red;}
|
||||
|
||||
.pull-left .input-control {margin-right: 10px;}
|
||||
|
||||
@@ -5,6 +5,18 @@ $(function()
|
||||
{
|
||||
location.href = createLink('execution', 'burn', 'executionID=' + executionID + '&type=' + type + '&interval=' + $(this).val());
|
||||
});
|
||||
|
||||
$('#weekend').click(function()
|
||||
{
|
||||
var browseType = type.match('noweekend') ? type.replace('noweekend', 'withweekend') : type.replace('withweekend', 'noweekend');
|
||||
location.href = createLink('execution', 'burn', 'executionID=' + executionID + '&type=' + browseType + '&interval=' + interval);
|
||||
});
|
||||
|
||||
$('#delay').click(function()
|
||||
{
|
||||
var browseType = type.match('nodelay') ? type.replace('nodelay', 'withdelay') : type.replace('withdelay', 'nodelay');
|
||||
location.href = createLink('execution', 'burn', 'executionID=' + executionID + '&type=' + browseType + '&interval=' + interval);
|
||||
});
|
||||
})
|
||||
|
||||
/* Save burn as image.*/
|
||||
|
||||
@@ -359,7 +359,9 @@ $lang->execution->linkStory = 'Link Story';
|
||||
$lang->execution->createTask = 'Create Task';
|
||||
$lang->execution->goback = "Go Back";
|
||||
$lang->execution->noweekend = 'Exclude Weekend';
|
||||
$lang->execution->nowdelay = 'Exclude Delay Date';
|
||||
$lang->execution->withweekend = 'Include Weekend';
|
||||
$lang->execution->withdelay = 'Include Delay Date';
|
||||
$lang->execution->interval = 'Intervals ';
|
||||
$lang->execution->fixFirstWithLeft = 'Update hours left too';
|
||||
$lang->execution->unfinishedExecution = "This {$lang->executionCommon} has ";
|
||||
@@ -384,6 +386,7 @@ $lang->execution->charts->burn->graph->rotateNames = 1;
|
||||
$lang->execution->charts->burn->graph->showValues = 0;
|
||||
$lang->execution->charts->burn->graph->reference = 'Ideal';
|
||||
$lang->execution->charts->burn->graph->actuality = 'Actual';
|
||||
$lang->execution->charts->burn->graph->delay = 'Delay';
|
||||
|
||||
$lang->execution->placeholder = new stdclass();
|
||||
$lang->execution->placeholder->code = "Abbreviation of {$lang->executionCommon} name";
|
||||
|
||||
@@ -359,7 +359,9 @@ $lang->execution->linkStory = "关联{$lang->SRCommon}";
|
||||
$lang->execution->createTask = '创建任务';
|
||||
$lang->execution->goback = "返回任务列表";
|
||||
$lang->execution->noweekend = '去除周末';
|
||||
$lang->execution->nodelay = '去除延期日期';
|
||||
$lang->execution->withweekend = '显示周末';
|
||||
$lang->execution->withdelay = '显示延期日期';
|
||||
$lang->execution->interval = '间隔';
|
||||
$lang->execution->fixFirstWithLeft = '修改剩余工时';
|
||||
$lang->execution->unfinishedExecution = "该{$lang->executionCommon}下还有";
|
||||
@@ -384,6 +386,7 @@ $lang->execution->charts->burn->graph->rotateNames = 1;
|
||||
$lang->execution->charts->burn->graph->showValues = 0;
|
||||
$lang->execution->charts->burn->graph->reference = '参考';
|
||||
$lang->execution->charts->burn->graph->actuality = '实际';
|
||||
$lang->execution->charts->burn->graph->delay = '延期';
|
||||
|
||||
$lang->execution->placeholder = new stdclass();
|
||||
$lang->execution->placeholder->code = '团队内部的简称';
|
||||
|
||||
@@ -2792,8 +2792,7 @@ class executionModel extends model
|
||||
{
|
||||
$today = helper::today();
|
||||
$executions = $this->dao->select('id, code')->from(TABLE_EXECUTION)
|
||||
->where('end')->ge($today)
|
||||
->andWhere('type')->in('sprint,stage')
|
||||
->where('type')->in('sprint,stage')
|
||||
->andWhere('lifetime')->ne('ops')
|
||||
->andWhere('status')->notin('done,closed,suspended')
|
||||
->fetchPairs();
|
||||
@@ -2943,10 +2942,11 @@ class executionModel extends model
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $burnBy
|
||||
* @param bool $showDelay
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBurnDataFlot($executionID = 0, $burnBy = '')
|
||||
public function getBurnDataFlot($executionID = 0, $burnBy = '', $showDelay = false)
|
||||
{
|
||||
/* Get execution and burn counts. */
|
||||
$execution = $this->getById($executionID);
|
||||
@@ -2959,7 +2959,8 @@ class executionModel extends model
|
||||
foreach($sets as $date => $set)
|
||||
{
|
||||
if($date < $execution->begin) continue;
|
||||
if($date > $execution->end) continue;
|
||||
if(!$showDelay and $date > $execution->end) $set->value = 'null';
|
||||
if($showDelay and $date < $execution->end) $set->value = 'null';
|
||||
|
||||
$burnData[$date] = $set;
|
||||
$count++;
|
||||
@@ -3648,6 +3649,13 @@ class executionModel extends model
|
||||
$chartData['burnLine'] = $this->report->createSingleJSON($sets, $dateList);
|
||||
$chartData['baseLine'] = $baselineJSON;
|
||||
|
||||
$execution = $this->getById($executionID);
|
||||
if($execution->status != 'closed' and helper::today() > $execution->end)
|
||||
{
|
||||
$delaySets = $this->getBurnDataFlot($executionID, $burnBy, true);
|
||||
$chartData['delayLine'] = $this->report->createSingleJSON($delaySets, $dateList);
|
||||
}
|
||||
|
||||
return $chartData;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,13 +18,16 @@
|
||||
<?php js::set('burnXUnit', $lang->execution->burnXUnit);?>
|
||||
<?php js::set('burnYUnit', $lang->execution->burnYUnit);?>
|
||||
<?php js::set('type', $type);?>
|
||||
<?php js::set('interval', $interval);?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'>
|
||||
<?php
|
||||
$weekend = ($type == 'noweekend') ? 'withweekend' : "noweekend";
|
||||
$weekend = strpos($type, 'noweekend') !== false ? 'withweekend' : 'noweekend';
|
||||
$delay = strpos($type, 'withdelay') !== false ? 'nodelay' : 'withdelay';
|
||||
common::printLink('execution', 'computeBurn', 'reload=yes', '<i class="icon icon-refresh"></i> ' . $lang->execution->computeBurn, 'hiddenwin', "title='{$lang->execution->computeBurn}' class='btn btn-primary' id='computeBurn'");
|
||||
echo '<div class="space"></div>';
|
||||
echo html::a($this->createLink('execution', 'burn', "executionID=$executionID&type=$weekend&interval=$interval"), $lang->execution->$weekend, '', "class='btn btn-link'");
|
||||
echo html::a('#', $lang->execution->$weekend, '', "class='btn btn-link' id='weekend'");
|
||||
if($execution->status != 'closed' and helper::today() > $execution->end) echo html::a('#', $lang->execution->$delay, '', "class='btn btn-link' id='delay'");
|
||||
if(common::canModify('execution', $execution)) common::printLink('execution', 'fixFirst', "execution=$execution->id", $lang->execution->fixFirst, '', "class='btn btn-link iframe' data-width='700'");
|
||||
echo $lang->execution->howToUpdateBurn;
|
||||
?>
|
||||
@@ -54,6 +57,9 @@
|
||||
<div id="burnLegend">
|
||||
<div class="line-ref"><div class='barline'></div><?php echo $lang->execution->charts->burn->graph->reference;?></div>
|
||||
<div class="line-real"><div class='barline bg-primary'></div><?php echo $lang->execution->charts->burn->graph->actuality;?></div>
|
||||
<?php if(strpos($type, 'withdelay') !== false):?>
|
||||
<div class="line-real"><div class='barline bg-delay'></div><?php echo $lang->execution->charts->burn->graph->delay;?></div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,6 +100,19 @@ function initBurnChar()
|
||||
}]
|
||||
};
|
||||
|
||||
var delaySets =
|
||||
{
|
||||
label: "<?php echo $lang->execution->charts->burn->graph->delay;?>",
|
||||
color: 'red',
|
||||
pointStrokeColor: 'red',
|
||||
pointHighlightStroke: 'red',
|
||||
pointColor: 'red',
|
||||
fillColor: 'rgba(0,106,241, .07)',
|
||||
pointHighlightFill: '#fff',
|
||||
data: <?php echo $chartData['delayLine']?>
|
||||
}
|
||||
if(type.match('withdelay')) data.datasets.push(delaySets);
|
||||
|
||||
var burnChart = $("#burnCanvas").lineChart(data,
|
||||
{
|
||||
pointDotStrokeWidth: 2,
|
||||
|
||||
Reference in New Issue
Block a user