Move ticks from filesystem into database. I'm going to preserve the filesystem and just delete it manually. I'll add a login warning, but I'm pretty sure I'm the only person who'll ever be affected by this. Co-authored-by: Greg Sarjeant <1686767+gsarjeant@users.noreply.github.com> Reviewed-on: https://gitea.subcultureofone.org/greg/tkr/pulls/19
33 lines
1.4 KiB
PHP
33 lines
1.4 KiB
PHP
<?php
|
|
class HomeView {
|
|
public function renderTicksSection(string $siteDescription, array $ticks, int $page, int $limit){
|
|
global $config;
|
|
ob_start();
|
|
?>
|
|
|
|
<ul class="tick-feed" aria-label="Recent updates">
|
|
<?php foreach ($ticks as $tick): ?>
|
|
<?php
|
|
$datetime = new DateTime($tick['timestamp'], new DateTimeZone('UTC'));
|
|
$relativeTime = Util::relative_time($tick['timestamp']);
|
|
?>
|
|
<li class="tick" tabindex="0">
|
|
<time datetime="<?php echo $datetime->format('c') ?>"><?php echo Util::escape_html($relativeTime) ?></time>
|
|
<span class="tick-text"><?php echo Util::linkify(Util::escape_html($tick['tick'])) ?></span>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<div class="tick-pagination">
|
|
<?php if ($page > 1): ?>
|
|
<a <?php if($config->strictAccessibility): ?>tabindex="0"<?php endif; ?>
|
|
href="?page=<?php echo $page - 1 ?>">« Newer</a>
|
|
<?php endif; ?>
|
|
<?php if (count($ticks) === $limit): ?>
|
|
<a <?php if($config->strictAccessibility): ?>tabindex="0"<?php endif; ?>
|
|
href="?page=<?php echo $page + 1 ?>">Older »</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php return ob_get_clean();
|
|
}
|
|
}
|