BootstrapSQLiteBlog/lib/PostRender.php

50 lines
1.8 KiB
PHP

<?php
class PostRender
{
public static function rows($varRows)
{
$varUser = UserAuth::getUser();
$varParsedown = new Parsedown();
$intRenderedRows = 0;
?>
<?php foreach ($varRows as $r): ?>
<?php if (!UserAuth::visible($r["visibility"])) continue; ?>
<div class="container my-5">
<div class="row">
<div class="col-lg-8">
<div class="xborder xborder-secondary xrounded xp-3">
<?php echo $varParsedown->text($r["content"]); ?>
</div>
<hr />
<div class="text-muted">
<div>by <?= $r["username"]; ?></div>
<div>on <?= $r["created"]; ?> UTC</div>
</div>
<?php if (Request::getParam("edit")): ?>
<div>
<a href="/post/<?= $r["id"]; ?>">edit</a>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php $intRenderedRows++; ?>
<?php endforeach; ?>
<?php if ($intRenderedRows < 1): ?>
<div class="container my-5">
<div class="row">
<div class="col-lg-8">
<p>Sorry, there is nothing here to show.</p>
</div>
</div>
</div>
<?php endif; ?>
<?php
}
}
?>