aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/topics/index.php
blob: e5385424bc1f2422fdb2f07c4df2b1379802bca4 (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
<?php
/**
 * @var CourseTopic[] $topics
 * @var Course_TopicsController $controller
 * @var array<array{next: ?CourseTopic, previous: ?CourseTopic}> $topic_links
 */
?>
<? if (count($topics) > 0) : ?>
<table class="default withdetails">
    <colgroup>
        <col width="50%">
        <col>
    </colgroup>
    <thead>
        <tr>
            <th><?= _('Thema') ?></th>
            <th><?= _('Termine') ?></th>
        </tr>
    </thead>
    <tbody>
    <? foreach ($topics as $key => $topic) : ?>
        <tr class="<?= Request::get("open") === $topic->getId() ? "open" : "" ?>">
            <td>
                <a href="#" name="<?=$topic->getId()?>" onClick="jQuery(this).closest('tr').toggleClass('open'); return false;">
                <? if ($topic->paper_related): ?>
                    <?= Icon::create('glossary')->asSvg(array_merge(
                        ['class' => 'text-top'],
                        tooltip2(_('Thema behandelt eine Hausarbeit oder ein Referat'))
                    )) ?>
                <? endif; ?>
                    <?= htmlReady($topic['title']) ?>
                </a>
            </td>
            <td>
                <ul class="clean">
                    <? foreach ($topic->dates as $date) : ?>
                        <li>
                            <a href="<?= URLHelper::getLink("dispatch.php/course/dates/details/".$date->getId()) ?>" data-dialog="size=auto">
                                <?= Icon::create('date', 'clickable')->asSvg(['class' => 'text-bottom']) ?>
                                <?= htmlReady($date->getFullName()) ?>
                            </a>
                        </li>
                    <? endforeach ?>
                </ul>
            </td>
        </tr>
        <tr class="details nohover">
            <td colspan="2">
                <div class="detailscontainer">
                    <table class="default nohover">
                        <tbody>
                        <tr>
                            <td><strong><?= _('Beschreibung') ?></strong></td>
                            <td><?= formatReady($topic['description']) ?></td>
                        </tr>
                        <tr>
                            <td><strong><?= _('Materialien') ?></strong></td>
                            <td>
                                <? $material = false ?>
                                <ul class="clean">
                                    <? $folder = $topic->folders->first() ?>
                                    <? if ($documents_activated && $folder) : ?>
                                        <li>
                                            <a href="<?= URLHelper::getLink(
                                                'dispatch.php/course/files/index/' . $folder->id
                                                ) ?>">
                                                <?= $folder->getTypedFolder()->getIcon('clickable')->asSvg(['class' => 'text-bottom']) ?>
                                                <?= _('Dateiordner') ?>
                                            </a>
                                        </li>
                                        <? $material = true ?>
                                    <? endif ?>

                                    <? if ($forum_activated && ($link_to_thread = $topic->forum_thread_url)) : ?>
                                        <li>
                                            <a href="<?= URLHelper::getLink($link_to_thread) ?>">
                                                <?= Icon::create('forum', 'clickable')->asSvg(['class' => 'text-bottom']) ?>
                                                <?= _('Thema im Forum') ?>
                                            </a>
                                        </li>
                                        <? $material = true ?>
                                    <? endif ?>
                                </ul>
                                <? if (!$material) : ?>
                                    <?= _('Keine Materialien zu dem Thema vorhanden') ?>
                                <? endif ?>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div style="text-align: center;">
                        <? if ($GLOBALS['perm']->have_studip_perm("tutor", Context::getId())) : ?>
                            <?= Studip\LinkButton::createEdit(
                                _('Bearbeiten'),
                                $controller->editURL($topic),
                                ['data-dialog' => '']
                            ) ?>

                            <form action="<?= $controller->delete($topic) ?>" method="post" style="display: inline">
                                <?= Studip\Button::create(
                                    _('Löschen'),
                                    'delete',
                                    ['data-confirm' => _('Das Thema wirklich löschen?')]
                                ) ?>
                            </form>

                            <? if (!$cancelled_dates_locked && $topic->dates->count()) : ?>
                                <?= \Studip\LinkButton::create(_('Alle Termine ausfallen lassen'), URLHelper::getURL("dispatch.php/course/cancel_dates", ['issue_id' => $topic->getId()]), ['data-dialog' => '']) ?>
                            <? endif ?>

                            <span class="button-group">
                            <? if ($topic_links[$topic->id]['previous']) : ?>
                                <form action="<?= $controller->swap($topic, $topic_links[$topic->id]['previous']) ?>" method="post" style="display: inline;">
                                    <?= Studip\Button::createMoveUp(_('Nach oben verschieben')) ?>
                                </form>
                            <? endif ?>
                            <? if ($topic_links[$topic->id]['next']) : ?>
                                <form action="<?= $controller->swap($topic, $topic_links[$topic->id]['next']) ?>" method="post" style="display: inline;">
                                    <?= Studip\Button::createMoveDown(_('Nach unten verschieben')) ?>
                                </form>
                            <? endif ?>
                            </span>
                        <? endif ?>
                    </div>
                </div>
            </td>
        </tr>
    <? endforeach ?>
    </tbody>
</table>
<? else : ?>
    <?= MessageBox::info(_('Keine Themen vorhanden.')) ?>
<? endif ?>