diff options
author | Christian Klinger | 2016-08-01 15:39:03 +0200 |
---|---|---|
committer | Christian Klinger | 2016-08-01 15:39:03 +0200 |
commit | 075c225b050b84b816e66f600f9600b6a689cb77 (patch) | |
tree | 30b6eb36e4b776d3d111e7d33bd5a78385f209ee /modules-available/baseconfig/inc/validator.inc.php | |
parent | Add ugly scripts to transform translation files to new format (diff) | |
download | slx-admin-075c225b050b84b816e66f600f9600b6a689cb77.tar.gz slx-admin-075c225b050b84b816e66f600f9600b6a689cb77.tar.xz slx-admin-075c225b050b84b816e66f600f9600b6a689cb77.zip |
Fixed problems with validation of multilist and multiinput.
Diffstat (limited to 'modules-available/baseconfig/inc/validator.inc.php')
-rw-r--r-- | modules-available/baseconfig/inc/validator.inc.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/modules-available/baseconfig/inc/validator.inc.php b/modules-available/baseconfig/inc/validator.inc.php index 00e8c0e0..ec7b95aa 100644 --- a/modules-available/baseconfig/inc/validator.inc.php +++ b/modules-available/baseconfig/inc/validator.inc.php @@ -30,7 +30,7 @@ class Validator case 'function': return self::$data[1]($displayValue); case 'multilist': - return self::validateList($data[1], $displayValue); + return self::validateMultiList($data[1], $displayValue); case 'multiinput': return self::validateMultiInput($data[1], $displayValue); default: @@ -86,12 +86,21 @@ class Validator return $displayValue; return false; } + private static function validateMultiList($list, &$displayValue) + { + $allowedValues = explode('|', $list); + $values = []; + foreach ($displayValue as $v) { + if (in_array($v, $allowedValues)) { + $values[] = $v; + } + } + $displayValue = implode(' ', $values); + return $displayValue; + } private static function validateMultiInput(&$list, &$displayValue) { return $displayValue; - //die("validateMultiInput: " . print_r($list, true) . ", disp = " . $displayValue); - //return implode('~,~', $displayValue); - /* TODO: DO I have to do validation */ } } |