aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/members/awaiting_list.php
blob: b59767f22cda90f950c79a5eef72613e040a13b6 (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<br>
<a name="awaiting"></a>
<form action="<?= $controller->link_for('course/members/edit_awaiting') ?>" method="post" data-dialog="size=50%">
    <?= CSRFProtection::tokenTag() ?>
    <table class="default collapsable ">
        <caption>
            <?= $waitingTitle ?>
            <span class="actions">
                <a href="<?= URLHelper::getLink('dispatch.php/messages/write', [
                    'filter'               => $waiting_type,
                    'emailrequest'         => 1,
                    'course_id'            => $course_id,
                    'default_subject'      => $subject,
                ])?>" data-dialog title="<?= _('Nachricht mit Mailweiterleitung an alle Wartenden versenden') ?>">
                    <?= Icon::create('inbox') ?>
                </a>
            </span>
        </caption>
        <colgroup>
        <? if (!$is_locked): ?>
            <col width="20">
        <? endif; ?>
            <col width="20">
            <col>
            <col width="15%">
            <col width="35%">
            <col width="80">
        </colgroup>
        <thead>
            <tr class="sortable">
            <? if (!$is_locked) : ?>
                <th>
                    <input aria-label="<?= _('NutzerInnen auswählen') ?>"
                           type="checkbox" name="all" value="1"
                           data-proxyfor=":checkbox[name^=awaiting]"
                           data-activates="#action_awaiting,button[name='submit_awaiting']">
                </th>
            <? endif ?>
                <th><p class="sr-only"><?= _('Nummer') ?></p></th>
                <th <? if ($sort_by === 'nachname' && $sort_status === $waiting_type) printf('class="sort%s"', $order); ?>>
                    <a href="<?= URLHelper::getLink(sprintf(
                        "?sortby=nachname&sort_status={$waiting_type}&order=%s&toggle=%s#awaiting",
                        $order,
                        $sort_by === 'nachname'
                    )) ?>">
                        <?= _('Nachname, Vorname') ?>
                    </a>
                </th>
                <th style="text-align: center" <? if ($sort_by === 'position' && $sort_status === $waiting_type) printf('class="sort%s"', $order); ?>>
                    <? $order = $sort_status !== $waiting_type ? 'desc' : $order; ?>
                    <a href="<?= URLHelper::getLink(sprintf(
                        '?sortby=position&sort_status=%s&order=%s&toggle=%s#awaiting',
                        $waiting_type,
                        $order,
                        $sort_by === 'position'
                    )) ?>">
                    <? if ($waiting_type === 'awaiting'): ?>
                        <?= _('Position') ?>
                    <? else: ?>
                        <?= _('Priorität') ?>
                    <? endif; ?>
                    </a>
                </th>
                <th><?= _('Studiengang')  ?></th>
                <th class="actions"><?= _('Aktion') ?></th>
            </tr>
        </thead>
        <tbody>
        <? $nr = 0 ?>
        <? foreach ($awaiting as $waiting) : ?>
            <? $fullname = $waiting['fullname'] ;?>
            <tr>
            <? if (!$is_locked) : ?>
                <td>
                    <input aria-label="<?= sprintf(_('%s auswählen'), htmlReady($fullname)) ?>" type="checkbox"
                           name="awaiting[<?= htmlReady($waiting['user_id']) ?>]" value="1"
                           <? if (isset($flash['checked']) && in_array($waiting['user_id'], $flash['checked'])) echo 'checked'; ?>>
                        </td>
            <? endif ?>
                <td style="text-align: right"><?= sprintf('%02d', ++$nr) ?></td>
                <td>
                    <a href="<?= $controller->link_for('profile', ['username' => $waiting['username']]) ?>" <? if ($waiting['mkdate'] >= $last_visitdate) echo 'class="new-member"'; ?>>
                        <?= Avatar::getAvatar($waiting['user_id'], $waiting['username'])->getImageTag(Avatar::SMALL, [
                            'style' => 'margin-right: 5px',
                            'title' => $fullname,
                        ]) ?>
                        <?= htmlReady($fullname) ?>
                    </a>
                </td>
                <td style="text-align: center">
                    <?= $waiting['position'] ?>
                </td>
                <td>
                    <?= $this->render_partial('course/members/_studycourse.php', [
                        'studycourses' => new SimpleCollection(UserStudyCourse::findByUser($waiting['user_id']))
                    ]) ?>
                </td>
                <td class="actions">
                    <? $actionMenu = ActionMenu::get()->setContext($fullname) ?>
                    <? if ($user_id !== $waiting['user_id']) : ?>
                        <? $actionMenu->addLink(
                            URLHelper::getURL('dispatch.php/messages/write', [
                                'filter'           => 'send_sms_to_all',
                                'emailrequest'    => 1,
                                'rec_uname'       => $waiting['username'],
                                'default_subject' => $subject,
                            ]),
                            _('Nachricht mit Mailweiterleitung senden'),
                            Icon::create(
                                'mail',
                                Icon::ROLE_CLICKABLE,
                                [
                                    'title' => sprintf(
                                        _('Nachricht mit Weiterleitung an %s senden'),
                                        $fullname
                                    )
                                ]
                            ),
                            ['data-dialog' => '']
                        ) ?>
                    <? endif?>
                    <? if (!$is_locked) : ?>
                        <? $actionMenu->addLink(
                            $controller->url_for('course/members/cancel_subscription/singleuser/' . $waiting_type . '/' . $waiting['user_id']),
                            _('Aus Veranstaltung austragen'),
                            Icon::create('door-leave'),
                            ['title' => sprintf(_('%s austragen'), $fullname)]
                        ) ?>
                    <? endif ?>
                    <?= $actionMenu->render() ?>
                </td>
            </tr>
        <? endforeach ?>
        </tbody>
    <? if (!$is_locked) : ?>
        <tfoot>
            <tr>
                <td colspan="6" class="groupactions">
                    <select name="action_awaiting" id="action_awaiting" aria-label="<?= _('Aktion auswählen') ?>">
                        <option value="">- <?= _('Aktion auswählen') ?></option>
                        <option value="upgrade_autor">
                            <?= sprintf(_('Zu %s hochstufen'), htmlReady($status_groups['autor'])) ?>
                        </option>
                        <option value="upgrade_user">
                            <?= sprintf(_('Zu %s hochstufen'), htmlReady($status_groups['user'])) ?>
                        </option>
                        <option value="remove"><?= _('Austragen') ?></option>
                        <option value="message"><?=_('Nachricht senden')?></option>
<!--                    <option value="copy_to_sem"><?= _('In Seminar verschieben/kopieren') ?></option>-->
                    </select>
                    <input type="hidden" value="<?= htmlReady($waiting_type) ?>" name="waiting_type"/>
                    <?= \Studip\Button::create(_('Ausführen'), 'submit_awaiting') ?>
                </td>
            </tr>
        </tfoot>
    <? endif ?>
    </table>
</form>