Merge branch 'master' of github.com:easysoft/zentaopms
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
|
||||
<style>
|
||||
.table-chart tr > td.chart-color {padding-left: 0!important; text-align: center; padding-right: 0!important; color: #f1f1f1}
|
||||
.chart-wrapper {padding: 10px; background-color: #f1f1f1; border: 1px solid #e5e5e5}
|
||||
</style>
|
||||
<!--[if lte IE 8]>
|
||||
<?php
|
||||
js::import($jsRoot . 'chartjs/excanvas.min.js');
|
||||
?>
|
||||
<![endif]-->
|
||||
<?php
|
||||
if($config->debug)
|
||||
{
|
||||
js::import($jsRoot . 'chartjs/chart.min.js');
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
(function()
|
||||
{
|
||||
var colorIndex = 0;
|
||||
function nextAccentColor(idx)
|
||||
{
|
||||
if(typeof idx === 'undefined') idx = colorIndex++;
|
||||
return new $.zui.Color({h: idx * 67 % 360, s: 0.5, l: 0.55});
|
||||
}
|
||||
|
||||
jQuery.fn.tableChart = function()
|
||||
{
|
||||
$(this).each(function()
|
||||
{
|
||||
var $table = $(this);
|
||||
var options = $.extend({scaleShowLabels: true, scaleLabel: '<%=label%>: <%=value%>'}, $table.data());
|
||||
var chartType = options.chart || 'pie';
|
||||
var $canvas = $(options.target);
|
||||
if(!$canvas.length) return;
|
||||
var chart = null;
|
||||
|
||||
if(chartType === 'pie')
|
||||
{
|
||||
var data = [];
|
||||
var $rows = $table.find('tbody > tr').each(function(idx)
|
||||
{
|
||||
var $row = $(this);
|
||||
var color = nextAccentColor().toCssStr();
|
||||
|
||||
$row.attr('data-id', idx).find('.chart-color-dot').css('color', color);
|
||||
data.push({label: $row.find('.chart-label').text(), value: parseInt($row.find('.chart-value').text()), color: color, id: idx});
|
||||
});
|
||||
|
||||
chart = $canvas.pieChart(data, options);
|
||||
$canvas.on('mousemove', function(e)
|
||||
{
|
||||
var activePoints = chart.getSegmentsAtEvent(e);
|
||||
$rows.removeClass('active');
|
||||
if(activePoints.length)
|
||||
{
|
||||
$rows.filter('[data-id="' + activePoints[0].id + '"]').addClass('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
if(chart !== null) $table.data('zui.chart', chart);
|
||||
});
|
||||
};
|
||||
|
||||
$(function()
|
||||
{
|
||||
$('.table-chart').tableChart();
|
||||
});
|
||||
}());
|
||||
</script>
|
||||
+15
-17
@@ -729,7 +729,7 @@ class project extends control
|
||||
$position[] = $this->lang->project->burn;
|
||||
|
||||
/* Get date list. */
|
||||
list($dateList, $interval) = $this->project->getDateList($projectInfo->begin, $projectInfo->end, $type, $interval);
|
||||
list($dateList, $interval) = $this->project->getDateList($projectInfo->begin, $projectInfo->end, $type, $interval, 'j/n');
|
||||
|
||||
$sets = $this->project->getBurnDataFlot($project->id);
|
||||
$limitJSON = '[]';
|
||||
@@ -740,16 +740,12 @@ class project extends control
|
||||
$days = count($dateList) - 1;
|
||||
$rate = $firstTime / $days;
|
||||
$baselineJSON = '[';
|
||||
foreach($dateList as $i => $date) $baselineJSON .='[' . $i . ',' . ($days - $i) * $rate . '],';
|
||||
foreach($dateList as $i => $date) $baselineJSON .= ($days - $i) * $rate . ',';
|
||||
$baselineJSON = rtrim($baselineJSON, ',') . ']';
|
||||
|
||||
$flotJSON['data'] = $this->report->createSingleJSON($sets, $dateList);
|
||||
$flotJSON['limit'] = $limitJSON;
|
||||
$flotJSON['baseline'] = $baselineJSON;
|
||||
$flotJSON['dateList'] = json_encode($dateList);
|
||||
$flotJSON['ticks'] = json_encode(array_keys($dateList));
|
||||
|
||||
$charts = $this->report->createJSChartFlot($project->name, $flotJSON, 900, 400);
|
||||
$chartData['labels'] = $dateList;
|
||||
$chartData['burnLine'] = $this->report->createSingleJSON($sets, $dateList);
|
||||
$chartData['baseLine'] = $baselineJSON;
|
||||
|
||||
/* Set a space when assemble the string for english. */
|
||||
$space = $this->app->getClientLang() == 'en' ? ' ' : '';
|
||||
@@ -757,14 +753,16 @@ class project extends control
|
||||
foreach($dayList as $key => $val) $dayList[$key] = $this->lang->project->interval . $space . ($key + 1) . $space . $this->lang->day;
|
||||
|
||||
/* Assign. */
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->tabID = 'burn';
|
||||
$this->view->charts = $charts;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->type = $type;
|
||||
$this->view->interval = $interval;
|
||||
$this->view->dayList = array('full' => $this->lang->project->interval . $space . 1 . $space . $this->lang->day) + $dayList;
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->tabID = 'burn';
|
||||
$this->view->charts = $charts;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->projectName = $project->name;
|
||||
$this->view->type = $type;
|
||||
$this->view->interval = $interval;
|
||||
$this->view->chartData = $chartData;
|
||||
$this->view->dayList = array('full' => $this->lang->project->interval . $space . 1 . $space . $this->lang->day) + $dayList;
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.container {max-width: 950px!important;}
|
||||
.container .actions {margin-bottom: 10px; padding: 0 25px}
|
||||
.container .actions {margin-bottom: 10px; padding: 0}
|
||||
.container .actions > .text {padding: 5px 5px 5px 15px; line-height: 20px}
|
||||
.mw-220px {max-width: 220px!important}
|
||||
#wrap h1{font-size:14px;}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
$(function()
|
||||
{
|
||||
initBurnChar();
|
||||
|
||||
$('#burnTab').addClass('active');
|
||||
|
||||
$('#interval').change(function()
|
||||
{
|
||||
location.href = createLink('project', 'burn', 'projectID=' + projectID + '&type=' + type + '&interval=' + $(this).val());
|
||||
})
|
||||
});
|
||||
})
|
||||
|
||||
@@ -49,6 +49,7 @@ $lang->project->whitelist = 'Whitelist';
|
||||
$lang->project->totalEstimate = 'Est';
|
||||
$lang->project->totalConsumed = 'Done';
|
||||
$lang->project->totalLeft = 'Left';
|
||||
$lang->project->Left = 'Left';
|
||||
$lang->project->progess = 'Progess';
|
||||
$lang->project->viewBug = 'View bug';
|
||||
$lang->project->noProduct = 'No product';
|
||||
@@ -111,6 +112,7 @@ $lang->project->dynamic = 'Dynamic';
|
||||
$lang->project->build = 'Build';
|
||||
$lang->project->testtask = 'Testtask';
|
||||
$lang->project->burn = 'Burndown';
|
||||
$lang->project->baseline = 'Base Line';
|
||||
$lang->project->computeBurn = 'Update';
|
||||
$lang->project->burnData = 'Burndown data';
|
||||
$lang->project->team = 'Team';
|
||||
|
||||
@@ -49,6 +49,7 @@ $lang->project->whitelist = '分组白名单';
|
||||
$lang->project->totalEstimate = '总预计';
|
||||
$lang->project->totalConsumed = '总消耗';
|
||||
$lang->project->totalLeft = '总剩余';
|
||||
$lang->project->Left = '剩余';
|
||||
$lang->project->progess = '进度';
|
||||
$lang->project->viewBug = '查看bug';
|
||||
$lang->project->noProduct = '无产品项目';
|
||||
@@ -111,6 +112,7 @@ $lang->project->dynamic = '动态';
|
||||
$lang->project->build = '版本列表';
|
||||
$lang->project->testtask = '测试任务';
|
||||
$lang->project->burn = '燃尽图';
|
||||
$lang->project->baseline = '基准线';
|
||||
$lang->project->computeBurn = '更新';
|
||||
$lang->project->burnData = '燃尽图数据';
|
||||
$lang->project->team = '团队成员';
|
||||
|
||||
@@ -1535,7 +1535,7 @@ class projectModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDateList($begin, $end, $type, $interval = '')
|
||||
public function getDateList($begin, $end, $type, $interval = '', $format = 'm/d/Y')
|
||||
{
|
||||
$begin = strtotime($begin);
|
||||
$end = strtotime($end);
|
||||
@@ -1575,7 +1575,7 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
$counter = 0;
|
||||
$dateList[] = date('m/d/Y', $date);
|
||||
$dateList[] = date($format, $date);
|
||||
$date += 24 * 3600;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/chart.html.php';?>
|
||||
<?php include './taskheader.html.php';?>
|
||||
<?php js::set('projectID', $projectID);?>
|
||||
<?php js::set('type', $type);?>
|
||||
@@ -36,6 +37,31 @@
|
||||
<div class='text pull-left'><?php echo $lang->project->howToUpdateBurn;?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $charts;?>
|
||||
<canvas id='burnChart' width='800' height='400' data-bezier-curve='false' data-responsive='true'></canvas>
|
||||
<h1><?php echo $projectName . ' ' . $this->lang->project->burn;?></h1>
|
||||
</div>
|
||||
<script>
|
||||
function initBurnChar()
|
||||
{
|
||||
var data =
|
||||
{
|
||||
labels: <?php echo json_encode($chartData['labels'])?>,
|
||||
datasets: [
|
||||
{
|
||||
label: "<?php echo $lang->project->baseline;?>",
|
||||
color: "#CCC",
|
||||
fillColor: "rgba(0,0,0,0)",
|
||||
showTooltips: false,
|
||||
data: <?php echo $chartData['baseLine']?>
|
||||
},
|
||||
{
|
||||
label: "<?php echo $lang->project->Left?>",
|
||||
color: "#0033CC",
|
||||
data: <?php echo $chartData['burnLine']?>
|
||||
}]
|
||||
};
|
||||
|
||||
var burnChart = $("#burnChart").lineChart(data, {});
|
||||
}
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -1003,11 +1003,9 @@ class task extends control
|
||||
$chartOption = $this->lang->task->report->$chart;
|
||||
$this->task->mergeChartOption($chart);
|
||||
|
||||
$chartXML = $this->report->createSingleXML($chartData, $chartOption->graph);
|
||||
$this->view->charts[$chart] = $this->report->createJSChart($chartOption->swf, $chartXML, $chartOption->width, $chartOption->height);
|
||||
$this->view->datas[$chart] = $this->report->computePercent($chartData);
|
||||
}
|
||||
$this->view->renderJS = $this->report->renderJsCharts(count($this->view->charts));
|
||||
}
|
||||
|
||||
$this->project->setMenu($this->project->getPairs(), $projectID);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/chart.html.php';?>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
<span class='prefix'><?php echo html::icon($lang->icons['task']);?></span>
|
||||
@@ -44,27 +45,36 @@
|
||||
</div>
|
||||
<table class='table active-disabled'>
|
||||
<?php foreach($charts as $chartType => $chartContent):?>
|
||||
<tr valign='top'>
|
||||
<td><?php echo $chartContent;?></td>
|
||||
<td width='300'>
|
||||
<tr class='text-top'>
|
||||
<td>
|
||||
<div class='chart-wrapper text-center'>
|
||||
<h5><?php echo $lang->task->report->charts[$chartType];?></h5>
|
||||
<div class='chart-canvas'><canvas id='chart-<?php echo $chartType ?>' width='500' height='140' data-responsive='true'></canvas></div>
|
||||
</div>
|
||||
</td>
|
||||
<td style='width: 320px'>
|
||||
<?php $height = zget($lang->task->report->$chartType, 'height', $lang->story->report->options->height) . 'px'; ?>
|
||||
<div style="height:<?php echo $height;?>; overflow:auto;">
|
||||
<table class='table table-condensed table-hover table-striped table-bordered'>
|
||||
<div style="max-height:<?php echo $height;?>; overflow:auto;">
|
||||
<table class='table table-condensed table-hover table-striped table-bordered table-chart' data-chart='pie' data-target='#chart-<?php echo $chartType ?>' data-animation='false'>
|
||||
<caption class='text-left'><?php echo $lang->task->report->charts[$chartType];?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='w-20px'></th>
|
||||
<th><?php echo $lang->task->report->$chartType->item;?></th>
|
||||
<th><?php echo $lang->task->report->value;?></th>
|
||||
<th><?php echo $lang->report->percent;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($datas[$chartType] as $key => $data):?>
|
||||
<tr class='text-center'>
|
||||
<td><?php echo $data->name;?></td>
|
||||
<td><?php echo $data->value;?></td>
|
||||
<td class='chart-color'><i class='chart-color-dot icon-circle'></i></td>
|
||||
<td class='chart-label'><?php echo $data->name;?></td>
|
||||
<td class='chart-value'><?php echo $data->value;?></td>
|
||||
<td><?php echo ($data->percent * 100) . '%';?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
@@ -74,5 +84,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $renderJS;?>
|
||||
<!-- <?php echo $renderJS;?> -->
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Vendored
+9
File diff suppressed because one or more lines are too long
+4
-3
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user