mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-05 05:39:20 +02:00
Add float & double types to the Settings
This commit is contained in:
parent
113473f256
commit
67ab425bb9
@ -1473,7 +1473,7 @@ Sent by MyAAC,<br/>
|
|||||||
],
|
],
|
||||||
'status_timeout' => [
|
'status_timeout' => [
|
||||||
'name' => 'Status Timeout',
|
'name' => 'Status Timeout',
|
||||||
'type' => 'number',
|
'type' => 'double',
|
||||||
'min' => 0,
|
'min' => 0,
|
||||||
'max' => 10, // more than 10 seconds waiting makes no sense
|
'max' => 10, // more than 10 seconds waiting makes no sense
|
||||||
'step' => 0.1,
|
'step' => 0.1,
|
||||||
|
@ -219,7 +219,7 @@ class Settings implements \ArrayAccess
|
|||||||
if ($setting['type'] === 'boolean') {
|
if ($setting['type'] === 'boolean') {
|
||||||
$value = ($setting['default'] ? 'true' : 'false');
|
$value = ($setting['default'] ? 'true' : 'false');
|
||||||
}
|
}
|
||||||
else if (in_array($setting['type'], ['text', 'number', 'email', 'password', 'textarea'])) {
|
else if (in_array($setting['type'], ['text', 'number', 'float', 'double', 'email', 'password', 'textarea'])) {
|
||||||
$value = $setting['default'];
|
$value = $setting['default'];
|
||||||
}
|
}
|
||||||
else if ($setting['type'] === 'options') {
|
else if ($setting['type'] === 'options') {
|
||||||
@ -245,7 +245,11 @@ class Settings implements \ArrayAccess
|
|||||||
$checkbox($key, false, $value);
|
$checkbox($key, false, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (in_array($setting['type'], ['text', 'number', 'email', 'password'])) {
|
else if (in_array($setting['type'], ['text', 'number', 'float', 'double', 'email', 'password'])) {
|
||||||
|
if (in_array($setting['type'], ['float', 'double'])) {
|
||||||
|
$setting['type'] = 'number';
|
||||||
|
}
|
||||||
|
|
||||||
if ($setting['type'] === 'number') {
|
if ($setting['type'] === 'number') {
|
||||||
$min = (isset($setting['min']) ? ' min="' . $setting['min'] . '"' : '');
|
$min = (isset($setting['min']) ? ' min="' . $setting['min'] . '"' : '');
|
||||||
$max = (isset($setting['max']) ? ' max="' . $setting['max'] . '"' : '');
|
$max = (isset($setting['max']) ? ' max="' . $setting['max'] . '"' : '');
|
||||||
@ -351,7 +355,7 @@ class Settings implements \ArrayAccess
|
|||||||
if ($setting['type'] === 'boolean') {
|
if ($setting['type'] === 'boolean') {
|
||||||
echo ($setting['default'] ? 'Yes' : 'No');
|
echo ($setting['default'] ? 'Yes' : 'No');
|
||||||
}
|
}
|
||||||
else if (in_array($setting['type'], ['text', 'number', 'email', 'password', 'textarea'])) {
|
else if (in_array($setting['type'], ['text', 'number', 'float', 'double', 'email', 'password', 'textarea'])) {
|
||||||
echo $setting['default'];
|
echo $setting['default'];
|
||||||
}
|
}
|
||||||
else if ($setting['type'] === 'options') {
|
else if ($setting['type'] === 'options') {
|
||||||
@ -498,9 +502,12 @@ class Settings implements \ArrayAccess
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'number':
|
case 'number':
|
||||||
if (!isset($ret['step']) || (int)$ret['step'] == 1) {
|
|
||||||
$ret['value'] = (int)$ret['value'];
|
$ret['value'] = (int)$ret['value'];
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
case 'double':
|
||||||
|
case 'float':
|
||||||
|
$ret['value'] = (double)($ret['value']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user