repartition.phtml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php $this->partial('aside_stats'); ?>
  2. <div class="post content">
  3. <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('back_to_rss_feeds'); ?></a>
  4. <?php if ($this->feed) {?>
  5. <h1>
  6. <?php echo _t('stats_repartition'), " - "; ?>
  7. <a href="<?php echo _url('configure', 'feed', 'id', $this->feed->id()); ?>">
  8. <?php echo $this->feed->name(); ?>
  9. </a>
  10. </h1>
  11. <?php } else {?>
  12. <h1><?php echo _t('stats_repartition'); ?></h1>
  13. <?php }?>
  14. <div class="stat">
  15. <h2><?php echo _t('stats_entry_per_hour'); ?></h2>
  16. <div id="statsEntryPerHour" style="height: 300px"></div>
  17. </div>
  18. <div class="stat">
  19. <h2><?php echo _t('stats_entry_per_day_of_week'); ?></h2>
  20. <div id="statsEntryPerDayOfWeek" style="height: 300px"></div>
  21. </div>
  22. <div class="stat">
  23. <h2><?php echo _t('stats_entry_per_month'); ?></h2>
  24. <div id="statsEntryPerMonth" style="height: 300px"></div>
  25. </div>
  26. </div>
  27. <script>
  28. "use strict";
  29. function initStats() {
  30. if (!window.Flotr) {
  31. if (window.console) {
  32. console.log('FreshRSS waiting for Flotr…');
  33. }
  34. window.setTimeout(initStats, 50);
  35. return;
  36. }
  37. // Entry per hour
  38. Flotr.draw(document.getElementById('statsEntryPerHour'),
  39. [<?php echo $this->repartitionHour ?>],
  40. {
  41. grid: {verticalLines: false},
  42. bars: {horizontal: false, show: true},
  43. xaxis: {noTicks: 23,
  44. tickFormatter: function(x) {
  45. var x = parseInt(x);
  46. return x + 1;
  47. },
  48. min: -0.9,
  49. max: 23.9,
  50. tickDecimals: 0},
  51. yaxis: {min: 0},
  52. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
  53. });
  54. // Entry per day of week
  55. Flotr.draw(document.getElementById('statsEntryPerDayOfWeek'),
  56. [<?php echo $this->repartitionDayOfWeek ?>],
  57. {
  58. grid: {verticalLines: false},
  59. bars: {horizontal: false, show: true},
  60. xaxis: {noTicks: 6,
  61. tickFormatter: function(x) {
  62. var x = parseInt(x),
  63. days = <?php echo $this->days?>;
  64. return days[x];
  65. },
  66. min: -0.9,
  67. max: 6.9,
  68. tickDecimals: 0},
  69. yaxis: {min: 0},
  70. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
  71. });
  72. // Entry per month
  73. Flotr.draw(document.getElementById('statsEntryPerMonth'),
  74. [<?php echo $this->repartitionMonth ?>],
  75. {
  76. grid: {verticalLines: false},
  77. bars: {horizontal: false, show: true},
  78. xaxis: {noTicks: 12,
  79. tickFormatter: function(x) {
  80. var x = parseInt(x),
  81. months = <?php echo $this->months?>;
  82. return months[(x - 1)];
  83. },
  84. min: 0.1,
  85. max: 12.9,
  86. tickDecimals: 0},
  87. yaxis: {min: 0},
  88. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
  89. });
  90. }
  91. initStats();
  92. </script>