index.phtml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php $this->partial('aside_stats'); ?>
  2. <div class="post">
  3. <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a>
  4. <h1><?php echo _t('admin.stats.main'); ?></h1>
  5. <div class="stat half">
  6. <h2><?php echo _t('admin.stats.entry_repartition'); ?></h2>
  7. <table>
  8. <thead>
  9. <tr>
  10. <th> </th>
  11. <th><?php echo _t('admin.stats.main_stream'); ?></th>
  12. <th><?php echo _t('admin.stats.all_feeds'); ?></th>
  13. </tr>
  14. </thead>
  15. <tbody>
  16. <tr>
  17. <th><?php echo _t('admin.stats.status_total'); ?></th>
  18. <td class="numeric"><?php echo format_number($this->repartition['main_stream']['total']); ?></td>
  19. <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['total']); ?></td>
  20. </tr>
  21. <tr>
  22. <th><?php echo _t('admin.stats.status_read'); ?></th>
  23. <td class="numeric"><?php echo format_number($this->repartition['main_stream']['read']); ?></td>
  24. <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['read']); ?></td>
  25. </tr>
  26. <tr>
  27. <th><?php echo _t('admin.stats.status_unread'); ?></th>
  28. <td class="numeric"><?php echo format_number($this->repartition['main_stream']['unread']); ?></td>
  29. <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['unread']); ?></td>
  30. </tr>
  31. <tr>
  32. <th><?php echo _t('admin.stats.status_favorites'); ?></th>
  33. <td class="numeric"><?php echo format_number($this->repartition['main_stream']['favorite']); ?></td>
  34. <td class="numeric"><?php echo format_number($this->repartition['all_feeds']['favorite']); ?></td>
  35. </tr>
  36. </tbody>
  37. </table>
  38. </div><!--
  39. --><div class="stat half">
  40. <h2><?php echo _t('admin.stats.top_feed'); ?></h2>
  41. <table>
  42. <thead>
  43. <tr>
  44. <th><?php echo _t('admin.stats.feed'); ?></th>
  45. <th><?php echo _t('admin.stats.category'); ?></th>
  46. <th><?php echo _t('admin.stats.entry_count'); ?></th>
  47. <th><?php echo _t('admin.stats.percent_of_total'); ?></th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <?php foreach ($this->topFeed as $feed) { ?>
  52. <tr>
  53. <td><a href="<?php echo _url('stats', 'repartition', 'id', $feed['id']); ?>"><?php echo $feed['name']; ?></a></td>
  54. <td><?php echo $feed['category']; ?></td>
  55. <td class="numeric"><?php echo format_number($feed['count']); ?></td>
  56. <td class="numeric"><?php echo format_number($feed['count'] / $this->repartition['all_feeds']['total'] * 100, 1);?></td>
  57. </tr>
  58. <?php } ?>
  59. </tbody>
  60. </table>
  61. </div>
  62. <div class="stat">
  63. <h2><?php echo _t('admin.stats.entry_per_day'); ?></h2>
  64. <div id="statsEntryPerDay" style="height: 300px"></div>
  65. </div>
  66. <div class="stat half">
  67. <h2><?php echo _t('admin.stats.feed_per_category'); ?></h2>
  68. <div id="statsFeedPerCategory" style="height: 300px"></div>
  69. <div id="statsFeedPerCategoryLegend"></div>
  70. </div><!--
  71. --><div class="stat half">
  72. <h2><?php echo _t('admin.stats.entry_per_category'); ?></h2>
  73. <div id="statsEntryPerCategory" style="height: 300px"></div>
  74. <div id="statsEntryPerCategoryLegend"></div>
  75. </div>
  76. </div>
  77. <script>
  78. "use strict";
  79. function initStats() {
  80. if (!window.Flotr) {
  81. if (window.console) {
  82. console.log('FreshRSS waiting for Flotr…');
  83. }
  84. window.setTimeout(initStats, 50);
  85. return;
  86. }
  87. // Entry per day
  88. var avg = [];
  89. for (var i = -31; i <= 0; i++) {
  90. avg.push([i, <?php echo $this->average?>]);
  91. }
  92. Flotr.draw(document.getElementById('statsEntryPerDay'),
  93. [{
  94. data: <?php echo $this->count ?>,
  95. bars: {horizontal: false, show: true}
  96. },{
  97. data: avg,
  98. lines: {show: true},
  99. label: "<?php echo $this->average?>"
  100. }],
  101. {
  102. grid: {verticalLines: false},
  103. xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0, min: -30.75, max: -0.25},
  104. yaxis: {min: 0},
  105. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
  106. });
  107. // Feed per category
  108. Flotr.draw(document.getElementById('statsFeedPerCategory'),
  109. <?php echo $this->feedByCategory ?>,
  110. {
  111. grid: {verticalLines: false, horizontalLines: false},
  112. pie: {explode: 10, show: true, labelFormatter: function(){return '';}},
  113. xaxis: {showLabels: false},
  114. yaxis: {showLabels: false},
  115. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}},
  116. legend: {container: document.getElementById('statsFeedPerCategoryLegend'), noColumns: 3}
  117. });
  118. // Entry per category
  119. Flotr.draw(document.getElementById('statsEntryPerCategory'),
  120. <?php echo $this->entryByCategory ?>,
  121. {
  122. grid: {verticalLines: false, horizontalLines: false},
  123. pie: {explode: 10, show: true, labelFormatter: function(){return '';}},
  124. xaxis: {showLabels: false},
  125. yaxis: {showLabels: false},
  126. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}},
  127. legend: {container: document.getElementById('statsEntryPerCategoryLegend'), noColumns: 3}
  128. });
  129. }
  130. initStats();
  131. </script>