<?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.tooltip'); 
?>
<script type="text/javascript">
function tableOrdering(order, dir, task)
{
	var form = document.adminForm;
	
	form.direction.value	= dir;
	document.adminForm.submit();
}
</script>
<div style="text-align:right;">
<?php if($this->isAdmin) { ?>
<a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&layout=addeditevent')); ?>" class="editlinktip hasTip" title="<?php echo JText::_('RSE_ADD_EVENT_TITLE'); ?>"><img src="<?php echo JURI::root().'images/M_images/edit.png'; ?>" alt="<?php echo JText::_('RSE_ADD_EVENT'); ?>" /></a>
<?php } ?>
<a href="<?php echo html_entity_decode(JRoute::_('index.php?option=com_rsevents&view=events&format=feed&type=rss')); ?>"><img src="<?php echo JURI::root().'images/M_images/livemarks.png' ?>" /></a>
</div>
<div class="componentheading<?php echo $this->escape($this->parameters->get('pageclass_sfx')); ?>"><?php echo JText::_('RSE_EVENTS') ;?></div> 
<br/>
<form action="index.php?option=com_rsevents&view=events<?php echo $this->itemId; ?>" method="post" name="adminForm">
<?php 
if($this->search_location == 0  || $this->search_location == 2)
	echo rseventsViewEvents::showSearch(); 
?>
<?php if($this->parameters->get('enableordering') == 1 && ($this->parameters->get('orderloction') == 0 || $this->parameters->get('orderloction') == 2)) { ?>
<div style="text-align:right;">
<?php echo JHTML::_('grid.sort',  JText::_('RSE_ORDERING').' ', 'e.EventStartDate', $this->direction, 'e.EventStartDate'); ?>
<br/>
</div>
<?php } ?>
<?php
if ($this->rseventsConfig['events.layout'] == 2) { ?> 
<table class="rsevents-table-list" cellspacing="0" cellpadding="0" width="100%">
	<thead>
		<tr>
			<th>
				<?php echo JText::_('RSE_DATE'); ?>
			</th>
			<th>
				<?php echo JText::_('RSE_EVENTNAME'); ?>
			</th>
			<th>
				<?php echo JText::_('RSE_LOCATION_NAME'); ?>
			</th>
			<th>
				<?php echo JText::_('RSE_CATEGORY_NAME'); ?>
			</th>
		</tr>
	</thead>
	<tbody>
<?php
} 
//showing the events 
if(!empty($this->layouts))
   foreach($this->layouts as $layout)
      echo $layout ;
else
   echo JText::_('RSE_NO_EVENTS');

echo ($this->rseventsConfig['events.layout'] == 2) ? "</tbody>\n</table>" : "";
?>

<?php if($this->parameters->get('enableordering') == 1 && ($this->parameters->get('orderloction') == 1 || $this->parameters->get('orderloction') == 2)) { ?>
<br/>
<div style="text-align:right;">
<?php echo JHTML::_('grid.sort',  JText::_('RSE_ORDERING').' ', 'e.EventStartDate', $this->direction, 'e.EventStartDate'); ?>
<br/>
</div>
<?php } ?>

<div class="rsevents-pagination">
	<div class="pageslinks">
		<?php echo $this->pagination->getPagesLinks(); ?>
	</div>
	<p class="pagescounter">
		<?php echo $this->pagination->getPagesCounter(); ?>
	</p>
</div>
<br/>

<?php 
if($this->search_location == 1 || $this->search_location == 2)
	echo rseventsViewEvents::showSearch(); 
?>

<input type="hidden" name="direction" value="" />
</form>