<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
	if(!$module->roleid_check('pe',$_roleid))showmsg_nourl($lang['RETURN_NOPRI']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<head>
<title>后台编辑绩效考核参考统计图</title>
<link rel="stylesheet" type="text/css" href="admin/template/css/style.css" />
<style type="text/css">
	body, input, select{font-size:12px; margin:0px; padding:0px}
</style>
<script type="text/javascript" src="pe/admin/template/js/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript" src="pe/admin/template/js/highcharts.js" charset="utf-8"></script>
<script language="javascript" type="text/javascript">
	$(document).ready(function(){
		$('#year').val(<?php echo isset($y)?$y:date('Y');?>);
		$('#month').val(<?php echo isset($m)?$m:date('m');?>);
	});
	var nums=new Array();
	<?php
	foreach($series as $author => $_series)
	{
		echo 'nums["'.$author.'"]=new Array();'."\n";
		foreach($_series['data'] as $day => $clicks)
		{
			echo 'nums["'.$author.'"]['.$day.']='.intval($clicks).';'."\n";
		}
	}
	?>
	
	var clicks=new Array();
	<?php
	foreach($series as $author => $_series)
	{
		echo 'clicks["'.$author.'"]=new Array();'."\n";
		foreach($_series['clicks'] as $day => $clicks)
		{
			echo 'clicks["'.$author.'"]['.$day.']='.intval($clicks).';'."\n";
		}
	}
	?>
	var chart;
	$(document).ready(function() {
		chart = new Highcharts.Chart({
			chart: {
				renderTo: 'container',
				defaultSeriesType: 'spline'
			},
			title: {
				text: '<?php echo SITE_NAME;?> 后台编辑日发帖数量统计报表（<?php echo $y;?>年<?php echo $m;?>月份）'
			},
			xAxis: {
				categories: [<?php echo implode(',',$month);?>]
			},
			yAxis: {
				title: {
					text: '日发帖量(篇)'
				}
			},
			tooltip: {
						formatter: function() {
							return '编辑 '+this.series.name+' <?php echo $y;?>年<?php echo $m;?>月'+
								this.x+'号当日总发帖量：'+ nums[this.series.name][this.x] +'篇 ，总点击量: '+ clicks[this.series.name][this.x] +'次';
						}
					},
			plotOptions: {
				line: {
					dataLabels: {
						enabled: true
					},
					enableMouseTracking: false
				}
			},
			series: [
			<?php
				foreach($series as $_r)
				{
			?>
			{
				name: '<?php echo $_r['name'];?>',
				data: [<?php echo implode(',',$_r['data']);?>]
			},
			<?php
				}
			?>
			]
		});
		
		
	});
		
</script>

</head>
<body>
<div id="wrap">
	<div class="tab">
		<ul>
			<li><a href="?mod=pe&file=index&action=table">表格报表</a></li>
			<li><a href="?mod=pe&file=index&action=k" class="on">K线报表</a></li>			
		</ul>
	</div>
	<div class="main">
		<div style="width: 90%; height: 98%; margin: 0 auto; margin-top:10px">
		请选择要查看的年份：
		<select name="year" id="year">
			<?php
				for($i=2011;$i<=date('Y');$i++)
				{
			?>
			<option value="<?php echo $i;?>"><?php echo $i;?>年</option>
			<?php
				}
			?>
		</select>
		月份：
		<select name="month" id="month" onchange="self.location.href='<?php echo ADMIN_FILE;?>?mod=pe&file=index&y='+$('#year').val()+'&m='+$('#month').val()">
			<?php
				
				for($i=1;$i<=(!isset($y) || $y==date('Y')?date('m'):12);$i++)
				{
			?>
			<option value="<?php echo $i;?>"><?php echo $i;?>月</option>
			<?php
				}
			?>
		</select>
		</div>
		<div id="container" style="width: 98%; height:500px; margin: 0 auto; margin-top:10px"></div>	
	</div>	
</div>		
</body>
</html>