aboutsummaryrefslogtreecommitdiff
path: root/app/views/vips/pool/list_exercises.php
blob: d65a7db1cc4bb368992ab68a79b5930b8985f96a (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
<?php
/**
 * @var Vips_PoolController $controller
 * @var string $sort
 * @var bool $desc
 * @var int $page
 * @var array $search_filter
 * @var int $count
 * @var Exercise[] $exercises
 */
?>
<form action="" method="POST">
    <?= CSRFProtection::tokenTag() ?>
    <input type="hidden" name="sort" value="<?= $sort ?>">
    <input type="hidden" name="desc" value="<?= $desc ?>">
    <input type="hidden" name="page" value="<?= $page ?>">
    <input type="hidden" name="search_filter[search_string]" value="<?= htmlReady($search_filter['search_string']) ?>">
    <input type="hidden" name="search_filter[exercise_type]" value="<?= htmlReady($search_filter['exercise_type']) ?>">

    <table class="default">
        <caption>
            <?= _('Aufgaben') ?>
            <div class="actions">
                <?= sprintf(ngettext('%d Aufgabe', '%d Aufgaben', $count), $count) ?>
            </div>
        </caption>

        <thead>
            <tr class="sortable">
                <th style="width: 20px;">
                    <input type="checkbox" data-proxyfor=".batch_select" data-activates=".batch_action" aria-label="<?= _('Alle Aufgaben auswählen') ?>">
                </th>

                <th style="width: 35%;" class="<?= $controller->sort_class($sort === 'title', $desc) ?>">
                    <a href="<?= $controller->link_for('vips/pool/exercises', ['sort' => 'title', 'desc' => $sort === 'title' && !$desc, 'search_filter' => $search_filter]) ?>">
                        <?= _('Titel') ?>
                    </a>
                </th>

                <th style="width: 10%;" class="<?= $controller->sort_class($sort === 'type', $desc) ?>">
                    <a href="<?= $controller->link_for('vips/pool/exercises', ['sort' => 'type', 'desc' => $sort === 'type' && !$desc, 'search_filter' => $search_filter]) ?>">
                        <?= _('Aufgabentyp') ?>
                    </a>
                </th>

                <th style="width: 15%;" class="<?= $controller->sort_class($sort === 'Nachname', $desc) ?>">
                    <a href="<?= $controller->link_for('vips/pool/exercises', ['sort' => 'Nachname', 'desc' => $sort === 'Nachname' && !$desc, 'search_filter' => $search_filter]) ?>">
                        <?= _('Autor/-in') ?>
                    </a>
                </th>

                <th style="width: 10%;" class="<?= $controller->sort_class($sort === 'mkdate', $desc) ?>">
                    <a href="<?= $controller->link_for('vips/pool/exercises', ['sort' => 'mkdate', 'desc' => $sort === 'mkdate' && !$desc, 'search_filter' => $search_filter]) ?>">
                        <?= _('Datum') ?>
                    </a>
                </th>

                <th style="width: 20%;" class="<?= $controller->sort_class($sort === 'test_title', $desc) ?>">
                    <a href="<?= $controller->link_for('vips/pool/exercises', ['sort' => 'test_title', 'desc' => $sort === 'test_title' && !$desc, 'search_filter' => $search_filter]) ?>">
                        <?= _('Aufgabenblatt') ?>
                    </a>
                </th>

                <th class="actions">
                    <?= _('Aktionen') ?>
                </th>
            </tr>
        </thead>

        <tbody>
            <? foreach ($exercises as $exercise): ?>
                <? $exercise_obj = Exercise::buildExisting($exercise) ?>
                <? $course_id = $exercise['range_type'] === 'course' ? $exercise['range_id'] : null ?>
                <tr>
                    <td>
                        <input class="batch_select" type="checkbox" name="exercise_ids[<?= $exercise['id'] ?>]" value="<?= $exercise['assignment_id'] ?>" aria-label="<?= _('Zeile auswählen') ?>">
                    </td>

                    <td>
                        <a href="<?= $controller->link_for('vips/sheets/edit_exercise', ['cid' => $course_id, 'assignment_id' => $exercise['assignment_id'], 'exercise_id' => $exercise['id']]) ?>">
                            <?= htmlReady($exercise['title']) ?>
                        </a>
                    </td>

                    <td>
                        <?= htmlReady($exercise_obj->getTypeName()) ?>
                    </td>

                    <td>
                        <? if (isset($exercise['Nachname']) || isset($exercise['Vorname'])): ?>
                            <?= htmlReady($exercise['Nachname'] . ', ' . $exercise['Vorname']) ?>
                        <? endif ?>
                    </td>

                    <td>
                        <?= date('d.m.Y, H:i', $exercise['mkdate']) ?>
                    </td>

                    <td>
                        <a href="<?= $controller->link_for('vips/sheets/edit_assignment', ['cid' => $course_id, 'assignment_id' => $exercise['assignment_id']]) ?>">
                            <?= htmlReady($exercise['test_title']) ?>
                        </a>
                    </td>

                    <td class="actions">
                        <? $menu = ActionMenu::get() ?>
                        <? $menu->addLink($controller->url_for('vips/sheets/show_exercise', ['cid' => $course_id, 'assignment_id' => $exercise['assignment_id'], 'exercise_id' => $exercise['id']]),
                               _('Studierendensicht anzeigen'), Icon::create('community')
                           ) ?>

                        <? $menu->addLink($controller->url_for('vips/pool/copy_exercises_dialog', ["exercise_ids[{$exercise['id']}]" => $exercise['assignment_id']]),
                               _('Aufgabe kopieren'), Icon::create('copy'), ['data-dialog' => 'size=auto']
                           ) ?>

                        <? $menu->addButton('delete', _('Aufgabe löschen'), Icon::create('trash'), [
                               'formaction' => $controller->url_for('vips/pool/delete_exercises', ["exercise_ids[{$exercise['id']}]" => $exercise['assignment_id']]),
                               'data-confirm' => sprintf(_('Wollen Sie wirklich die Aufgabe „%s“ löschen?'), $exercise['title'])
                           ]) ?>
                        <?= $menu->render() ?>
                    </td>
                </tr>
            <? endforeach ?>
        </tbody>

        <tfoot>
            <tr>
                <td colspan="4">
                    <?= Studip\Button::create(_('Kopieren'), 'copy_selected', [
                            'class' => 'batch_action',
                            'data-dialog' => 'size=auto',
                            'formaction' => $controller->url_for('vips/pool/copy_exercises_dialog')
                        ]) ?>
                    <?= Studip\Button::create(_('Verschieben'), 'move_selected', [
                            'class' => 'batch_action',
                            'data-dialog' => 'size=auto',
                            'formaction' => $controller->url_for('vips/pool/move_exercises_dialog')
                        ]) ?>
                    <?= Studip\Button::create(_('Löschen'), 'delete_selected', [
                            'class' => 'batch_action',
                            'formaction' => $controller->url_for('vips/pool/delete_exercises'),
                            'data-confirm' => _('Wollen Sie wirklich die ausgewählten Aufgaben löschen?')
                        ]) ?>
                </td>
                <td colspan="3" class="actions">
                    <?= $controller->page_chooser($controller->url_for('vips/pool/exercises', ['page' => '%d', 'sort' => $sort, 'desc' => $desc, 'search_filter' => $search_filter]), $count, $page) ?>
                </td>
            </tr>
        </tfoot>
    </table>
</form>