logs.phtml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $this->partial('aside_configure');
  5. ?>
  6. <main class="post">
  7. <h1><?= _t('index.log') ?></h1>
  8. <?php
  9. /** @var list<FreshRSS_Log> $items */
  10. $items = $this->logsPaginator->items();
  11. ?>
  12. <?php if (!empty($items)) { ?>
  13. <form method="post" action="<?= _url('index', 'logs') ?>">
  14. <?php $this->logsPaginator->render('logs_pagination.phtml', 'page'); ?>
  15. <div id="loglist-wrapper" class="table-wrapper scrollbar-thin">
  16. <table id="loglist">
  17. <thead>
  18. <th><?= _t('conf.logs.loglist.level') ?></th>
  19. <th><?= _t('conf.logs.loglist.timestamp') ?></th>
  20. <th><?= _t('conf.logs.loglist.message') ?></th>
  21. </thead>
  22. <tbody>
  23. <?php foreach ($items as $log) { ?>
  24. <tr class="log-item log-<?= $log->level() ?>">
  25. <td class="log-level">
  26. <?= _i($log->level()) ?>
  27. </td>
  28. <td class="log-date">
  29. <time datetime="<?= date('Y-m-d H:i:s', @strtotime($log->date()) ?: 0) ?>">
  30. <?= date('Y-m-d H:i:s', @strtotime($log->date()) ?: 0) ?>
  31. </time>
  32. </td>
  33. <td class="log-message">
  34. <?= htmlspecialchars($log->info(), ENT_NOQUOTES, 'UTF-8') ?>
  35. </td>
  36. </tr>
  37. <?php } ?>
  38. </tbody>
  39. </table>
  40. </div>
  41. <?php $this->logsPaginator->render('logs_pagination.phtml', 'page'); ?>
  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
  51. } else { ?>
  52. <p class="alert alert-warn"><?= _t('index.log.empty') ?></p>
  53. <?php } ?>
  54. </main>