repartition.phtml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_ViewStats $this */
  4. $this->partial('aside_subscription');
  5. $feedname = _t('admin.stats.all_feeds');
  6. ?>
  7. <nav class="nav_menu">
  8. <div id="nav_menu_toggle_aside" class="nav_mobile">
  9. <button class="btn">
  10. <?= _i('category') ?>
  11. </button>
  12. </div>
  13. <select id="feed_select" class="select-change">
  14. <option data-url="<?= _url('stats', 'repartition') ?>"><?= _t('admin.stats.all_feeds') ?></option>
  15. <?php foreach ($this->categories as $category) {
  16. $feeds = $category->feeds();
  17. if (!empty($feeds)) {
  18. echo '<optgroup label="', $category->name(), '">';
  19. foreach ($feeds as $feed) {
  20. if ($this->feed !== null && $feed->id() == $this->feed->id()) {
  21. echo '<option value="', $feed->id(), '" selected="selected" data-url="',
  22. _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>';
  23. $feedname = $feed->name();
  24. } else {
  25. echo '<option value="', $feed->id(), '" data-url="',
  26. _url('stats', 'repartition', 'id', $feed->id()), '">', $feed->name(), '</option>';
  27. }
  28. }
  29. echo '</optgroup>';
  30. }
  31. }?>
  32. </select>
  33. <?php if ($this->feed !== null) {?>
  34. <a class="btn" href="<?= _url('subscription', 'feed', 'id', $this->feed->id()) ?>">
  35. <?= _i('configure') ?> <?= _t('gen.action.manage') ?>
  36. </a>
  37. <?php }?>
  38. </nav>
  39. <main class="post">
  40. <h1><?= _t('admin.stats.repartition', $feedname) ?></h1>
  41. <div class="box double-width">
  42. <div class="box-title"><h2><?= _t('admin.stats.overview') ?></h2></div>
  43. <div class="box-content scrollbar-thin">
  44. <table>
  45. <tr>
  46. <th><?= _t('admin.stats.status_total') ?></th>
  47. <th><?= _i('read') ?> <?= _t('admin.stats.status_read') ?></th>
  48. <th><?= _i('unread') ?> <?= _t('admin.stats.status_unread') ?></th>
  49. <th><?= _i('starred') ?> <?= _t('admin.stats.status_favorites') ?></th>
  50. </tr>
  51. <tr>
  52. <?php
  53. $feedID = $this->feed !== null ? $this->feed->id() : 0;
  54. if ($feedID === 0) { ?>
  55. <td class="numeric"><?= $this->repartition['total'] ?? -1 ?></td>
  56. <td class="numeric"><?= $this->repartition['count_reads'] ?? -1 ?></td>
  57. <td class="numeric"><?= $this->repartition['count_unreads'] ?? -1 ?></td>
  58. <td class="numeric"><a href="<?= _url('index', 'index', 'get', 's') ?>" title="<?= _t('gen.action.filter') ?>"><?= $this->repartition['count_favorites'] ?? -1 ?></a></td>
  59. <?php
  60. } else {
  61. ?>
  62. <td class="numeric"><a href="<?= _url('index', 'index', 'get', 'f_' . $feedID, 'state', FreshRSS_Entry::STATE_ALL) ?>" title="<?= _t('gen.action.filter') ?>"><?= $this->repartition['total'] ?? -1 ?></a></td>
  63. <td class="numeric"><a href="<?= _url('index', 'index', 'get', 'f_' . $feedID, 'state', FreshRSS_Entry::STATE_READ) ?>" title="<?= _t('gen.action.filter') ?>"><?= $this->repartition['count_reads'] ?? -1 ?></a></td>
  64. <td class="numeric"><a href="<?= _url('index', 'index', 'get', 'f_' . $feedID, 'state', FreshRSS_Entry::STATE_NOT_READ) ?>" title="<?= _t('gen.action.filter') ?>"><?= $this->repartition['count_unreads'] ?? -1 ?></a></td>
  65. <td class="numeric"><a href="<?= _url('index', 'index', 'get', 'f_' . $feedID, 'state', FreshRSS_Entry::STATE_FAVORITE) ?>" title="<?= _t('gen.action.filter') ?>"><?= $this->repartition['count_favorites'] ?? -1 ?></a></td>
  66. <?php } ?>
  67. </tr>
  68. </table>
  69. </div>
  70. </div>
  71. <div class="box double-width double-height">
  72. <div class="box-title"><h2><?= _t('admin.stats.entry_per_hour', $this->averageHour) ?></h2></div>
  73. <div class="box-content scrollbar-thin">
  74. <canvas id="statsEntriesPerHour"></canvas>
  75. <script class="jsonData-stats" type="application/json"><?=
  76. json_encode([
  77. 'canvasID' => 'statsEntriesPerHour',
  78. 'charttype' => 'bar',
  79. 'data' => $this->repartitionHour,
  80. 'label' => _t('admin.stats.entry_count'),
  81. 'xAxisLabels' => $this->hours24Labels
  82. ], JSON_UNESCAPED_UNICODE)
  83. ?></script>
  84. </div>
  85. </div>
  86. <br />
  87. <div class="box">
  88. <div class="box-title"><h2><?= _t('admin.stats.entry_per_day_of_week', $this->averageDayOfWeek) ?></h2></div>
  89. <div class="box-content scrollbar-thin">
  90. <canvas id="statsEntriesPerDayOfWeek"></canvas>
  91. <script class="jsonData-stats" type="application/json"><?=
  92. json_encode([
  93. 'canvasID' => 'statsEntriesPerDayOfWeek',
  94. 'charttype' => 'bar',
  95. 'data' => $this->repartitionDayOfWeek,
  96. 'label' => _t('admin.stats.entry_count'),
  97. 'xAxisLabels' => $this->days,
  98. ], JSON_UNESCAPED_UNICODE)
  99. ?></script>
  100. </div>
  101. </div>
  102. <div class="box">
  103. <div class="box-title"><h2><?= _t('admin.stats.entry_per_month', $this->averageMonth) ?></h2></div>
  104. <div class="box-content scrollbar-thin">
  105. <canvas id="statsEntriesPerMonth"></canvas>
  106. <script class="jsonData-stats" type="application/json"><?=
  107. json_encode([
  108. 'canvasID' => 'statsEntriesPerMonth',
  109. 'charttype' => 'bar',
  110. 'data' => $this->repartitionMonth,
  111. 'label' => _t('admin.stats.entry_count'),
  112. 'xAxisLabels' => $this->months,
  113. ], JSON_UNESCAPED_UNICODE)
  114. ?></script>
  115. </div>
  116. </div>
  117. </main>
  118. <script src="../scripts/statsWithChartjs.js?<?= @filemtime(PUBLIC_PATH . '/scripts/statsWithChartjs.js') ?>"></script>