aboutsummaryrefslogtreecommitdiff
path: root/app/views/index/reader.phtml
blob: ae576c2e58a59cccb0d2791308c556a695dc4301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
declare(strict_types=1);
/** @var FreshRSS_View $this */
if (!Minz_Request::paramBoolean('ajax')) {
	$this->partial('aside_feed');
	$this->partial('nav_menu');
}

call_user_func($this->callbackBeforeEntries, $this);

$lazyload = FreshRSS_Context::userConf()->lazyload;
?>
<main id="stream" class="reader">
	<h1 class="title_hidden"><?= _t('conf.reading.view.reader') ?></h1>
	<div id="new-article" hidden="hidden">
		<a href="<?= Minz_Url::display(Minz_Request::currentRequest()) ?>"><?= _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
	</div><?php
	$lastEntry = null;
	$nbEntries = 0;
	foreach ($this->entries as $entry):
		$lastEntry = $entry;
		$nbEntries++;
		ob_flush();
		/** @var FreshRSS_Entry */
		$entry = Minz_ExtensionManager::callHook('entry_before_display', $entry);
		if ($entry == null) {
			continue;
		}
		$this->entry = $entry;

		//We most likely already have the feed object in cache, otherwise make a request
		$this->feed = FreshRSS_Category::findFeed($this->categories, $entry->feedId()) ?? $entry->feed() ?? FreshRSS_Feed::default();
	?><div class="flux<?= !$entry->isRead() ? ' not_read' : '' ?><?= $entry->isFavorite() ? ' favorite' : '' ?>" id="flux_<?= $entry->id() ?>" data-priority="<?= $this->feed->priority() ?>">
		<?php $this->renderHelper('index/article'); ?>
	</div><?php
	endforeach;

	if ($nbEntries > 0):
		call_user_func($this->callbackBeforePagination, $this, $nbEntries, $lastEntry);
		$this->renderHelper('stream-footer');
?></main><?php
	else:
		ob_end_clean();	//Discard the articles headers, as we have no articles
?>
<main id="stream" class="reader">
	<div id="new-article" hidden="hidden">
		<a href="<?= Minz_Url::display(Minz_Request::currentRequest()) ?>"><?= _t('gen.js.new_article'); /* TODO: move string in JS*/ ?></a>
	</div>
	<div class="prompt alert alert-warn">
		<h2 class="alert-head"><?= _t('index.feed.empty') ?></h2>
	</div>
</main>
<?php endif; ?>