query.phtml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. if ($this->query === null) {
  5. throw new FreshRSS_Context_Exception('Query not initialised!');
  6. }
  7. ?>
  8. <div class="post">
  9. <h2><?= $this->query->getName() ?></h2>
  10. <div>
  11. <a href="<?= $this->query->getUrl() ?>"><?= _i('link') ?> <?= _t('gen.action.filter') ?></a>
  12. </div>
  13. <form method="post" action="<?= _url('configure', 'query', 'id', $this->queryId, '#', 'slider') ?>" autocomplete="off">
  14. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  15. <div class="form-group">
  16. <label class="group-name" for="name"><?= _t('conf.query.name') ?></label>
  17. <div class="group-controls">
  18. <input type="text" name="name" id="name" value="<?= $this->query->getName() ?>" />
  19. </div>
  20. </div>
  21. <legend><?= _t('conf.query.filter') ?></legend>
  22. <div class="form-group">
  23. <label class="group-name" for=""><?= _t('conf.query.filter.search') ?></label>
  24. <div class="group-controls">
  25. <input type="text" id="query_search" name="query[search]" value="<?= htmlspecialchars($this->query->getSearch()->getRawInput(), ENT_COMPAT, 'UTF-8') ?>"/>
  26. </div>
  27. </div>
  28. <div class="form-group">
  29. <label class="group-name" for=""><?= _t('conf.query.filter.state') ?></label>
  30. <div class="group-controls">
  31. <label class="checkbox" for="show_read">
  32. <input type="checkbox" name="query[state][]" id="show_read"
  33. value="<?= FreshRSS_Entry::STATE_READ ?>" <?= FreshRSS_Entry::STATE_READ & $this->query->getState() ? 'checked="checked"' : ''?> />
  34. <?= _t('index.menu.read') ?>
  35. </label>
  36. <label class="checkbox" for="show_not_read">
  37. <input type="checkbox" name="query[state][]" id="show_not_read"
  38. value="<?= FreshRSS_Entry::STATE_NOT_READ ?>" <?= FreshRSS_Entry::STATE_NOT_READ & $this->query->getState() ? 'checked="checked"' : ''?> />
  39. <?= _t('index.menu.unread') ?>
  40. </label>
  41. <label class="checkbox" for="show_favorite">
  42. <input type="checkbox" name="query[state][]" id="show_favorite"
  43. value="<?= FreshRSS_Entry::STATE_FAVORITE ?>" <?= FreshRSS_Entry::STATE_FAVORITE & $this->query->getState() ? 'checked="checked"' : ''?> />
  44. <?= _t('index.menu.starred') ?>
  45. </label>
  46. <label class="checkbox" for="show_not_favorite">
  47. <input type="checkbox" name="query[state][]" id="show_not_favorite"
  48. value="<?= FreshRSS_Entry::STATE_NOT_FAVORITE ?>" <?= FreshRSS_Entry::STATE_NOT_FAVORITE & $this->query->getState() ? 'checked="checked"' : ''?> />
  49. <?= _t('index.menu.non-starred') ?>
  50. </label>
  51. </div>
  52. </div>
  53. <div class="form-group">
  54. <label class="group-name" for="query_get"><?= _t('conf.query.filter.type') ?></label>
  55. <div class="group-controls">
  56. <select name="query[get]" id="query_get" size="10">
  57. <option value=""></option>
  58. <option value="s" <?= 's' === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= _t('conf.query.get_favorite') ?></option>
  59. <optgroup label="<?= _t('conf.query.filter.categories') ?>">
  60. <?php foreach ($this->categories as $category): ?>
  61. <option value="c_<?= $category->id() ?>" <?= "c_{$category->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $category->name() ?></option>
  62. <?php endforeach?>
  63. </optgroup>
  64. <optgroup label="<?= _t('conf.query.filter.feeds') ?>">
  65. <?php foreach ($this->feeds as $feed): ?>
  66. <option value="f_<?= $feed->id() ?>" <?= "f_{$feed->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $feed->name() ?></option>
  67. <?php endforeach?>
  68. </optgroup>
  69. <optgroup label="<?= _t('conf.query.filter.tags') ?>">
  70. <?php foreach ($this->tags as $tag): ?>
  71. <option value="t_<?= $tag->id() ?>" <?= "t_{$tag->id()}" === $this->query->getGet() ? 'selected="selected"' : '' ?>><?= $tag->name() ?></option>
  72. <?php endforeach?>
  73. </optgroup>
  74. </select>
  75. </div>
  76. </div>
  77. <div class="form-group">
  78. <label class="group-name" for=""><?= _t('conf.query.filter.order') ?></label>
  79. <div class="group-controls">
  80. <select name="query[order]" id="query_order">
  81. <option value=""></option>
  82. <option value="ASC" <?= 'ASC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_asc') ?></option>
  83. <option value="DESC" <?= 'DESC' === $this->query->getOrder() ? 'selected="selected"' : '' ?>><?= _t('conf.query.order_desc') ?></option>
  84. </select>
  85. </div>
  86. </div>
  87. <div class="form-group form-actions">
  88. <div class="group-controls">
  89. <button type="submit" class="btn btn-important"><?= _t('gen.action.submit') ?></button>
  90. <button type="submit" class="btn btn-attention confirm"
  91. data-str-confirm="<?= _t('gen.js.confirm_action_feed_cat') ?>"
  92. formaction="<?= _url('configure', 'deleteQuery', 'id', $this->queryId) ?>"
  93. formmethod="post"><?= _t('gen.action.remove') ?></button>
  94. </div>
  95. </div>
  96. </form>
  97. </div>