aboutsummaryrefslogtreecommitdiff
path: root/app/views/vips/exercises/TextTask/print.php
blob: acfd0a81a86d26ca9ef8da3413fc7c86854ef4be (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
<?php
/**
 * @var ClozeTask $exercise
 * @var VipsSolution $solution
 * @var array $response
 * @var array $results
 * @var bool $print_correction
 * @var bool $show_solution
 * @var bool $print_files
 */
?>
<? if ($exercise->getLayout() !== 'none'): ?>
    <? if ($print_correction && $solution->commented_solution != '') : ?>
        <div class="label-text">
            <?= _('Kommentierte Lösung') ?>
        </div>

        <?= formatReady($solution->commented_solution) ?>
    <? elseif ($solution->id && $response[0] != '') : ?>
        <div class="label-text">
            <?= _('Lösung des Teilnehmers:') ?>
        </div>

        <div class="vips_output">
            <? if ($exercise->getLayout() === 'markup'): ?>
                <?= formatReady($response[0]) ?>
            <? elseif ($exercise->getLayout() === 'code'): ?>
                <pre><?= htmlReady($response[0]) ?></pre>
            <? else: ?>
                <?= htmlReady($response[0], true, true) ?>
            <? endif ?>
        </div>
    <? elseif ($print_correction) : ?>
        <div class="description" style="font-style: italic;">
            <?= _('Es wurde kein Text als Lösung abgegeben.') ?>
        </div>
    <? else : ?>
        <div class="vips_output" style="min-height: 30em;">
            <? if ($exercise->getLayout() === 'markup'): ?>
                <?= formatReady($exercise->task['template']) ?>
            <? elseif ($exercise->getLayout() === 'code'): ?>
                <pre><?= htmlReady($exercise->task['template']) ?></pre>
            <? else: ?>
                <?= htmlReady($exercise->task['template'], true, true) ?>
            <? endif ?>
        </div>
    <? endif ?>
<? endif ?>

<? if ($exercise->options['file_upload'] && $solution && $solution->folder && count($solution->folder->file_refs)): ?>
    <? foreach ($solution->folder->file_refs as $file_ref): ?>
        <? if ($print_files && $file_ref->isImage()): ?>
            <div class="label-text">
                <?= htmlReady($file_ref->name) ?>:
            </div>
            <div class="formatted-content">
                <img src="<?= htmlReady($file_ref->getDownloadURL()) ?>">
            </div>
        <? endif ?>
    <? endforeach ?>

    <div class="label-text">
        <?= _('Hochgeladene Dateien') ?>
    </div>

    <ul>
        <? foreach ($solution->folder->file_refs as $file_ref): ?>
            <li>
                <a href="<?= htmlReady($file_ref->getDownloadURL()) ?>">
                    <?= htmlReady($file_ref->name) ?>
                </a>
            </li>
        <? endforeach ?>
    </ul>
<? endif ?>

<? if ($show_solution && $exercise->task['answers'][0]['text'] != '') : ?>
    <div class="label-text">
        <?= _('Musterlösung') ?>
    </div>

    <?= formatReady($exercise->task['answers'][0]['text']) ?>
<? endif ?>