aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/basicdata/_input.php
diff options
context:
space:
mode:
authorMoritz Strohm <strohm@data-quest.de>2022-09-28 09:50:22 +0000
committerMoritz Strohm <strohm@data-quest.de>2022-09-28 09:50:22 +0000
commit48960208784586e8ad9bde75626dc4e631e18711 (patch)
treee9248937013bfbb9432816d899dd2f46ca7cc620 /app/views/course/basicdata/_input.php
parent408bdb87a4eca0e4ac2b6eb85f6271e2c8c27b42 (diff)
fix for BIESt #1016
Merge request studip/studip!625
Diffstat (limited to 'app/views/course/basicdata/_input.php')
-rw-r--r--app/views/course/basicdata/_input.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/app/views/course/basicdata/_input.php b/app/views/course/basicdata/_input.php
index ffaad5e..60f6b60 100644
--- a/app/views/course/basicdata/_input.php
+++ b/app/views/course/basicdata/_input.php
@@ -2,35 +2,35 @@
# Lifter010: TODO
$is_locked = $input['locked'] ? 'disabled readonly' : '';
$is_locked_array = $input['locked'] ? ['disabled' => true, 'readonly' => true] : [];
-$is_required_array = $input['must'] ? ['required' => true] : [];
-$is_pattern_array = $input['pattern'] ? ['pattern' => $input['pattern']] : [];
+$is_required_array = !empty($input['must']) ? ['required' => true] : [];
+$is_pattern_array = !empty($input['pattern']) ? ['pattern' => $input['pattern']] : [];
if ($input['type'] === "text") : ?>
- <? if ($input['i18n']) : ?>
+ <? if (!empty($input['i18n'])) : ?>
<?= I18N::input($input['name'], $input['value'], $is_locked_array + $is_required_array + $is_pattern_array) ?>
<? else : ?>
- <input <?=$is_locked ?> type="text" name="<?= $input['name'] ?>" value="<?= htmlReady($input['value']) ?>" <? if ($input['must']) echo 'required'; ?> <? if ($input['pattern']) : ?>pattern="<?= htmlReady($input['pattern']) ?>"<? endif ?>>
+ <input <?=$is_locked ?> type="text" name="<?= htmlReady($input['name']) ?>" value="<?= htmlReady($input['value']) ?>" <? if (!empty($input['must'])) echo 'required'; ?> <? if (!empty($input['pattern'])) printf('pattern="%s"', htmlReady($input['pattern'])) ?>>
<? endif ?>
<? endif;
if ($input['type'] === "number") : ?>
- <input <?=$is_locked ?> type="number" name="<?= $input['name'] ?>" value="<?= htmlReady($input['value']) ?>" min="<?= $input['min'] ?>" <? if ($input['must']) echo 'required'; ?>>
+ <input <?=$is_locked ?> type="number" name="<?= htmlReady($input['name']) ?>" value="<?= htmlReady($input['value']) ?>" min="<?= $input['min'] ?>" <? if (!empty($input['must'])) echo 'required'; ?>>
<? endif;
if ($input['type'] === "textarea") : ?>
- <? if ($input['i18n']) : ?>
+ <? if (!empty($input['i18n'])) : ?>
<?= I18N::textarea($input['name'], $input['value'], $is_locked_array + $is_required_array) ?>
<? else : ?>
- <textarea <?=$is_locked ?> name="<?= $input['name'] ?>" <? if ($input['must']) echo 'required'; ?>><?=
+ <textarea <?=$is_locked ?> name="<?= htmlReady($input['name']) ?>" <? if (!empty($input['must'])) echo 'required'; ?>><?=
htmlReady($input['value'])
?></textarea>
<? endif ?>
<? endif;
if ($input['type'] === "select") : ?>
- <? if (!$input['choices'][$input['value']] && !(isset($input['changable']) && $input['changable'])): ?>
+ <? if (empty($input['choices'][$input['value']]) && empty($input['changable'])): ?>
<?= _("Keine Änderung möglich") ?>
<? else: ?>
- <select <?=$is_locked ?> name="<?= $input['name'] ?>" <? if ($input['must']) echo 'required'; ?>>
+ <select <?=$is_locked ?> name="<?= htmlReady($input['name']) ?>" <? if (!empty($input['must'])) echo 'required'; ?>>
<? foreach ($input['choices'] as $choice_value => $choice_name): ?>
<? if (is_array($choice_name)): ?>
<optgroup label="<?= htmlReady($choice_value) ?>">
@@ -51,7 +51,7 @@ if ($input['type'] === "select") : ?>
<? endif;
if ($input['type'] === "multiselect") : ?>
- <select <?=$is_locked ?> name="<?= $input['name'] ?>" multiple class="nested-select" <? if ($input['must']) echo 'required'; ?>>
+ <select <?=$is_locked ?> name="<?= htmlReady($input['name']) ?>" multiple class="nested-select" <? if (!empty($input['must'])) echo 'required'; ?>>
<? if ($input['choices']) : foreach ($input['choices'] as $choice_value => $choice_name) : ?>
<option value="<?= htmlReady($choice_value) ?>"<?=
in_array($choice_value, is_array($input['value']) ? $input['value'] : [$input['value']])
@@ -65,7 +65,7 @@ if ($input['type'] === 'nested-select'): ?>
<? if (isset($input['changable']) && !$input['changable']): ?>
<?= _("Keine Änderung möglich") ?>
<? else: ?>
- <select <?= $is_locked ?> name="<?= $input['name'] ?>" class="nested-select" <? if ($input['must']) echo 'required'; ?> <? if ($input['multiple']) echo 'multiple'; ?>>
+ <select <?= $is_locked ?> name="<?= htmlReady($input['name']) ?>" class="nested-select" <? if (!empty($input['must'])) echo 'required'; ?> <? if (!empty($input['multiple'])) echo 'multiple'; ?>>
<? foreach ($input['choices'] as $outer_id => $group): ?>
<? if ($group['label'] !== false): ?>
<option value="<?= htmlReady($outer_id) ?>" class="nested-item-header" <? if (in_array($outer_id, (array)$input['value'])) echo 'selected'; ?>>