global.phtml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. <h1 class="title_hidden"><?= _t('conf.reading.view.global') ?></h1>
  15. <?php
  16. $params = $_GET;
  17. unset($params['c']);
  18. unset($params['a']);
  19. $url_base = array(
  20. 'c' => 'index',
  21. 'a' => 'normal',
  22. 'params' => $params,
  23. );
  24. $unreadArticles = 0;
  25. foreach ($this->categories as $cat) {
  26. $feeds = $cat->feeds();
  27. $url_base['params']['get'] = 'c_' . $cat->id();
  28. if (!empty($feeds)) {
  29. $unreadArticles += $cat->nbNotRead();
  30. ?>
  31. <div class="box category" data-unread="<?= $cat->nbNotRead() ?>">
  32. <div class="box-title"><a class="title" data-unread="<?= format_number($cat->nbNotRead()) ?>"
  33. href="<?= Minz_Url::display($url_base) ?>"><h2><?= $cat->name() ?></h2></a></div>
  34. <ul class="box-content scrollbar-thin">
  35. <?php
  36. foreach ($feeds as $feed) {
  37. $nb_not_read = $feed->nbNotRead();
  38. $error_class = '';
  39. $error_title = '';
  40. if ($feed->inError()) {
  41. $error_class = ' error';
  42. $error_title = _t('sub.feed.error');
  43. }
  44. $empty_class = '';
  45. $empty_title = '';
  46. if ($feed->nbEntries() == 0) {
  47. $empty_class = ' empty';
  48. $empty_title = _t('sub.feed.empty');
  49. }
  50. $mute_class = $feed->mute() ? ' mute' : '';
  51. $url_base['params']['get'] = 'f_' . $feed->id();
  52. ?>
  53. <li id="f_<?= $feed->id() ?>" class="item feed<?= $error_class, $empty_class, $mute_class ?>" title="<?= $error_title, $empty_title ?>"
  54. data-unread="<?= $feed->nbNotRead() ?>" data-priority="<?= $feed->priority() ?>">
  55. <?php if (FreshRSS_Context::$user_conf->show_favicons): ?><img class="favicon" src="<?= $feed->favicon() ?>" alt="✇" loading="lazy" /><?php endif; ?>
  56. <a class="item-title" data-unread="<?= format_number($feed->nbNotRead()) ?>" href="<?= Minz_Url::display($url_base) ?>"><?= $feed->name() ?></a>
  57. </li>
  58. <?php } ?>
  59. </ul>
  60. </div>
  61. <?php
  62. }
  63. }
  64. if ($unreadArticles < 1 && $state_unread) {
  65. ?>
  66. <div id="noArticlesToShow" class="prompt alert alert-warn">
  67. <h2 class="alert-head"><?= _t('index.feed.empty') ?></h2>
  68. <?php if (FreshRSS_Auth::hasAccess()) { ?>
  69. <p><a href="<?= _url('subscription', 'add') ?>"><?= _t('index.feed.add') ?></a></p>
  70. <?php } ?>
  71. </div>
  72. <?php } ?>
  73. </main>
  74. <div id="overlay">
  75. <a class="close" href="#"><?= _i('close') ?></a>
  76. <div id="panel"<?= FreshRSS_Context::$user_conf->display_posts ? '' : ' class="hide_posts"' ?>>
  77. </div>
  78. </div>