<?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');
if (isset($_GET['id']) && $_GET['id'] != '') $group = rst_get_groups(intval($_GET['id']));
if (isset($group) && count($group) == 0) rst_admin_redirect('?option=com_rstickets&task=groups');
?>
<h4 class="rst_h4"><?php echo isset($department) ? LBL_EDIT_GROUP : LBL_NEW_GROUP ?></h4>
<!--<a href="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=groups" class="backButton"><?php echo BTN_BACK; ?></a>-->
<form method="post" action="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=add_group&amp;action=add_group" name="add_group">
<input type="hidden" name="GroupId" value="<?php echo isset($group) ? rst_clean($_GET['id']) : 0 ?>" />
<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td colspan="2"><?php echo LBL_GROUP_PROPERTIES; ?></td>
	</tr>
	</thead>
	<tbody>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_NAME; ?></td>
		<td><input type="text" name="GroupName" value="<?php echo isset($group[0]['GroupName']) ? $group[0]['GroupName'] : (isset($_POST['GroupName']) ? $_POST['GroupName'] : '') ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_PERMISSIONS; ?></td>
		<td>
			<input type="checkbox" class="smallCheck" name="CanAddTicket" value="1" <?php echo isset($group[0]['CanAddTicket']) && $group[0]['CanAddTicket'] == 1  ? 'checked="checked"' : (isset($_POST['CanAddTicket']) && $_POST['CanAddTicket'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_ADD_TICKET; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanAddTicketUsers" value="1" <?php echo isset($group[0]['CanAddTicketUsers']) && $group[0]['CanAddTicketUsers'] == 1  ? 'checked="checked"' : (isset($_POST['CanAddTicketUsers']) && $_POST['CanAddTicketUsers'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_ADD_TICKET_USERS; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanAddTicketStaff" value="1" <?php echo isset($group[0]['CanAddTicketStaff']) && $group[0]['CanAddTicketStaff'] == 1  ? 'checked="checked"' : (isset($_POST['CanAddTicketStaff']) && $_POST['CanAddTicketStaff'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_ADD_TICKET_STAFF; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanUpdateTicket" value="1" <?php echo isset($group[0]['CanUpdateTicket']) && $group[0]['CanUpdateTicket'] == 1  ? 'checked="checked"' : (isset($_POST['CanUpdateTicket']) && $_POST['CanUpdateTicket'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_UPDATE_TICKET; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanDeleteTicket" value="1" <?php echo isset($group[0]['CanDeleteTicket']) && $group[0]['CanDeleteTicket'] == 1  ? 'checked="checked"' : (isset($_POST['CanDeleteTicket']) && $_POST['CanDeleteTicket'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_DELETE_TICKET; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanAnswerTicket" value="1" <?php echo isset($group[0]['CanAnswerTicket']) && $group[0]['CanAnswerTicket'] == 1  ? 'checked="checked"' : (isset($_POST['CanAnswerTicket']) && $_POST['CanAnswerTicket'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_ANSWER_TICKET; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanDeleteTicketReplies" value="1" <?php echo isset($group[0]['CanDeleteTicketReplies']) && $group[0]['CanDeleteTicketReplies'] == 1  ? 'checked="checked"' : (isset($_POST['CanDeleteTicketReplies']) && $_POST['CanDeleteTicketReplies'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_DELETE_TICKET_REPLIES; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanUpdateTicketReplies" value="1" <?php echo isset($group[0]['CanUpdateTicketReplies']) && $group[0]['CanUpdateTicketReplies'] == 1  ? 'checked="checked"' : (isset($_POST['CanUpdateTicketReplies']) && $_POST['CanUpdateTicketReplies'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_UPDATE_TICKET_REPLIES; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanAssignTickets" value="1" <?php echo isset($group[0]['CanAssignTickets']) && $group[0]['CanAssignTickets'] == 1  ? 'checked="checked"' : (isset($_POST['CanAssignTickets']) && $_POST['CanAssignTickets'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_ASSIGN_TICKETS; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanChangeTicketStatus" value="1" <?php echo isset($group[0]['CanChangeTicketStatus']) && $group[0]['CanChangeTicketStatus'] == 1  ? 'checked="checked"' : (isset($_POST['CanChangeTicketStatus']) && $_POST['CanChangeTicketStatus'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_CHANGE_TICKET_STATUS; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanSeeUnallocatedTickets" value="1" <?php echo isset($group[0]['CanSeeUnallocatedTickets']) && $group[0]['CanSeeUnallocatedTickets'] == 1  ? 'checked="checked"' : (isset($_POST['CanSeeUnallocatedTickets']) && $_POST['CanSeeUnallocatedTickets'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_SEE_UNALLOCATED_TICKETS; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanSeeOtherTickets" value="1" <?php echo isset($group[0]['CanSeeOtherTickets']) && $group[0]['CanSeeOtherTickets'] == 1 ? 'checked="checked"' : (isset($_POST['CanSeeOtherTickets']) && $_POST['CanSeeOtherTickets'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_SEE_OTHER_TICKETS; ?><br/>
			<input type="checkbox" class="smallCheck" name="CanMoveTicket" value="1" <?php echo isset($group[0]['CanMoveTicket']) && $group[0]['CanMoveTicket'] == 1 ? 'checked="checked"' : (isset($_POST['CanMoveTicket']) && $_POST['CanMoveTicket'] == 1 ? 'checked="checked"' : '') ?>/> <?php echo LBL_CAN_MOVE_TICKET; ?><br/>
			</td>
	</tr>
	</tbody>
</table>
<!--<p><button type="submit"><?php echo BTN_SUBMIT; ?></button></p>-->
</form>