aboutsummaryrefslogtreecommitdiff
path: root/app/views/my_courses/groups.php
blob: 4476aeb20df2c48cda15b0c61c33d91529237bc6 (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
<?php
/**
 * @var MyCoursesController $controller
 * @var bool $studygroups
 * @var string $cid
 * @var array $groups
 * @var array $group_names
 * @var array $semesters
 * @var string $group_field
 * @var string $current_semester
 */
?>
<form method="post" action="<?= $controller->store_groups($studygroups) ?>" class="default">
    <?= CSRFProtection::tokenTag() ?>

    <input type="hidden" name="cid" value="<?= htmlReady($cid) ?>">
    <table class="default collapsable">
        <caption><?= _('Gruppenzuordnung') ?></caption>
        <colgroup>
            <col>
        <? for ($i = 0; $i < 9; $i += 1): ?>
            <col style="width: 32px">
        <? endfor; ?>
        </colgroup>
        <thead>
            <tr>
                <th><?= _('Veranstaltung') ?></th>
                <th colspan="100%"><?= _('Gruppe/Farbe') ?></th>
            </tr>
        </thead>
        <? foreach ($groups as $group_id => $group_members): ?>
            <tbody <? if (isset($semesters[$group_id]['semester_id']) && $current_semester != $semesters[$group_id]['semester_id']) echo 'class="collapsed"'; ?>>
            <? if ($group_field !== 'not_grouped'): ?>

                <tr class="table_header header-row">
                    <th colspan="10" class="toggle-indicator">
                        <a class="toggler" href="#">
                            <? if (is_array($group_names[$group_id])): ?>
                                <?= htmlReady($group_names[$group_id][1] . ' > ' . $group_names[$group_id][0]) ?>
                            <? else: ?>
                                <?= htmlReady($group_names[$group_id]) ?>
                            <? endif; ?>
                        </a>
                    </th>
                </tr>
            <? endif; ?>
            <? foreach ($group_members as $member): ?>
                <tr>
                    <td>
                        <a href="<?= URLHelper::getLink('seminar_main.php?auswahl=' . $member['seminar_id']) ?>">
                            <?= htmlReady(Config::get()->IMPORTANT_SEMNUMBER ? $my_sem[$member['seminar_id']]['sem_nr'] : '') ?>
                            <?= htmlReady($my_sem[$member['seminar_id']]['name']) ?>
                        </a>
                        <? if (!$my_sem[$member['seminar_id']]['visible']): ?>
                            <?= _('(versteckt)') ?>
                        <? endif; ?>
                    </td>
                <? for ($i = 0; $i < 9; $i++): ?>
                    <td class="gruppe<?= $i ?> mycourses-group-selector" onclick="this.querySelector('input').checked = true;">
                        <input type="radio" name="gruppe[<?= $member['seminar_id'] ?>]" value="<?= $i ?>"
                               aria-label="<?= sprintf(_('Gruppe %u zuordnen'), $i + 1) ?>"
                               id="course-group-<?= htmlReady($member['seminar_id']) ?>-<?= $i ?>"
                            <? if ($my_sem[$member['seminar_id']]['gruppe'] == $i) echo 'checked'; ?>>
                        <label for="course-group-<?= htmlReady($member['seminar_id']) ?>-<?= $i ?>">
                            <span class="group-number"><?= $i + 1 ?></span>
                            <span class="checked-icon">
                                <?= Icon::create('accept', Icon::ROLE_INFO)->asImg(20) ?>
                            </span>
                        </label>
                    </td>
                <? endfor; ?>
                </tr>
            <? endforeach; ?>
            </tbody>
        <? endforeach; ?>
    </table>

    <div align="center" data-dialog-button>
        <div class="button-group">
            <?= Studip\Button::createAccept(_('Speichern')) ?>
            <?= Studip\LinkButton::createCancel(_('Abbrechen'), $controller->url_for('my_courses/groups')) ?>
        </div>
    </div>
</form>