repartition.phtml 3.6 KB

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