repartition.phtml 3.5 KB

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