nav_menu.phtml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <?php
  2. $actual_view = Minz_Request::param('output', 'normal');
  3. ?>
  4. <div class="nav_menu">
  5. <?php if ($actual_view === 'normal') { ?>
  6. <a class="btn toggle_aside" href="#aside_flux"><?php echo FreshRSS_Themes::icon('category'); ?></a>
  7. <?php } ?>
  8. <?php if ($this->loginOk || Minz_Configuration::allowAnonymousRefresh()) { ?>
  9. <a id="actualize" class="btn" href="<?php echo _url ('feed', 'actualize'); ?>"><?php echo FreshRSS_Themes::icon('refresh'); ?></a>
  10. <?php } ?>
  11. <?php if ($this->loginOk) { ?>
  12. <?php
  13. $get = false;
  14. $string_mark = Minz_Translate::t ('mark_all_read');
  15. if ($this->get_f) {
  16. $get = 'f_' . $this->get_f;
  17. $string_mark = Minz_Translate::t ('mark_feed_read');
  18. } elseif ($this->get_c && $this->get_c != 'a') {
  19. if ($this->get_c === 's') {
  20. $get = 's';
  21. } else {
  22. $get = 'c_' . $this->get_c;
  23. }
  24. $string_mark = Minz_Translate::t ('mark_cat_read');
  25. }
  26. $nextGet = $get;
  27. if ($this->conf->onread_jump_next && (strlen ($get) > 2)) {
  28. $anotherUnreadId = '';
  29. $foundCurrent = false;
  30. switch ($get[0]) {
  31. case 'c':
  32. foreach ($this->cat_aside as $cat) {
  33. if ($cat->id () == $this->get_c) {
  34. $foundCurrent = true;
  35. continue;
  36. }
  37. if ($cat->nbNotRead () <= 0) continue;
  38. $anotherUnreadId = $cat->id ();
  39. if ($foundCurrent) break;
  40. }
  41. $nextGet = empty ($anotherUnreadId) ? 'a' : 'c_' . $anotherUnreadId;
  42. break;
  43. case 'f':
  44. foreach ($this->cat_aside as $cat) {
  45. if ($cat->id () == $this->get_c) {
  46. foreach ($cat->feeds () as $feed) {
  47. if ($feed->id () == $this->get_f) {
  48. $foundCurrent = true;
  49. continue;
  50. }
  51. if ($feed->nbNotRead () <= 0) continue;
  52. $anotherUnreadId = $feed->id ();
  53. if ($foundCurrent) break;
  54. }
  55. break;
  56. }
  57. }
  58. $nextGet = empty ($anotherUnreadId) ? 'c_' . $this->get_c : 'f_' . $anotherUnreadId;
  59. break;
  60. }
  61. }
  62. $p = isset($this->entries[0]) ? $this->entries[0] : null;
  63. $idMax = $p === null ? '0' : $p->id();
  64. $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax));
  65. $output = Minz_Request::param('output', '');
  66. if (($output != '') && ($this->conf->view_mode !== $output)) {
  67. $arUrl['params']['output'] = $output;
  68. }
  69. $markReadUrl = Minz_Url::display($arUrl);
  70. Minz_Session::_param ('markReadUrl', $markReadUrl);
  71. ?>
  72. <div class="stick" id="nav_menu_read_all">
  73. <a class="read_all btn" href="<?php echo $markReadUrl; ?>"><?php echo Minz_Translate::t ('mark_read'); ?></a>
  74. <div class="dropdown">
  75. <div id="dropdown-read" class="dropdown-target"></div>
  76. <a class="dropdown-toggle btn" href="#dropdown-read"><?php echo FreshRSS_Themes::icon('down'); ?></a>
  77. <ul class="dropdown-menu">
  78. <li class="dropdown-close"><a href="#close">❌</a></li>
  79. <li class="item"><a href="<?php echo $markReadUrl; ?>"><?php echo $string_mark; ?></a></li>
  80. <li class="separator"></li>
  81. <?php
  82. $today = $this->today;
  83. $one_week = $today - 604800;
  84. ?>
  85. <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'idMax', $today . '000000'); ?>"><?php echo Minz_Translate::t ('before_one_day'); ?></a></li>
  86. <li class="item"><a href="<?php echo _url ('entry', 'read', 'is_read', 1, 'get', $get, 'idMax', $one_week . '000000'); ?>"><?php echo Minz_Translate::t ('before_one_week'); ?></a></li>
  87. </ul>
  88. </div>
  89. </div>
  90. <?php } ?>
  91. <?php
  92. $params = Minz_Request::params ();
  93. if (isset ($params['search'])) {
  94. $params['search'] = urlencode ($params['search']);
  95. }
  96. $url = array (
  97. 'c' => 'index',
  98. 'a' => 'index',
  99. 'params' => $params
  100. );
  101. ?>
  102. <div class="dropdown" id="nav_menu_views">
  103. <div id="dropdown-views" class="dropdown-target"></div>
  104. <a class="dropdown-toggle btn" href="#dropdown-views"><?php echo Minz_Translate::t ('display'); ?> <?php echo FreshRSS_Themes::icon('down'); ?></a>
  105. <ul class="dropdown-menu">
  106. <li class="dropdown-close"><a href="#close">❌</a></li>
  107. <?php
  108. $url_output = $url;
  109. if ($actual_view !== 'normal') { ?>
  110. <li class="item">
  111. <?php $url_output['params']['output'] = 'normal'; ?>
  112. <a class="view_normal" href="<?php echo Minz_Url::display ($url_output); ?>">
  113. <?php echo Minz_Translate::t ('normal_view'); ?>
  114. </a>
  115. </li>
  116. <?php } if($actual_view !== 'reader') { ?>
  117. <li class="item">
  118. <?php $url_output['params']['output'] = 'reader'; ?>
  119. <a class="view_normal" href="<?php echo Minz_Url::display ($url_output); ?>">
  120. <?php echo Minz_Translate::t ('reader_view'); ?>
  121. </a>
  122. </li>
  123. <?php } if($actual_view !== 'global') { ?>
  124. <li class="item">
  125. <?php $url_output['params']['output'] = 'global'; ?>
  126. <a class="view_normal" href="<?php echo Minz_Url::display ($url_output); ?>">
  127. <?php echo Minz_Translate::t ('global_view'); ?>
  128. </a>
  129. </li>
  130. <?php } ?>
  131. <li class="separator"></li>
  132. <?php
  133. $url_state = $url;
  134. $url_state['params']['state'] = 'all';
  135. ?>
  136. <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'all') ? 'true' :'false'; ?>">
  137. <a class="print_all" href="<?php echo Minz_Url::display ($url_state); ?>">
  138. <?php echo Minz_Translate::t ('show_all_articles'); ?>
  139. </a>
  140. </li>
  141. <?php
  142. $url_state['params']['state'] = 'not_read';
  143. ?>
  144. <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'not_read') ? 'true' :'false'; ?>">
  145. <a class="print_non_read" href="<?php echo Minz_Url::display ($url_state); ?>">
  146. <?php echo Minz_Translate::t ('show_not_reads'); ?>
  147. </a>
  148. </li>
  149. <?php
  150. $url_state['params']['state'] = 'read';
  151. ?>
  152. <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'read') ? 'true' :'false'; ?>">
  153. <a class="print_read" href="<?php echo Minz_Url::display ($url_state); ?>">
  154. <?php echo Minz_Translate::t ('show_read'); ?>
  155. </a>
  156. </li>
  157. <?php
  158. $url_state['params']['state'] = 'favorite';
  159. ?>
  160. <li class="item" role="checkbox" aria-checked="<?php echo ($this->state === 'favorite') ? 'true' :'false'; ?>">
  161. <a class="print_favorite" href="<?php echo Minz_Url::display ($url_state); ?>">
  162. <?php echo Minz_Translate::t ('show_favorite'); ?>
  163. </a>
  164. </li>
  165. <li class="separator"></li>
  166. <li class="item">
  167. <?php
  168. $url_order = $url;
  169. if ($this->order === 'DESC') {
  170. $url_order['params']['order'] = 'ASC';
  171. ?>
  172. <a href="<?php echo Minz_Url::display ($url_order); ?>">
  173. <?php echo Minz_Translate::t ('older_first'); ?>
  174. </a>
  175. <?php
  176. } else {
  177. $url_order['params']['order'] = 'DESC';
  178. ?>
  179. <a href="<?php echo Minz_Url::display ($url_order); ?>">
  180. <?php echo Minz_Translate::t ('newer_first'); ?>
  181. </a>
  182. <?php } ?>
  183. </li>
  184. <li class="separator"></li>
  185. <li class="item">
  186. <a class="view_rss" target="_blank" href="<?php echo Minz_Url::display ($this->rss_url); ?>">
  187. <?php echo Minz_Translate::t ('rss_view'); ?>
  188. </a>
  189. </li>
  190. </ul>
  191. </div>
  192. <div class="item search">
  193. <form action="<?php echo _url ('index', 'index'); ?>" method="get">
  194. <?php $search = Minz_Request::param ('search', ''); ?>
  195. <input type="search" name="search" class="extend" value="<?php echo $search; ?>" placeholder="<?php echo Minz_Translate::t ('search_short'); ?>" />
  196. <?php $get = Minz_Request::param ('get', ''); ?>
  197. <?php if($get != '') { ?>
  198. <input type="hidden" name="get" value="<?php echo $get; ?>" />
  199. <?php } ?>
  200. <?php $order = Minz_Request::param ('order', ''); ?>
  201. <?php if($order != '') { ?>
  202. <input type="hidden" name="order" value="<?php echo $order; ?>" />
  203. <?php } ?>
  204. <?php $state = Minz_Request::param ('state', ''); ?>
  205. <?php if($state != '') { ?>
  206. <input type="hidden" name="state" value="<?php echo $state; ?>" />
  207. <?php } ?>
  208. </form>
  209. </div>
  210. </div>