4
0

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