nav_menu.phtml 7.6 KB

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