38 require_once(SMARTY_PLUGINS_DIR .
'shared.escape_special_chars.php');
50 foreach ($params as $_key => $_val) {
55 $$_key = (string) $_val;
59 $options = (array) $_val;
64 $$_key = array_values((array) $_val);
68 if (is_array($_val)) {
70 foreach ($_val as $_sel) {
71 if (is_object($_sel)) {
72 if (method_exists($_sel,
"__toString")) {
73 $_sel = smarty_function_escape_special_chars((
string) $_sel->__toString());
75 trigger_error(
"html_options: selected attribute contains an object of class '". get_class($_sel) .
"' without __toString() method", E_USER_NOTICE);
79 $_sel = smarty_function_escape_special_chars((
string) $_sel);
81 $selected[$_sel] =
true;
83 }
elseif (is_object($_val)) {
84 if (method_exists($_val,
"__toString")) {
85 $selected = smarty_function_escape_special_chars((
string) $_val->__toString());
87 trigger_error(
"html_options: selected attribute is an object of class '". get_class($_val) .
"' without __toString() method", E_USER_NOTICE);
90 $selected = smarty_function_escape_special_chars((
string) $_val);
98 if (!empty($params[
'strict'])) {
99 if (!is_scalar($_val)) {
100 trigger_error(
"html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE);
103 if ($_val ===
true || $_val === $_key) {
104 $extra .=
' ' . $_key .
'="' . smarty_function_escape_special_chars($_key) .
'"';
112 if (!is_array($_val)) {
113 $extra .=
' ' . $_key .
'="' . smarty_function_escape_special_chars($_val) .
'"';
115 trigger_error(
"html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
121 if (!isset($options) && !isset($values)) {
129 if (isset($options)) {
130 foreach ($options as $_key => $_val) {
134 foreach ($values as $_i => $_key) {
141 $_html_class = !empty(
$class) ?
' class="'.$class.
'"' :
'';
142 $_html_id = !empty(
$id) ?
' id="'.$id.
'"' :
'';
143 $_html_result =
'<select class="form-control" name="' . $name .
'"' . $_html_class . $_html_id . $extra .
'>' .
"\n" . $_html_result .
'</select>' .
"\n";
146 return $_html_result;
151 if (!is_array($value)) {
152 $_key = smarty_function_escape_special_chars($key);
153 $_html_result =
'<option value="' . $_key .
'"';
154 if (is_array($selected)) {
155 if (isset($selected[$_key])) {
156 $_html_result .=
' selected="selected"';
158 }
elseif ($_key === $selected) {
159 $_html_result .=
' selected="selected"';
161 $_html_class = !empty(
$class) ?
' class="'.$class.
' option"' :
'';
162 $_html_id = !empty(
$id) ?
' id="'.$id.
'-'.$idx.
'"' :
'';
163 if (is_object($value)) {
164 if (method_exists($value,
"__toString")) {
165 $value = smarty_function_escape_special_chars((
string) $value->__toString());
167 trigger_error(
"html_options: value is an object of class '". get_class($value) .
"' without __toString() method", E_USER_NOTICE);
171 $value = smarty_function_escape_special_chars((
string) $value);
173 $_html_result .= $_html_class . $_html_id .
'>' . $value .
'</option>' .
"\n";
180 return $_html_result;
185 $optgroup_html =
'<optgroup label="' . smarty_function_escape_special_chars($key) .
'">' .
"\n";
186 foreach ($values as $key => $value) {
189 $optgroup_html .=
"</optgroup>\n";
190 return $optgroup_html;
if($rub=fetch_assoc($rub_query)) if(check_if_module_active('url_rewriting')) $class
smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx)
smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, &$idx)
smarty_function_html_options($params, $template)
Smarty {html_options} function plugin.
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))