aboutsummaryrefslogtreecommitdiff
path: root/app/views/vips/solutions/student_grade.php
blob: a624232dd87bb1ecb8b28228eaebad90fd1e9cfd (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
<?php
/**
 * @var bool $use_weighting
 * @var array $participants
 * @var array $items
 * @var string $user_id
 */
?>
<table class="default">
    <caption>
        <?= _('Note') ?>
    </caption>

    <thead>
        <tr>
            <th>
                <?= _('Titel') ?>
            </th>
            <th colspan="3" style="text-align: center; width: 1%;">
                <?= _('Punkte') ?>
            </th>
            <th style="text-align: right;">
                <?= _('Prozent') ?>
            </th>
            <? if ($use_weighting) : ?>
                <th style="text-align: right;">
                    <?= _('Gewichtung') ?>
                </th>
            <? endif ?>
        </tr>
    </thead>

    <? /* here, $participants contains only one entry */ ?>
    <? foreach ($participants as $me) : ?>

        <tbody>
            <? foreach (['tests', 'blocks', 'exams'] as $category) : ?>
                <? foreach ($items[$category] as $item) : ?>
                    <? if ($item['item']->isVisible($user_id) && $item['weighting']) : ?>
                        <tr>
                            <td>
                                <?= htmlReady($item['name']) ?>
                            </td>

                            <td style="text-align: right;">
                                <? if (isset($me['items'][$category][$item['id']]['points'])) : ?>
                                    <?= sprintf('%g', $me['items'][$category][$item['id']]['points']) ?>
                                <? else : ?>
                                    &ndash;
                                <? endif ?>
                            </td>

                            <td style="text-align: center;">
                                /
                            </td>

                            <td style="text-align: right;">
                                <?= sprintf('%g', $item['points']) ?>
                            </td>

                            <td style="text-align: right;">
                                <? if (isset($me['items'][$category][$item['id']]['percent'])) : ?>
                                    <?= sprintf('%.1f %%', $me['items'][$category][$item['id']]['percent']) ?>
                                <? else : ?>
                                    &ndash;
                                <? endif ?>
                            </td>

                            <? if ($use_weighting) : ?>
                                <td style="text-align: right;">
                                    <?= sprintf('%.1f %%', $item['weighting']) ?>
                                </td>
                            <? endif ?>
                        </tr>
                    <? endif ?>
                <? endforeach ?>
            <? endforeach ?>
        </tbody>

        <tfoot>
            <tr>
                <td colspan="4" style="padding: 5px;">
                    <?= _('Prozent, gesamt') ?>
                </td>
                <td style="padding: 5px; text-align: right;">
                    <?= sprintf('%.1f %%', $me['overall']['weighting']) ?>
                </td>
                <? if ($use_weighting) : ?>
                    <td></td>
                <? endif ?>
            </tr>

            <tr style="font-weight: bold;">
                <td colspan="<?= $use_weighting ? 6 : 5 ?>" style="text-align: center;">
                    <?= _('Note:') ?>
                    <?= htmlReady($me['grade']) ?>
                    <? if ($me['grade_comment'] != '') : ?>
                        (<?= htmlReady($me['grade_comment']) ?>)
                    <? endif ?>
                </td>
            </tr>
        </tfoot>

    <? endforeach ?>
</table>