repartition.phtml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php $this->partial('aside_stats'); ?>
  2. <div class="post ">
  3. <a href="<?php echo _url('index', 'index'); ?>"><?php echo _t('gen.action.back_to_rss_feeds'); ?></a>
  4. <h1><?php echo _t('admin.stats.repartition'); ?></h1>
  5. <select id="feed_select" class="select-change">
  6. <option data-url="<?php echo _url('stats', 'repartition')?>"><?php echo _t('admin.stats.all_feeds')?></option>
  7. <?php foreach ($this->categories as $category) {
  8. $feeds = $category->feeds();
  9. if (!empty($feeds)) {
  10. echo '<optgroup label="', $category->name(), '">';
  11. foreach ($feeds as $feed) {
  12. if ($this->feed && $feed->id() == $this->feed->id()){
  13. echo '<option value="', $feed->id(), '" selected="selected" data-url="', _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>';
  14. } else {
  15. echo '<option value="', $feed->id(), '" data-url="', _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>';
  16. }
  17. }
  18. echo '</optgroup>';
  19. }
  20. }?>
  21. </select>
  22. <?php if ($this->feed) {?>
  23. <a class="btn" href="<?php echo _url('subscription', 'index', 'id', $this->feed->id()); ?>">
  24. <?php echo _i('configure'); ?> <?php echo _t('gen.action.manage'); ?>
  25. </a>
  26. <?php }?>
  27. <div class="stat">
  28. <table>
  29. <tr>
  30. <th><?php echo _t('admin.stats.status_total'); ?></th>
  31. <th><?php echo _t('admin.stats.status_read'); ?></th>
  32. <th><?php echo _t('admin.stats.status_unread'); ?></th>
  33. <th><?php echo _t('admin.stats.status_favorites'); ?></th>
  34. </tr>
  35. <tr>
  36. <td class="numeric"><?php echo $this->repartition['total']; ?></td>
  37. <td class="numeric"><?php echo $this->repartition['read']; ?></td>
  38. <td class="numeric"><?php echo $this->repartition['unread']; ?></td>
  39. <td class="numeric"><?php echo $this->repartition['favorite']; ?></td>
  40. </tr>
  41. </table>
  42. </div>
  43. <div class="stat">
  44. <h2><?php echo _t('admin.stats.entry_per_hour', $this->averageHour); ?></h2>
  45. <div id="statsEntryPerHour" style="height: 300px"></div>
  46. </div>
  47. <div class="stat half">
  48. <h2><?php echo _t('admin.stats.entry_per_day_of_week', $this->averageDayOfWeek); ?></h2>
  49. <div id="statsEntryPerDayOfWeek" style="height: 300px"></div>
  50. </div><!--
  51. --><div class="stat half">
  52. <h2><?php echo _t('admin.stats.entry_per_month', $this->averageMonth); ?></h2>
  53. <div id="statsEntryPerMonth" style="height: 300px"></div>
  54. </div>
  55. </div>
  56. <script>
  57. "use strict";
  58. function initStats() {
  59. if (!window.Flotr) {
  60. if (window.console) {
  61. console.log('FreshRSS waiting for Flotr…');
  62. }
  63. window.setTimeout(initStats, 50);
  64. return;
  65. }
  66. // Entry per hour
  67. Flotr.draw(document.getElementById('statsEntryPerHour'),
  68. [{
  69. data: <?php echo $this->repartitionHour ?>,
  70. bars: {horizontal: false, show: true}
  71. }],
  72. {
  73. grid: {verticalLines: false},
  74. xaxis: {noTicks: 23,
  75. tickFormatter: function(x) {
  76. var x = parseInt(x);
  77. return x + 1;
  78. },
  79. min: -0.9,
  80. max: 23.9,
  81. tickDecimals: 0},
  82. yaxis: {min: 0},
  83. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
  84. });
  85. // Entry per day of week
  86. Flotr.draw(document.getElementById('statsEntryPerDayOfWeek'),
  87. [{
  88. data: <?php echo $this->repartitionDayOfWeek ?>,
  89. bars: {horizontal: false, show: true}
  90. }],
  91. {
  92. grid: {verticalLines: false},
  93. xaxis: {noTicks: 6,
  94. tickFormatter: function(x) {
  95. var x = parseInt(x),
  96. days = <?php echo $this->days?>;
  97. return days[x];
  98. },
  99. min: -0.9,
  100. max: 6.9,
  101. tickDecimals: 0},
  102. yaxis: {min: 0},
  103. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
  104. });
  105. // Entry per month
  106. Flotr.draw(document.getElementById('statsEntryPerMonth'),
  107. [{
  108. data: <?php echo $this->repartitionMonth ?>,
  109. bars: {horizontal: false, show: true}
  110. }],
  111. {
  112. grid: {verticalLines: false},
  113. xaxis: {noTicks: 12,
  114. tickFormatter: function(x) {
  115. var x = parseInt(x),
  116. months = <?php echo $this->months?>;
  117. return months[(x - 1)];
  118. },
  119. min: 0.1,
  120. max: 12.9,
  121. tickDecimals: 0},
  122. yaxis: {min: 0},
  123. mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
  124. });
  125. }
  126. initStats();
  127. </script>