global.phtml 2.2 KB

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