<?php defined( '_JEXEC' ) or die( 'Restricted access' ); ?>

<div class="mod_jltcenter_events<?php echo $params->get('moduleclass_sfx');?>">
<div class="slider_mask">
	<div id="<?php echo $params->get('slider_id','jltc_slider_mask');?>">
<?php
	if ($events){

	foreach ($events as $event){?>
	<div>
		<h4>
		<?php
			if(!empty($Itemid)){
				$event_link = JROUTE::_('index.php?option=com_jlticketcenter&view=tickets&id='.$event->id.'&Itemid='.$this->itemid);
			}else{
				$event_link = JROUTE::_('index.php?option=com_jlticketcenter&view=tickets&id='.$event->id);
			}
		?>
		<a href="<?php echo $event_link;?>"><?php echo $event->event_name;?></a>
		</h4>
		
		<h5>
		<?php if ($params->get('artist_link')==1){
				if(!empty($Itemid)){
					$url = JROUTE::_('index.php?option=com_jlticketcenter&view=event&layout=performer&performer_id='.$event->performer.'&Itemid='.$Itemid);
				}else{
					$url = JROUTE::_('index.php?option=com_jlticketcenter&view=event&layout=performer&performer='.$event->performer_id);
				}
			  		echo JHTML::link($url, $event->performer_name);
				}
			  else{
			  	echo $event->performer_name;
			} 
		?>
		</h5>
		<strong><?php echo JHTML::_('date', $event->event_date, JText::_('DATE_FORMAT_LC2'),null);?></strong>
		<br />
		<?php if ($event->short_desc){
				echo nl2br($event->short_desc);
				echo '<br/><br/>';
		}?>
		<strong>
		 <?php if ($params->get('venue_link')==1){
		 			if(!empty($Itemid)){ 
			  			$url = JROUTE::_('index.php?option=com_jlticketcenter&view=event&layout=venue&venue_id='.$event->venue.'&Itemid='.$Itemid);
		 			}else{
		 				$url = JROUTE::_('index.php?option=com_jlticketcenter&view=event&layout=venue&venue='.$event->venue_id);
		 			}
			  		echo JHTML::link($url,$event->venue_name);
		 		}
			  	else{
			  	echo $event->venue_name;
				} 
		?>
		</strong>
		<br />
		 <?php if ($params->get('display_city')==1){
		 			$comma = true;
		 			echo $event->city_name;
		 		}
				if ($params->get('display_region')==1 && $event->state_name!=$event->state_name){
					if ($comma){
						echo ', ';
					}
		 			echo $event->state_name;
		 			$comma = true;
		 		}
		 		if ($params->get('display_country')==1){
		 			if ($comma){
						echo ', ';
					}
		 			echo $event->country;
		 		}
		 ?>
		 <?php 
		 	if(!empty($Itemid)){
		 		$tickets_link = JROUTE::_('index.php?option=com_jlticketcenter&view=tickets&id='.$event->id.'&Itemid='.$Itemid); 
		 	}else{
		 		$tickets_link = JROUTE::_('index.php?option=com_jlticketcenter&view=tickets&id='.$event->id);
		 	}
		 	 echo JHTML::link($tickets_link,JText::_('Book Ticket'),'class="booking"');
		 	 ?>
	</div>
	<?php 
	 }// end foeeach
}
else{
echo JText::_('Events haven\'t found') .'<br>';
}?>
	</div>
</div>

<?php if ($params->get('prev_next_buttons') || $params->get('play_button') || $params->get('stop_button')){ ?>
<p class="buttons">
	<?php if ($params->get('prev_next_buttons')){?>
		<span id="prev_<?php echo $params->get('slider_id','jltc_slider_mask');?>"></span>
	<?php }?>
	<?php if ($params->get('play_button',false)){ ?>
		<span id="play1">Play &gt;</span>
	<?php }?>
	
	<?php if ($params->get('stop_button')){ ?>
		<span id="stop1">Stop</span>
	<?php }?>
	<?php if ($params->get('prev_next_buttons')){?>
		<span id="next_<?php echo $params->get('slider_id','jltc_slider_mask');?>"></span>
	<?php }?>
</p>	
<?php }?>
</div>
