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) {
return select_opts(Vars::$prefixes, $selected, $echo);
}
function selectOptsPrefixesNoBlank($selected = null)
{
$return = '';
foreach (Vars::$prefixes as $val => &$label) {
if (empty($val)) {
continue;
}
$sel = ($val == $selected ? ' selected' : '');
$string = '<option value="'.$val.'"'.$sel.'>'.$label.'</option>';
$return .= $string;
}
unset($label);
return $return;
}
function select_opts_countries($selected = null, $echo = true) {
return select_opts(Vars::$countries, $selected, $echo);
}
......@@ -155,7 +174,7 @@ if ( ! function_exists('form_dropdown'))
if ($extra != '') $extra = ' '.$extra;
$multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';
$multiple = (count($selected) > 1 && strpos($extra, 'multiple') === false) ? ' multiple="multiple"' : '';
$form = '<select name="'.$name.'"'.$extra.$multiple.">\n";
if ($blankFirstOption) {
......@@ -381,7 +400,7 @@ if (!function_exists('formLinkedDropdownWithExtra')) {
if ( ! function_exists('url_title'))
{
function url_title($str, $separator = 'dash', $lowercase = FALSE)
function url_title($str, $separator = 'dash', $lowercase = false)
{
if ($separator == 'dash')
{
......@@ -412,7 +431,7 @@ if ( ! function_exists('url_title'))
$str = preg_replace("#".$key."#i", $val, $str);
}
if ($lowercase === TRUE)
if ($lowercase === true)
{
$str = strtolower($str);
}
......