summaryrefslogtreecommitdiff
path: root/app/views/index/reader.phtml
blob: eb6613b28197d7ea1016b882a2105c05559b0f7c (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
54
55
56
57
58
59
60
61
<?php
$this->partial('nav_menu');

if (!empty($this->entries)) {
	$lazyload = FreshRSS_Context::$user_conf->lazyload;
	$content_width = FreshRSS_Context::$user_conf->content_width;
?>

<div id="stream" class="reader"><?php
	foreach ($this->entries as $item) {
		$item = Minz_ExtensionManager::callHook('entry_before_display', $item);
		if (is_null($item)) {
			continue;
		}
	?><div class="flux<?php echo !$item->isRead() ? ' not_read' : ''; ?><?php echo $item->isFavorite() ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id(); ?>">
		<div class="flux_content">
			<div class="content <?php echo $content_width; ?>">
				<?php
					$feed = FreshRSS_CategoryDAO::findFeed($this->categories, $item->feed());	//We most likely already have the feed object in cache
					if (empty($feed)) $feed = $item->feed(true);
					$favoriteUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id()));
					if ($item->isFavorite()) {
						$favoriteUrl['params']['is_favorite'] = 0;
					}
					$readUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id()));
					if ($item->isRead()) {
						$readUrl['params']['is_read'] = 0;
					}
				?>
				<a class="read" href="<?php echo Minz_Url::display($readUrl); ?>">
					<?php echo _i($item->isRead() ? 'read' : 'unread'); ?>
				</a>
				<a class="bookmark" href="<?php echo Minz_Url::display($favoriteUrl); ?>">
					<?php echo _i($item->isFavorite() ? 'starred' : 'non-starred'); ?>
				</a>
				<a href="<?php echo _url('index', 'reader', 'get', 'f_' . $feed->id()); ?>">
					<img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span>
				</a>
				<h1 class="title"><a target="_blank" rel="noreferrer" class="go_website" href="<?php echo $item->link(); ?>"><?php echo $item->title(); ?></a></h1>

				<div class="author"><?php
					$author = $item->author();
					echo $author != '' ? _t('gen.short.by_author', $author) . ' — ' : '',
						$item->date();
				?></div>

				<?php echo $item->content(); ?>
			</div>
		</div>
	</div>
	<?php } ?>

	<?php $this->renderHelper('pagination'); ?>
</div>

<?php } else { ?>
<div id="stream" class="prompt alert alert-warn reader">
	<h2><?php echo _t('index.feed.empty'); ?></h2>
	<a href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('index.feed.add'); ?></a><br /><br />
</div>
<?php } ?>