main.phtml 4.7 KB

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