logs.phtml 1.7 KB

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