reader.phtml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. call_user_func($this->callbackBeforeEntries, $this);
  9. $lazyload = FreshRSS_Context::userConf()->lazyload;
  10. ?>
  11. <main id="stream" class="reader">
  12. <h1 class="title_hidden"><?= _t('conf.reading.view.reader') ?></h1>
  13. <div id="new-article" hidden="hidden">
  14. <a href="<?= Minz_Url::display(Minz_Request::currentRequest()) ?>"><?= _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
  15. </div><?php
  16. $lastEntry = null;
  17. $nbEntries = 0;
  18. foreach ($this->entries as $entry):
  19. /** @var FreshRSS_Entry|null $entry */
  20. $entry = Minz_ExtensionManager::callHook('entry_before_display', $entry);
  21. if ($entry === null) {
  22. continue;
  23. }
  24. ob_flush();
  25. $this->entry = $entry;
  26. $lastEntry = $entry;
  27. $nbEntries++;
  28. //We most likely already have the feed object in cache, otherwise make a request
  29. $this->feed = FreshRSS_Category::findFeed($this->categories, $entry->feedId()) ?? $entry->feed() ?? FreshRSS_Feed::default();
  30. ?><div class="flux<?= !$entry->isRead() ? ' not_read' : '' ?><?= $entry->isFavorite() ? ' favorite' : '' ?>" id="flux_<?= $entry->id() ?>" data-priority="<?= $this->feed->priority() ?>">
  31. <?php $this->renderHelper('index/article'); ?>
  32. </div><?php
  33. endforeach;
  34. if ($nbEntries > 0):
  35. call_user_func($this->callbackBeforePagination, $this, $nbEntries, $lastEntry);
  36. $this->renderHelper('stream-footer');
  37. ?></main><?php
  38. else:
  39. ob_end_clean(); //Discard the articles headers, as we have no articles
  40. ?>
  41. <main id="stream" class="reader">
  42. <div id="new-article" hidden="hidden">
  43. <a href="<?= Minz_Url::display(Minz_Request::currentRequest()) ?>"><?= _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
  44. </div>
  45. <div class="prompt alert alert-warn">
  46. <h2 class="alert-head"><?= _t('index.feed.empty') ?></h2>
  47. </div>
  48. </main>
  49. <?php endif; ?>