nav_menu.phtml 9.6 KB

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