index.phtml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. /** @var FreshRSS_ViewStats $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.main') ?></h1>
  10. <div class="stat-grid">
  11. <div class="stat half">
  12. <h2><?= _t('admin.stats.entry_repartition') ?></h2>
  13. <div class="table-wrapper scrollbar-thin">
  14. <table>
  15. <thead>
  16. <tr>
  17. <th> </th>
  18. <th><?= _t('admin.stats.main_stream') ?></th>
  19. <th><?= _t('admin.stats.all_feeds') ?></th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. <tr>
  24. <th><?= _t('admin.stats.status_total') ?></th>
  25. <td class="numeric"><?= format_number($this->repartitions['main_stream']['total'] ?? -1) ?></td>
  26. <td class="numeric"><?= format_number($this->repartitions['all_feeds']['total'] ?? -1) ?></td>
  27. </tr>
  28. <tr>
  29. <th><?= _t('admin.stats.status_read') ?></th>
  30. <td class="numeric"><?= format_number($this->repartitions['main_stream']['count_reads'] ?? -1) ?></td>
  31. <td class="numeric"><?= format_number($this->repartitions['all_feeds']['count_reads'] ?? -1) ?></td>
  32. </tr>
  33. <tr>
  34. <th><?= _t('admin.stats.status_unread') ?></th>
  35. <td class="numeric"><?= format_number($this->repartitions['main_stream']['count_unreads'] ?? -1) ?></td>
  36. <td class="numeric"><?= format_number($this->repartitions['all_feeds']['count_unreads'] ?? -1) ?></td>
  37. </tr>
  38. <tr>
  39. <th><?= _t('admin.stats.status_favorites') ?></th>
  40. <td class="numeric"><?= format_number($this->repartitions['main_stream']['count_favorites'] ?? -1) ?></td>
  41. <td class="numeric"><?= format_number($this->repartitions['all_feeds']['count_favorites'] ?? -1) ?></td>
  42. </tr>
  43. </tbody>
  44. </table>
  45. </div>
  46. </div>
  47. <div class="stat half">
  48. <h2><?= _t('admin.stats.top_feed') ?></h2>
  49. <div class="table-wrapper scrollbar-thin">
  50. <table>
  51. <thead>
  52. <tr>
  53. <th><?= _t('admin.stats.feed') ?></th>
  54. <th><?= _t('admin.stats.category') ?></th>
  55. <th><?= _t('admin.stats.entry_count') ?></th>
  56. <th><?= _t('admin.stats.percent_of_total') ?></th>
  57. </tr>
  58. </thead>
  59. <tbody>
  60. <?php foreach ($this->topFeed as $feed): ?>
  61. <tr>
  62. <td><a href="<?= _url('stats', 'repartition', 'id', $feed['id']) ?>"><?= $feed['name'] ?></a></td>
  63. <td><?= $feed['category'] ?></td>
  64. <td class="numeric"><?= format_number($feed['count']) ?></td>
  65. <td class="numeric"><?php
  66. if (!empty($this->repartitions['all_feeds']['total'])) {
  67. echo format_number($feed['count'] / $this->repartitions['all_feeds']['total'] * 100, 1);
  68. }
  69. ?></td>
  70. </tr>
  71. <?php endforeach; ?>
  72. </tbody>
  73. </table>
  74. </div>
  75. </div>
  76. <div class="stat">
  77. <h2><?= _t('admin.stats.entry_per_day') ?></h2>
  78. <div>
  79. <canvas id="statsEntriesPerDay"></canvas>
  80. <script class="jsonData-stats" type="application/json">
  81. <?php
  82. echo json_encode(array(
  83. 'canvasID' => 'statsEntriesPerDay',
  84. 'charttype' => 'barWithAverage',
  85. 'labelBarChart' => _t('admin.stats.entry_count'),
  86. 'dataBarChart' => $this->entryCount,
  87. 'labelAverage' => 'Average ('.$this->average.')',
  88. 'dataAverage' => $this->average,
  89. 'xAxisLabels' => $this->last30DaysLabels,
  90. ), JSON_UNESCAPED_UNICODE);
  91. ?></script>
  92. </div>
  93. </div>
  94. <div class="stat half">
  95. <h2><?= _t('admin.stats.feed_per_category') ?></h2>
  96. <div>
  97. <canvas id="statsFeedsPerCategory"></canvas>
  98. <script class="jsonData-stats" type="application/json">
  99. <?php
  100. echo json_encode(array(
  101. 'canvasID' => 'statsFeedsPerCategory',
  102. 'charttype' => 'doughnut',
  103. 'data' => $this->feedByCategory['data'],
  104. 'labels' => $this->feedByCategory['label'],
  105. ), JSON_UNESCAPED_UNICODE);
  106. ?></script>
  107. </div>
  108. </div>
  109. <div class="stat half">
  110. <h2><?= _t('admin.stats.entry_per_category') ?></h2>
  111. <div>
  112. <canvas id="statsEntriesPerCategory"></canvas>
  113. <script class="jsonData-stats" type="application/json">
  114. <?php
  115. echo json_encode(array(
  116. 'canvasID' => 'statsEntriesPerCategory',
  117. 'charttype' => 'doughnut',
  118. 'data' => $this->entryByCategory['data'],
  119. 'labels' => $this->entryByCategory['label'],
  120. ), JSON_UNESCAPED_UNICODE);
  121. ?></script>
  122. </div>
  123. </div>
  124. </div>
  125. </main>
  126. <script src="../scripts/statsWithChartjs.js?<?= @filemtime(PUBLIC_PATH . '/scripts/statsWithChartjs.js') ?>"></script>