logs.phtml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. <?php $this->logsPaginator->render('logs_pagination.phtml', 'page'); ?>
  17. <div id="loglist-wrapper" class="table-wrapper scrollbar-thin">
  18. <table id="loglist">
  19. <thead>
  20. <th><?= _t('conf.logs.loglist.level') ?></th>
  21. <th><?= _t('conf.logs.loglist.timestamp') ?></th>
  22. <th><?= _t('conf.logs.loglist.message') ?></th>
  23. </thead>
  24. <tbody>
  25. <?php foreach ($items as $log) { ?>
  26. <tr class="log-item log-<?= $log->level() ?>">
  27. <td class="log-level">
  28. <?= _i($log->level()) ?>
  29. </td>
  30. <td class="log-date">
  31. <time datetime="<?= date('Y-m-d H:i:s', @strtotime($log->date()) ?: 0) ?>">
  32. <?= date('Y-m-d H:i:s', @strtotime($log->date()) ?: 0) ?>
  33. </time>
  34. </td>
  35. <td class="log-message">
  36. <?= htmlspecialchars($log->info(), ENT_NOQUOTES, 'UTF-8') ?>
  37. </td>
  38. </tr>
  39. <?php } ?>
  40. </tbody>
  41. </table>
  42. </div>
  43. <?php $this->logsPaginator->render('logs_pagination.phtml', 'page'); ?>
  44. <form method="post" action="<?= _url('index', 'logs') ?>">
  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 } else { ?>
  54. <p class="alert alert-warn"><?= _t('index.log.empty') ?></p>
  55. <?php } ?>
  56. </main>