repartition.phtml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /** @var FreshRSS_View $this */
  3. $this->partial('aside_subscription');
  4. ?>
  5. <main class="post ">
  6. <div class="link-back-wrapper">
  7. <a class="link-back" href="<?= _url('index', 'index') ?>"><?= _t('gen.action.back_to_rss_feeds') ?></a>
  8. </div>
  9. <h1><?= _t('admin.stats.repartition') ?></h1>
  10. <select id="feed_select" class="select-change">
  11. <option data-url="<?= _url('stats', 'repartition') ?>"><?= _t('admin.stats.all_feeds') ?></option>
  12. <?php foreach ($this->categories as $category) {
  13. $feeds = $category->feeds();
  14. if (!empty($feeds)) {
  15. echo '<optgroup label="', $category->name(), '">';
  16. foreach ($feeds as $feed) {
  17. if ($this->feed && $feed->id() == $this->feed->id()) {
  18. echo '<option value="', $feed->id(), '" selected="selected" data-url="',
  19. _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>';
  20. } else {
  21. echo '<option value="', $feed->id(), '" data-url="',
  22. _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>';
  23. }
  24. }
  25. echo '</optgroup>';
  26. }
  27. }?>
  28. </select>
  29. <?php if ($this->feed) {?>
  30. <a class="btn" href="<?= _url('subscription', 'index', 'id', $this->feed->id()) ?>">
  31. <?= _i('configure') ?> <?= _t('gen.action.manage') ?>
  32. </a>
  33. <?php }?>
  34. <div class="stat-grid">
  35. <div class="stat">
  36. <table>
  37. <tr>
  38. <th><?= _t('admin.stats.status_total') ?></th>
  39. <th><?= _t('admin.stats.status_read') ?></th>
  40. <th><?= _t('admin.stats.status_unread') ?></th>
  41. <th><?= _t('admin.stats.status_favorites') ?></th>
  42. </tr>
  43. <tr>
  44. <td class="numeric"><?= $this->repartition['total'] ?></td>
  45. <td class="numeric"><?= $this->repartition['count_reads'] ?></td>
  46. <td class="numeric"><?= $this->repartition['count_unreads'] ?></td>
  47. <td class="numeric"><?= $this->repartition['count_favorites'] ?></td>
  48. </tr>
  49. </table>
  50. </div>
  51. <div class="stat">
  52. <h2><?= _t('admin.stats.entry_per_hour', $this->averageHour) ?></h2>
  53. <div>
  54. <canvas id="statsEntriesPerHour"></canvas>
  55. <script class="jsonData-stats" type="application/json">
  56. <?php
  57. echo json_encode(array(
  58. 'canvasID' => 'statsEntriesPerHour',
  59. 'charttype' => 'bar',
  60. 'data' => $this->repartitionHour,
  61. 'label' => _t('admin.stats.entry_count'),
  62. 'xAxisLabels' => $this->hours24Labels
  63. ), JSON_UNESCAPED_UNICODE);
  64. ?></script>
  65. </div>
  66. </div>
  67. <div class="stat half">
  68. <h2><?= _t('admin.stats.entry_per_day_of_week', $this->averageDayOfWeek) ?></h2>
  69. <div>
  70. <canvas id="statsEntriesPerDayOfWeek"></canvas>
  71. <script class="jsonData-stats" type="application/json">
  72. <?php
  73. echo json_encode(array(
  74. 'canvasID' => 'statsEntriesPerDayOfWeek',
  75. 'charttype' => 'bar',
  76. 'data' => $this->repartitionDayOfWeek,
  77. 'label' => _t('admin.stats.entry_count'),
  78. 'xAxisLabels' => $this->days,
  79. ), JSON_UNESCAPED_UNICODE);
  80. ?></script>
  81. </div>
  82. </div>
  83. <div class="stat half">
  84. <h2><?= _t('admin.stats.entry_per_month', $this->averageMonth) ?></h2>
  85. <div>
  86. <canvas id="statsEntriesPerMonth"></canvas>
  87. <script class="jsonData-stats" type="application/json">
  88. <?php
  89. echo json_encode(array(
  90. 'canvasID' => 'statsEntriesPerMonth',
  91. 'charttype' => 'bar',
  92. 'data' => $this->repartitionMonth,
  93. 'label' => _t('admin.stats.entry_count'),
  94. 'xAxisLabels' => $this->months,
  95. ), JSON_UNESCAPED_UNICODE);
  96. ?></script>
  97. </div>
  98. </div>
  99. </div>
  100. </main>
  101. <script src="../scripts/statsWithChartjs.js?<?= @filemtime(PUBLIC_PATH . '/scripts/statsWithChartjs.js') ?>"></script>