logs.phtml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $this->partial('aside_configure');
  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('index.log') ?></h1>
  11. <?php
  12. /** @var array<FreshRSS_Log> $items */
  13. $items = $this->logsPaginator->items();
  14. ?>
  15. <?php if (!empty($items)) { ?>
  16. <form method="post" action="<?= _url('index', 'logs') ?>">
  17. <?php $this->logsPaginator->render('logs_pagination.phtml', 'page'); ?>
  18. <div id="loglist-wrapper" class="table-wrapper scrollbar-thin">
  19. <table id="loglist">
  20. <thead>
  21. <th><?= _t('conf.logs.loglist.level') ?></th>
  22. <th><?= _t('conf.logs.loglist.timestamp') ?></th>
  23. <th><?= _t('conf.logs.loglist.message') ?></th>
  24. </thead>
  25. <tbody>
  26. <?php foreach ($items as $log) { ?>
  27. <tr class="log-item log-<?= $log->level() ?>">
  28. <td class="log-level">
  29. <?= _i($log->level()) ?>
  30. </td>
  31. <td class="log-date">
  32. <time datetime="<?= date('Y-m-d H:i:s', @strtotime($log->date()) ?: 0) ?>">
  33. <?= date('Y-m-d H:i:s', @strtotime($log->date()) ?: 0) ?>
  34. </time>
  35. </td>
  36. <td class="log-message">
  37. <?= htmlspecialchars($log->info(), ENT_NOQUOTES, 'UTF-8') ?>
  38. </td>
  39. </tr>
  40. <?php } ?>
  41. </tbody>
  42. </table>
  43. </div>
  44. <?php $this->logsPaginator->render('logs_pagination.phtml', 'page'); ?>
  45. <div class="form-group form-actions">
  46. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  47. <input type="hidden" name="clearLogs" />
  48. <div class="group-controls">
  49. <button type="submit" class="btn btn-attention"><?= _t('index.log.clear') ?></button>
  50. </div>
  51. </div>
  52. </form>
  53. <?php
  54. } else { ?>
  55. <p class="alert alert-warn"><?= _t('index.log.empty') ?></p>
  56. <?php } ?>
  57. </main>