aboutsummaryrefslogtreecommitdiff
path: root/app/views/multipersonsearch/no_js_form.php
blob: 84883a0b2eebaf304322b18a910ada369c140b19 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
/**
 * @var string $title
 * @var MultipersonsearchController $controller
 * @var string $name
 * @var array $selectableUsersHidden
 * @var array $selectedUsersHidden
 * @var array $quickfilter
 * @var array $selectableUsers
 * @var array $selectedUsers
 * @var string $search
 * @var string $searchPreset
 * @var string $additionHTML
 */
?>
<? if (isset($title)): ?>
    <h1><?= htmlReady($title) ?></h1>
<? endif; ?>
<form method="post" action="<?= $controller->link_for('multipersonsearch/no_js_form/?name=' . $name) ?>">
    <input type="hidden" name="search_persons_selectable_hidden" value="<?=htmlReady(json_encode($selectableUsersHidden))?>">
    <input type="hidden" name="search_persons_selected_hidden" value="<?=htmlspecialchars(json_encode($selectedUsersHidden))?>">
    <input type="hidden" name="last_search_hidden" value="<?= htmlReady($search) ?>">
    <input type="hidden" name="last_search_preset" value="<?= htmlReady($searchPreset ?? '') ?>">
    <input type="hidden" name="not_first_call" value="true">
    <?= CSRFProtection::tokenTag() ?>

    <!-- neue Suche -->
    <div id="search_persons" style="width: 800px;">
        <label>
            <input name="freesearch" type="text" placeholder="<?=_('Suchen')?>"
                   aria-label="<?= _('Suchbegriff') ?>" style="width: 45%" value="<?= $search ?>">
            <?= Icon::create('search')->asInput([
                'name'  =>'submit_search',
                'class' =>'stay_on_dialog',
                'title' => _('Suche starten')
            ]) ?>
        </label>
        <br><br>
         <select name="search_preset" aria-label="<?= _('Vorauswahl bestimmter Bereiche, alternativ zur Suche') ?>" style="width: 45%">
            <option><?=_('--- Suchvorlagen ---')?></option>
        <? foreach ($quickfilter as $title) : ?>
            <option value="<?= htmlReady($title) ?>" <?= isset($searchPreset) && $searchPreset === $title ? 'selected' : '' ?>>
                <?= $title; ?>
            </option>
        <? endforeach; ?>
        </select>
        <?= Icon::create('accept')->asInput([
            'name'  =>'submit_search_preset',
            'class' =>'stay_on_dialog',
            'title' => _('Vorauswahl anwenden')
        ]) ?>

        <div id="search_persons_content">
            <div style="display: inline-block; float: left; width: 44%; height: 100%">
                <label><?=_('Suchergebnis')?><br>
                <select id="search_persons_selectable" name="search_persons_selectable[]" style="min-width: 200px; width: 100%; height: 116px" style="height: 16px" multiple
                        aria-label="<?= _('Gefundene Personen, die der Gruppe hinzugefügt werden können') ?>">
                        <? if (count($selectableUsers) == 0) : ?>
                            <option disabled><?= _("Keine neuen Suchergebnisse gefunden"); ?></option>
                        <? else : ?>
                            <? foreach ($selectableUsers as $person): ?>
                                <option value="<?= $person->id ?>"><?= htmlReady($person->nachname . ', ' . $person->vorname) ?> - <?= htmlReady($person->perms) ?> (<?= htmlReady($person->username)?>)</option>
                            <? endforeach; ?>
                        <? endif; ?>
                </select>
                </label>
            </div>
            <div style="display: inline-block; width: 10%; text-align: center">
                <br>
                <br>
                <br>
                <?= Icon::create('arr_2right')
                        ->asInput([
                            'id' => 'search_persons_add',
                            'name' => 'search_persons_add',
                            'class' => 'stay_on_dialog',
                            'title' => _('In den Suchergebnissen markierte Bereiche der Gruppe hinzufügen')
                        ]) ?>
                <br><br>
                <?= Icon::create('arr_2left')
                        ->asInput([
                            'id' => 'search_persons_remove',
                            'name' => 'search_persons_remove',
                            'class' => 'stay_on_dialog',
                            'title' => _('Bei den bereits ausgewählten Personen die markierten Personen entfernen')
                        ]) ?>
            </div>
            <div style="display: inline-block; float: right; width: 44%">
                <label>
                <div>
                    <? $selectedCount = count($selectedUsers);
                    if ($selectedCount === 0) : ?>
                        <?=_('Niemand wurde ausgewählt.')?>
                    <? elseif ($selectedCount === 1) : ?>
                        <?=_('Eine Person wurde ausgewählt')?>
                    <? else : ?>
                        <?=sprintf(_('%s Personen wurden ausgewählt.'), $selectedCount)?>
                    <? endif ?>
                </div>
                <select id="search_persons_selected" name="search_persons_selected[]" style="min-width: 200px; width: 100%; height: 116px" size="7" multiple
                        aria-label="<?= _('Personen, die in die Gruppe eingetragen werden') ?>"
                        >
                    <? foreach ($selectedUsers as $user): ?>
                        <option value="<?= $user->id ?>"><?= htmlReady($user->nachname . ', ' . $user->vorname) ?> - <?= htmlReady($user->perms) ?> (<?= htmlReady($user->username)?>)</option>
                    <? endforeach; ?>
                </select>
                </label>
            </div><br>
        </div>
    </div>
    <br>
    <?= $additionHTML; ?>
    <?= \Studip\Button::create(_('Speichern'), 'save') ?>
    <?= \Studip\Button::create(_('Abbrechen'), 'abort') ?>
</form>