
<div class="content_wrapper">
<style>
    .btn-name {
        white-space: nowrap;
    }
</style>
    <div class="container-fluid">
        <div id="msg-tip"></div>
        <aside>
            <header><i class="fa fa-fw fa-file"></i>活动类型</header>
            <section>
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-sm-6">
                            <a style="margin:5px;" class="btn btn-primary" href="javascript:;" role="button"><?php echo $config['name'];?></a>
                            
                        </div>
                        
                    </div>
                    <?php if($config['type'] == 'rank'){ ?>
                        <div class="row">
	                        <form class="form-inline" role="form" method="POST" action="<?php echo "/#activitysta/rank/{$config['id']}"; ?>" >
			                    <span class="gap"></span>
			                    
			                    <div class="form-group">
			                        <label>查询玩家排名:</label>
			                        
			                        <input type="text" class="form-control" value="<?php if($uid) echo $uid;?>" placeholder="uid" name="uid" />
			                    </div>
			                    <span class="gap"></span>
			                    <button type="submit" class="btn btn-primary" id="query">查询排名</button>
			                    <span class="gap"></span>
			                </form>
		            	</div>
                        <?php } ?>
                </div>
            </section>
        </aside>
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>活动数据</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-2">
                                    <div class="table-responsive">
                                        <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th>记录每天(点击日期导出UID)</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                            if(is_array($date)  && !empty($date)){
                                                foreach ($date as $key => $vl) { ?>
                                                    <tr>
                                                        <td><a href="/activitysta/exportUid/<?php echo $config['id']; ?>/<?php echo $vl;?>/1"><?php echo $vl;?></a></td>
                                                    </tr>
                                                <?php }
                                            } else{?>
                                                <tr>
                                                    <td colspan="10">暂无数据</td>
                                                </tr>
                                            <?php } ?>
                                            </tbody>
                                        </table>
                                        <table class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th>记录结束(点击日期导出UID)</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                            if(is_array($dateEnd)  && !empty($dateEnd)){
                                                foreach ($dateEnd as $key => $vl) { ?>
                                                    <tr>
                                                        <td><a href="/activitysta/exportUid/<?php echo $config['id']; ?>/<?php echo $vl;?>/2"><?php echo $vl;?></a></td>
                                                    </tr>
                                                <?php }
                                            } else{?>
                                                <tr>
                                                    <td colspan="10">暂无数据</td>
                                                </tr>
                                            <?php } ?>
                                            </tbody>
                                        </table>
                                    </div>
                                   
                                </div>
                                
                                <?php foreach($stage as $rid => $row){ ?>
                                <div class="col-sm-10 <?php echo $rid==1?"":"col-sm-offset-2";?>">
                                    <aside>
                                        <header><i class="fa fa-fw fa-file"></i>数值分布 - 每天</header>
                                        <section>
                                            <div class="container-fluid">
                                                <div class="row">
                                                    <div id="progres<?php echo $rid;?>" style="min-width: 310px; height: 500px; margin: 0 auto"></div>
                                                </div>
                                            </div>
                                        </section>
                                    </aside>
                                </div>
                                
                                <div class="col-sm-10 col-sm-offset-2">
                                    <aside>
                                        <header><i class="fa fa-fw fa-file"></i>数值分布 - 结束</header>
                                        <section>
                                            <div class="container-fluid">
                                                <div class="row">
                                                    <div id="progresEnd<?php echo $rid;?>" style="min-width: 310px; height: 500px; margin: 0 auto"></div>
                                                </div>
                                            </div>
                                        </section>
                                    </aside>
                                </div>
                                
                                
                                <div class="col-sm-10 col-sm-offset-2">
                                    <aside>
                                        <header><i class="fa fa-fw fa-file"></i>进度分布 - 每天</header>
                                        <section>
                                            <div class="container-fluid">
                                                <div class="row">
                                                    <div id="data<?php echo $rid;?>" style="min-width: 310px; height: 500px; margin: 0 auto"></div>
                                                </div>
                                            </div>
                                        </section>
                                    </aside>
                                </div>
                                
                                <div class="col-sm-10 col-sm-offset-2">
                                    <aside>
                                        <header><i class="fa fa-fw fa-file"></i>进度分布 - 结束</header>
                                        <section>
                                            <div class="container-fluid">
                                                <div class="row">
                                                    <div id="dataEnd<?php echo $rid;?>" style="min-width: 310px; height: 500px; margin: 0 auto"></div>
                                                </div>
                                            </div>
                                        </section>
                                    </aside>
                                </div>
                               <? } ?>
                                
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>
</div>


