public static function level($name, $selected, $attribs = '', $params = true, $id = false)
	{
		$db = App::get('db');

		$query = $db->getQuery()
			->select('a.id', 'value')
			->select('a.title', 'text')
			->from('#__viewlevels', 'a')
			->group('a.id')
			->group('a.title')
			->group('a.ordering')
			->order('a.ordering', 'asc')
			->order('title', 'asc');

		// Get the options.
		$db->setQuery($query->toString());
		$options = $db->loadObjectList();

		// Check for a database error.
		if ($db->getErrorNum())
		{
			throw new Exception($db->getErrorMsg(), 500, E_WARNING);
			return null;
		}

		// If params is an array, push these options to the array
		if (is_array($params))
		{
			$options = array_merge($params, $options);
		}
		// If all levels is allowed, push it into the array.
		elseif ($params)
		{
			array_unshift($options, Select::option('', Lang::txt('JOPTION_ACCESS_SHOW_ALL_LEVELS')));
		}

		return Select::genericlist(
			$options,
			$name,
			array(
				'list.attr' => $attribs,
				'list.select' => $selected,
				'id' => $id
			)
		);
	}
public static function level($name, $selected, $attribs = '', $params = true, $id = false)
	{
		$db = App::get('db');

		$query = $db->getQuery()
			->select('a.id', 'value')
			->select('a.title', 'text')
			->from('#__viewlevels', 'a')
			->group('a.id')
			->group('a.title')
			->group('a.ordering')
			->order('a.ordering', 'asc')
			->order('title', 'asc');

		// Get the options.
		$db->setQuery($query->toString());
		$options = $db->loadObjectList();

		// Check for a database error.
		if ($db->getErrorNum())
		{
			throw new Exception($db->getErrorMsg(), 500, E_WARNING);
			return null;
		}

		// If params is an array, push these options to the array
		if (is_array($params))
		{
			$options = array_merge($params, $options);
		}
		// If all levels is allowed, push it into the array.
		elseif ($params)
		{
			array_unshift($options, Select::option('', Lang::txt('JOPTION_ACCESS_SHOW_ALL_LEVELS')));
		}

		return Select::genericlist(
			$options,
			$name,
			array(
				'list.attr' => $attribs,
				'list.select' => $selected,
				'id' => $id
			)
		);
	}
public static function level ( $ name , $ selected , $ attribs = '' , $ params = true , $ id = false ) { $ db = App :: get ( 'db' ) ; $ query = $ db -> getQuery ( ) -> select ( 'a.id' , 'value' ) -> select ( 'a.title' , 'text' ) -> from ( '#__viewlevels' , 'a' ) -> group ( 'a.id' ) -> group ( 'a.title' ) -> group ( 'a.ordering' ) -> order ( 'a.ordering' , 'asc' ) -> order ( 'title' , 'asc' ) ; // Get the options. $ db -> setQuery ( $ query -> toString ( ) ) ; $ options = $ db -> loadObjectList ( ) ; // Check for a database error. if ( $ db -> getErrorNum ( ) ) { throw new Exception ( $ db -> getErrorMsg ( ) , 500 , E_WARNING ) ; return null ; } // If params is an array, push these options to the array if ( is_array ( $ params ) ) { $ options = array_merge ( $ params , $ options ) ; } // If all levels is allowed, push it into the array. elseif ( $ params ) { array_unshift ( $ options , Select :: option ( '' , Lang :: txt ( 'JOPTION_ACCESS_SHOW_ALL_LEVELS' ) ) ) ; } return Select :: genericlist ( $ options , $ name , array ( 'list.attr' => $ attribs , 'list.select' => $ selected , 'id' => $ id ) ) ; }
Displays a list of the available access view levels

@param   string  $name      The form field name.
@param   string  $selected  The name of the selected section.
@param   string  $attribs   Additional attributes to add to the select field.
@param   mixed   $params    True to add "All Sections" option or and array of options
@param   string  $id        The form field id
@return  string  The required HTML for the SELECT tag.
Displays a list of the available access view levels