aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/topics/index.php
blob: 1577a2dedf9db277ffc98066f293644b7f5d7be9 (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
<?php
/**
 * @var CourseTopic[] $topics
 * @var Course_TopicsController $controller
 * @var array<array{next: ?CourseTopic, previous: ?CourseTopic}> $topic_links
 */

use Studip\Button;

?>
<? if (count($topics) > 0) : ?>
    <form method="POST">
        <?= CSRFProtection::tokenTag() ?>
        <table class="default" id="topics_index_table">
            <thead>
                <tr>
                    <th scope="col" style="width: 20px">
                        <input
                            type="checkbox"
                            data-proxyfor="#topics_index_table tbody input[type=checkbox]"
                            data-activates="#topics_index_table tfoot button"
                            aria-label="<?= _('Alle Themen auswählen') ?>"
                        >
                    </th>
                    <th scope="col"><?= _('Thema') ?></th>
                    <th scope="col" class="responsive-hidden"><?= _('Termine') ?></th>
                    <th scope="col"><?= _('Materialien') ?></th>
                    <th scope="col" class="responsive-hidden"><?= _('Beschreibung') ?></th>
                    <? if ($is_tutor = User::findCurrent()->hasPermissionLevel('tutor', Context::get())) : ?>
                        <th scope="col" class="actions"><?= _('Aktionen') ?></th>
                    <? endif ?>
                </tr>
            </thead>
            <tbody>
            <? foreach ($topics as $topic) : ?>
                <tr>
                    <td>
                        <input type="checkbox" value="<?= htmlReady($topic->id) ?>" name="topics[]"
                               aria-label="<?= sprintf(_('Thema %s auswählen'), htmlReady($topic->title)) ?>">
                    </td>
                    <td>
                        <a
                            href="<?= URLHelper::getLink('dispatch.php/course/topics/details/' . $topic->id) ?>"
                            title=" <?= sprintf(_('Thema %s öffnen'), htmlReady($topic->title)) ?>"
                            aria-label="<?= sprintf(_('Thema %s öffnen'), htmlReady($topic->title)) ?>"
                            data-dialog="size=auto"
                        >
                            <?= htmlReady($topic['title']) ?>
                        </a>
                        <? if ($topic->paper_related): ?>
                            <?= Icon::create('info-circle')->asImg(array_merge(
                                tooltip2(_('Thema behandelt eine Hausarbeit oder ein Referat'))
                            )) ?>
                        <? endif ?>
                    </td>
                    <td class="responsive-hidden">
                        <?= $this->render_partial('course/topics/_dates.php', ['topic' => $topic]) ?>
                    </td>
                    <td>
                        <?= $this->render_partial('course/topics/_material.php', ['topic' => $topic]) ?>
                    </td>
                    <td class="responsive-hidden">
                        <?= formatReady($topic['description']) ?>
                    </td>
                    <? if ($is_tutor) : ?>
                        <td class="actions">
                            <div>
                                <? $move_up_label = sprintf(_('%s nach oben verschieben'), htmlReady($topic->title));
                                if ($topic_links[$topic->id]['previous']) : ?>
                                    <button
                                        class="as-link"
                                        formaction="<?= $controller->swap($topic, $topic_links[$topic->id]['previous']) ?>"
                                        aria-label="<?= $move_up_label ?>"
                                        title="<?= $move_up_label ?>"
                                    >
                                        <?= Icon::create('arr_2up') ?>
                                    </button>
                                <? else : ?>
                                    <?= Icon::create('arr_2up', Icon::ROLE_INACTIVE) ?>
                                <? endif ?>
                                <? $move_down_label = sprintf(_('%s nach unten verschieben'), htmlReady($topic->title));
                                if ($topic_links[$topic->id]['next']) : ?>
                                    <button
                                        class="as-link"
                                        formaction="<?= $controller->swap($topic, $topic_links[$topic->id]['next']) ?>"
                                        aria-label="<?= $move_down_label ?>"
                                        title="<?= $move_down_label ?>"
                                    >
                                        <?= Icon::create('arr_2down') ?>
                                    </button>
                                <? else : ?>
                                    <?= Icon::create('arr_2down', Icon::ROLE_INACTIVE) ?>
                                <? endif ?>
                                <?= $controller->getActionMenu($topic) ?>
                            </div>
                        </td>
                    <? endif ?>
                </tr>
            <? endforeach ?>
            </tbody>
            <? if ($is_tutor) : ?>
                <tfoot>
                <tr>
                    <td colspan="6">
                        <? if ($documents_activated) : ?>
                            <?= Button::create(_('Dateiordner anlegen'), 'bulk_folder', [
                                'formaction' => $controller->bulkURL('folder'),
                                'data-confirm' => _('Sind Sie sicher, dass Sie für Ihre Auswahl je einen Dateiordner anlegen wollen?'),
                            ]) ?>
                        <? endif ?>
                        <? if ($forum_activated) : ?>
                            <?= Button::create(_('Forumsthema anlegen'), 'bulk_ftopic', [
                                'formaction' => $controller->bulkURL('ftopic'),
                                'data-confirm' => _('Sind Sie sicher, dass Sie für Ihre Auswahl je ein Forumsthema anlegen wollen?'),
                            ]) ?>
                        <? endif ?>
                        <?= Button::create(_('Löschen'), 'bulk_delete', [
                            'formaction' => $controller->bulkURL('delete'),
                            'data-confirm' => _('Sind Sie sicher, dass Sie Ihre Auswahl löschen wollen?'),
                        ]) ?>
                    </td>
                </tr>
                </tfoot>
            <? endif ?>
        </table>
    </form>
<? else : ?>
    <?= MessageBox::info(_('Keine Themen vorhanden.')) ?>
<? endif ?>