nav_menu.phtml 7.2 KB

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