public static function genericlist($data, $name, $attribs = null, $optKey = 'value', $optText = 'text', $selected = null, $idtag = false,
		$translate = false)
	{
		// Set default options
		$options = array_merge(self::$formatOptions, array('format.depth' => 0, 'id' => false));

		if (is_array($attribs) && func_num_args() == 3)
		{
			// Assume we have an options array
			$options = array_merge($options, $attribs);
		}
		else
		{
			// Get options from the parameters
			$options['id'] = $idtag;
			$options['list.attr'] = $attribs;
			$options['list.translate'] = $translate;
			$options['option.key'] = $optKey;
			$options['option.text'] = $optText;
			$options['list.select'] = $selected;
		}

		$attribs = '';

		if (isset($options['list.attr']))
		{
			if (is_array($options['list.attr']))
			{
				$attribs = ArrayHelper::toString($options['list.attr']);
			}
			else
			{
				$attribs = $options['list.attr'];
			}

			if ($attribs != '')
			{
				$attribs = ' ' . $attribs;
			}
		}

		$id = $options['id'] !== false ? $options['id'] : $name;
		$id = str_replace(array('[', ']'), '', $id);

		$baseIndent = str_repeat($options['format.indent'], $options['format.depth']++);
		$html = $baseIndent . '<select' . ($id !== '' ? ' id="' . $id . '"' : '') . ' name="' . $name . '"' . $attribs . '>' . $options['format.eol']
			. self::options($data, $options) . $baseIndent . '</select>' . $options['format.eol'];

		return $html;
	}
public static function genericlist($data, $name, $attribs = null, $optKey = 'value', $optText = 'text', $selected = null, $idtag = false,
		$translate = false)
	{
		// Set default options
		$options = array_merge(self::$formatOptions, array('format.depth' => 0, 'id' => false));

		if (is_array($attribs) && func_num_args() == 3)
		{
			// Assume we have an options array
			$options = array_merge($options, $attribs);
		}
		else
		{
			// Get options from the parameters
			$options['id'] = $idtag;
			$options['list.attr'] = $attribs;
			$options['list.translate'] = $translate;
			$options['option.key'] = $optKey;
			$options['option.text'] = $optText;
			$options['list.select'] = $selected;
		}

		$attribs = '';

		if (isset($options['list.attr']))
		{
			if (is_array($options['list.attr']))
			{
				$attribs = ArrayHelper::toString($options['list.attr']);
			}
			else
			{
				$attribs = $options['list.attr'];
			}

			if ($attribs != '')
			{
				$attribs = ' ' . $attribs;
			}
		}

		$id = $options['id'] !== false ? $options['id'] : $name;
		$id = str_replace(array('[', ']'), '', $id);

		$baseIndent = str_repeat($options['format.indent'], $options['format.depth']++);
		$html = $baseIndent . '<select' . ($id !== '' ? ' id="' . $id . '"' : '') . ' name="' . $name . '"' . $attribs . '>' . $options['format.eol']
			. self::options($data, $options) . $baseIndent . '</select>' . $options['format.eol'];

		return $html;
	}
public static function genericlist ( $ data , $ name , $ attribs = null , $ optKey = 'value' , $ optText = 'text' , $ selected = null , $ idtag = false , $ translate = false ) { // Set default options $ options = array_merge ( self :: $ formatOptions , array ( 'format.depth' => 0 , 'id' => false ) ) ; if ( is_array ( $ attribs ) && func_num_args ( ) == 3 ) { // Assume we have an options array $ options = array_merge ( $ options , $ attribs ) ; } else { // Get options from the parameters $ options [ 'id' ] = $ idtag ; $ options [ 'list.attr' ] = $ attribs ; $ options [ 'list.translate' ] = $ translate ; $ options [ 'option.key' ] = $ optKey ; $ options [ 'option.text' ] = $ optText ; $ options [ 'list.select' ] = $ selected ; } $ attribs = '' ; if ( isset ( $ options [ 'list.attr' ] ) ) { if ( is_array ( $ options [ 'list.attr' ] ) ) { $ attribs = ArrayHelper :: toString ( $ options [ 'list.attr' ] ) ; } else { $ attribs = $ options [ 'list.attr' ] ; } if ( $ attribs != '' ) { $ attribs = ' ' . $ attribs ; } } $ id = $ options [ 'id' ] !== false ? $ options [ 'id' ] : $ name ; $ id = str_replace ( array ( '[' , ']' ) , '' , $ id ) ; $ baseIndent = str_repeat ( $ options [ 'format.indent' ] , $ options [ 'format.depth' ] ++ ) ; $ html = $ baseIndent . '<select' . ( $ id !== '' ? ' id="' . $ id . '"' : '' ) . ' name="' . $ name . '"' . $ attribs . '>' . $ options [ 'format.eol' ] . self :: options ( $ data , $ options ) . $ baseIndent . '</select>' . $ options [ 'format.eol' ] ; return $ html ; }
Generates an HTML selection list.

@param   array    $data       An array of objects, arrays, or scalars.
@param   string   $name       The value of the HTML name attribute.
@param   mixed    $attribs    Additional HTML attributes for the <select> tag. This
can be an array of attributes, or an array of options. Treated as options
if it is the last argument passed. Valid options are:
Format options, see {@see Select::$formatOptions}.
Selection options, see {@see Select::options()}.
list.attr, string|array: Additional attributes for the select
element.
id, string: Value to use as the select element id attribute.
Defaults to the same as the name.
list.select, string|array: Identifies one or more option elements
to be selected, based on the option key values.
@param   string   $optKey     The name of the object variable for the option value. If
set to null, the index of the value array is used.
@param   string   $optText    The name of the object variable for the option text.
@param   mixed    $selected   The key that is selected (accepts an array or a string).
@param   mixed    $idtag      Value of the field id or null by default
@param   boolean  $translate  True to translate

@return  string  HTML for the select list.

@since   1.0
Generates an HTML selection list .