aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers/stream-footer.phtml
blob: d2334f2e81d557d2a10c3d198a46d86a75d4a576 (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
<?php
	declare(strict_types=1);
	/** @var FreshRSS_View $this */
	$url_next = Minz_Request::currentRequest();
	if (FreshRSS_Context::$continuation_id !== '0') {
		$url_next['params']['cid'] = FreshRSS_Context::$continuation_id;
	}
	if (FreshRSS_Context::$sort !== 'id') {
		$url_next['params']['idMax'] = FreshRSS_Context::$id_max;
	}
	$url_next['params']['state'] = (string)FreshRSS_Context::$state;
	$url_next['params']['ajax'] = '1';

	$url_mark_read = [
		'c' => 'entry',
		'a' => 'read',
		'params' => [
			'get' => FreshRSS_Context::currentGet(),
			'nextGet' => FreshRSS_Context::$next_get,
			'idMax' => FreshRSS_Context::$id_max,
			'search' => FreshRSS_Context::$search->toString(),
			'state' => FreshRSS_Context::$state,
			'sort' => FreshRSS_Context::$sort,
			'order' => FreshRSS_Context::$order,
		],
	];

	$hasAccess = FreshRSS_Auth::hasAccess();
	if ($hasAccess) {
?>
<form id="stream-footer" action="" method="post">
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
<?php } else { ?>
<div id="stream-footer">
<?php }?>
	<div class="stream-footer-inner">
	<?php if (FreshRSS_Context::$continuation_id !== '0') { ?>
		<button id="load_more" type="submit" class="btn" formaction="<?= Minz_Url::display($url_next) ?>"><?= _t('gen.stream.load_more') ?></button>
	<?php } elseif ($hasAccess) { ?>
		<?= _t('gen.stream.nothing_to_load') ?>
		<?php if (FreshRSS_Context::userConf()->mark_read_button !== 'none') {
			$css = '';
			switch (FreshRSS_Context::userConf()->mark_read_button) {
				case 'big':
					$css = 'as-link big';
					break;
				case 'small':
					$css = 'btn small';
					break;
			}
			?>
			<br />
			<button id="bigMarkAsRead"
				class="<?= $css ?> <?= FreshRSS_Context::userConf()->reading_confirm ? 'confirm" disabled="disabled' : '' ?>"
				form="stream-footer"
				formaction="<?= Minz_Url::display($url_mark_read) ?>"
				type="submit">
				<span class="bigTick">✓</span><br />
				<span class="markAllRead"><?= _t('gen.stream.mark_all_read') ?></span><br />
				<?php if (FreshRSS_Context::userConf()->onread_jump_next) { ?>
					<span class="jumpNext"><?= _t('conf.reading.jump_next') ?></span>
				<?php } ?>
			</button>
		<?php
		} } else { ?>
		<?= _t('gen.stream.nothing_to_load') ?><br />
	<?php } ?>
	</div>
<?php if ($hasAccess) { ?>
</form>
<?php } else {?>
</div>
<?php }?>