<?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_SETTINGS; ?></h4>
<!--
<a href="#" onclick="show_settings('emailSettings');return false;"><?php echo LBL_EMAIL; ?></a> | <a href="#" onclick="show_settings('listingSettings');return false;"><?php echo LBL_TICKETS_LISTINGS; ?></a> | <a href="#" onclick="show_settings('dateSettings');return false;"><?php echo LBL_DATE_SETTINGS; ?></a> | <a href="#" onclick="show_settings('autocloseSettings');return false;"><?php echo LBL_AUTOCLOSE_SETTINGS; ?></a>
-->
<?php
	  $RST_adapter->initTabs(1);
      $RST_adapter->startPane('settings-pane');
      $RST_adapter->startTab(LBL_GENERAL,'general');
?>
<form method="post" action="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=settings&amp;action=update_general_settings" id="generalSettings">
<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td colspan="2"><?php echo LBL_GENERAL.' '.LBL_SETTINGS; ?></td>
	</tr>
	</thead>
	<tbody>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_LICENSE; ?></td>
		<td><input type="text" name="License_Code" value="<?php echo $T_SETTINGS['License_Code']; ?>" size="50"/></td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_DATE_SETTINGS; ?></td>
		<td>
			<select name="Date_Format">
				<option <?php echo $T_SETTINGS['Date_Format'] == 'd.m' ? 'selected="selected"' : ''; ?> value="d.m">dd.mm</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'm.d' ? 'selected="selected"' : ''; ?> value="m.d">mm.dd</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'd.m.Y' ? 'selected="selected"' : ''; ?> value="d.m.Y">dd.mm.yyyy</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'm.d.Y' ? 'selected="selected"' : ''; ?> value="m.d.Y">mm.dd.yyyy</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'd/m/Y' ? 'selected="selected"' : ''; ?> value="d/m/Y">dd/mm/yyyy</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'm/d/Y' ? 'selected="selected"' : ''; ?> value="m/d/Y">mm/dd/yyyy</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'Y-m-d' ? 'selected="selected"' : ''; ?> value="Y-m-d">yyyy-mm-dd</option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_RSTICKETS_LINK; ?></td>
		<td>
		<select name="RStickets_Link">
				<option <?php echo  $T_SETTINGS['RStickets_Link'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo  $T_SETTINGS['RStickets_Link'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_RSTICKETS_SHOW_MENU; ?></td>
		<td>
		<select name="RStickets_Show_Menu">
				<option <?php echo  $T_SETTINGS['RStickets_Show_Menu'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo  $T_SETTINGS['RStickets_Show_Menu'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_RSTICKETS_ADD_TICKETS; ?></td>
		<td>
		<select name="RStickets_Add_Tickets">
				<option <?php echo  $T_SETTINGS['RStickets_Add_Tickets'] == 'yes' ? 'selected="selected"' : ''; ?> value="yes"><?php echo LBL_EVERYONE; ?></option>
				<option <?php echo  $T_SETTINGS['RStickets_Add_Tickets'] == 'users' ? 'selected="selected"' : ''; ?> value="users"><?php echo LBL_REGISTERED; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_RSTICKETS_MYSQL_UTF8; ?></td>
		<td>
		<select name="RStickets_MySQL_UTF8">
				<option <?php echo  $T_SETTINGS['RStickets_MySQL_UTF8'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo  $T_SETTINGS['RStickets_MySQL_UTF8'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_RSTICKETS_CUSTOM_USER_LINK; ?></td>
		<td><input type="text" name="RStickets_Custom_User_Link" value="<?php echo $T_SETTINGS['RStickets_Custom_User_Link']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_STAFF_CAN_ADD_TICKETS; ?></td>
		<td>
		<select name="Staff_Can_Add_Tickets">
				<option <?php echo  $T_SETTINGS['Staff_Can_Add_Tickets'] == 'all' ? 'selected="selected"' : ''; ?> value="all"><?php echo LBL_ALL_DEPARTMENTS; ?></option>
				<option <?php echo  $T_SETTINGS['Staff_Can_Add_Tickets'] == 'assigned' ? 'selected="selected"' : ''; ?> value="assigned"><?php echo LBL_ASSIGNED_DEPARTMENTS; ?></option>
			</select>
		</td>
	</tr>
	<?php if (function_exists('date_default_timezone_set')) { ?>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_TIMEZONE_CURRENT; ?></td>
		<td><span id="rst_timezone_hour"><?php echo $hour = date('H'); ?></span>:<?php echo date('i'); ?></td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_TIMEZONE; ?></td>
		<td>
		<select name="Date_Timezone" onchange="rst_change_timezone('<?php echo $hour; ?>',this.value)">
		<?php
		$timezones = array('' => LBL_TIMEZONE_NOT_SET,'Etc/GMT+12' => 'GMT - 12','Etc/GMT+11' => 'GMT - 11','Etc/GMT+10' => 'GMT - 10','Etc/GMT+9' => 'GMT - 9','Etc/GMT+8' => 'GMT - 8','Etc/GMT+7' => 'GMT - 7','Etc/GMT+6' => 'GMT - 6','Etc/GMT+5' => 'GMT - 5','Etc/GMT+4' => 'GMT - 4','Etc/GMT+3' => 'GMT - 3','Etc/GMT+2' => 'GMT - 2','Etc/GMT+1' => 'GMT - 1','Etc/GMT' => 'GMT','Etc/GMT-1' => 'GMT + 1','Etc/GMT-2' => 'GMT + 2','Etc/GMT-3' => 'GMT + 3','Etc/GMT-4' => 'GMT + 4','Etc/GMT-5' => 'GMT + 5','Etc/GMT-6' => 'GMT + 6','Etc/GMT-7' => 'GMT + 7','Etc/GMT-8' => 'GMT + 8','Etc/GMT-9' => 'GMT + 9','Etc/GMT-10' => 'GMT + 10','Etc/GMT-11' => 'GMT + 11','Etc/GMT-12' => 'GMT + 12','Etc/GMT-13' => 'GMT + 13');
		foreach ($timezones as $timezone => $timezone_title)
			echo '<option '.($T_SETTINGS['Date_Timezone'] == $timezone ? 'selected="selected"' : '').' value="'.$timezone.'">'.$timezone_title.'</option>';
		?>
			</select>
		</td>
	</tr>
	<?php }	?>
	</tbody>
</table>
<p><button type="submit"><?php echo BTN_UPDATE_SETTINGS; ?></button></p>
</form>
<?php
	$RST_adapter->endTab();
    $RST_adapter->startTab(LBL_CAPTCHA,'captcha');
?>
<form method="post" action="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=settings&amp;action=update_captcha_settings" id="captchaSettings">
<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td colspan="2"><?php echo LBL_CAPTCHA.' '.LBL_SETTINGS; ?></td>
	</tr>
	</thead>
	<tbody>
	<?php if(function_exists('imagecreate') && function_exists('imagettfbbox')) { ?>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_ENABLED; ?></td>
		<td><select name="Captcha_Enabled">
			<option <?php echo $T_SETTINGS['Captcha_Enabled'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
			<option <?php echo $T_SETTINGS['Captcha_Enabled'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
		</select></td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_DISPLAY_CAPTCHA_FOR; ?></td>
		<td>
		<input type="checkbox" <?php echo strpos($T_SETTINGS['Captcha_Enabled_For'],'unregistered') !== false ? 'checked="checked"' : ''; ?> name="Captcha_Enabled_For[]" value="unregistered" id="rst_captcha_enabled_for1" />
		<label for="rst_captcha_enabled_for1"><?php echo LBL_UNREGISTERED; ?></label>
		<input type="checkbox" <?php echo strpos($T_SETTINGS['Captcha_Enabled_For'],'users') !== false ? 'checked="checked"' : ''; ?> name="Captcha_Enabled_For[]" value="users" id="rst_captcha_enabled_for2" />
		<label for="rst_captcha_enabled_for2"><?php echo LBL_CUSTOMERS; ?></label>
		<input type="checkbox" <?php echo strpos($T_SETTINGS['Captcha_Enabled_For'],'staff') !== false ? 'checked="checked"' : ''; ?> name="Captcha_Enabled_For[]" value="staff" id="rst_captcha_enabled_for3" />
		<label for="rst_captcha_enabled_for3"><?php echo LBL_STAFF; ?></label>
		</td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_CHARACTERS; ?></td>
		<td><input type="text" name="Captcha_Characters" value="<?php echo $T_SETTINGS['Captcha_Characters']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_GENERATE_DOTS; ?></td>
		<td><select name="Captcha_Dots">
			<option <?php echo $T_SETTINGS['Captcha_Dots'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
			<option <?php echo $T_SETTINGS['Captcha_Dots'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
		</select></td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_GENERATE_LINES; ?></td>
		<td><select name="Captcha_Lines">
			<option <?php echo $T_SETTINGS['Captcha_Lines'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
			<option <?php echo $T_SETTINGS['Captcha_Lines'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
		</select></td>
	</tr>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_CASE_SENSITIVE; ?></td>
		<td><select name="Captcha_Case_Sensitive">
			<option <?php echo $T_SETTINGS['Captcha_Case_Sensitive'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
			<option <?php echo $T_SETTINGS['Captcha_Case_Sensitive'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
		</select></td>
	</tr>
	<?php } else { ?>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_NO_CAPTCHA; ?></td>
	</tr>
	<?php rst_disable_captcha(); } ?>
	</tbody>
</table>
<p><button type="submit"><?php echo BTN_UPDATE_SETTINGS; ?></button></p>
</form>
<?php
	$RST_adapter->endTab();
    $RST_adapter->startTab(LBL_EMAIL,'email');
	if(!defined('RST_PLUGIN_CRON'))
		echo rst_replace_placeholder('{custom_sess}',rst_custom_sess(),LBL_BUY_PLUGIN_CRON);
?>
<form method="post" action="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=settings&amp;action=update_email_settings" id="emailSettings">
<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td colspan="2"><?php echo LBL_EMAIL.' '.LBL_SETTINGS; ?></td>
	</tr>
	</thead>
	<tbody>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_EMAIL; ?></td>
		<td><input type="text" name="Email_Address" value="<?php echo $T_SETTINGS['Email_Address']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_FULLNAME; ?></td>
		<td><input type="text" name="Email_Address_Fullname" value="<?php echo $T_SETTINGS['Email_Address_Fullname']; ?>" /></td>
	</tr>
	<?php if(defined('RST_PLUGIN_CRON')) { ?>
	<tr>
		<td class="tdGrey"><?php echo LBL_SERVER_ADDRESS; ?></td>
		<td><input type="text" name="Email_Server" value="<?php echo $T_SETTINGS['Email_Server']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_SERVER_PROTOCOL; ?></td>
		<td>
			<select name="Email_Server_Protocol">
				<option <?php echo $T_SETTINGS['Email_Server_Protocol'] == '/pop3' ? 'selected="selected"' : ''; ?> value="/pop3">POP3</option>
				<option <?php echo $T_SETTINGS['Email_Server_Protocol'] == '/imap' ? 'selected="selected"' : ''; ?> value="/imap">IMAP</option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_SERVER_SECURITY; ?></td>
		<td>
			<select name="Email_Server_Security">
				<option <?php echo $T_SETTINGS['Email_Server_Security'] == '' ? 'selected="selected"' : ''; ?> value=""><?php echo LBL_NO; ?></option>
				<option <?php echo $T_SETTINGS['Email_Server_Security'] == '/ssl' ? 'selected="selected"' : ''; ?> value="/ssl"><?php echo LBL_YES; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_SERVER_PORT; ?></td>
		<td><input type="text" name="Email_Server_Port" value="<?php echo $T_SETTINGS['Email_Server_Port']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_USERNAME; ?></td>
		<td><input type="text" name="Email_Address_Account" value="<?php echo $T_SETTINGS['Email_Address_Account']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_PASSWORD; ?></td>
		<td><input type="text" name="Email_Address_Password" value="<?php echo $T_SETTINGS['Email_Address_Password']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_CRON_TYPE; ?></td>
		<td>
			<select name="Email_Cron_Type">
				<option <?php echo $T_SETTINGS['Email_Cron_Type'] == 'cron' ? 'selected="selected"' : ''; ?> value="cron"><?php echo LBL_CRON_TYPE_MANUAL; ?></option>
				<option <?php echo $T_SETTINGS['Email_Cron_Type'] == 'include' ? 'selected="selected"' : ''; ?> value="include"><?php echo LBL_CRON_TYPE_AUTOMATIC; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_CRON_INTERVAL; ?></td>
		<td><input type="text" name="Email_Cron_Interval" value="<?php echo $T_SETTINGS['Email_Cron_Interval']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_ACCEPT_NEW_TICKETS; ?></td>
		<td>
			<select name="Email_Accept_New_Tickets">
				<option <?php echo $T_SETTINGS['Email_Accept_New_Tickets'] == 'yes' ? 'selected="selected"' : ''; ?> value="yes"><?php echo LBL_EVERYONE; ?></option>
				<option <?php echo $T_SETTINGS['Email_Accept_New_Tickets'] == 'users' ? 'selected="selected"' : ''; ?> value="users"><?php echo LBL_REGISTERED; ?></option>
				<option <?php echo $T_SETTINGS['Email_Accept_New_Tickets'] == 'no' ? 'selected="selected"' : ''; ?> value="no"><?php echo LBL_NOBODY; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_ASSIGN_TO_DEPARTMENT; ?></td>
		<td>
			<select name="Email_Default_Department">
				<option <?php echo $T_SETTINGS['Email_Default_Department'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_UNASSIGNED; ?></option>
				<?php
				$departments = rst_get_departments();
				if (count($departments) > 0)
					foreach ($departments as $department)
						echo '<option '.($T_SETTINGS['Email_Default_Department'] == $department['DepartmentId'] ? 'selected="selected"' : '').' value="'.$department['DepartmentId'].'">'.$department['DepartmentName'].'</option>';
				?>
			</select>
		</td>
	</tr>
	<?php } else { ?>
	<tr>
		<td colspan="2">
			<input type="hidden" name="Email_Cron_Type" value="cron"/>
			<input type="hidden" name="Email_Cron_Interval" value="100" />
		</td>
	</tr>
	<?php }	?>
	</tbody>
</table>
<p><button type="submit"><?php echo BTN_UPDATE_SETTINGS; ?></button> <?php if(defined('RST_PLUGIN_CRON')) echo '<button type="button" onclick="location.href=\''.RST_BACKEND_SCRIPT_PATH.'?option=com_rstickets&task=settings&amp;action=test_email_settings\';">'.BTN_TEST_EMAIL_SETTINGS.'</button>'; ?></p>
</form>
<?php
	$RST_adapter->endTab();
	$RST_adapter->startTab(LBL_TICKETS_LISTINGS,'listing');
?>
<form method="post" action="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=settings&amp;action=update_listing_settings" id="listingSettings">
<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td colspan="2"><?php echo LBL_TICKETS_LISTINGS.' '.LBL_SETTINGS; ?></td>
	</tr>
	</thead>
	<tbody>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_STAFF_FRONTEND.' - '.LBL_DATE_TIME; ?></td>
		<td>
			<select name="Backend_TicketTime">
				<option <?php echo $T_SETTINGS['Backend_TicketTime'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Backend_TicketTime'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_STAFF_FRONTEND.' - '.LBL_TICKET_CODE; ?></td>
		<td>
			<select name="Backend_TicketCode">
				<option <?php echo $T_SETTINGS['Backend_TicketCode'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Backend_TicketCode'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_STAFF_FRONTEND.' - '.LBL_SUBJECT; ?></td>
		<td>
			<select name="Backend_TicketSubject">
				<option <?php echo $T_SETTINGS['Backend_TicketSubject'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Backend_TicketSubject'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_STAFF_FRONTEND.' - '.LBL_STAFF; ?></td>
		<td>
			<select name="Backend_StaffFullname">
				<option <?php echo $T_SETTINGS['Backend_StaffFullname'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Backend_StaffFullname'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_STAFF_FRONTEND.' - '.LBL_CUSTOMER; ?></td>
		<td>
			<select name="Backend_CustomerFullname">
				<option <?php echo $T_SETTINGS['Backend_CustomerFullname'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Backend_CustomerFullname'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_STAFF_FRONTEND.' - '.LBL_PRIORITY; ?></td>
		<td>
			<select name="Backend_TicketPriority">
				<option <?php echo $T_SETTINGS['Backend_TicketPriority'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Backend_TicketPriority'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_STAFF_FRONTEND.' - '.LBL_STATUS; ?></td>
		<td>
			<select name="Backend_TicketStatus">
				<option <?php echo $T_SETTINGS['Backend_TicketStatus'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Backend_TicketStatus'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	
	<tr>
		<td class="tdGrey"><?php echo LBL_CUSTOMER_FRONTEND.' - '.LBL_DATE_TIME; ?></td>
		<td>
			<select name="Frontend_TicketTime">
				<option <?php echo $T_SETTINGS['Frontend_TicketTime'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Frontend_TicketTime'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_CUSTOMER_FRONTEND.' - '.LBL_TICKET_CODE; ?></td>
		<td>
			<select name="Frontend_TicketCode">
				<option <?php echo $T_SETTINGS['Frontend_TicketCode'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Frontend_TicketCode'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_CUSTOMER_FRONTEND.' - '.LBL_SUBJECT; ?></td>
		<td>
			<select name="Frontend_TicketSubject">
				<option <?php echo $T_SETTINGS['Frontend_TicketSubject'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Frontend_TicketSubject'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_CUSTOMER_FRONTEND.' - '.LBL_STAFF; ?></td>
		<td>
			<select name="Frontend_StaffFullname">
				<option <?php echo $T_SETTINGS['Frontend_StaffFullname'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Frontend_StaffFullname'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_CUSTOMER_FRONTEND.' - '.LBL_CUSTOMER; ?></td>
		<td>
			<select name="Frontend_CustomerFullname">
				<option <?php echo $T_SETTINGS['Frontend_CustomerFullname'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Frontend_CustomerFullname'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_CUSTOMER_FRONTEND.' - '.LBL_PRIORITY; ?></td>
		<td>
			<select name="Frontend_TicketPriority">
				<option <?php echo $T_SETTINGS['Frontend_TicketPriority'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Frontend_TicketPriority'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_CUSTOMER_FRONTEND.' - '.LBL_STATUS; ?></td>
		<td>
			<select name="Frontend_TicketStatus">
				<option <?php echo $T_SETTINGS['Frontend_TicketStatus'] == 1 ? 'selected="selected"' : ''; ?> value="1"><?php echo LBL_YES; ?></option>
				<option <?php echo $T_SETTINGS['Frontend_TicketStatus'] == 0 ? 'selected="selected"' : ''; ?> value="0"><?php echo LBL_NO; ?></option>
			</select>
		</td>
	</tr>
	</tbody>
</table>
<p><button type="submit"><?php echo BTN_UPDATE_SETTINGS; ?></button></p>
</form>
<?php
	$RST_adapter->endTab();
	/*
	$RST_adapter->startTab(LBL_DATE_SETTINGS,"date");
?>
<form method="post" action="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=settings&amp;action=update_date_settings" id="dateSettings">
<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td colspan="2"><?php echo LBL_DATE_SETTINGS.' '.LBL_SETTINGS; ?></td>
	</tr>
	</thead>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_DATE_SETTINGS; ?></td>
		<td>
			<select name="Date_Format">
				<option <?php echo $T_SETTINGS['Date_Format'] == 'd.m' ? 'selected="selected"' : ''; ?> value="d.m">dd.mm</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'm.d' ? 'selected="selected"' : ''; ?> value="m.d">mm.dd</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'd.m.Y' ? 'selected="selected"' : ''; ?> value="d.m.Y">dd.mm.yyyy</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'm.d.Y' ? 'selected="selected"' : ''; ?> value="m.d.Y">mm.dd.yyyy</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'd/m/Y' ? 'selected="selected"' : ''; ?> value="d/m/Y">dd/mm/yyyy</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'm/d/Y' ? 'selected="selected"' : ''; ?> value="m/d/Y">mm/dd/yyyy</option>
				<option <?php echo $T_SETTINGS['Date_Format'] == 'Y-m-d' ? 'selected="selected"' : ''; ?> value="Y-m-d">yyyy-mm-dd</option>
			</select>
		</td>
	</tr>
	</tbody>
</table>
<p><button type="submit"><?php echo BTN_UPDATE_SETTINGS; ?></button></p>
</form>
<?php
	$RST_adapter->endTab();
	*/
	$RST_adapter->startTab(LBL_AUTOCLOSE_SETTINGS,'autoclose');
?>
<form method="post" action="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=settings&amp;action=update_autoclose_settings" id="autocloseSettings">
<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td colspan="2"><?php echo LBL_AUTOCLOSE_SETTINGS.' '.LBL_SETTINGS; ?></td>
	</tr>
	</thead>
	<tbody>
	<tr>
		<td class="tdGrey td250"><?php echo LBL_AUTOCLOSE_CRON_INTERVAL; ?></td>
		<td><input type="text" name="Autoclose_Cron_Interval" value="<?php echo $T_SETTINGS['Autoclose_Cron_Interval']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_AUTOCLOSE_EMAIL_INTERVAL; ?></td>
		<td><input type="text" name="Autoclose_Email_Interval" value="<?php echo $T_SETTINGS['Autoclose_Email_Interval']; ?>" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_AUTOCLOSE_INTERVAL; ?></td>
		<td><input type="text" name="Autoclose_Interval" value="<?php echo $T_SETTINGS['Autoclose_Interval']; ?>" /></td>
	</tr>
	<tr>
		<td colspan="2"><?php echo LBL_AUTOCLOSE_MESSAGE; ?></td>
	</tr>
	</tbody>
</table>
<p><button type="submit"><?php echo BTN_UPDATE_SETTINGS; ?></button></p>
</form>
<?php
	$RST_adapter->endTab();
	$RST_adapter->startTab(LBL_PLUGINS,'plugins');
	$rst_plugins = rst_get_plugins();
?>
<form method="post" action="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=plugins.upload.process" id="pluginInstallSettings" enctype="multipart/form-data">
<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td><?php echo BTN_INSTALL; ?></td>
	</tr>
	</thead>
	<tbody>
	<tr>
		<td><?php echo LBL_INSTALL_PLUGIN; ?><br />
		<input type="file" name="userfile" size="100" />
		<input type="submit" value="<?php echo BTN_INSTALL; ?>" class="button" style="width:100px;" />
		<input type="hidden" value="rstplugin" name="filetype" />
		</td>
	</tr>
	</tbody>
</table>
</form>

<table cellpadding="4" cellspacing="0" class="tableGrey">
	<thead>
	<tr class="tableHead">
		<td class="tdGrey"><?php echo LBL_ACTIONS; ?></td>
		<td><?php echo LBL_DESCRIPTION; ?></td>
	</tr>
	</thead>
	<tbody>
	<?php foreach ($rst_plugins as $rst_plugin) { ?>
	<tr>
		<td class="tdGrey td250">
		<?php if ($rst_plugin['PluginInstalled'] == 0) { ?><a href="<?php echo $rst_plugin['PluginLink']; ?>" class="addButton" target="_blank"><?php echo BTN_BUY_PLUGIN; ?></a><?php } ?>
		<?php if ($rst_plugin['PluginInstalled'] == 1) { ?><a href="<?php echo RST_BACKEND_SCRIPT_PATH;?>?option=com_rstickets&task=settings&action=plugins.uninstall&pluginId=<?php echo $rst_plugin['PluginId']; ?>" onclick="return confirm('<?php echo LBL_SURE ;?>')" class="deleteButton"><?php echo BTN_DELETE; ?></a><?php } ?>
		</td>
		<td><p><u><?php echo $rst_plugin['PluginName']; ?></u><br />
		<?php echo $rst_plugin['PluginDescription']; ?></p></td>
	</tr>
	<?php } ?>
	</tbody>
</table>
<?php
	$RST_adapter->endTab();
	$RST_adapter->endPane();
?>