<?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
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

$params = & $params;

$db				= JFactory::getDBO();
$layout 		= $params->get('chooselayout',0);
$class_suffix	= $params->get('moduleclass_sfx');
$class_suffix	= (empty($class_suffix)) ? '' : '_'.$class_suffix;
$itid			= $params->get('itemid','');
$categ			= $params->get('categs','0');
$loc			= $params->get('locs','0');
$startd			= $params->get('startd','0');
$endd			= $params->get('endd','0');


$Itemid = JRequest::getVar('Itemid','','request');
if(!empty($Itemid))
{
	if($itid == '' || empty($itid)) $itemId =  '&Itemid='.$Itemid;
		else $itemId = '&Itemid='.$itid;
} else $itemId='';


//get categories
$db->setQuery("SELECT IdCategory, CategoryName  FROM #__rsevents_categories");
$categories      = JHTML::_('select.genericlist', $db->loadObjectList(), 'IdCategory[]', 'size="3" multiple="multiple" style="width:75%"','IdCategory', 'CategoryName');

//get locations
$db->setQuery("SELECT IdLocation, LocationName  FROM #__rsevents_locations");
$locations      = JHTML::_('select.genericlist', $db->loadObjectList(), 'IdLocation[]', 'size="3" multiple="multiple" style="width:75%"','IdLocation', 'LocationName');


?>
<div class="event_search<?php echo $class_suffix; ?>">
<form action="<?php echo JRoute::_('index.php?option=com_rsevents&view=events&layout=search'.$itemId,false); ?>" method="post" >

<?php if($categ == 1) { ?>
<label for="IdCategory"><?php echo JText::_('RSE_SEARCH_MODULE_CATEGORIES'); ?></label>
<br/>
<?php echo $categories.'<br/>'; } ?>

<?php if($loc == 1) { ?>
<label for="IdLocation"><?php echo JText::_('RSE_SEARCH_MODULE_LOCATIONS'); ?></label>
<br/>
<?php echo $locations.'<br/>'; } ?>

<?php if($startd == 1) { ?>
<label for="rseStartDate"><?php echo JText::_('RSE_SEARCH_MODULE_STARTDATE'); ?></label>
<br/>
<?php echo JHTML::_('calendar', date('Y-m-d'), "rseStartDate", "rseStartDate","%Y-%m-%d",'readonly="readonly"') . '<br/>'; } ?>

<?php if($endd == 1) { ?>
<label for="IdLocation"><?php echo JText::_('RSE_SEARCH_MODULE_ENDDATE'); ?></label>
<br/>
<?php echo JHTML::_('calendar', date('Y-m-d'), "rseEndDate", "rseEndDate","%Y-%m-%d",'readonly="readonly"') . '<br/>'; } ?>
<label for="rse_keyword"><?php echo JText::_('RSE_SEARCH_MODULE_KEYWORDS'); ?></label> 
<br/>
<input type="text" id="rse_keyword" name="rse_keyword" value="" style="width:90%" />
<br/><br/>
<button class="button" type="submit"><?php echo JText::_('RSE_SEARCH_MODULE_SEARCH_BUTTON'); ?></button>
</form>
</div>