aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/gradebook/lecturers/custom_definitions.php
blob: 6b906981456c0b745815ebe66eef10e97db215f0 (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
<form class="default" action="<?= $controller->link_for('course/gradebook/lecturers/store_grades') ?>" method="POST">
    <?= CSRFProtection::tokenTag()?>
    <div style="overflow-x:auto;">
        <table class="default gradebook-lecturer-custom-definitions sortable-table" data-sortlist="[[0, 0]]">
            <caption>
                <?= _('Noten manuell erfassen') ?>
            </caption>

            <thead>
                <tr class="sortable">
                    <th data-sort="text"><?= _('Name') ?></th>
                    <? if (count($customDefinitions)) { ?>
                        <? foreach ($customDefinitions as $definition) { ?>
                            <th>
                                <?= htmlReady($definition->name) ?>
                            </th>
                        <? } ?>
                    <? } else { ?>
                        <th>&nbsp;</th>
                    <? } ?>
                </tr>
            </thead>

            <tbody>

                <? foreach ($students as $index => $student) { ?>
                    <tr>
                        <td class="gradebook-student-name" data-sort-value="<?= $studentName = htmlReady(htmlReady($student->nachname . ', ' . $student->vorname)) ?>">
                            <a href="<?= URLHelper::getLink('dispatch.php/profile', ['username' => $student->username]) ?>">
                                <?= $studentName ?>
                            </a>
                        </td>
                        <? if (count($customDefinitions)) { ?>
                            <? foreach ($customDefinitions as $definition) { ?>
                                <td class="gradebook-grade-input">
                                    <? $instance = $controller->getInstanceForUser($definition, $student) ?>
                                    <? $rawgrade = $instance ? $instance->rawgrade : 0 ?>
                                    <? $passed = $instance ? $instance->passed : 0 ?>
                                    <? $feedback = $instance ? $instance->feedback : '' ?>
                                    <label class="undecorated">
                                        <input type="number"
                                               name="grades[<?= htmlReady($student->user_id) ?>][<?= htmlReady($definition->id) ?>]"
                                               value="<?= $controller->formatAsPercent($rawgrade) ?>"
                                               min="0"> %
                                    </label>
                                    <label>
                                        <?=_('Bestanden')?>
                                        <input type="checkbox"
                                               name="passed[<?= htmlReady($student->user_id) ?>][<?= htmlReady($definition->id) ?>]"
                                               value="1"
                                               <?= $passed ? 'checked' : ''?>>
                                    </label>
                                    <label>
                                        <input type="text"
                                               name="feedback[<?= htmlReady($student->user_id) ?>][<?= htmlReady($definition->id) ?>]"
                                               value="<?=htmlReady($feedback)?>" placeholder="<?=_('Feedback')?>">
                                    </label>
                                </td>
                            <? } ?>
                    <? } elseif ($index === 0) { ?>
                                <td rowspan="<?= count($students) ?>" class="gradebook-lecturer-blank-slate">
                                    <p><?= _('Es sind keine manuellen Leistungen definiert.') ?></p>
                                </td>
                        <? } ?>
                    </tr>
                <? } ?>

            </tbody>

            <? if (count($customDefinitions) && count($students)) { ?>
                <? $tfootColspan = 1 + count($customDefinitions) ?>
                <tfoot class="gradebook-lecturer-custom-definitions-actions">
                    <tr>
                        <td colspan="<?= $tfootColspan ?>">
                            <?= \Studip\Button::createAccept(_('Speichern')) ?>
                            <?= \Studip\LinkButton::createCancel(_('Abbrechen'), $controller->url_for('course/gradebook/lecturers')) ?>
                        </td>
                    </tr>
                </tfoot>
            <? } ?>
        </table>
    </div>
</form>

<? if (!count($students)) { ?>
    <?= \MessageBox::info(_('Es gibt noch keine Teilnehmer.')) ?>
<? } ?>