aboutsummaryrefslogtreecommitdiff
path: root/app/views/vips/exercises/SequenceTask/print.php
blob: 1ccb76d365e40fa3458159fd8b5fa17bd4d53379 (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
<?php
/**
 * @var bool $show_solution
 * @var array|null $response
 * @var Exercise $exercise
 * @var bool $print_correction
 * @var array $results
 */
?>
<table class="content description inline-content" style="min-width: 40em;">
    <thead>
        <tr>
            <th>
                <?= _('Anzuordnende Antworten') ?>
            </th>

            <? if ($show_solution): ?>
                <th>
                    <?= _('Richtige Antworten') ?>
                </th>
            <? endif ?>
        </tr>
    </thead>

    <tbody>
        <tr style="vertical-align: top;">
            <td>
                <ol>
                    <? if ($response): ?>
                        <? foreach ($response as $n => $id): ?>
                            <? foreach ($exercise->task['answers'] as $i => $answer): ?>
                                <? if ($answer['id'] === $id): ?>
                                    <? if ($exercise->task['compare'] === 'sequence'): ?>
                                        <li class="neutral_item">
                                            <?= formatReady($answer['text']) ?>
                                        </li>

                                        <? if ($print_correction && $n + 1 < count($response)): ?>
                                            <div class="correction_marker sequence">
                                                <? if ($results[$i]['points'] == 1): ?>
                                                    <span style="color: green;">}</span>
                                                    <?= Icon::create('accept', Icon::ROLE_STATUS_GREEN)->asImg(['title' => _('richtig')]) ?>
                                                <? else: ?>
                                                    <span style="color: red;">}</span>
                                                    <?= Icon::create('decline', Icon::ROLE_STATUS_RED)->asImg(['title' => _('falsch')]) ?>
                                                <? endif ?>
                                            </div>
                                        <? endif ?>
                                    <? elseif ($exercise->task['compare'] === 'position'): ?>
                                        <li class="<?= $print_correction && $results[$i]['points'] == 1 ? 'correct_item' : 'mc_item' ?>">
                                            <?= formatReady($answer['text']) ?>

                                            <? if ($print_correction): ?>
                                                <? if ($results[$i]['points'] == 1): ?>
                                                    <?= Icon::create('accept', Icon::ROLE_STATUS_GREEN)->asImg(['class' => 'correction_marker', 'title' => _('richtig')]) ?>
                                                <? else: ?>
                                                    <?= Icon::create('decline', Icon::ROLE_STATUS_RED)->asImg(['class' => 'correction_marker', 'title' => _('falsch')]) ?>
                                                <? endif ?>
                                            <? endif ?>
                                        </li>
                                    <? else: ?>
                                        <li class="mc_item">
                                            <?= formatReady($answer['text']) ?>
                                        </li>
                                    <? endif ?>
                                <? endif ?>
                            <? endforeach ?>
                        <? endforeach ?>
                    <? else: ?>
                        <? foreach ($exercise->orderedAnswers($response) as $answer): ?>
                            <li class="mc_item">
                                <?= formatReady($answer['text']) ?>
                            </li>
                        <? endforeach ?>
                    <? endif ?>
                </ol>
            </td>

            <? if ($show_solution): ?>
                <td>
                    <ol>
                        <? foreach ($exercise->task['answers'] as $answer): ?>
                            <li class="mc_item">
                                <?= formatReady($answer['text']) ?>
                            </li>
                        <? endforeach ?>
                    </ol>
                </td>
            <? endif ?>
        </tr>
    </tbody>
</table>