aboutsummaryrefslogtreecommitdiff
path: root/lib/models/resources
diff options
context:
space:
mode:
authorDavid Siegfried <david.siegfried@uni-vechta.de>2024-03-18 14:45:11 +0000
committerJan-Hendrik Willms <tleilax+github@gmail.com>2024-03-18 21:57:06 +0100
commit56f1bfe1bd8fcc9633284f7f2ea87229e87186a0 (patch)
tree903b2fdcfb0466cdf9e1dca0ca7e3d70d0101bed /lib/models/resources
parent8692df2f41931a31a5ac1ab9fcc6d143ac57d668 (diff)
fix room-request, re #3825
Merge request studip/studip!2693
Diffstat (limited to 'lib/models/resources')
-rw-r--r--lib/models/resources/ResourcePropertyDefinition.class.php22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/models/resources/ResourcePropertyDefinition.class.php b/lib/models/resources/ResourcePropertyDefinition.class.php
index d2d7bf6..82d29c9 100644
--- a/lib/models/resources/ResourcePropertyDefinition.class.php
+++ b/lib/models/resources/ResourcePropertyDefinition.class.php
@@ -154,7 +154,7 @@ class ResourcePropertyDefinition extends SimpleORMap
? $special_name
: 'properties[' . $this->id . ']';
- if ($type == 'bool') {
+ if ($type === 'bool') {
$label_html_classes = 'col-3';
//Booleans can have one or two input elements,
//whether a false state shall be selectable or not.
@@ -188,7 +188,7 @@ class ResourcePropertyDefinition extends SimpleORMap
} else {
return $input_html;
}
- } elseif ($type == 'select') {
+ } elseif ($type === 'select') {
$options_html = sprintf(
'<option value="" %2$s>%1$s</option>',
_('Bitte wählen'),
@@ -220,7 +220,7 @@ class ResourcePropertyDefinition extends SimpleORMap
$options_html
);
}
- } elseif ($type == 'position') {
+ } elseif ($type === 'position') {
$factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH']);
$template = $factory->open('templates/resources/position_attribute_form_part.php');
$template->set_attribute(
@@ -241,7 +241,7 @@ class ResourcePropertyDefinition extends SimpleORMap
);
return $template->render();
- } elseif ($type == 'user') {
+ } elseif ($type === 'user') {
$search = new QuickSearch($input_name, new StandardSearch('user_id'));
$search->defaultValue($value, ($value ? get_fullname($value, 'full_rev_username') : ''));
return sprintf(
@@ -265,12 +265,14 @@ class ResourcePropertyDefinition extends SimpleORMap
);
} else {
$input_type = 'text';
- if ($type == 'num') {
+ $min = '';
+ if ($type === 'num') {
$input_type = 'number';
+ $min = 'min="0"';
}
if ($with_label) {
return sprintf(
- '<label %1$s>%5$s<input type="%2$s" name="%3$s" value="%4$s" %5$s></label>',
+ '<label %1$s>%5$s<input type="%2$s" name="%3$s" value="%4$s" %6$s %7$s></label>',
(
$label_html_classes
? 'class="' . htmlReady($label_html_classes) . '"'
@@ -280,15 +282,17 @@ class ResourcePropertyDefinition extends SimpleORMap
htmlReady($input_name),
$value,
htmlReady($this->__toString()),
- $disabled ? 'disabled' : ''
+ $disabled ? 'disabled' : '',
+ $min
);
} else {
return sprintf(
- '<input type="%1$s" name="%2$s" value="%3$s" %4$s>',
+ '<input type="%1$s" name="%2$s" value="%3$s" %4$s %5$s>',
$input_type,
htmlReady($input_name),
$value,
- $disabled ? 'disabled' : ''
+ $disabled ? 'disabled' : '',
+ $min
);
}
}