4
0

nav_menu.phtml 8.6 KB

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