reader.phtml 2.6 KB

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