<?php

/**
* @version 2.8.0
* @package Joomla 2.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
*/

global $Itemid,$show_group_members,$cb_integrated,$registrant_name,$registrant_show_avatar,$button_color, $registrant_cb_linked,$xhtml,$cb_integrated,$registrant_name,$registrant_username;
$user = $this->user;
$muser = $this->muser;
$tuser = $muser->table;
$profile = $tuser->TableJUser;
$mfieldtype = $this->getModel('fieldtype');

$fieldtypes = $mfieldtype->getTypes();
$tuser->load($user->userId);
$html = "";
if($show_group_members == 1){
     $html ='<tr class="detail member'.$user->userId.'"><td colspan="9"><table border="0" cellpadding=1 cellspacing=1 width="100%">';
	  $html = ""; 
   if(count($tuser->members)){
	   
	   foreach($tuser->members as $member){
		   
		   $username = '';
		   $username = $tuser->TableJUser->username;
		  
		   $html .= "<tr class='child detail' id='".$user->userId."'>";

		   $html .="<td>&nbsp;</td>";
		   if($cb_integrated > 0 && $registrant_show_avatar ==1){ 
		  	 $html .="<td>&nbsp;</td>";
		  }
		  foreach($this->fields as $field){
			  
			  if($field->name == 'name'){
		      $html .="<td>";
		  
		    switch($registrant_name){

				case 1:

					$html .= $member->firstname;

				break;

				case 2:

					$html .=$member->lastname;

				break;

				case 3:

					$html .=$member->firstname.' '.$member->lastname;

				break;
				default:
				  $html .=$member->firstname.' '.$member->lastname;

			 }

			$html .= "</td><td>&nbsp;</td>";
			
		   }else{
			   			   
			   if (isset($member->{$field->name}) && $member->{$field->name} != '') {
				   
					$fieldClass = 'Field_'.$fieldtypes[$field->type];
			  
			  $fieldTable = new $fieldClass();
			  $fieldTable->load($field->id);
			  $function = 'viewHtml';
			  if(is_callable(array($fieldTable,'exportView'))){
				  $function = 'exportView';
			  }

					$html .='<td>'.$fieldTable->$function((array)$member).'</td>';
			   
			   }else{
				   $html .='<td>&nbsp;</td>';
			   }

		   }
			  
		  }
		   
	   }
	   
   }
	
}
echo $html;
?>