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
			)
		);
	}