summaryrefslogtreecommitdiff
path: root/src/application/views/view_search_results.php
blob: e21fbb8758bdba5b2c5dc82bb1ad7302940aeccd (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
<?php
use mystic\forum\utils\StringUtils;
?>

<?php if (count($posts) > 0): ?>
    <p><?= __("%result_count% result(s) in %search_duration% second(s)", [
        "result_count" => count($posts),
        "search_duration" => number_format($search_duration, 2, __(".", context: "Number formatting"), __(",", context: "Number formatting")),
    ]) ?></p>
    <div class="list-group margin-top">
        <?php foreach ($posts as $post):
            if ($post->deleted) continue;
            $hasAttachments = count($attachments[$post->id]) > 0;
        ?>
            <a href="?_action=viewtopic&amp;topic=<?= htmlentities(urlencode($post->topicId)) ?>#post-<?= htmlentities(urlencode($post->id)) ?>" class="list-group-item">
                <?php if ($hasAttachments): ?>
                    <span class="badge"><span class="glyphicon glyphicon-paperclip"></span></span>
                <?php endif; ?>
                <?= htmlentities(StringUtils::truncate(strip_tags(renderPost($post->content)), 100)) ?><br>
                <span class="text-muted"><?= __("posted by %author% on %post_date% in %topic%", [
                    "author" => '<em>' . htmlentities($users[$post->authorId]?->displayName ?? __("unknown")) . '</em>',
                    "post_date" => '<span class="_time">' . htmlentities($post->postDate->format("c")) . '</span>',
                    "topic" => '<em>' . htmlentities($topics[$post->topicId]?->title ?? "unknown") . '</em>',
                ]) ?></span>
            </a>
        <?php endforeach; ?>
    </div>
<?php else: ?>
    <div class="well icon-well text-info margin-top margin-bottom">
        <span class="glyphicon glyphicon-info-sign text-info" aria-hidden="true"></span>
        <em><?= __("No results for this search") ?></em>
    </div>
<?php endif; ?>