index.phtml 4.3 KB

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