<?php
/**
* @version		3.0.0
* @package		JomLand TicketCenter
* @copyright	Copyright (C) 2010 JomLand.com. All rights reserved.
* @link 		www.jomland.com
* @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/ 
// no direct access
defined('_JEXEC') or die('Restricted access');
?>

<table id="events_table">
	<thead>
		<tr>
			<th class="who_city"><?php echo JText::_('What');?></th>
			<?php if ($this->params->get('images_on_tables')){?>
				<th class="image_title"></th>
			<?php }?>
			
			<th class="who_city"><?php echo JText::_('Who');?></th>
			<th class="when"><?php echo JText::_('When');?></th>
			<?php if ($this->params->get('display_venue')>0){ ?>
			<th class="where"><?php echo JText::_('Where');?></th>
			<?php }?>
			<th class="tickets"><?php echo JText::_('Order');?></th>
		</tr>
	</thead>
<?php 	
foreach ($this->events as $event){
	$event_link = JROUTE::_('index.php?option=com_jlticketcenter&view=tickets&id='.$event->id.'&Itemid='.$this->itemid);
	$performer_link = JROUTE::_('index.php?option=com_jlticketcenter&view=event&performer='.$event->performer_id.'&Itemid='.$this->itemid);
	
	if($event->event_type==1){
		$ticket_text = JText::_('Register');
	}else{
		$ticket_text = JText::_('Tickets');	
	}
		
	if ($this->params->get('display_venue')>0){
		$venue  = JLTicketCenterLinksHelper::VenueLink($this->params->get('display_venue'),$event->venue_id,$event->venue_name,$this->itemid);
	}
?>
		<tr>
			<?php if ($this->params->get('images_on_tables')){
				if(!empty($event->event_img)){?>
				<td>
					<a href="<?php echo $event_link;?>"><?php echo JHtml::image($event->event_img, $event->event_name, 'class="event_table_image"');?></a>
				</td>
				<td>
					<a href="<?php echo $event_link;?>"><?php echo $event->event_name;?></a>
				</td>
			<?php }
				else{ ?>
				<td colspan="2">
					<a href="<?php echo $event_link;?>"><?php echo $event->event_name;?></a>
				</td>
			<?php }
			}
			else{?>
			<td>
			<a href="<?php echo $event_link;?>"><?php echo $event->event_name;?></a>
			</td>
		<?php }?>
	
			<td>
			<a href="<?php echo $performer_link;?>"><?php echo $event->performer_name;?></a>
			</td>
			<td>
			<datetime>
			<?php echo JHTML::_('date', $event->event_date, JText::_('DATE_FORMAT_LC3').' H:i',null);?>
			</datetime>
			</td>
			<?php if ($this->params->get('display_venue')>0){ ?>
			<td>
			 <?php echo $venue;?>
			 </td>
			 <?php }?>
			 <td>
	 			<a href="<?php echo $event_link;?>"><?php echo $ticket_text;?></a>
			 </td>
	</tr>		
<?php };// end foeeach?>
</table>	

 
