<?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');

if (!rst_is_staff_logged()) rst_redirect('index.php?option=com_rstickets');

if (isset($_GET['id']))
{
	$getsearch = rst_get_search($_GET['id']);
	if (count($getsearch) == 0) unset($getsearch);
}

if ($_GET['page'] == 'save_search_my_tickets') { $search = 'save_search_my_tickets'; $redirect = isset($getsearch) ? 'my_searches' : 'my_tickets'; }
if ($_GET['page'] == 'save_search_tickets')	{ $search = 'save_search_tickets'; $redirect = isset($getsearch) ? 'searches' : 'tickets'; }

?>
<h4 class="rst_h4"><?php echo LBL_PREDEFINED_SEARCHES; ?></h4>
<a href="<?php echo JRoute::_('index.php?option=com_rstickets&page='.$redirect); ?>" class="backButton"><?php echo BTN_BACK; ?></a>
<form method="post" action="<?php echo JRoute::_('index.php?option=com_rstickets&page='.$redirect.(isset($getsearch) ? '&id='.$getsearch['SearchId'] : '').'&action='.$search); ?>" onsubmit="return validate_save_search(this)">
<table cellspacing="0" cellpadding="4" class="tableGrey wide">
<thead>
<tr class="tableHead">
	<td colspan="2"><?php echo LBL_PREDEFINED_SEARCHES; ?></td>
</tr>
</thead>
<tbody>
	<tr>
		<td class="tdGrey"><?php echo LBL_SEARCH_NAME; ?></td>
		<td><input type="text" value="<?php echo isset($getsearch['SearchName']) ? $getsearch['SearchName'] : '' ?>" name="SearchName" /></td>
	</tr>
	<tr>
		<td class="tdGrey"><?php echo LBL_PREDEFINED_DEFAULT_SEARCH;?></td>
		<td><select name="SearchDefault">
		<option <?php echo isset($getsearch['SearchDefault']) && $getsearch['SearchDefault'] == 0 ? 'selected="selected"' : '' ?> value="0"><?php echo LBL_NO; ?></option>
		<option <?php echo isset($getsearch['SearchDefault']) && $getsearch['SearchDefault'] == 1 ? 'selected="selected"' : '' ?> value="1"><?php echo LBL_YES; ?></option>
		</select></td>
	</tr>
</tbody>
</table>
<button type="submit"><?php echo BTN_SAVE_SEARCH; ?></button>
</form>