stats.phtml 4.6 KB

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