From 7d1b16dce7e435caefd39975ca68a08c4f79fc03 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Mon, 23 Mar 2020 16:19:48 +0100 Subject: map integration in home --- app/fn/fn.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'app/fn') 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 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 .= '' . PHP_EOL; + } + return $html; +} -- cgit v1.2.3