You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.5 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
  1. <?=$this->site->add_js("https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js")?>
  2. <?=$this->site->add_js("https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js")?>
  3. <div class="page-header">
  4. <h1 class="page-title">유입경로별 접속 통계</h1>
  5. </div>
  6. <?=form_open(NULL, array('method'=>'get','class'=>'form-flex','autocomplete'=>'off'))?>
  7. <div data-ax-tbl class="ax-search-tbl">
  8. <div data-ax-tr>
  9. <div data-ax-td>
  10. <div data-ax-td-label>일자 검색</div>
  11. <div data-ax-td-wrap>
  12. <input class="form-control" name="startdate" data-toggle="datepicker" value="<?=$startdate?>">
  13. </div>
  14. <div data-ax-td-wrap>
  15. <input class="form-control" name="enddate" data-toggle="datepicker" value="<?=$enddate?>">
  16. </div>
  17. </div>
  18. <div data-ax-td>
  19. <div data-ax-td-wrap>
  20. <button class="btn btn-sm btn-default"><i class="far fa-search"></i> 필터적용</button>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. <?=form_close()?>
  26. <div class="H10"></div>
  27. <div class="row">
  28. <div class="col-sm-6">
  29. <div style="max-width:400px;margin:auto">
  30. <h4 class="text-center">유입경로별 접속 통계</h4>
  31. <canvas id="chart-browser" width="200" height="200"></canvas>
  32. </div>
  33. </div>
  34. <div class="col-sm-6">
  35. <div class="grid">
  36. <table>
  37. <thead>
  38. <tr>
  39. <th>키워드</th>
  40. <th>접속수</th>
  41. </tr>
  42. </thead>
  43. <tbody>
  44. <?php foreach($statics['list'] as $row):?>
  45. <tr>
  46. <td class="text-center"><?=$row['sta_referrer_host']?></td>
  47. <td class="text-right"><?=number_format($row['count'])?> (<?=$statics['total']>0? round($row['count']/$statics['total']*100,2):0?>%)</td>
  48. </tr>
  49. <?php endforeach;?>
  50. <?php if(count($statics['list']) == 0):?>
  51. <tr>
  52. <td class="empty" colspan="2">접속 기록이 없습니다.</td>
  53. </tr>
  54. <?php endif;?>
  55. </tbody>
  56. <tfoot>
  57. <tr>
  58. <td class="text-center">TOTAL</td>
  59. <td class="text-right"><?=number_format($statics['total'])?></td>
  60. </tr>
  61. </tfoot>
  62. </table>
  63. </div>
  64. </div>
  65. </div>
  66. <script>
  67. $(function(){
  68. var $chart = $("#chart-browser");
  69. var chart_data = <?=$statics['counts']?>;
  70. var chart = new Chart($chart, {
  71. type: 'pie',
  72. data: {
  73. labels: <?=$statics['sta_referrer_host']?>,
  74. datasets: [{
  75. label : '# %',
  76. data: chart_data,
  77. backgroundColor : randomColorGenerator(chart_data.length)
  78. }]
  79. },
  80. options : {
  81. animation : {
  82. animateScale:true
  83. },
  84. legend: {
  85. labels : {
  86. fontColor : '#fff'
  87. }
  88. }
  89. }
  90. });
  91. });
  92. var randomColorGenerator = function (count) {
  93. var ret = [];
  94. for(i=0; i<count;i++)
  95. {
  96. ret.push( '#' + (Math.random().toString(16) + '0000000').slice(2, 8) );
  97. }
  98. return ret;
  99. };
  100. </script>