repartition.phtml 2.8 KB

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