stats.phtml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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><?php echo $this->repartition['main_stream']['total']?></td>
  18. <td><?php echo $this->repartition['all_feeds']['total']?></td>
  19. </tr>
  20. <tr>
  21. <th><?php echo Minz_Translate::t ('status_read')?></th>
  22. <td><?php echo $this->repartition['main_stream']['read']?></td>
  23. <td><?php echo $this->repartition['all_feeds']['read']?></td>
  24. </tr>
  25. <tr>
  26. <th><?php echo Minz_Translate::t ('status_unread')?></th>
  27. <td><?php echo $this->repartition['main_stream']['unread']?></td>
  28. <td><?php echo $this->repartition['all_feeds']['unread']?></td>
  29. </tr>
  30. <tr>
  31. <th><?php echo Minz_Translate::t ('status_favorites')?></th>
  32. <td><?php echo $this->repartition['main_stream']['favorite']?></td>
  33. <td><?php echo $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>
  53. <script>
  54. "use strict";
  55. function initStats() {
  56. if (!window.Flotr) {
  57. if (window.console) {
  58. console.log('FreshRSS waiting for Flotr…');
  59. }
  60. window.setTimeout(initStats, 50);
  61. return;
  62. }
  63. // Entry per day
  64. Flotr.draw(document.getElementById('statsEntryPerDay'),
  65. [<?php echo $this->count ?>],
  66. {
  67. grid: {verticalLines: false},
  68. bars: {horizontal: false, show: true},
  69. xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0},
  70. yaxis: {min: 0},
  71. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.y;}}
  72. });
  73. // Feed per category
  74. Flotr.draw(document.getElementById('statsFeedPerCategory'),
  75. <?php echo $this->feedByCategory ?>,
  76. {
  77. grid: {verticalLines: false, horizontalLines: false},
  78. pie: {explode: 10, show: true, labelFormatter: function(){return '';}},
  79. xaxis: {showLabels: false},
  80. yaxis: {showLabels: false},
  81. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ obj.y + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}},
  82. legend: {container: document.getElementById('statsFeedPerCategoryLegend'), noColumns: 3}
  83. });
  84. // Entry per category
  85. Flotr.draw(document.getElementById('statsEntryPerCategory'),
  86. <?php echo $this->entryByCategory ?>,
  87. {
  88. grid: {verticalLines: false, horizontalLines: false},
  89. pie: {explode: 10, show: true, labelFormatter: function(){return '';}},
  90. xaxis: {showLabels: false},
  91. yaxis: {showLabels: false},
  92. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ obj.y + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}},
  93. legend: {container: document.getElementById('statsEntryPerCategoryLegend'), noColumns: 3}
  94. });
  95. }
  96. initStats();
  97. </script>