<?php
/**
* @version 1.0.0
* @package RSEvents! 1.0.0
* @copyright (C) 2009 www.rsjoomla.com
* @license GPL, http://www.gnu.org/copyleft/gpl.html
*/

defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.modal');
?>
<form action="index.php?option=com_rsevents&task=listsubscriptions" method="post" name="adminForm">
	<table class="adminform">
		<tr>
			<td width="100%">
			</td>
			<?php if($this->event_filter) {?>
			<td nowrap="nowrap">
				<?php echo $this->lists1['tickets'];	?>
			</td>
			<?php } ?> 
			<td nowrap="nowrap">
				<?php echo $this->lists['events'];	?>
			</td>
			<td nowrap="nowrap">
				<?php  echo $this->lists['state'];	?>
			</td>
		</tr>
	</table>
	<div id="editcell1">
		<table class="adminlist" width="100%">
			<thead>
			<tr>
				<th width="1%">
					<?php echo JText::_( 'RSE_#' ); ?>
				</th>
				<th width="1%">
					<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->data); ?>);"/>
				</th>
				<th width="20%">
					<?php
						$msg=JText::_('RSE_SUBSCRIBER_EVENT_NAME');
						echo JHTML::_('grid.sort',$msg,'e.EventName',$this->sortOrder,$this->sortColumn);
					?>
				</th>
				<th width="5%">
					<?php
						$msg=JText::_('RSE_SUBSCRIBER_IP');
						echo JHTML::_('grid.sort',$msg,'s.UserIp',$this->sortOrder,$this->sortColumn);
					?>
				</th>
				<th width="10%">
					<?php
						$msg=JText::_('RSE_SUBSCRIBER_NAME');
						echo JHTML::_('grid.sort',$msg,'#__rsevents_subscribers.FirstName.LastName',$this->sortOrder,$this->sortColumn);
					?>
				</th>
				<th width="10%">
					<?php
						$msg=JText::_('RSE_SUBSCRIBER_USERNAME');
						echo JHTML::_('grid.sort',$msg,'u.username',$this->sortOrder,$this->sortColumn);
					?>
				</th>
				<th width="10%">
					<?php
						$msg=JText::_('RSE_SUBSCRIBER_EMAIL');
						echo JHTML::_('grid.sort',$msg,'#__rsevents_subscribers.Email',$this->sortOrder,$this->sortColumn);
					?>
				</th>
				<th width="10%">
					<?php
						$msg=JText::_('RSE_SUBSCRIBER_SUBSCRIBED');
						echo JHTML::_('grid.sort',$msg,'s.SubscriptionDate',$this->sortOrder,$this->sortColumn);
					?>
				</th>
				<th width="5%">
					<?php
						echo JText::_('RSE_SUBSCRIBER_DETAILS');
					?>
				</th>
				<th width="3%">
					<?php
						echo JText::_('RSE_SUBSCRIBER_ACCEPTED');
					?>
				</th>
				<th width="3%">
					<?php
						echo JText::_('RSE_SUBSCRIBER_PENDING');
					?>
				</th>
				<th width="3%">
					<?php
						echo JText::_('RSE_SUBSCRIBER_DENIED');
					?>
				</th>
				<th width="3%">
					<?php
						echo JText::_('RSE_SUBSCRIBER_DELETE');
					?>
				</th>
			</tr>
			</thead>
			<tbody>
	<?php
	$k = 0;
	for ($i=0,$n=count($this->data);$i<$n;$i++)
	{
		$row =& $this->data[$i];
		$checked=JHTML::_('grid.id',$i,$row->RecordId);
	?>
			<tr class="<?php echo "row$k"; ?>">
				<td><?php echo $row->RecordId; ?></td>
				<td><?php echo $checked; ?></td>
				<td><?php echo $row->EventName .' <em>('.$row->TicketsSubscribed.' x '.$row->TicketName.')</em>'; ?></td>
				<td><?php echo $row->UserIp; ?></td>
				<td><a href="index.php?option=com_rsevents&task=editsubscription&cid=<?php echo $row->RecordId; ?>"><?php echo $row->FirstName.' '.$row->LastName; ?></a></td>
				<td><?php echo empty($row->username) ? JText::_('RSE_GUEST') : $row->username; ?></td>
				<td><?php echo $row->Email; ?></td>
				<td align="center"><?php echo date('Y-m-d',$row->SubscriptionDate); ?></td>
				<td align="center"><a href="index.php?option=com_rsevents&task=showtransaction&tmpl=component&cid=<?php echo $row->RecordId; ?>" class="modal"><img src="<?php echo JURI::root();?>administrator/components/com_rsevents/images/icons/details.png" /></a></td>
				<td align="center"><?php echo ($row->SubscriptionState!=1) ? '<a href="index.php?option=com_rsevents&task=accepted&controller=subscriptions&cid='.$row->RecordId.'">' : ''; ?><img src="<?php echo JURI::root().'administrator/components/com_rsevents/images/icons/'.($row->SubscriptionState==1 ? 'tick.png' : 'delete.png');?>"><?php echo ($row->SubscriptionState==1) ? '</a>' : ''; ?></td>
				<td align="center"><?php echo ($row->SubscriptionState!=0) ? '<a href="index.php?option=com_rsevents&task=pending&controller=subscriptions&cid='.$row->RecordId.'">' : ''; ?><img src="<?php echo JURI::root().'administrator/components/com_rsevents/images/icons/'.($row->SubscriptionState==0 ? 'tick.png' : 'delete.png');?>"><?php echo ($row->SubscriptionState==1) ? '</a>' : ''; ?></td>
				<td align="center"><?php echo ($row->SubscriptionState!=-1) ? '<a href="index.php?option=com_rsevents&task=denied&controller=subscriptions&cid='.$row->RecordId.'">' : ''; ?><img src="<?php echo JURI::root().'administrator/components/com_rsevents/images/icons/'.($row->SubscriptionState==-1 ? 'tick.png' : 'delete.png');?>"><?php echo ($row->SubscriptionState==1) ? '</a>' : ''; ?></td>
				<td align="center"><a href="index.php?option=com_rsevents&task=delete&controller=subscriptions&cid=<?php echo $row->RecordId; ?>"><img src="<?php echo JURI::root().'administrator/components/com_rsevents/images/icons/delete.png' ;?>"></a></td>
			</tr>
	<?php
		$k=1-$k;
	}
	?>
		</tbody>
		<tfoot>
			<tr>
				<td colspan="13"><?php echo $this->pagination->getListFooter(); ?></td>
			</tr>
		</tfoot>
		</table>
	</div>
	<?php echo JHTML::_( 'form.token' ); ?>
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="task" value="listsubscriptions" />
	<input type="hidden" name="option" value="com_rsevents" />
	<input type="hidden" name="view" value="subscriptions" />
	<input type="hidden" name="controller" value="subscriptions" />
	<input type="hidden" name="filter_order" value="<?php echo $this->sortColumn; ?>" />
	<input type="hidden" name="filter_order_Dir" value="<?php echo $this->sortOrder; ?>" />
	</form>