aboutsummaryrefslogtreecommitdiff
path: root/app/views/contact/index.php
blob: 0bcdcd3a6b479aa93cfe47ca9a9d3185284e6209 (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
116
117
118
<? use \Studip\Button; ?>
<form action="<?= $controller->url_for('contact/edit_contact/' . $filter) ?>" method="post">
    <?= CSRFProtection::tokenTag() ?>
    <table class="default">
        <caption>
            <?= htmlReady($title) ?>
            <span class='actions'>
                <?= $multiPerson ?>
                <? if ($filter): ?>
                    <a href="<?= $controller->url_for('contact/editGroup/' . $filter) ?>" data-dialog="size=auto"
                       title="<?= _('Gruppe bearbeiten') ?>">
                        <?= Icon::create('edit') ?>
                    </a>
                    <?= Icon::create('trash')->asInput(
                        ['formaction'   => $controller->url_for('contact/deleteGroup/' . $filter),
                         'title'        => _('Gruppe löschen'),
                         'data-confirm' => sprintf(_('Gruppe %s wirklich löschen?'), $title)]) ?>
                <? endif; ?>
            </span>
        </caption>
        <thead>
            <tr>
                <th style="width:20px !important;">
                    <input aria-label="<?= _('Alle %s auswählen') ?>"
                           type="checkbox" name="all" value="1" data-proxyfor=":checkbox[name^=contact]">
                </th>
                <th>
                    <?= _('Name') ?>
                </th>
                <th class="hidden-small-down">
                    <?= _('Stud.IP') ?>
                </th>
                <th class="hidden-small-down">
                    <?= _('E-Mail') ?>
                </th>
                <th class="actions">
                    <?= _('Aktionen') ?>
                </th>
            </tr>
        </thead>
        <tbody>
            <? if (!empty($contacts))  : ?>
                <? foreach ($contacts as $header => $contactgroup): ?>
                    <tr id="letter_<?= $header ?>">
                        <th colspan="5">
                            <?= $header ?>
                        </th>
                    </tr>
                    <? foreach ($contactgroup as $contact): ?>
                        <tr id="contact_<?= $contact->id ?>">
                            <td>
                                <input aria-label="<?= _('Auswählen') ?>"
                                       type="checkbox" name="contact[<?= $contact->username ?>]" value="1"
                                    <? if (isset($flash['contacts']) && in_array($contact->id, $flash['contacts'])) echo 'checked'; ?>>
                            </td>
                            <td>
                                <?= ObjectdisplayHelper::avatarlink($contact) ?>
                            </td>
                            <td class="hidden-small-down">
                                <a data-dialog="button"
                                   href="<?= URLHelper::getLink('dispatch.php/messages/write', ['rec_uname' => $contact->username]) ?>">
                                    <?= htmlReady($contact->username) ?>
                                </a>
                            </td>
                            <td class="hidden-small-down">
                                <a href="mailto:<?= htmlReady($contact->email) ?>">
                                    <?= htmlReady($contact->email) ?>
                                </a>
                            </td>
                            <td class="actions">
                                <? $actionMenu = ActionMenu::get()->setContext($contact) ?>
                                <? if (Config::get()->BLUBBER_GLOBAL_MESSENGER_ACTIVATE) : ?>
                                    <? $actionMenu->addLink(
                                        URLHelper::getURL('dispatch.php/blubber/write_to/' . $contact->user_id),
                                        _('Blubber diesen Nutzer an'),
                                        Icon::create('blubber'),
                                        ['data-dialog' => '']
                                    ) ?>
                                <? endif ?>
                                <? $actionMenu->addLink($controller->url_for('contact/vcard', ['user[]' => $contact->username]),
                                    _('vCard herunterladen'),
                                    Icon::create('vcard')) ?>
                                <?= $actionMenu->addButton('remove_person',
                                    $filter ? _('Kontakt aus Gruppe entfernen') : _('Kontakt entfernen'),
                                    Icon::create('trash',
                                        [
                                            'data-confirm' => sprintf(
                                                _('Wollen Sie %s wirklich von der Liste entfernen'),
                                                $contact->username
                                            ),
                                            'formaction'   => $controller->url_for('contact/remove/' . $filter, ['user' => $contact->username])
                                        ])
                                )->render() ?>
                            </td>
                        </tr>
                    <? endforeach; ?>
                <? endforeach; ?>
            <? else : ?>
                <tr>
                    <td colspan="4" style="text-align: center">
                        <?= $filter ? _('Keine Kontakte in der Gruppe vorhanden') : _('Keine Kontakte vorhanden') ?>
                    </td>
                </tr>
            <? endif ?>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="5" class="groupactions">
                    <select name="action_contact" id="contact_action" aria-label="<?= _('Aktion auswählen') ?>">
                        <option value="">- <?= _('Aktion auswählen') ?></option>
                        <option value="remove"><?= $filter ? _('Kontakte aus Gruppe entfernen') : _('Kontakte entfernen') ?></option>
                    </select>
                    <?= Button::create(_('Ausführen'), 'submit_action') ?>
                </td>
            </tr>
        </tfoot>
    </table>
</form>