diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2020-03-23 16:19:48 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2020-03-23 16:26:48 +0100 |
commit | 7d1b16dce7e435caefd39975ca68a08c4f79fc03 (patch) | |
tree | b075ed8e9531bce23845eba0b9fef585901ebde1 /app/fn | |
parent | 73e2d40ee0d82c9d68eca8db35b323db77eb5713 (diff) | |
download | wcms-7d1b16dce7e435caefd39975ca68a08c4f79fc03.tar.gz wcms-7d1b16dce7e435caefd39975ca68a08c4f79fc03.zip |
map integration in home
Diffstat (limited to 'app/fn')
-rw-r--r-- | app/fn/fn.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/app/fn/fn.php b/app/fn/fn.php index 6dfeb2c..60e4722 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -2,6 +2,8 @@ use Wcms\Medialist; +use function Clue\StreamFilter\fun; + function readablesize($bytes) { $format = ' %d %s'; @@ -292,7 +294,29 @@ function recurse_copy($src,$dst) { } } closedir($dir); -} +} + +/** + * Generate a list of <options> html drop down list + * + * @param array $options as `value => title` + * @param string|int $selected value of actualy selected option + * + * @return string HTML list of options + */ +function options(array $options, $selected = null) : string +{ + $html = ''; + foreach ($options as $value => $title) { + if($value == $selected) { + $attribute = 'selected'; + } else { + $attribute = ''; + } + $html .= '<option value="' . $value . '" ' . $attribute . '>' . $title . '</option>' . PHP_EOL; + } + return $html; +} |