aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/studygroup/members.php
blob: 060f33945c455ad1e06772be607fbabab8bbdcd9 (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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php
/**
 * @var Course_StudygroupController $controller
 * @var int $anzahl
 * @var int $page
 * @var string $sem_id
 * @var array $moderators
 * @var array $tutors
 * @var array $autors
 * @var array $accepted
 * @var bool $rechte
 * @var string $view
 * @var array $sem_class
 * @var StudygroupInvitation[] $invitedMembers
 */
?>
<?= $this->render_partial('course/studygroup/_feedback', compact('anzahl', 'page', 'sem_id')) ?>

<? if (count($moderators) > 0): ?>
    <?= $this->render_partial("course/studygroup/_members_{$view}.php", [
        'title'          => $sem_class['title_dozent_plural'] ?: _('Gruppenadministrator/-innen'),
        'sem_id'         => $sem_id,
        'members'        => $moderators,
        'moderator_list' => true,
        'type'           => 'moderator',
    ]) ?>
<? endif ?>

<? if (count($tutors) > 0): ?>
    <?= $this->render_partial("course/studygroup/_members_{$view}.php", [
        'title'   => $sem_class['title_tutor_plural'] ?: _('Moderator/-innen'),
        'sem_id'  => $sem_id,
        'members' => $tutors,
        'type'    => 'tutor',
    ]) ?>
<? endif ?>

<? if (count($autors) > 0): ?>
    <?= $this->render_partial("course/studygroup/_members_{$view}.php", [
        'title'   => $sem_class['title_autor_plural'] ?: _('Mitglieder'),
        'sem_id'  => $sem_id,
        'members' => $autors,
        'type'    => 'autor',
    ]) ?>
<? endif ?>


<? if ($rechte): ?>
    <? if (count($accepted) > 0): ?>
        <form action="<?= $controller->edit_members('bulk') ?>" method="post">
            <table class="default sortable-table" id="studygroup-members">
                <caption><?= _('Offene Mitgliedsanträge') ?></caption>
                <colgroup>
                    <col style="width: 24px">
                    <col style="width: 40px">
                    <col>
                    <col style="width: 80px">
                </colgroup>
                <thead>
                    <tr>
                        <th data-sort="false">
                            <input type="checkbox"
                                   data-proxyfor="#studygroup-members tbody :checkbox"
                                   data-activates="#studygroup-members tfoot .button">
                        </th>
                        <th data-sort="false"></th>
                        <th data-sort="text"><?= _('Name') ?></th>
                        <th data-sort="false" class="actions">
                            <?= _('Aktionen') ?>
                        </th>
                    </tr>
                </thead>
                <tbody>
                <? foreach ($accepted as $p) : ?>
                    <tr>
                        <td>
                            <input type="checkbox" name="members[]" value="<?= htmlReady($p['username']) ?>">
                        </td>
                        <td>
                            <a href="<?= URLHelper::getLink('dispatch.php/profile', ['username' => $p->username]) ?>">
                                <?= Avatar::getAvatar($p['user_id'])->getImageTag(Avatar::SMALL) ?>
                            </a>
                        </td>
                        <td>
                            <a href="<?= URLHelper::getLink('dispatch.php/profile', ['username' => $p->username]) ?>">
                                <?= htmlReady($p->user->getFullName('no_title_rev')) ?>
                            </a>
                        </td>
                        <td class="actions">
                            <a href="<?= $controller->edit_members('accept', ['user' => $p->username]) ?>">
                                <?= Icon::create('accept')->asSvg(['title' => _('Eintragen')]) ?>
                            </a>

                            <a href="<?= $controller->edit_members('deny', ['user' => $p->username]) ?>" data-confirm="<?= _('Wollen Sie die Mitgliedschaft wirklich ablehnen?') ?>">
                                <?= Icon::create('trash')->asSvg(['title' => _('Mitgliedschaft ablehnen')]) ?>
                            </a>
                        </td>
                    </tr>
                <? endforeach ?>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="4">
                            <?= Studip\Button::create(_('Personen eintragen'), 'accept', [
                                'data-confirm' => _('Wollen Sie die markierten Personen wirklich eintragen?'),
                            ]) ?>
                            <?= Studip\Button::create(_('Mitgliedschaften ablehnen'), 'deny', [
                                'data-confirm' => _('Wollen Sie die Mitgliedschaften wirklich ablehnen?'),
                            ]) ?>
                        </td>
                    </tr>
                </tfoot>
            </table>
        </form>
    <? endif; ?>

    <? if (count($invitedMembers) > 0) : ?>
        <form action="<?= $controller->edit_members('bulk') ?>" method="post">
            <table class="default sortable-table" id="studygroup-awaiting">
                <caption><?= _('Verschickte Einladungen') ?></caption>
                <colgroup>
                    <col style="width: 24px">
                    <col style="width: 40px">
                    <col>
                    <col style="width: 80px">
                </colgroup>
                <thead>
                    <tr>
                        <th data-sort="false">
                            <input type="checkbox"
                                   data-proxyfor="#studygroup-awaiting tbody :checkbox"
                                   data-activates="#studygroup-awaiting tfoot .button">
                        </th>
                        <th data-sort="false"></th>
                        <th data-sort="text"><?= _('Name') ?></th>
                        <th data-sort="false" class="actions">
                            <?= _('Aktionen') ?>
                        </th>
                    </tr>
                </thead>
                <tbody>
                <? foreach ($invitedMembers as $p): ?>
                    <tr>
                        <td>
                            <input type="checkbox" name="members[]" value="<?= htmlReady($p->user->username) ?>">
                        </td>
                        <td>
                            <a href="<?= URLHelper::getLink('dispatch.php/profile' , ['username' => $p->user->username]) ?>">
                                <?= Avatar::getAvatar($p->user_id)->getImageTag(Avatar::SMALL) ?>
                            </a>
                        </td>
                        <td>
                            <a href="<?= URLHelper::getLink('dispatch.php/profile' , ['username' => $p->user->username]) ?>">
                                <?= htmlReady($p->user->getFullName()) ?>
                            </a>
                        </td>
                        <td class="actions">
                            <a href="<?= $controller->edit_members('cancelInvitation', ['user' => $p->user->username]) ?>" data-confirm="<?= _('Wollen Sie die Einladung wirklich löschen?') ?>">
                                <?= Icon::create('trash')->asSvg(['title' => _('Einladung löschen')]) ?>
                            </a>
                        </td>
                    </tr>
                <? endforeach; ?>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="4">
                            <?= Studip\Button::create(_('Einladungen löschen'), 'cancel-invitations', [
                                'data-confirm' => _('Wollen Sie die markierten Einladungen wirklich löschen?'),
                            ]) ?>
                        </td>
                    </tr>
                </tfoot>
            </table>
        </form>
    <? endif; ?>
<? endif; ?>