{codecitation style="brush: php;"}
class JElementSections extends JElement
{
	/**
	 * Element name
	 *
	 * @access	protected
	 * @var		string
	 */
	var	$_name = 'sections';

	function fetchElement($name, $value, &$node, $control_name)
	{
		$options = array();
		$db = &JFactory::getDBO();
		$query = 'SELECT id, title AS `text` ' . 
				'FROM #__sections ' .
				'ORDER BY title ';

		$db->setQuery( $query );
		$result = $db->loadAssocList();
		if(is_array($result)) $options += $db->loadAssocList();

		$attribs = "multiple=\"multiple\" size=\"5\" class=\"inputbox\"";
		return JHTML::_('select.genericlist',  $options, ''.$control_name.'['.$name.'][]', $attribs, 'id', 'text', $value, $control_name.$name );
	}
}
{/codecitation}