nav_menu.phtml 8.5 KB

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