summaryrefslogtreecommitdiff
path: root/src/application/views/view_topiclog.php
blob: be3f78df0b6eb2a78862ae8b3c33117987e63821 (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
<?php

/** @var \mystic\forum\orm\TopicLogMessage $logMessage */
/** @var ?\mystic\forum\orm\User $postAuthor */

use mystic\forum\orm\TopicLogMessage;

$hide_actions ??= false;
$hide_pfp ??= false;

$user = "";
if ($postAuthor === null) {
    $user = __("(deleted)");
} else {
    $user = '<a href="?_action=viewuser&user=' . htmlentities(urlencode($postAuthor->id)) . '">' . htmlentities($postAuthor->displayName) . '</a>';
}

?>
<div class="media" id="post-<?= htmlentities($logMessage->id) ?>">
<div class="media-left hidden-sm hidden-xs">
    <?php if ($postAuthor): ?>
        <?php if ($hide_actions): ?>
            <img class="media-object" alt="<?= __("Profile picture") ?>" src="?_action=profilepicture&amp;user=<?= htmlentities(urlencode($postAuthor->id)) ?>" width="64" height="64">
        <?php else: ?>
            <a href="?_action=viewuser&amp;user=<?= htmlentities(urlencode($postAuthor->id)) ?>">
                <img class="media-object" alt="<?= __("Profile picture") ?>" src="?_action=profilepicture&amp;user=<?= htmlentities(urlencode($postAuthor->id)) ?>" width="64" height="64">
            </a>
        <?php endif; ?>
    <?php else: ?>
        <div class="media-object" style="width:64px;height:64px"></div>
    <?php endif; ?>
</div>
<div class="media-body">
    <?php if ($logMessage->type === TopicLogMessage::LOCKED): ?>
        <div class="well icon-well text-info">
            <span class="glyphicon glyphicon-lock text-info" aria-hidden="true"></span>
            <em><?= __("%user% locked this topic", [
                "user" => $user,
            ]) ?></em>
            <br>
            <small class="_time"><?= $logMessage->postDate->format("c") ?></small>
        </div>
    <?php elseif ($logMessage->type === TopicLogMessage::UNLOCKED): ?>
        <div class="well icon-well text-success">
            <span class="glyphicon glyphicon-globe text-success" aria-hidden="true"></span>
            <em><?= __("%user% unlocked this topic", [
                "user" => $user,
            ]) ?></em>
            <br>
            <small class="_time"><?= $logMessage->postDate->format("c") ?></small>
        </div>
    <?php elseif ($logMessage->type === TopicLogMessage::TITLE_CHANGED): ?>
        <div class="well icon-well text-info">
            <span class="glyphicon glyphicon-pencil text-info" aria-hidden="true"></span>
            <em><?= __("%user% changed the title of this topic from %old_title% to %new_title%", [
                "user" => $user,
                "old_title" => '<strong>' . htmlentities($logMessage->params["old_value"] ?? __("unknown")) . '</strong>',
                "new_title" => '<strong>' . htmlentities($logMessage->params["new_value"] ?? __("unknown")) . '</strong>',
            ]) ?></em>
            <br>
            <small class="_time"><?= $logMessage->postDate->format("c") ?></small>
        </div>
    <?php else: ?>
        <?= __("unknown") ?>
    <?php endif; ?>
</div>
</div>