diff options
author | Tom Needham <needham.thomas@gmail.com> | 2011-11-29 22:11:42 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2011-11-29 22:11:42 +0000 |
commit | dd7a411f9aaceab1bf8eab551e5f95ff5feff6fb (patch) | |
tree | 8c21a5aa4e397e9987389b65b82c2181e900d930 /lib/template.php | |
parent | 88de9e40503833f76e79e8ac722025ceafd15c4b (diff) | |
download | nextcloud-server-dd7a411f9aaceab1bf8eab551e5f95ff5feff6fb.tar.gz nextcloud-server-dd7a411f9aaceab1bf8eab551e5f95ff5feff6fb.zip |
Disable save button while saving. Streamlined code.
Diffstat (limited to 'lib/template.php')
-rw-r--r-- | lib/template.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/template.php b/lib/template.php index 440b62003e7..881d2a27b1e 100644 --- a/lib/template.php +++ b/lib/template.php @@ -98,6 +98,33 @@ function relative_modified_date($timestamp) { else { return $l->t('years ago'); } } +function html_select_options($options, $selected, $params=array()) { + if (!is_array($selected)){ + $selected=array($selected); + } + if (isset($params['combine']) && $params['combine']){ + $options = array_combine($options, $options); + } + $value_name = $label_name = false; + if (isset($params['value'])){ + $value_name = $params['value']; + } + if (isset($params['label'])){ + $label_name = $params['label']; + } + $html = ''; + foreach($options as $value => $label){ + if ($value_name && is_array($label)){ + $value = $label[$value_name]; + } + if ($label_name && is_array($label)){ + $label = $label[$label_name]; + } + $select = in_array($value, $selected) ? ' selected="selected"' : ''; + $html .= '<option value="' . $value . '"' . $select . '>' . $label . '</option>'."\n"; + } + return $html; +} /** * This class provides the templates for owncloud. |