aboutsummaryrefslogtreecommitdiff
path: root/app/views/messages/read.php
blob: 85f7eabf1e534fa8d3b841acb66acb9fd1b05e89 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<? if (!Request::isXhr()) : ?>
    <h1 class="responsive-hidden"><?= _("Betreff").": ".htmlReady($message["subject"]) ?></h1>
<? endif ?>

<? if ($message["autor_id"] !== "____%system%____") : ?>
<div style="float:left; margin-right: 10px;"><?= Avatar::getAvatar($message["autor_id"])->getImageTag(Avatar::MEDIUM) ?></div>
<? endif ?>
<table id="message_metadata" data-message_id="<?= $message->getId() ?>">
    <tbody>
        <tr>
            <td><strong><?= _("Von") ?></strong></td>
            <td>
            <? if ($message['autor_id'] === '____%system%____'): ?>
                <?= _('Stud.IP') ?>
            <? else: ?>
                <a href="<?= URLHelper::getLink("dispatch.php/profile", ['username' => get_username($message["autor_id"])]) ?>"><?= htmlReady(get_fullname($message["autor_id"])) ?></a>
            <? endif; ?>
            </td>
        </tr>
        <tr>
            <td><strong><?= _("An") ?></strong></td>
            <td>
                <? $num_recipients = $message->getNumRecipients() ?>
                <? if ($message["autor_id"] !== $GLOBALS["user"]->id && (!$message['show_adressees'] || $num_recipients > Config::get()->SHOW_ADRESSEES_LIMIT)) : ?>
                    <?= $num_recipients > 1 ? sprintf(_("%s Personen"), $num_recipients) : _("Eine Person") ?>
                <? else : ?>
                <ul class="list-csv" id="adressees">
                <? foreach ($message->getRecipients() as $message_user) : ?>
                    <li>
                        <a href="<?= URLHelper::getLink("dispatch.php/profile", ['username' => $message_user["username"]]) ?>">
                            <?= htmlReady($message_user['fullname']) ?><!-- avoid extra space before ::after
                     --></a><!--
                 --></li>
                <? endforeach ?>
                </ul>
                <? endif ?>
            </td>
        </tr>
        <tr>
            <td><strong><?= _("Datum") ?></strong></td>
            <td><?= date("d.m.Y H:i", $message['mkdate']) ?></td>
        </tr>
        <tr>
            <td><strong><?= _("Schlagworte") ?></strong></td>
            <td>
                <form id="message-tags" action="<?= $controller->url_for('messages/tag/' . $message->id) ?>" method="post" data-dialog>
                <? foreach ($message->getTags() as $tag) : ?>
                    <span>
                        <a href="<?= URLHelper::getLink("?", ['tag' => $tag]) ?>" class="message-tag" title="<?= _("Alle Nachrichten zu diesem Schlagwort") ?>">
                            <?= htmlReady($tag) ?>
                        </a>
                        <?= Icon::create('trash', 'clickable', ['title' => _("Schlagwort entfernen")])->asInput(["class" => 'text-bottom', "name" => 'remove_tag', "value" => $tag]) ?>
                    </span>
                <? endforeach ?>
                    <span class="message-tags-wrapper">
                        <input type="text" name="add_tag">
                        <?= Icon::create('add', 'clickable', ['title' => _('Schlagwort hinzufügen')])->asInput() ?>
                    </span>
                </form>
            </td>
        </tr>
    </tbody>
</table>
<div class="clear"></div>

<div class="message_body">
    <?= formatReady($message["message"]) ?>
</div>
<? if($attachment_folder): ?>
    <table class="default sortable-table message-attachments" data-sortlist="[[2, 0]]">
        <caption><?= _('Anhänge') ?></caption>
        <?= $this->render_partial('files/_files_thead') ?>
        <? foreach($attachment_folder->getFiles() as $file): ?>
            <? if ($file->isVisible($GLOBALS['user']->id)) : ?>
                <?= $this->render_partial(
                    'files/_fileref_tr',
                    [
                        'file'           => $file,
                        'current_folder' => $attachment_folder,
                        'last_visitdate' => time()
                    ]
                ) ?>
            <? endif ?>
        <? endforeach ?>
    </table>
<? endif ?>

<div align="center" data-dialog-button>
    <div class="button-group">
    <? if ($message['autor_id'] !== '____%system%____'): ?>
        <?= Studip\LinkButton::create(
            _('Antworten'),
            URLHelper::getURL('dispatch.php/messages/write', ['answer_to' => $message->id, 'quote' => $message->id]),
            ['data-dialog' => 'size=700']
        ) ?>
    <? endif; ?>
        <?= Studip\LinkButton::create(
            _('Weiterleiten'),
            URLHelper::getURL('dispatch.php/messages/write', ['answer_to' => $message->id, 'forward' => 'rec']),
            ['data-dialog' => 'size=700']
        ) ?>
    </div>
    <?= Studip\LinkButton::create(
        _('Drucken'),
        URLHelper::getURL('dispatch.php/messages/print/' . $message->id),
        ['class' => 'print_action']

    ) ?>
    <form action="<?= $controller->delete($message, $mbox) ?>" method="post" style="display: inline;">
        <input type="hidden" name="studip-ticket" value="<?= get_ticket() ?>">
        <?= \Studip\Button::create(_('Löschen'), 'delete', [
            'data-confirm' => _('Nachricht wirklich löschen?'),
        ])?>
    </form>
</div>