aboutsummaryrefslogtreecommitdiff
path: root/app/views/consultation/admin/block-responsibilities.php
blob: 4d1b5ee660a3147278befbab783ad6888a4e799a (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
<?php
$block = $block ?? false;
$selected = function ($type, $id) use ($block) {
    if (!$block ) {
        return '';
    }
    $matched = $block->responsibilities->filter(function ($responsibility) use ($type, $id) {
        return $responsibility->range_type === $type && $responsibility->range_id === $id;
    });
    return count($matched) > 0 ? 'selected' : '';
}
?>
<? if (!empty($responsible['users'])): ?>
    <label>
        <?= _('Durchführende Personen') ?>
        <select name="responsibilities[user][]" multiple class="nested-select">
            <? foreach ($responsible['users'] as $user): ?>
                <option value="<?= htmlReady($user->id) ?>" <?= $selected('user', $user->id) ?>>
                    <?= htmlReady($user->getFullName()) ?>
                </option>
            <? endforeach; ?>
        </select>
    </label>
<? endif; ?>

<? if (!empty($responsible['groups'])): ?>
    <label>
        <?= _('Durchführende Gruppen') ?>
        <select name="responsibilities[statusgroup][]" multiple class="nested-select">
            <? foreach ($responsible['groups'] as $group): ?>
                <option value="<?= htmlReady($group->id) ?>" <?= $selected('statusgroup', $group->id) ?>>
                    <?= htmlReady($group->getName()) ?>
                </option>
            <? endforeach; ?>
        </select>
    </label>
<? endif; ?>

<? if (!empty($responsible['institutes'])): ?>
    <label>
        <?= _('Durchführende Einrichtungen') ?>
        <select name="responsibilities[institute][]" multiple class="nested-select">
            <? foreach ($responsible['institutes'] as $institute): ?>
                <option value="<?= htmlReady($institute->id) ?>" <?= $selected('institute', $institute->id) ?>>
                    <?= htmlReady($institute->getFullname()) ?>
                </option>
            <? endforeach; ?>
        </select>
    </label>
<? endif; ?>