logs.phtml 2.1 KB

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