aboutsummaryrefslogtreecommitdiff
path: root/app/views/calendar/single/manage_access.php
blob: 4f7be8f86b8e952f36d73493981b59ba15b50fae (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
<? if (Request::isXhr()) : ?>
    <? foreach (PageLayout::getMessages() as $messagebox) : ?>
        <?= $messagebox ?>
    <? endforeach ?>
<? endif; ?>
<form id="calendar-manage-access" data-dialog="" method="post" action="<?= $controller->url_for('calendar/single/store_permissions/' . $calendar->getRangeId()) ?>">
    <? CSRFProtection::tokenTag() ?>
    <? $perms = [1 => _('Keine'), 2 => _('Lesen'), 4 => _('Schreiben')] ?>
    <table class="default">
        <caption>
            <?= _('Bestehende Freigaben') ?>
            <span class="actions" style="font-size: 0.8em;">
                <label>
                    <?= _('Auswahl') ?>:
                    <select name="group_filter" size="1" class="submit-upon-select">
                        <option value="list"<?= $group_filter_selected == 'list' ? ' selected' : '' ?>><?= _('Alle Personen anzeigen') ?></option>
                        <? foreach ($filter_groups as $filter_group) : ?>
                        <option value="<?= $filter_group->getId() ?>"<?= $group_filter_selected == $filter_group->getId() ? ' selected' : '' ?>><?= htmlReady($filter_group->name) ?></option>
                        <? endforeach; ?>
                    </select>
                </label>
                <?= Icon::create('accept', 'clickable')
                      ->asInput([
                        'id' => "calendar-group-submit",
                        'name' => "calendar_group_submit",
                        'class' => "text-top"]) ?>
                <span style="padding-left: 1em;">
                    <?= $mps->render() ?>
                </span>
                <script>
                    STUDIP.MultiPersonSearch.init();
                </script>
            </span>
        </caption>
        <thead>
            <tr>
                <th>
                    <?= _('Name') ?>
                </th>
                <th>
                    <?= _('Berechtigung') ?>
                </th>
                <th>
                    <?= _('Eigene Berechtigung') ?>
                </th>
                <th class="actions">
                    <?= _('Aktionen') ?>
                </th>
            </tr>
        </thead>
        <tbody>
            <? foreach ($users as $header => $usergroup): ?>
                <tr id="letter_<?= $header ?>" class="calendar-user-head">
                    <th colspan="4">
                        <?= $header ?>
                    </th>
                </tr>
                <? foreach ($usergroup as $user): ?>
                    <tr id="contact_<?= $user->user_id ?>">
                        <td>
                            <?= ObjectdisplayHelper::avatarlink($user->user) ?>
                        </td>
                        <td style="white-space: nowrap;">
                            <label>
                                <input type="radio" name="perm[<?= $user->user_id ?>]" value="<?= Calendar::PERMISSION_FORBIDDEN ?>"
                                       <?= $user->permission < Calendar::PERMISSION_READABLE ? ' checked' : '' ?>>
                                <?= _('Keine') ?>
                            </label>
                            <label>
                                <input type="radio" name="perm[<?= $user->user_id ?>]" value="<?= Calendar::PERMISSION_READABLE ?>"
                                    <?= $user->permission == Calendar::PERMISSION_READABLE ? ' checked' : '' ?>>
                                <?= _('Lesen') ?>
                            </label>
                            <label>
                                <input type="radio" name="perm[<?= $user->user_id ?>]" value="<?= Calendar::PERMISSION_WRITABLE ?>"
                                    <?= $user->permission == Calendar::PERMISSION_WRITABLE ? ' checked' : '' ?>>
                                <?= _('Schreiben') ?>
                            </label>
                        </td>
                        <td>
                            <?= $perms[$own_perms[$user->user_id]] ?>
                        </td>
                        <td class="actions">
                            <a title="<?= _('Benutzer entfernen') ?>" onClick="STUDIP.CalendarDialog.removeUser(this);" href="<?= $controller->url_for('calendar/single/remove_user/' . $calendar->getRangeId(), ['user_id' => $user->user_id]) ?>">
                                <?= Icon::create('trash', 'clickable')->asImg() ?>
                            </a>
                        </td>
                    </tr>
                <? endforeach; ?>
            <? endforeach; ?>
        </tbody>
    </table>
    <div style="text-align: center;" data-dialog-button>
        <?= Studip\Button::create(_('Speichern'), 'store') ?>
        <? if (!Request::isXhr()) : ?>
        <?= Studip\LinkButton::create(_('Abbrechen'), $controller->url_for('calendar/single/' . $last_view)) ?>
        <? endif; ?>
    </div>
</form>