aboutsummaryrefslogtreecommitdiff
path: root/app/views/vips/exercises/TextLineTask/edit.php
blob: 3d2af0a3300fc38e2c52f043778a91583cf73d7e (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
<?php
/**
 * @var ClozeTask $exercise
 */
?>
<div class="label-text">
    <?= _('Automatisch bewertete Antworten') ?>
</div>

<div class="dynamic_list">
    <? foreach ($exercise->task['answers'] as $i => $answer): ?>
        <div class="dynamic_row mc_row">
            <label class="dynamic_counter undecorated">
                <input class="character_input" name="answer[<?= $i ?>]" type="text" value="<?= htmlReady($answer['text']) ?>">
            </label>
            <label class="undecorated" style="padding: 1ex;">
                <input type="radio" name="correct[<?= $i ?>]" value="1"<? if ($answer['score'] == 1): ?> checked<? endif ?>>
                <?= _('richtig') ?>
            </label>
            <label class="undecorated" style="padding: 1ex;">
                <input type="radio" name="correct[<?= $i ?>]" value="0.5"<? if ($answer['score'] == 0.5): ?> checked<? endif ?>>
                <?= _('teils richtig') ?>
            </label>
            <label class="undecorated" style="padding: 1ex;">
                <input type="radio" name="correct[<?= $i ?>]" value="0"<? if ($answer['score'] == 0): ?> checked<? endif ?>>
                <?= _('falsch') ?>
            </label>

            <?= Icon::create('trash')->asInput(['class' => 'delete_dynamic_row', 'title' => _('Antwort löschen')]) ?>
        </div>
    <? endforeach ?>

    <div class="dynamic_row mc_row template">
        <label class="dynamic_counter undecorated">
            <input class="character_input" data-name="answer" type="text">
        </label>
        <label class="undecorated" style="padding: 1ex;">
            <input type="radio" data-name="correct" value="1">
            <?= _('richtig') ?>
        </label>
        <label class="undecorated" style="padding: 1ex;">
            <input type="radio" data-name="correct" value="0.5">
            <?= _('teils richtig') ?>
        </label>
        <label class="undecorated" style="padding: 1ex;">
            <input type="radio" data-name="correct" value="0" checked>
            <?= _('falsch') ?>
        </label>

        <?= Icon::create('trash')->asInput(['class' => 'delete_dynamic_row', 'title' => _('Antwort löschen')]) ?>
    </div>

    <?= Studip\Button::create(_('Antwort hinzufügen'), 'add_answer', ['class' => 'add_dynamic_row']) ?>
</div>

<label>
    <?= _('Art des Textvergleichs') ?>

    <select name="compare" onchange="$(this).parent().next('label').toggle($(this).val() === 'numeric')">
        <option value="">
            <?= _('Groß-/Kleinschreibung ignorieren') ?>
        </option>
        <option value="levenshtein" <?= isset($exercise->task['compare']) && $exercise->task['compare'] === 'levenshtein' ? 'selected' : '' ?>>
            <?= _('Textähnlichkeit (Levenshtein-Distanz)') ?>
        </option>
        <option value="soundex" <?= isset($exercise->task['compare']) && $exercise->task['compare'] === 'soundex' ? 'selected' : '' ?>>
            <?= _('Ähnlichkeit der Aussprache (Soundex)') ?>
        </option>
        <option value="numeric" <?= isset($exercise->task['compare']) && $exercise->task['compare'] === 'numeric' ? 'selected' : '' ?>>
            <?= _('Numerischer Wertevergleich (ggf. mit Einheit)') ?>
        </option>
    </select>
</label>

<label style="<?= isset($exercise->task['compare']) && $exercise->task['compare'] === 'numeric' ? '' : 'display: none;' ?>">
    <?= _('Erlaubte relative Abweichung vom korrekten Wert') ?>
    <br>
    <input type="text" class="size-s" style="display: inline; text-align: right;"
           name="epsilon" value="<?= isset($exercise->task['epsilon']) ? sprintf('%g', $exercise->task['epsilon'] * 100) : '0' ?>"> %
</label>