nav_menu.phtml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?php
  2. $actual_view = Minz_Request::actionName();
  3. flush();
  4. if (isset($this->callbackBeforePagination)) {
  5. call_user_func($this->callbackBeforePagination, $this);
  6. }
  7. ?>
  8. <div class="nav_menu">
  9. <?php if ($actual_view === 'normal' || $actual_view === 'reader' ) { ?>
  10. <a class="btn toggle_aside" href="#aside_feed"><?= _i('category') ?></a>
  11. <?php } ?>
  12. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  13. <div id="nav_menu_actions" class="stick">
  14. <?php
  15. $states = array(
  16. 'read' => FreshRSS_Entry::STATE_READ,
  17. 'unread' => FreshRSS_Entry::STATE_NOT_READ,
  18. 'starred' => FreshRSS_Entry::STATE_FAVORITE,
  19. 'non-starred' => FreshRSS_Entry::STATE_NOT_FAVORITE,
  20. );
  21. foreach ($states as $state_str => $state) {
  22. $state_enabled = FreshRSS_Context::isStateEnabled($state);
  23. $url_state = Minz_Request::currentRequest();
  24. $url_state['params']['state'] = FreshRSS_Context::getRevertState($state);
  25. ?>
  26. <a id="toggle-<?= $state_str ?>"
  27. class="btn <?= $state_enabled ? 'active' : '' ?>"
  28. role="checkbox" aria-checked="<?= $state_enabled ? 'true' : 'false' ?>"
  29. title="<?= _t('index.menu.' . $state_str) ?>"
  30. href="<?= Minz_Url::display($url_state) ?>"><?= _i($state_str) ?></a>
  31. <?php } ?>
  32. <div class="dropdown">
  33. <div id="dropdown-query" class="dropdown-target"></div>
  34. <a class="dropdown-toggle btn" href="#dropdown-query"><?= _i('down') ?></a>
  35. <ul class="dropdown-menu">
  36. <li class="dropdown-close"><a href="#close">❌</a></li>
  37. <li class="dropdown-header">
  38. <?= _t('index.menu.queries') ?>
  39. <a class="no-mobile" href="<?= _url('configure', 'queries') ?>"><?= _i('configure') ?></a>
  40. </li>
  41. <?php foreach (FreshRSS_Context::$user_conf->queries as $query) { ?>
  42. <li class="item query">
  43. <a href="<?= $query['url'] ?>"><?= $query['name'] ?></a>
  44. </li>
  45. <?php } ?>
  46. <?php if (count(FreshRSS_Context::$user_conf->queries) > 0) { ?>
  47. <li class="separator no-mobile"></li>
  48. <?php } ?>
  49. <?php
  50. $url_query = Minz_Request::currentRequest();;
  51. $url_query['c'] = 'configure';
  52. $url_query['a'] = 'addQuery';
  53. ?>
  54. <li class="item no-mobile"><a href="<?= Minz_Url::display($url_query) ?>"><?= _i('bookmark-add') ?> <?= _t('index.menu.add_query') ?></a></li>
  55. </ul>
  56. </div>
  57. </div>
  58. <?php
  59. $get = FreshRSS_Context::currentGet();
  60. $string_mark = _t('index.menu.mark_all_read');
  61. $string_unmark = _t('index.menu.mark_selection_unread');
  62. if ($get[0] === 'f') {
  63. $string_mark = _t('index.menu.mark_feed_read');
  64. } elseif ($get[0] === 'c') {
  65. $string_mark = _t('index.menu.mark_cat_read');
  66. }
  67. $mark_read_url = array(
  68. 'c' => 'entry',
  69. 'a' => 'read',
  70. 'params' => array(
  71. 'get' => $get,
  72. 'nextGet' => FreshRSS_Context::$next_get,
  73. 'idMax' => FreshRSS_Context::$id_max,
  74. 'search' => htmlspecialchars_decode(FreshRSS_Context::$search, ENT_QUOTES),
  75. 'state' => FreshRSS_Context::$state,
  76. ),
  77. );
  78. $mark_unread_url = $mark_read_url;
  79. $mark_unread_url['params']['is_read'] = false;
  80. $mark_unread_url['params']['nextGet'] = $get;
  81. ?>
  82. <div class="stick" id="nav_menu_read_all">
  83. <form id="mark-read-menu" method="post">
  84. <?php $confirm = FreshRSS_Context::$user_conf->reading_confirm ? 'confirm" disabled="disabled' : ''; ?>
  85. <button class="read_all btn <?= $confirm ?>"
  86. form="mark-read-menu"
  87. formaction="<?= Minz_Url::display($mark_read_url) ?>"
  88. type="submit"><?= _t('gen.action.mark_read') ?></button>
  89. <div class="dropdown">
  90. <input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
  91. <div id="dropdown-read" class="dropdown-target"></div>
  92. <a class="dropdown-toggle btn" href="#dropdown-read"><?= _i('down') ?></a>
  93. <ul class="dropdown-menu">
  94. <li class="dropdown-close"><a href="#close">❌</a></li>
  95. <li class="item">
  96. <button class="as-link <?= $confirm ?>"
  97. form="mark-read-menu"
  98. formaction="<?= Minz_Url::display($mark_read_url) ?>"
  99. type="submit"><?= $string_mark ?></button>
  100. </li>
  101. <li class="separator"></li>
  102. <?php
  103. $today = @strtotime('today');
  104. $mark_before_today = $mark_read_url;
  105. $mark_before_today['params']['idMax'] = $today . '000000';
  106. $mark_before_one_week = $mark_read_url;
  107. $mark_before_one_week['params']['idMax'] = ($today - 604800) . '000000';
  108. $mark_unread_enabled = FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ) or !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ);
  109. ?>
  110. <li class="item">
  111. <button class="as-link <?= $confirm ?>"
  112. form="mark-read-menu"
  113. formaction="<?= Minz_Url::display($mark_before_today) ?>"
  114. type="submit"><?= _t('index.menu.before_one_day') ?></button>
  115. </li>
  116. <li class="item">
  117. <button class="as-link <?= $confirm ?>"
  118. form="mark-read-menu"
  119. formaction="<?= Minz_Url::display($mark_before_one_week) ?>"
  120. type="submit"><?= _t('index.menu.before_one_week') ?></button>
  121. </li>
  122. <li class="separator"></li>
  123. <li class="item">
  124. <button class="as-link <?= $mark_unread_enabled ? $confirm : '" disabled="disabled' ?>"
  125. form="mark-read-menu"
  126. formaction="<?= Minz_Url::display($mark_unread_url) ?>"
  127. type="submit"><?= $string_unmark ?></button>
  128. </li>
  129. </ul>
  130. </div>
  131. </form>
  132. </div>
  133. <?php } ?>
  134. <?php $url_output = Minz_Request::currentRequest(); ?>
  135. <div class="stick" id="nav_menu_views">
  136. <?php
  137. $readingModes = FreshRSS_ReadingMode::getReadingModes();
  138. $readingModes = Minz_ExtensionManager::callHook('nav_reading_modes', $readingModes);
  139. /** @var FreshRSS_ReadingMode $mode */
  140. foreach ($readingModes as $mode) {
  141. ?>
  142. <a class="<?= $mode->getId() ?> btn <?php if ($mode->isActive()) { echo 'active'; } ?>" title="<?= $mode->getTitle() ?>" href="<?= Minz_Url::display($mode->getUrlParams()) ?>">
  143. <?= $mode->getName() ?>
  144. </a>
  145. <?php
  146. }
  147. ?>
  148. <?php
  149. $url_output['a'] = 'rss';
  150. if (FreshRSS_Context::$user_conf->token) {
  151. $url_output['params']['user'] = Minz_Session::param('currentUser');
  152. $url_output['params']['token'] = FreshRSS_Context::$user_conf->token;
  153. }
  154. if (FreshRSS_Context::$user_conf->since_hours_posts_per_rss) {
  155. $url_output['params']['hours'] = FreshRSS_Context::$user_conf->since_hours_posts_per_rss;
  156. }
  157. ?>
  158. <a class="view-rss btn" target="_blank" rel="noreferrer" title="<?= _t('index.menu.rss_view') ?>" href="<?= Minz_Url::display($url_output) ?>">
  159. <?= _i('rss') ?>
  160. </a>
  161. </div>
  162. <div class="item search">
  163. <form action="<?= _url('index', 'index') ?>" method="get">
  164. <input type="search" name="search" class="extend" value="<?php
  165. echo htmlspecialchars(htmlspecialchars_decode(FreshRSS_Context::$search, ENT_QUOTES), ENT_COMPAT, 'UTF-8'); ?>" placeholder="<?= _t('index.menu.search_short') ?>" />
  166. <?php $get = Minz_Request::param('get', ''); ?>
  167. <?php if($get != '') { ?>
  168. <input type="hidden" name="get" value="<?= $get ?>" />
  169. <?php } ?>
  170. <?php $order = Minz_Request::param('order', ''); ?>
  171. <?php if($order != '') { ?>
  172. <input type="hidden" name="order" value="<?= $order ?>" />
  173. <?php } ?>
  174. <?php $state = Minz_Request::param('state', ''); ?>
  175. <?php if($state != '') { ?>
  176. <input type="hidden" name="state" value="<?= $state ?>" />
  177. <?php } ?>
  178. </form>
  179. </div>
  180. <?php
  181. if (FreshRSS_Context::$order === 'DESC') {
  182. $order = 'ASC';
  183. $icon = 'up';
  184. $title = _t('index.menu.older_first');
  185. } else {
  186. $order = 'DESC';
  187. $icon = 'down';
  188. $title = _t('index.menu.newer_first');
  189. }
  190. $url_order = Minz_Request::currentRequest();
  191. $url_order['params']['order'] = $order;
  192. ?>
  193. <a id="toggle-order" class="btn" href="<?= Minz_Url::display($url_order) ?>" title="<?= $title ?>">
  194. <?= _i($icon) ?>
  195. </a>
  196. <?php if (FreshRSS_Auth::hasAccess() || FreshRSS_Context::$system_conf->allow_anonymous_refresh) { ?>
  197. <a id="actualize" class="btn" href="<?= _url('feed', 'actualize') ?>" title="<?= _t('gen.action.actualize') ?>"><?= _i('refresh') ?></a>
  198. <?php } ?>
  199. </div>