blob: 17f66781edb86f367d180d0e7d85ced9d44c4c82 (
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
|
<?php
/**
* @var Vips_SheetsController $controller
* @var int $assignment_id
* @var int[] $exercise_ids
* @var Course[] $courses
*/
?>
<form class="default" action="<?= $controller->copy_exercises() ?>" method="POST">
<?= CSRFProtection::tokenTag() ?>
<input type="hidden" name="assignment_id" value="<?= $assignment_id ?>">
<? foreach ($exercise_ids as $exercise_id): ?>
<input type="hidden" name="exercise_ids[]" value="<?= $exercise_id ?>">
<? endforeach ?>
<label>
<?= _('Aufgabenblatt auswählen') ?>
<select name="target_assignment_id" class="vips_nested_select">
<? $assignments = VipsAssignment::findByRangeId($GLOBALS['user']->id) ?>
<? usort($assignments, fn($a, $b) => strcoll($a->test->title, $b->test->title)) ?>
<? if ($assignments): ?>
<optgroup label="<?= _('Persönliche Aufgabensammlung') ?>">
<? foreach ($assignments as $assignment): ?>
<option value="<?= $assignment->id ?>" <?= $assignment->id == $assignment_id ? 'selected' : '' ?>>
<?= htmlReady($assignment->test->title) ?>
</option>
<? endforeach ?>
</optgroup>
<? endif ?>
<? foreach ($courses as $course): ?>
<? $assignments = VipsAssignment::findByRangeId($course->id) ?>
<? $assignments = array_filter($assignments, fn($a) => !$a->isLocked()) ?>
<? usort($assignments, fn($a, $b) => strcoll($a->test->title, $b->test->title)) ?>
<? if ($assignments): ?>
<optgroup label="<?= htmlReady($course->name . ' (' . $course->start_semester->name . ')') ?>">
<? foreach ($assignments as $assignment): ?>
<option value="<?= $assignment->id ?>" <?= $assignment->id == $assignment_id ? 'selected' : '' ?>>
<?= htmlReady($assignment->test->title) ?>
</option>
<? endforeach ?>
</optgroup>
<? endif ?>
<? endforeach ?>
</select>
</label>
<footer data-dialog-button>
<?= Studip\Button::createAccept(_('Kopieren'), 'copy') ?>
</footer>
</form>
|