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

// DIE()
defined('_JEXEC') or die('Restricted access');

// MUST BE LOGGED IN & ADMIN PERMISSIONS
if (!isset($_SESSION['RST_User']['UserId']) || (isset($_SESSION['RST_User']['Admin']) && $_SESSION['RST_User']['Admin'] == 0)) rst_admin_redirect('?option=com_rstickets');
?>
<h4 class="rst_h4"><?php echo LBL_STAFF; ?></h4>
<!--<a href="index.php?option=com_rstickets&page=add_staff" class="addButton"><?php echo LBL_NEW_STAFF; ?></a>-->
<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td class="tdGrey"><?php echo LBL_USERNAME; ?></td>
		<td class="tdGrey"><?php echo LBL_FULLNAME; ?></td>
		<td class="tdGrey"><?php echo LBL_EMAIL; ?></td>
		<td class="tdGrey"><?php echo LBL_GROUP; ?></td>
		<td><?php echo LBL_ACTIONS; ?></td>
	</tr>
	</thead>
	<tbody>
		<?php
		$staffs = rst_get_staff();
		if (count($staffs) > 0)
			foreach ($staffs as $key => $staff)
				echo '<tr class="'.($key % 2 == 0 ? 'trEven' : 'trOdd').'">
				<td class="tdGrey"><a href="'.RST_BACKEND_SCRIPT_PATH.'?option=com_rstickets&task=add_staff&amp;id='.$staff['UserId'].'">'.$staff['Username'].'</a></td>
				<td class="tdGrey">'.$staff['Fullname'].'</td>
				<td class="tdGrey">'.$staff['Email'].'</td>
				<td class="tdGrey">'.$staff['GroupName'].'</td>
				<td><a href="'.RST_BACKEND_SCRIPT_PATH.'?option=com_rstickets&task=add_staff&amp;id='.$staff['UserId'].'" class="editButton">'.BTN_EDIT.'</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a onclick="return confirm(\''.LBL_SURE.'\')" href="'.RST_BACKEND_SCRIPT_PATH.'?option=com_rstickets&task=staff&amp;action=delete_staff&amp;id='.$staff['UserId'].'" class="deleteButton">'.BTN_DELETE.'</a></td>
				</tr>';
		else echo '<tr><td colspan="5"><strong>'.LBL_NO_STAFF.'</strong></td></tr>';
		?>
	</tbody>
</table>