<?php

/**
* @version 2.8.9
* @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
*/

$fieldTable = DtrTable::getInstance('field','Table');

$fieldType = DtrModel::getInstance('Fieldtype','DtregisterModel');
$fieldTypes = $fieldType->getTypes();

$firstname_field = $fieldTable->fingbyName('firstname');
$lastname_field = $fieldTable->fingbyName('lastname');
$email_field = $fieldTable->fingbyName('email');

 echo "<pre><table>";
 
 foreach($this->transactions as $transation) {
    echo "<tr>";  
	 echo "<td>".$transation->id."</td>";
	    $data = unserialize($transation->data);
		echo "<td>";
		$data_f = false;
		 if(is_array($data['__dtregister']['DTH']['register']['User'])) {
		   foreach($data['__dtregister']['DTH']['register']['User'] as $user) {
			   $data_f = $user;
			   break;
		   }
		 } else {
		     print_r($data);
		 }
		 
		 //$data_f = array_shift($data['__dtregister']['DTH']['register']['User']);
		  $fname = $data_f['fields'][$firstname_field->id];
		  
		   $lname = $data_f['fields'][$lastname_field->id];
		   $email = $data_f['fields'][$email_field->id];
		   if($email == 'alemmon@goaa.org') {
			 print_r($data);
		 }
		 echo '<a href"#">'.trim($fname." ".$lname).' ('.$email.')</a>';
		 if($fname == "") {
		    print_r($data);
			
		 }
		//print_r($data['__dtregister']['DTH']['register']['User'][0]['fields']);
		echo "<td>".$data_f['confirmNum']."</td>";
		echo "<td>";
		$text = ($transation->processed==1)?JText::_('DT_PROCESSED'):JText::_('DT_PROCESSING_ERROR');
	 echo "<td>".$text."</td>";
	echo "</tr>";
	  
 }
 
 echo "</table>";

?>