aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers/view/normal_view.phtml
blob: 87bf2e22a71202c5db0a22db5d37b1377646f1e3 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php

$this->partial ('aside_flux');
$this->partial ('nav_menu');

if (!empty($this->entries)) {
	$display_today = true;
	$display_yesterday = true;
	$display_others = true;
	if ($this->loginOk) {
		$sharing = $this->conf->sharing;
	} else {
		$sharing = array();
	}
	$hidePosts = !$this->conf->display_posts;
	$lazyload = $this->conf->lazyload;
	$topline_read = $this->conf->topline_read;
	$topline_favorite = $this->conf->topline_favorite;
	$topline_date = $this->conf->topline_date;
	$topline_link = $this->conf->topline_link;
	$bottomline_read = $this->conf->bottomline_read;
	$bottomline_favorite = $this->conf->bottomline_favorite;
	$bottomline_sharing = $this->conf->bottomline_sharing && (count($sharing));
	$bottomline_tags = $this->conf->bottomline_tags;
	$bottomline_date = $this->conf->bottomline_date;
	$bottomline_link = $this->conf->bottomline_link;

	$content_width = $this->conf->content_width;
?>

<div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php
	?><div id="new-article">
		<a href="<?php echo Minz_Url::display ($this->url); ?>"><?php echo Minz_Translate::t ('new_article'); ?></a>
	</div><?php
	foreach ($this->entries as $item) {
		if ($display_today && $item->isDay (FreshRSS_Days::TODAY, $this->today)) {
			?><div class="day" id="day_today"><?php
				echo Minz_Translate::t ('today');
				?><span class="date"> — <?php echo timestamptodate (time (), false); ?></span><?php
				?><span class="name"><?php echo $this->currentName; ?></span><?php
			?></div><?php
			$display_today = false;
		}
		if ($display_yesterday && $item->isDay (FreshRSS_Days::YESTERDAY, $this->today)) {
			?><div class="day" id="day_yesterday"><?php
				echo Minz_Translate::t ('yesterday');
				?><span class="date"> — <?php echo timestamptodate (time () - 86400, false); ?></span><?php
				?><span class="name"><?php echo $this->currentName; ?></span><?php
			?></div><?php
			$display_yesterday = false;
		}
		if ($display_others && $item->isDay (FreshRSS_Days::BEFORE_YESTERDAY, $this->today)) {
			?><div class="day" id="day_before_yesterday"><?php
				echo Minz_Translate::t ('before_yesterday');
				?><span class="name"><?php echo $this->currentName; ?></span><?php
			?></div><?php
			$display_others = false;
		}
	?><div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
		<ul class="horizontal-list flux_header"><?php
			if ($this->loginOk) {
				if ($topline_read) {
					?><li class="item manage"><?php
						$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ()));
						if ($item->isRead()) {
							$arUrl['params']['is_read'] = 0;
						}
						?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
							echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php
					?></li><?php
				}
				if ($topline_favorite) {
					?><li class="item manage"><?php
						$arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ()));
						if ($item->isFavorite()) {
							$arUrl['params']['is_favorite'] = 0;
						}
						?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
							echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php
					?></li><?php
				}
			}
			$feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed ());	//We most likely already have the feed object in cache
			if ($feed == null) {
				$feed = $item->feed(true);
				if ($feed == null) {
					$feed = FreshRSS_Feed::example();
				}
			}
			?><li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span></a></li>
			<li class="item title"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo $item->title (); ?></a></li>
			<?php if ($topline_date) { ?><li class="item date"><?php echo $item->date (); ?> </li><?php } ?>
			<?php if ($topline_link) { ?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php } ?>
		</ul>

		<div class="flux_content">
			<div class="content <?php echo $content_width; ?>">
				<h1 class="title"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo $item->title (); ?></a></h1>
				<?php
					$author = $item->author();
					echo $author != '' ? '<div class="author">' . Minz_Translate::t('by_author', $author) . '</div>' : '',
						$lazyload && $hidePosts ? lazyimg($item->content()) : $item->content();
				?>
			</div>
			<ul class="horizontal-list bottom"><?php
				if ($this->loginOk) {
					if ($bottomline_read) {
						?><li class="item manage"><?php
							$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('id' => $item->id ()));
							if ($item->isRead()) {
								$arUrl['params']['is_read'] = 0;
							}
							?><a class="read" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
								echo FreshRSS_Themes::icon($item->isRead () ? 'read' : 'unread'); ?></a><?php
						?></li><?php
					}
					if ($bottomline_favorite) {
						?><li class="item manage"><?php
							$arUrl = array('c' => 'entry', 'a' => 'bookmark', 'params' => array('id' => $item->id ()));
							if ($item->isFavorite()) {
								$arUrl['params']['is_favorite'] = 0;
							}
							?><a class="bookmark" href="<?php echo Minz_Url::display($arUrl); ?>"><?php
								echo FreshRSS_Themes::icon($item->isFavorite () ? 'starred' : 'non-starred'); ?></a><?php
						?></li><?php
					}
				} ?>
				<li class="item"><?php
						if ($bottomline_sharing) {
							$link = urlencode ($item->link ());
							$title = urlencode ($item->title () . ' · ' . $feed->name ());
					?><div class="dropdown">
						<div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div>
						<a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>">
							<?php echo FreshRSS_Themes::icon('share'); ?>
							<?php echo Minz_Translate::t ('share'); ?>
						</a>

						<ul class="dropdown-menu">
							<li class="dropdown-close"><a href="#close">❌</a></li>
							<?php foreach ($sharing as $share) :?>
								<li class="item share">
									<a target="_blank" href="<?php echo FreshRSS_Share::generateUrl($this->conf->shares, $share, $item->link(), $item->title() . ' . ' . $feed->name())?>">
										<?php echo Minz_Translate::t ($share['name']);?>
									</a>
								</li>
							<?php endforeach;?>
						</ul>
					</div>
					<?php } ?>
				</li><?php
				$tags = $bottomline_tags ? $item->tags() : null;
				if (!empty($tags)) {
				?><li class="item">
					<div class="dropdown">
						<div id="dropdown-tags-<?php echo $item->id ();?>" class="dropdown-target"></div>
						<a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php
							echo FreshRSS_Themes::icon('tag'), Minz_Translate::t ('related_tags');
						?></a>
						<ul class="dropdown-menu">
							<li class="dropdown-close"><a href="#close">❌</a></li><?php
							foreach($tags as $tag) {
								?><li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li><?php
							} ?>
						</ul>
					</div>
				</li><?php
				}
				if ($bottomline_date) {
					?><li class="item date"><?php echo $item->date (); ?></li><?php
				}
				if ($bottomline_link) {
					?><li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo FreshRSS_Themes::icon('link'); ?></a></li><?php
				} ?>
			</ul>
		</div>
	</div>
	<?php } ?>

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

<?php $this->partial ('nav_entries'); ?>

<?php } else { ?>
<div id="stream" class="alert alert-warn normal">
	<span class="alert-head"><?php echo Minz_Translate::t ('no_feed_to_display'); ?></span>
	<?php echo Minz_Translate::t ('think_to_add'); ?>
</div>
<?php } ?>