<script src="<?php echo base_url();?>public/js/common.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/highcharts.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/exporting.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/highcharts/modules/export-data.js"></script>
<script type="text/javascript">
	//设置图表导出格式选项
	Highcharts.setOptions({
	    lang: {
	        printChart: '打印图表',
	        downloadJPEG: '下载 JPEG 文件',
	        downloadPDF: '下载 PDF   文件',
	        downloadPNG: '下载 PNG  文件',
	        downloadSVG: '下载 SVG  文件',
	        downloadCSV: '下载 CSV  文件',
	        downloadXLS: '下载 XLS   文件',
	        viewData: '查看数据表格'
	    },
	    navigation: {
	        menuItemStyle: {
	            padding: '6px 14px'
	        }
	    },
	    exporting: {
	        url: ''
	    },
	    credits: {
	        text: '',
	        url: ''
	    }
	});
	
	<?php foreach($stage as $rid => $row){ ?>
    Highcharts.chart('data<?php echo $rid;?>', {
        chart: {
            type: 'line'
        },
        title: {
            text: '配置<?php echo $rid;?>进度分布 - 每天'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php echo implode(",", $row);?>]
        },
        yAxis: {
            title: {
                text: '人数'
            }
        },
        tooltip: {
            formatter: function () {
                return '<br/>小于等于'+this.x+'<br/>' +
                    '人数: ' + this.y;
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
        	<?php foreach($date as $day){ ?>
        	{
            name: '<?php echo $day; ?>',
            data: [<?php 
            	foreach($row as $val){
            		if(empty($data[$day][$rid][$val])){
            			echo "0,";
            		}else{
            			echo $data[$day][$rid][$val].",";
            		}
            	}
            ?>
            
            ]
        },
        <?php } ?>
        ]
    });

    Highcharts.chart('dataEnd<?php echo $rid;?>', {
        chart: {
            type: 'line'
        },
        title: {
            text: '配置<?php echo $rid;?>进度分布 - 结束'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php echo implode(",", $row);?>]
        },
        yAxis: {
            title: {
                text: '人数'
            }
        },
        tooltip: {
            formatter: function () {
                return '<br/>小于等于'+this.x+'<br/>' +
                    '人数: ' + this.y;
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
        	<?php foreach($dateEnd as $day){ ?>
	        	{
	            name: '<?php echo $day; ?>',
	            data: [<?php 
	            	foreach($row as $val){
	            		if(empty($dataEnd[$day][$rid][$val])){
	            			echo "0,";
	            		}else{
	            			echo $dataEnd[$day][$rid][$val].",";
	            		}
	            	}
	            ?>
	            
	            ]
	        },
	        <?php } ?>	
        ]
    });
    
    
    Highcharts.chart('progres<?php echo $rid;?>', {
        chart: {
            type: 'line'
        },
        title: {
            text: '配置<?php echo $rid;?>数值分布 - 每天'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php echo implode(",", $Interval);?>]
        },
        yAxis: {
            title: {
                text: '人数'
            }
        },
        tooltip: {
            formatter: function () {
                return '<br/>小于等于'+this.x+'<br/>' +
                    '人数: ' + this.y;
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
        	<?php foreach($date as $day){ ?>
        	{
            name: '<?php echo $day; ?>',
            data: [<?php 
            	foreach($Interval as $val){
            		if(empty($progressData[$day][$rid][$val])){
            			echo "0,";
            		}else{
            			echo $progressData[$day][$rid][$val].",";
            		}
            	}
            ?>
            
            ]
        },
        <?php } ?>
        ]
    });
    
    Highcharts.chart('progresEnd<?php echo $rid;?>', {
        chart: {
            type: 'line'
        },
        title: {
            text: '配置<?php echo $rid;?>数值分布 - 结束'
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: [<?php echo implode(",", $Interval);?>]
        },
        yAxis: {
            title: {
                text: '人数'
            }
        },
        tooltip: {
            formatter: function () {
                return '<br/>小于等于'+this.x+'<br/>' +
                    '人数: ' + this.y;
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [
        	<?php foreach($dateEnd as $day){ ?>
        	{
            name: '<?php echo $day; ?>',
            data: [<?php 
            	foreach($Interval as $val){
            		if(empty($progressDataEnd[$day][$rid][$val])){
            			echo "0,";
            		}else{
            			echo $progressDataEnd[$day][$rid][$val].",";
            		}
            	}
            ?>
            
            ]
        },
        <?php } ?>
        ]
    });
    
    <?php } ?>
</script>