* Code for CFD.
This commit is contained in:
@@ -1321,23 +1321,7 @@ class execution extends control
|
||||
$this->loadModel('kanban');
|
||||
$this->app->loadClass('date');
|
||||
|
||||
$end = helper::today() > $execution->end ? $execution->end : helper::today();
|
||||
if(helper::today() > $execution->end)
|
||||
{
|
||||
if(date($execution->end, strtotime('-14 days')) > $execution->begin)
|
||||
{
|
||||
$begin = date($execution->end, strtotime('-14 days'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$begin = $execution->begin;
|
||||
}
|
||||
}
|
||||
elseif(($execution->begin < helper::today()) and (helper::today() < $execution->end))
|
||||
{
|
||||
$begin = (date('Y-m-d', strtotime('-14 days')) < $execution->begin) ? $execution->begin : date('Y-m-d', strtotime('-14 days'));
|
||||
}
|
||||
|
||||
list($begin, $end) = $this->execution->getBeginEnd4CFD($execution);
|
||||
$dateList = date::getDateList($begin, $end, 'Y-m-d', '');
|
||||
|
||||
$this->view->title = $this->lang->execution->CFD;
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
.main-content > h2 {font-size: 16px;}
|
||||
#cfdWrapper {max-width: 1400px; margin: 0 auto; padding: 25px 100px 10px; position: relative;}
|
||||
#cfdYUnit {position: absolute; color: #CBD0DB; top: 0; left: 90px;}
|
||||
#cfdXUnit {position: absolute; color: #CBD0DB; bottom: 20px; right: 60px;}
|
||||
#cfdLegend {position: absolute; right: 0; width: 80px; height: 60px; top: 50%; margin-top: -30px; line-height: 30px; color: #838A9D; font-size: 12px;}
|
||||
#cfdLegend > div {position: relative; padding-left: 30px;}
|
||||
#cfdLegend > div > .barline {position: absolute; width: 20px; left: 0; top: 13px; height: 3px; background: #EEEEEE;}
|
||||
#cfdLegend .line-real .bg-primary {background: #1183fb;}
|
||||
#cfdLegend .line-real .bg-delay {background: red;}
|
||||
#cfdYUnit {position: absolute; color: #CBD0DB; top: 27px; left: 130px;}
|
||||
#cfdXUnit {position: absolute; color: #CBD0DB; bottom: 35px; right: 60px;}
|
||||
|
||||
.pull-left .input-control {margin-right: 10px;}
|
||||
|
||||
@@ -3092,6 +3092,36 @@ class executionModel extends model
|
||||
$this->dao->replace(TABLE_BURN)->data($data)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get begin and end for CFD.
|
||||
*
|
||||
* @param object $execution
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getBeginEnd4CFD($execution)
|
||||
{
|
||||
$begin = $execution->begin;
|
||||
$end = $execution->end;
|
||||
if(helper::today() < $execution->begin)
|
||||
{
|
||||
$begin = helper::today();
|
||||
$end = helper::today();
|
||||
}
|
||||
elseif((helper::today() >= $execution->begin) and (helper::today() <= $execution->end))
|
||||
{
|
||||
$begin = (date('Y-m-d', strtotime('-14 days')) < $execution->begin) ? $execution->begin : date('Y-m-d', strtotime('-14 days'));
|
||||
$end = helper::today();
|
||||
}
|
||||
elseif((helper::today() > $execution->end))
|
||||
{
|
||||
$begin = date($execution->end, strtotime('-14 days')) > $execution->begin ? date($execution->end, strtotime('-14 days')) : $execution->begin;
|
||||
$end = $execution->end;
|
||||
}
|
||||
|
||||
return array($begin, $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get burn data for flot
|
||||
*
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php js::set('executionID', $executionID);?>
|
||||
<?php js::set('executionName', $execution->name);?>
|
||||
<?php js::set('watermark', $lang->execution->watermark);?>
|
||||
<?php js::set('cfdXUnit', $lang->execution->burnXUnit);?>
|
||||
<?php js::set('cfdYUnit', $lang->execution->burnYUnit);?>
|
||||
<?php js::import($jsRoot . 'echarts/echarts.common.min.js'); ?>
|
||||
<?php js::import($jsRoot . 'html2canvas/min.js'); ?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
@@ -35,23 +30,28 @@
|
||||
<div id='mainContent' class='main-content'>
|
||||
<h2 class='text-center'><?php echo $executionName . ' - ' . zget($lang->execution->cfdTypeList, $type) . $lang->execution->CFD;?></h2>
|
||||
<div id="cfdWrapper">
|
||||
<div id="cfdChart">
|
||||
<canvas id="cfdCanvas" width='1400' height='600'></canvas>
|
||||
</div>
|
||||
<div id="cfdChart" style="width: 1200px; height: 600px"></div>
|
||||
<div id="cfdYUnit"><?php echo $lang->execution->count;?></div>
|
||||
<div id="cfdXUnit"><?php echo $lang->execution->burnXUnit;?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if(!empty($chartData)):?>
|
||||
<script>
|
||||
var series = [];
|
||||
var colors = ['#33B4DB', '#7ECF69', '#FFC73A', '#FF5A61', '#50C8D0', '#AF5AFF', '#4EA3FF', '#6C73FF', '#FF8C5A'];
|
||||
var i = 0;
|
||||
var i = 0;
|
||||
var series = [];
|
||||
var colors = ['#33B4DB', '#7ECF69', '#FFC73A', '#FF5A61', '#50C8D0', '#AF5AFF', '#4EA3FF', '#FF8C5A', '#6C73FF'];
|
||||
//var background = ['#E1F4FA', '#ECF8E9', '#FFF7E2', '#FFE7E8', '#E5F7F8', '#F3E7FF', '#E5F1FF', '#FFEEE7', '#E9EAFF'];
|
||||
|
||||
<?php foreach($chartData['line'] as $label => $set):?>
|
||||
series.push({
|
||||
name: '<?php echo $label;?>',
|
||||
type: 'line',
|
||||
stack: 'Total',
|
||||
areaStyle: {},
|
||||
color: colors[i],
|
||||
areaStyle: {
|
||||
color: colors[i],
|
||||
opacity: 0.2
|
||||
},
|
||||
emphasis: {
|
||||
focus: 'series'
|
||||
},
|
||||
@@ -60,8 +60,8 @@ series.push({
|
||||
i ++;
|
||||
<?php endforeach;?>
|
||||
|
||||
var chartDom = document.getElementById('cfdCanvas');
|
||||
var myChart = echarts.init(chartDom);
|
||||
var chartDom = document.getElementById('cfdChart');
|
||||
var CFD = echarts.init(chartDom);
|
||||
var option;
|
||||
|
||||
option = {
|
||||
@@ -75,12 +75,7 @@ option = {
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
|
||||
},
|
||||
toolbox: {
|
||||
feature: {
|
||||
saveAsImage: {}
|
||||
}
|
||||
data: <?php echo json_encode(array_keys($chartData['line']));?>
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
@@ -103,8 +98,12 @@ option = {
|
||||
series: series,
|
||||
};
|
||||
|
||||
option && myChart.setOption(option);
|
||||
option && CFD.setOption(option);
|
||||
window.addEventListener('resize', CFD.resize);
|
||||
</script>
|
||||
<?php endif;?>
|
||||
|
||||
<script>
|
||||
$('#type').change(function()
|
||||
{
|
||||
location.href = createLink('execution', 'cfd', 'executionID=' + executionID + '&type=' + $(this).val());
|
||||
|
||||
Reference in New Issue
Block a user