nav_menu.phtml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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_flux"><?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($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('queries'); ?>
  33. <a class="no-mobile" href="<?php echo _url('configure', 'queries'); ?>"><?php echo _i('configure'); ?></a>
  34. </li>
  35. <?php foreach (FreshRSS_Context::$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::$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('add_query'); ?></a></li>
  49. </ul>
  50. </div>
  51. </div>
  52. <?php
  53. $get = FreshRSS_Context::currentGet();
  54. $next_step = FreshRSS_Context::nextStep();
  55. $string_mark = _t('mark_all_read');
  56. if ($get[0] == 'f') {
  57. $string_mark = _t('mark_feed_read');
  58. } elseif ($get[0] == 'c') {
  59. $string_mark = _t('mark_cat_read');
  60. }
  61. $mark_read_url = array(
  62. 'c' => 'entry',
  63. 'a' => 'read',
  64. 'params' => array(
  65. 'get' => $get,
  66. 'nextGet' => $next_step['get'],
  67. 'idMax' => $next_step['idMax']
  68. )
  69. );
  70. ?>
  71. <form id="mark-read-menu" method="post" style="display: none"></form>
  72. <div class="stick" id="nav_menu_read_all">
  73. <?php $confirm = FreshRSS_Context::$conf->reading_confirm ? 'confirm' : ''; ?>
  74. <button class="read_all btn <?php echo $confirm; ?>"
  75. form="mark-read-menu"
  76. formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
  77. type="submit"><?php echo _t('mark_read'); ?></button>
  78. <div class="dropdown">
  79. <div id="dropdown-read" class="dropdown-target"></div>
  80. <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo _i('down'); ?></a>
  81. <ul class="dropdown-menu">
  82. <li class="dropdown-close"><a href="#close">❌</a></li>
  83. <li class="item">
  84. <button class="as-link <?php echo $confirm; ?>"
  85. form="mark-read-menu"
  86. formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
  87. type="submit"><?php echo $string_mark; ?></button>
  88. </li>
  89. <li class="separator"></li>
  90. <?php
  91. $today = @strtotime('today');
  92. $mark_before_today = $mark_read_url;
  93. $mark_before_today['params']['idMax'] = $today . '000000';
  94. $mark_before_one_week = $mark_read_url;
  95. $mark_before_one_week['params']['idMax'] = ($today - 604800) . '000000';
  96. ?>
  97. <li class="item">
  98. <button class="as-link <?php echo $confirm; ?>"
  99. form="mark-read-menu"
  100. formaction="<?php echo Minz_Url::display($mark_before_today); ?>"
  101. type="submit"><?php echo _t('before_one_day'); ?></button>
  102. </li>
  103. <li class="item">
  104. <button class="as-link <?php echo $confirm; ?>"
  105. form="mark-read-menu"
  106. formaction="<?php echo Minz_Url::display($mark_before_one_week); ?>"
  107. type="submit"><?php echo _t('before_one_week'); ?></button>
  108. </li>
  109. </ul>
  110. </div>
  111. </div>
  112. <?php } ?>
  113. <?php $url_output = Minz_Request::currentRequest(); ?>
  114. <div class="stick" id="nav_menu_views">
  115. <?php $url_output['a'] = 'normal'; ?>
  116. <a class="view_normal btn <?php echo $actual_view == 'normal'? 'active' : ''; ?>" title="<?php echo _t('normal_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  117. <?php echo _i("view-normal"); ?>
  118. </a>
  119. <?php $url_output['a'] = 'global'; ?>
  120. <a class="view_global btn <?php echo $actual_view == 'global'? 'active' : ''; ?>" title="<?php echo _t('global_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  121. <?php echo _i("view-global"); ?>
  122. </a>
  123. <?php
  124. $url_output['a'] = 'rss';
  125. if (FreshRSS_Context::$conf->token) {
  126. $url_output['params']['token'] = FreshRSS_Context::$conf->token;
  127. }
  128. ?>
  129. <a class="view_rss btn" target="_blank" title="<?php echo _t('rss_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
  130. <?php echo _i('rss'); ?>
  131. </a>
  132. </div>
  133. <div class="item search">
  134. <form action="<?php echo _url('index', 'index'); ?>" method="get">
  135. <?php $search = Minz_Request::param('search', ''); ?>
  136. <input type="search" name="search" class="extend" value="<?php echo $search; ?>" placeholder="<?php echo _t('search_short'); ?>" />
  137. <?php $get = Minz_Request::param('get', ''); ?>
  138. <?php if($get != '') { ?>
  139. <input type="hidden" name="get" value="<?php echo $get; ?>" />
  140. <?php } ?>
  141. <?php $order = Minz_Request::param('order', ''); ?>
  142. <?php if($order != '') { ?>
  143. <input type="hidden" name="order" value="<?php echo $order; ?>" />
  144. <?php } ?>
  145. <?php $state = Minz_Request::param('state', ''); ?>
  146. <?php if($state != '') { ?>
  147. <input type="hidden" name="state" value="<?php echo $state; ?>" />
  148. <?php } ?>
  149. </form>
  150. </div>
  151. <?php
  152. if (FreshRSS_Context::$order === 'DESC') {
  153. $order = 'ASC';
  154. $icon = 'up';
  155. $title = 'older_first';
  156. } else {
  157. $order = 'DESC';
  158. $icon = 'down';
  159. $title = 'newer_first';
  160. }
  161. $url_order = Minz_Request::currentRequest();
  162. $url_order['params']['order'] = $order;
  163. ?>
  164. <a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo _t($title); ?>">
  165. <?php echo _i($icon); ?>
  166. </a>
  167. <?php if (FreshRSS_Auth::hasAccess() || Minz_Configuration::allowAnonymousRefresh()) { ?>
  168. <a id="actualize" class="btn" href="<?php echo _url('feed', 'actualize'); ?>"><?php echo _i('refresh'); ?></a>
  169. <?php } ?>
  170. </div>