allow descriptive select fields
This commit is contained in:
parent
c1cdb15d70
commit
c8c7125e04
|
@ -932,6 +932,12 @@ string. This is the list of option values the user can select.</li>
|
||||||
<li><span style="font-weight: bold;">options_selected:</span> Array
|
<li><span style="font-weight: bold;">options_selected:</span> Array
|
||||||
of string. This is the list of pre selected elements, must contain
|
of string. This is the list of pre selected elements, must contain
|
||||||
values that are also in <span style="font-style: italic;">options</span>.</li>
|
values that are also in <span style="font-style: italic;">options</span>.</li>
|
||||||
|
<li><span style="font-weight: bold;">descriptiveOptions:</span>
|
||||||
|
Boolean value, if set to true then all elements in the options and
|
||||||
|
options_selected arrays must be arrays themselves (array(<span
|
||||||
|
style="font-style: italic;">value</span>, <span
|
||||||
|
style="font-style: italic;">description</span>)) (default: false)<br>
|
||||||
|
</li>
|
||||||
<li><span style="font-weight: bold;">size:</span> The size of the
|
<li><span style="font-weight: bold;">size:</span> The size of the
|
||||||
select field, if set to 1 a dropdown box will be displayed.</li>
|
select field, if set to 1 a dropdown box will be displayed.</li>
|
||||||
<li><span style="font-weight: bold;">noSorting:</span> If set to
|
<li><span style="font-weight: bold;">noSorting:</span> If set to
|
||||||
|
|
|
@ -641,13 +641,21 @@ function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindex
|
||||||
}
|
}
|
||||||
if (isset($values[$input[$i][$j]['name']])) $input[$i][$j]['options_selected'] = $values[$input[$i][$j]['name']];
|
if (isset($values[$input[$i][$j]['name']])) $input[$i][$j]['options_selected'] = $values[$input[$i][$j]['name']];
|
||||||
// merge both option arrays and sort them.
|
// merge both option arrays and sort them.
|
||||||
$options = array_merge ($input[$i][$j]['options'], $input[$i][$j]['options_selected'] );
|
$options = $input[$i][$j]['options'];
|
||||||
$options = array_unique($options);
|
if (!isset($input[$i][$j]['descriptiveOptions']) || ($input[$i][$j]['descriptiveOptions'] === false)) {
|
||||||
|
// merge both option arrays and sort them.
|
||||||
|
$options = array_merge($input[$i][$j]['options'], $input[$i][$j]['options_selected'] );
|
||||||
|
$options = array_unique($options);
|
||||||
|
}
|
||||||
if (!isset($input[$i][$j]['noSorting']) || !$input[$i][$j]['noSorting']) {
|
if (!isset($input[$i][$j]['noSorting']) || !$input[$i][$j]['noSorting']) {
|
||||||
sort($options);
|
sort($options);
|
||||||
}
|
}
|
||||||
foreach ($options as $option) {
|
foreach ($options as $option) {
|
||||||
if ($option!='') {
|
if (isset($input[$i][$j]['descriptiveOptions']) && ($input[$i][$j]['descriptiveOptions'] === true)) {
|
||||||
|
if (in_array($option[0], $input[$i][$j]['options_selected'])) echo "<option value=\"" . $option[0] . "\" selected>" . $option[1] . "</option>\n";
|
||||||
|
else echo "<option value=\"" . $option[0] . "\">" . $option[1] . "</option>\n";
|
||||||
|
}
|
||||||
|
elseif ($option!='') {
|
||||||
if (in_array($option, $input[$i][$j]['options_selected'])) echo "<option selected>" . $option . "</option>\n";
|
if (in_array($option, $input[$i][$j]['options_selected'])) echo "<option selected>" . $option . "</option>\n";
|
||||||
else echo "<option>" . $option . "</option>\n";
|
else echo "<option>" . $option . "</option>\n";
|
||||||
}
|
}
|
||||||
|
@ -695,6 +703,7 @@ function parseHtml($module, $input, $values, $restricted, &$tabindex, &$tabindex
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class includes all modules and attributes of an account.
|
* This class includes all modules and attributes of an account.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue