protected function _renderVarInput_mlenum($form, &$var, &$vars)
{
$varname = $var->getVarName();
$hvarname = htmlspecialchars($varname);
$values = $var->getValues();
$prompts = $var->type->getPrompts();
$selected = $var->getValue($vars);
/* If passing a non-array value need to get the keys. */
if (!is_array($selected)) {
foreach ($values as $key_1 => $values_2) {
if (isset($values_2[$selected])) {
$selected = array('1' => $key_1, '2' => $selected);
break;
}
}
}
/* Hidden tag to store the current first level. */
$html = sprintf('<input type="hidden" name="%s[old]" value="%s" %s />', $hvarname, htmlspecialchars($selected['1']), $this->_genID($varname . '_old'));
/* First level. */
$values_1 = Horde_Array::valuesToKeys(array_keys($values));
$html .= sprintf('<select %s name="%s[1]" onchange="%s"%s>', $this->_genID($varname . '_1'), $hvarname, 'if (this.value) { document.' . $form->getName() . '.formname.value=\'\';' . 'document.' . $form->getName() . '.submit() }', $var->hasAction() ? ' ' . $this->_genActionScript($form, $var->_action, $varname) : '');
if (!empty($prompts)) {
$html .= '<option value="">' . htmlspecialchars($prompts[0]) . '</option>';
}
$html .= $this->selectOptions($values_1, $selected['1']);
$html .= '</select>';
/* Second level. */
$html .= sprintf('<select %s name="%s[2]"%s>', $this->_genID($varname . '_2'), $hvarname, $var->hasAction() ? ' ' . $this->_genActionScript($form, $var->_action, $varname) : '');
if (!empty($prompts)) {
$html .= '<option value="">' . htmlspecialchars($prompts[1]) . '</option>';
}
$values_2 = array();
if (!empty($selected['1'])) {
$values_2 =& $values[$selected['1']];
}
return $html . $this->selectOptions($values_2, $selected['2']) . '</select>';
}