global.phtml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /** @var FreshRSS_View $this */
  3. $this->partial('nav_menu');
  4. $class = '';
  5. $state_unread = false;
  6. if (FreshRSS_Context::$user_conf->hide_read_feeds &&
  7. FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) &&
  8. !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
  9. $class = ' state_unread';
  10. $state_unread = true;
  11. }
  12. ?>
  13. <main id="stream" class="global<?= $class ?>">
  14. <?php
  15. $params = $_GET;
  16. unset($params['c']);
  17. unset($params['a']);
  18. $url_base = array(
  19. 'c' => 'index',
  20. 'a' => 'normal',
  21. 'params' => $params,
  22. );
  23. $unreadArticles = 0;
  24. foreach ($this->categories as $cat) {
  25. $feeds = $cat->feeds();
  26. $url_base['params']['get'] = 'c_' . $cat->id();
  27. if (!empty($feeds)) {
  28. $unreadArticles += $cat->nbNotRead();
  29. ?>
  30. <div class="box category" data-unread="<?= $cat->nbNotRead() ?>">
  31. <div class="box-title"><a class="title" data-unread="<?= format_number($cat->nbNotRead()) ?>"
  32. href="<?= Minz_Url::display($url_base) ?>"><?= $cat->name() ?></a></div>
  33. <ul class="box-content">
  34. <?php
  35. foreach ($feeds as $feed) {
  36. $nb_not_read = $feed->nbNotRead();
  37. $error = $feed->inError() ? ' error' : '';
  38. $empty = $feed->nbEntries() === 0 ? ' empty' : '';
  39. $url_base['params']['get'] = 'f_' . $feed->id();
  40. ?>
  41. <li id="f_<?= $feed->id() ?>" class="item feed<?= $error, $empty, $feed->mute() ? ' mute' : '' ?>"
  42. data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>">
  43. <?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?>
  44. <a class="item-title" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?= Minz_Url::display($url_base) ?>"><?= $feed->name() ?></a>
  45. </li>
  46. <?php } ?>
  47. </ul>
  48. </div>
  49. <?php
  50. }
  51. }
  52. if ($unreadArticles < 1 && $state_unread) {
  53. ?>
  54. <div id="noArticlesToShow" class="prompt alert alert-warn">
  55. <h2 class="alert-head"><?= _t('index.feed.empty') ?></h2>
  56. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  57. <p><a href="<?= _url('subscription', 'add') ?>"><?= _t('index.feed.add') ?></a></p>
  58. <?php } ?>
  59. </div>
  60. <?php } ?>
  61. </main>
  62. <div id="overlay">
  63. <a class="close" href="#"><?= _i('close') ?></a>
  64. </div>
  65. <div id="panel"<?= FreshRSS_Context::$user_conf->display_posts ? '' : ' class="hide_posts"' ?>>
  66. </div>