global.phtml 2.1 KB

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