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

defined( '_JEXEC' ) or die( 'Restricted access' ); 
jimport( 'joomla.application.component.view');

class rsfilesViewUsers extends JView
{
	function display($tpl = null)
	{
		global $mainframe;
		$db = JFactory::getDBO();
		
		$sortColumn	= $mainframe->getUserStateFromRequest( "com_rsevents.users.filter_order",		'filter_order',		'a.name',	'cmd' );
		$sortOrder	= $mainframe->getUserStateFromRequest( "com_rsevents.users.filter_order_Dir",	'filter_order_Dir',	'',			'word' );
		$group		= $mainframe->getUserStateFromRequest( "com_rsevents.users.filter_type",		'filter_type', 		0,			'string' );
		$search		= $mainframe->getUserStateFromRequest( "com_rsevents.users.search",			'search', 			'',			'string' );
		$search		= JString::strtolower( $search );
		 
		$db->setQuery("SELECT name AS value, name AS text FROM #__core_acl_aro_groups WHERE name != 'ROOT' AND name != 'USERS'");
		$groups[] = JHTML::_('select.option',  '0', '- '. JText::_( 'Select Group' ) .' -' );
		foreach( $db->loadObjectList() as $obj )
			$groups[] = JHTML::_('select.option',  $obj->value, JText::_( $obj->text ) );

		$lists['groups'] = JHTML::_('select.genericlist',$groups, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $group );
		
		$data			= $this->get('data');
		$pagination		= $this->get('pagination');
		
		
		$this->assignRef('filter',$search);
		$this->assignRef('sortColumn',$sortColumn);
		$this->assignRef('sortOrder',$sortOrder);
		$this->assignRef('data',$data);
		$this->assignRef('pagination',$pagination);
		$this->assignRef('lists',$lists);
		
		parent::display($tpl);
	}
}