nav_menu.phtml 8.5 KB

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