reader.phtml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. declare(strict_types=1);
  3. /** @var FreshRSS_View $this */
  4. if (!Minz_Request::paramBoolean('ajax')) {
  5. $this->partial('aside_feed');
  6. $this->partial('nav_menu');
  7. }
  8. $slider_feed = $this->feed;
  9. call_user_func($this->callbackBeforeEntries, $this);
  10. $lazyload = FreshRSS_Context::userConf()->lazyload;
  11. $useKeepUnreadImportant = !FreshRSS_Context::isImportant() && !FreshRSS_Context::isFeed();
  12. ?>
  13. <main id="stream" class="reader">
  14. <h1 class="title_hidden"><?= _t('conf.reading.view.reader') ?></h1>
  15. <div id="new-article" hidden="hidden">
  16. <a href="<?= Minz_Url::display(Minz_Request::currentRequest()) ?>"><?= _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
  17. </div><?php
  18. $lastEntry = null;
  19. $nbEntries = 0;
  20. foreach ($this->entries as $entry):
  21. /** @var FreshRSS_Entry|null $entry */
  22. $entry = Minz_ExtensionManager::callHook(Minz_HookType::EntryBeforeDisplay, $entry);
  23. if ($entry === null) {
  24. continue;
  25. }
  26. ob_flush();
  27. $this->entry = $entry;
  28. $lastEntry = $entry;
  29. $nbEntries++;
  30. //We most likely already have the feed object in cache, otherwise make a request
  31. $this->feed = FreshRSS_Category::findFeed($this->categories, $this->entry->feedId()) ?? $this->entry->feed() ?? FreshRSS_Feed::default();
  32. $this->entry->_feed($this->feed);
  33. ?><div class="flux<?= !$this->entry->isRead() ? ' not_read' : ''
  34. ?><?= $this->entry->isFavorite() ? ' favorite' : ''
  35. ?><?= $useKeepUnreadImportant && ($this->feed->priority() >= FreshRSS_Feed::PRIORITY_IMPORTANT) ? ' keep_unread ' : ''
  36. ?>" id="flux_<?= $this->entry->id()
  37. ?>" data-entry="<?= $this->entry->id()
  38. ?>" data-category="<?= $this->feed->categoryId()
  39. ?>" data-feed="<?= $this->feed->id()
  40. ?>" data-priority="<?= $this->feed->priority()
  41. ?>" data-link="<?= $this->entry->link()
  42. ?>"><?php $this->renderHelper('index/article'); ?>
  43. </div><?php
  44. endforeach;
  45. if ($nbEntries > 0):
  46. call_user_func($this->callbackBeforePagination, $this, $nbEntries, $lastEntry);
  47. $this->renderHelper('stream-footer');
  48. ?></main><?php
  49. else:
  50. ob_end_clean(); //Discard the articles headers, as we have no articles
  51. ?>
  52. <main id="stream" class="reader">
  53. <div id="new-article" hidden="hidden">
  54. <a href="<?= Minz_Url::display(Minz_Request::currentRequest()) ?>"><?= _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
  55. </div>
  56. <div class="prompt alert alert-warn">
  57. <h2 class="alert-head"><?= _t('index.feed.empty') ?></h2>
  58. </div>
  59. </main>
  60. <?php endif; ?>
  61. <?php $class = $this->displaySlider ? ' active' : ''; ?>
  62. <aside id="slider" class="<?= $class ?>">
  63. <a class="toggle_aside" href="#close"><?= _i('close') ?></a>
  64. <div id="slider-content">
  65. <?php
  66. if (isset($this->tag)) {
  67. $this->renderHelper('tag/update');
  68. } elseif (isset($slider_feed)) {
  69. $this->feed = $slider_feed;
  70. $this->renderHelper('feed/update');
  71. }
  72. ?>
  73. </div>
  74. </aside>
  75. <a href="#close" id="close-slider" class="<?= $class ?>">
  76. <?= _i('close') ?>
  77. </a>