diff options
author | Jonas Kohl | 2024-09-17 14:51:23 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-09-17 14:51:23 +0200 |
commit | a65d424263adfbff9629c7d91a613e4504c84613 (patch) | |
tree | 7d89c6d85168427782ae8c24625db14df90e376a /src/application/views/view_search_results.php | |
parent | f6dd78734f86f8daed7c5d472e7a199301095ff8 (diff) |
Add search
Diffstat (limited to 'src/application/views/view_search_results.php')
-rw-r--r-- | src/application/views/view_search_results.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/application/views/view_search_results.php b/src/application/views/view_search_results.php new file mode 100644 index 0000000..19a6978 --- /dev/null +++ b/src/application/views/view_search_results.php @@ -0,0 +1,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&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 color-info" aria-hidden="true"></span> + <em><?= __("No results for this search") ?></em> + </div> +<?php endif; ?> |