global.phtml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. $this->partial('nav_menu');
  5. $class = '';
  6. $state_unread = false;
  7. if (FreshRSS_Context::userConf()->hide_read_feeds &&
  8. FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) &&
  9. !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
  10. $class = ' state_unread';
  11. $state_unread = true;
  12. }
  13. ?>
  14. <datalist id="datalist-labels"></datalist>
  15. <template id="share_article_template">
  16. <?php $this->renderHelper('index/normal/entry_share_menu'); ?>
  17. <a class="dropdown-close" href="#close">❌</a>
  18. </template>
  19. <template id="labels_article_template">
  20. <div class="dropdown-menu">
  21. <ul class="dropdown-menu-scrollable scrollbar-thin">
  22. <li class="dropdown-header">
  23. <?= _t('index.menu.mylabels') ?>
  24. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  25. <a href="<?= _url('tag', 'index') ?>"><?= _i('configure') ?></a>
  26. <?php } ?>
  27. </li>
  28. <!-- Ajax -->
  29. </ul>
  30. </div>
  31. <a class="dropdown-close" href="#close">❌</a>
  32. </template>
  33. <main id="stream" class="global<?= $class ?>">
  34. <h1 class="title_hidden"><?= _t('conf.reading.view.global') ?></h1>
  35. <?php
  36. $params = array_filter($_GET, 'is_string', ARRAY_FILTER_USE_KEY);
  37. unset($params['c']);
  38. unset($params['a']);
  39. $url_base = [
  40. 'c' => 'index',
  41. 'a' => 'normal',
  42. 'params' => $params,
  43. ];
  44. $unreadArticles = 0;
  45. foreach ($this->categories as $cat) {
  46. $feeds = $cat->feeds();
  47. $url_base['params']['get'] = 'c_' . $cat->id();
  48. if (!empty($feeds)) {
  49. $unreadArticles += $cat->nbNotRead();
  50. ?>
  51. <div class="box category" data-unread="<?= $cat->nbNotRead() ?>">
  52. <div class="box-title"><a class="title open-panel" data-unread="<?= format_number($cat->nbNotRead()) ?>"
  53. href="<?= Minz_Url::display($url_base) ?>"><h2><?= $cat->name() ?></h2></a></div>
  54. <ul class="box-content scrollbar-thin">
  55. <?php
  56. foreach ($feeds as $feed) {
  57. if ($feed->priority() < FreshRSS_Feed::PRIORITY_FEED) {
  58. continue;
  59. }
  60. $nb_not_read = $feed->nbNotRead();
  61. $error_class = '';
  62. $error_title = '';
  63. if ($feed->inError() && !$feed->mute()) {
  64. $error_class = ' error';
  65. $error_title = _t('sub.feed.error');
  66. }
  67. $empty_class = '';
  68. $empty_title = '';
  69. if ($feed->nbEntries() == 0) {
  70. $empty_class = ' empty';
  71. $empty_title = _t('sub.feed.empty');
  72. }
  73. $mute_class = $feed->mute() ? ' mute' : '';
  74. $url_base['params']['get'] = 'f_' . $feed->id();
  75. ?>
  76. <li id="f_<?= $feed->id() ?>" class="item feed<?= $error_class, $empty_class, $mute_class ?>" title="<?= $error_title, $empty_title ?>"
  77. data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>">
  78. <?php if (FreshRSS_Context::userConf()->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?>
  79. <a class="item-title open-panel" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?= Minz_Url::display($url_base) ?>"><?= $feed->name() ?></a>
  80. </li>
  81. <?php } ?>
  82. </ul>
  83. </div>
  84. <?php
  85. }
  86. }
  87. if ($unreadArticles < 1 && $state_unread) {
  88. ?>
  89. <div id="noArticlesToShow" class="prompt alert alert-warn">
  90. <h2 class="alert-head"><?= _t('index.feed.empty') ?></h2>
  91. </div>
  92. <?php } ?>
  93. </main>
  94. <div id="overlay">
  95. <a class="close" href="#"><?= _i('close') ?></a>
  96. <div id="panel"<?= FreshRSS_Context::userConf()->display_posts ? '' : ' class="hide_posts"' ?>>
  97. </div>
  98. </div>