function smarty_function_html_options_optoutput($key,$value,$selected) {
if(!is_array($value)) {
$_html_result = '<option label="'.smarty_function_escape_special_chars($value) .'" value="'.
smarty_function_escape_special_chars($key) .'"';
if (in_array((string)$key,$selected))
$_html_result .= ' selected="selected"';
$_html_result .= '>'.smarty_function_escape_special_chars($value) .'</option>'."\n";
}else {
$_html_result = smarty_function_html_options_optgroup($key,$value,$selected);
}
return $_html_result;
}
function smarty_function_html_options_optoutput($key, $value, $selected)
{
    if (!is_array($value)) {
        $html_result = '<option label="' . htmlspecialchars($value) . '" value="' . htmlspecialchars($key) . '"';
        if (in_array($key, $selected)) {
            $html_result .= " selected=\"selected\"";
        }
        $html_result .= '>' . htmlspecialchars($value) . '</option>' . "\n";
    } else {
        $html_result = smarty_function_html_options_optgroup($key, $value, $selected);
    }
    return $html_result;
}
function smarty_function_html_options_optoutput($key, $value, $selected)
{
    if (!is_array($value)) {
        $html_result = "<option label=\"{$key}\" value=\"{$key}\"";
        if (in_array($key, $selected)) {
            $html_result .= " selected=\"selected\"";
        }
        $html_result .= ">{$value}</option>\n";
    } else {
        $html_result = smarty_function_html_options_optgroup($key, $value, $selected);
    }
    return $html_result;
}
function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
{
    if (!is_array($value)) {
        $_key = smarty_function_escape_special_chars($key);
        $_html_result = '<option value="' . $_key . '"';
        if (is_array($selected)) {
            if (isset($selected[$_key])) {
                $_html_result .= ' selected="selected"';
            }
        } elseif ($_key === $selected) {
            $_html_result .= ' selected="selected"';
        }
        $_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
        $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
        if (is_object($value)) {
            if (method_exists($value, "__toString")) {
                $value = smarty_function_escape_special_chars((string) $value->__toString());
            } else {
                trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
                return '';
            }
        } else {
            $value = smarty_function_escape_special_chars((string) $value);
        }
        $_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n";
        $idx++;
    } else {
        $_idx = 0;
        $_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? $id . '-' . $idx : null, $class, $_idx);
        $idx++;
    }
    return $_html_result;
}
Esempio n. 5
0
function smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
{
    if (!is_array($value)) {
        $_html_result = '<option value="' . smarty_function_escape_special_chars($key) . '"';
        if (in_array((string) $key, $selected)) {
            $_html_result .= ' selected="selected"';
        }
        $_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
        $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
        $_html_result .= $_html_class . $_html_id . '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
        $idx++;
    } else {
        $_idx = 0;
        $_html_result = smarty_function_html_options_optgroup($key, $value, $selected, $id . '-' . $idx, $class, $_idx);
        $idx++;
    }
    return $_html_result;
}
function smarty_function_wap_html_options_optoutput($key, $value, $selected)
{
    if (!is_array($value)) {
        $_html_result = '<option value="' . smarty_function_escape_special_chars($key) . '"';
        $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
    } else {
        $_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
    }
    return $_html_result;
}