<?php

/**
* @version 2.7.11
* @package Joomla 1.5
* @subpackage DT Register
* @copyright Copyright (C) 2006 DTH Development
* @copyright contact dthdev@dthdevelopment.com
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
include_once(JPATH_SITE."/administrator/components/com_dtregister/lib/defines.php");
include_once(JPATH_SITE."/administrator/components/com_dtregister/models/event.php");
include_once(JPATH_SITE."/administrator/components/com_dtregister/models/config.php");
include_once(JPATH_SITE."/administrator/components/com_dtregister/models/user.php");
include_once(JPATH_SITE."/administrator/components/com_dtregister/helpers/dtregister.php");
class JElementModeratorlist extends JElement {
  
  var $_name = 'Moderatorlist ';
  function fetchElement($name, $value, &$node, $control_name) {
     
		$db = &JFactory::getDBO();

		$class = $node->attributes('class');
        $jUserTable = DtrTable::getInstance('juser','Table');
		if (!$class) {

			$class = "inputbox";

		}
        $options = DtHtml::options( $jUserTable->optionslist_module(),'Select Moderator');
		 
		return JHTML::_('select.genericlist', $options,$control_name.'['.$name.']','',"value","text",$value);
		foreach( $options as $option ) {

			if(is_array( $value) ) {

				if( in_array( $option->id, $value ) ) {

					$result .= '<option selected="true" value="'.$option->id.'" >'.$option->title.'</option>';

				} else {

					$result .= '<option value="'.$option->id.'" >'.$option->title.'</option>';

				}

			} elseif ( $value ) {

				if( $value == $option->id ) {

					$result .= '<option selected="true" value="'.$option->id.'" >'.$option->title.'</option>';

				} else {

					$result .= '<option value="'.$option->id.'" >'.$option->title.'</option>';

				}

			} elseif ( !( $value ) ) {

				$result .= '<option value="'.$option->id.'" >'.$option->title.'</option>';

			}

		}

		$result .= '</select>';

		return $result;

  }
  
}
?>