f11d1bad by mpenner

Add a function that outputs user prefixes (like 'Mr.') with no blank first option. refs #1555

1 parent ab2665d8
...@@ -52,6 +52,25 @@ function select_opts_prefixes($selected = null, $echo = true) { ...@@ -52,6 +52,25 @@ function select_opts_prefixes($selected = null, $echo = true) {
52 return select_opts(Vars::$prefixes, $selected, $echo); 52 return select_opts(Vars::$prefixes, $selected, $echo);
53 } 53 }
54 54
55 function selectOptsPrefixesNoBlank($selected = null)
56 {
57 $return = '';
58
59 foreach (Vars::$prefixes as $val => &$label) {
60 if (empty($val)) {
61 continue;
62 }
63
64 $sel = ($val == $selected ? ' selected' : '');
65 $string = '<option value="'.$val.'"'.$sel.'>'.$label.'</option>';
66
67 $return .= $string;
68 }
69 unset($label);
70
71 return $return;
72 }
73
55 function select_opts_countries($selected = null, $echo = true) { 74 function select_opts_countries($selected = null, $echo = true) {
56 return select_opts(Vars::$countries, $selected, $echo); 75 return select_opts(Vars::$countries, $selected, $echo);
57 } 76 }
...@@ -155,7 +174,7 @@ if ( ! function_exists('form_dropdown')) ...@@ -155,7 +174,7 @@ if ( ! function_exists('form_dropdown'))
155 174
156 if ($extra != '') $extra = ' '.$extra; 175 if ($extra != '') $extra = ' '.$extra;
157 176
158 $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : ''; 177 $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === false) ? ' multiple="multiple"' : '';
159 178
160 $form = '<select name="'.$name.'"'.$extra.$multiple.">\n"; 179 $form = '<select name="'.$name.'"'.$extra.$multiple.">\n";
161 if ($blankFirstOption) { 180 if ($blankFirstOption) {
...@@ -381,7 +400,7 @@ if (!function_exists('formLinkedDropdownWithExtra')) { ...@@ -381,7 +400,7 @@ if (!function_exists('formLinkedDropdownWithExtra')) {
381 400
382 if ( ! function_exists('url_title')) 401 if ( ! function_exists('url_title'))
383 { 402 {
384 function url_title($str, $separator = 'dash', $lowercase = FALSE) 403 function url_title($str, $separator = 'dash', $lowercase = false)
385 { 404 {
386 if ($separator == 'dash') 405 if ($separator == 'dash')
387 { 406 {
...@@ -412,7 +431,7 @@ if ( ! function_exists('url_title')) ...@@ -412,7 +431,7 @@ if ( ! function_exists('url_title'))
412 $str = preg_replace("#".$key."#i", $val, $str); 431 $str = preg_replace("#".$key."#i", $val, $str);
413 } 432 }
414 433
415 if ($lowercase === TRUE) 434 if ($lowercase === true)
416 { 435 {
417 $str = strtolower($str); 436 $str = strtolower($str);
418 } 437 }
......