aboutsummaryrefslogtreecommitdiff
path: root/app/views/admin/datafields/new.php
blob: 2826589ab716645cd86a794c7803946a3bd0a24b (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?php
/**
 * @var Admin_DatafieldsController $controller
 * @var string $object_typ
 * @var string $type_name
 * @var string $object_type
 * @var array $institutes
 * @var Institute $item
 * @var DataField $datafield
 * @var array $replace_fields
 */

use Studip\Button, Studip\LinkButton;
?>

<form action="<?= $controller->url_for('admin/datafields/new/' . $object_typ) ?>" method="post" class="default">
    <?= CSRFProtection::tokenTag() ?>

    <fieldset>
        <legend>
            <?= sprintf(_('Einen neuen Datentyp für die Kategorie "%s" erstellen'), $type_name) ?>
        </legend>

        <label>
            <span class="required"><?= _('Name') ?></span>

            <?= I18N::input('datafield_name', $datafield->name, [
                'required'  => '',
                'size'      => 60,
                'maxlength' => 254,
            ]) ?>
        </label>

        <label>
            <?= _('Feldtyp') ?>

            <select name="datafield_type">
           <? foreach (DataFieldEntry::getSupportedTypes($object_typ) as $param): ?>
                <option><?= htmlReady($param) ?></option>
            <? endforeach; ?>
            </select>
        </label>

        <label for="object_class">
        <? if ($object_typ === 'sem'): ?>
            <?= _('Veranstaltungskategorie') ?>
        <? elseif ($object_typ === 'inst'): ?>
            <?= _('Einrichtungstyp') ?>
        <? elseif (in_array(
            $object_typ,
            [
                'moduldeskriptor',
                'modulteildeskriptor',
            ]
        )) : ?>
            <?= _('Sprache') ?>
        <? elseif (in_array(
            $object_typ,
            [
                'stgteilabschnittmodul',
                'modulteilstgteilabschnitt',
            ]
        )): ?>
            <?= _('Ersetzt Feld') ?>
        <? elseif ($object_typ === 'studycourse'): ?>
            <?= _('Typ/Abschnitt') ?>
        <? else: ?>
            <?= _('Nutzerstatus') ?>
        <? endif; ?>

        <? if ($object_typ === 'sem'): ?>
            <select name="object_class[]">
                <option value="NULL"><?= _('alle') ?></option>
            <? foreach (SemClass::getClasses() as $key => $val): ?>
                <option value="<?= $key ?>">
                    <?= htmlReady($val['name']) ?>
                </option>
            <? endforeach; ?>
        <? elseif ($object_typ === 'inst'): ?>
            <select name="object_class[]">
                <option value="NULL"><?= _('alle') ?></option>
            <? foreach ($GLOBALS['INST_TYPE'] as $key => $val): ?>
                <option value="<?= $key ?>">
                    <?= htmlReady($val['name']) ?>
                </option>
            <? endforeach; ?>
        <? elseif (in_array(
            $object_typ,
            [
                'moduldeskriptor',
                'modulteildeskriptor',
            ])
        ): ?>
            <select multiple name="object_class[]" required>
                <option value="NULL" selected><?= _('alle (mehrsprachige Eingabe bei Feldtyp textline, textarea, textmarkup)') ?></option>
            <? foreach ($GLOBALS['CONTENT_LANGUAGES'] as $key => $value) : ?>
                <option value="<?= htmlReady($key) ?>"><?= htmlReady($value['name']) ?></option>
            <? endforeach; ?>
        <? elseif (in_array(
            $object_typ,
            [
                'stgteilabschnittmodul',
                'modulteilstgteilabschnitt',
            ])
        ): ?>
            <select name="object_class" required>
                <option value="NULL" selected><?= _('Zusätzliches Datenfeld (keine Ersetzung)') ?></option>
            <? foreach (Admin_DatafieldsController::getReplaceFields($object_typ) as $key => $value) : ?>
                <option value="<?= htmlReady($key) ?>"><? printf('%s (%s)', $key, htmlReady($value)) ?></option>
            <? endforeach; ?>
        <? elseif ($object_typ === 'studycourse') : ?>
            <select name="object_class" required>
                <option value="all_settings" selected><?= _('alle (Abschnitt "Einstellungen")') ?></option>
                <option value="all_info"><?= _('alle (Abschnitt "Inhalte und Informationen")') ?></option>
                <option value="einfach_settings"><?= _('Einfach-Studiengänge (Abschnitt "Einstellungen")') ?></option>
                <option value="einfach_info"><?= _('Einfach-Studiengänge (Abschnitt "Inhalte und Informationen")') ?></option>
                <option value="mehrfach_settings"><?= _('Mehrfach-Studiengänge (Abschnitt "Einstellungen")') ?></option>
                <option value="mehrfach_info"><?= _('Mehrfach-Studiengänge (Abschnitt "Inhalte und Informationen")') ?></option>
        <? else: ?>
             <select multiple size="7" name="object_class[]" required>
                <option value="NULL" selected><?= _('alle') ?></option>
            <? foreach ($controller->user_status as $perm => $value): ?>
                <option value="<?= $value ?>"><?= $perm ?></option>
            <? endforeach; ?>
        <? endif; ?>
            </select>
        </label>

        <label>
            <?= _('Benötigter Status zum Bearbeiten') ?>

            <select name="edit_perms">
            <? foreach (array_keys($controller->user_status) as $perm): ?>
                <option><?= $perm ?></option>
            <? endforeach; ?>
            </select>
        </label>

        <label>
            <?= _('Sichtbarkeit') ?>

            <select name="visibility_perms">
            <? foreach (array_keys($controller->user_status) as $perm): ?>
                <option><?= $perm ?></option>
            <? endforeach; ?>
            </select>
        </label>

        <? if (!in_array(
            $object_typ,
            [
                'stgteilabschnittmodul',
                'modulteilstgteilabschnitt',
            ])
        ): ?>
        <label>
            <?= _('Einrichtung') ?>
            <select name="institut_id" class="nested-select">
                <option value="" class="is-placeholder"></option>
                <? foreach ($institutes as $institute): ?>
                    <option value="<?= htmlReady($institute['Institut_id']) ?>"
                        class="<?= $institute['is_fak'] ? 'nested-item-header' : 'nested-item' ?>"
                            <?= isset($item) && $item->institut_id === $institute['Institut_id'] ? 'selected' : ''?>>
                        <?= htmlReady(my_substr($institute['Name'],0,80)) ?>
                    </option>
                <? endforeach; ?>
            </select>
        </label>
        <? endif; ?>

    <? if ($object_typ === 'user') :?>
        <label>
            <input type="hidden" name="system" value="0">
            <input type="checkbox" name="system" value="1">

           <?= _('Systemfeld') ?>
           <?= tooltipIcon(_('Nur für die Person selbst sichtbar, wenn der '
                           . 'benötigte Status zum Bearbeiten oder die '
                           . 'Sichtbarkeit ausreichend ist')) ?>
        </label>
    <? endif; ?>

        <label>
            <?= _('Position') ?>

            <input type="text" name="priority"
                   maxlength="10" size="2" class="size-s">
        </label>

    <? if ($object_typ === 'sem'): ?>
        <label>
            <input type="checkbox" name="is_required" value="true">

           <?= _('Pflichtfeld') ?>
        </label>

        <label>
            <?= _('Beschreibung') ?>

            <textarea name="description"></textarea>
        </label>
    <? endif; ?>

    <? if ($object_typ === 'stgteilabschnittmodul' || $object_typ === 'modulteilstgteilabschnitt'): ?>
        <label>
            <?= _('Überschreibt') ?>
            <select name="replace_field">
                <option value=""><?= _('Zusätzliches Datenfeld (keine Ersetzung)') ?></option>
                <? foreach ($replace_fields as $key => $name): ?>
                    <option value="<?= $key ?>"><?= htmlReady($name) ?></option>
                <? endforeach; ?>
            </select>
        </label>
    <? endif; ?>

    <? if ($object_typ === 'user'): ?>
        <label>
            <input type="checkbox" name="is_userfilter" value="1">

           <?= _('Mögliche Bedingung für Anmelderegel') ?>
        </label>
    <? endif; ?>
    </fieldset>

    <footer data-dialog-button>
        <?= Button::createAccept(_('Anlegen'), 'anlegen', ['title' => _('Neues Datenfeld anlegen')]) ?>
        <?= LinkButton::createCancel(_('Abbrechen'), $controller->url_for('admin/datafields'), ['title' => _('Zurück zur Übersicht')]) ?>
    </footer>
</form>