<?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 rsfilesViewReports extends JView
{
	function display($tpl = null)
	{
		global $mainframe;
	
		JSubMenuHelper::addEntry(JText::_('RSFL_FILES_MENU'), 'index.php?option=com_rsfiles&task=files'); 
		JSubMenuHelper::addEntry(JText::_('RSFL_LICENSE_MENU'), 'index.php?option=com_rsfiles&task=licenses'); 
		JSubMenuHelper::addEntry(JText::_('RSFL_GROUPS_MENU'), 'index.php?option=com_rsfiles&task=groups'); 
		JSubMenuHelper::addEntry(JText::_('RSFL_STATISTICS_MENU'), 'index.php?option=com_rsfiles&task=statistics');
		JSubMenuHelper::addEntry(JText::_('RSFL_THEMES_MENU'), 'index.php?option=com_rsfiles&task=themes');
		JSubMenuHelper::addEntry(JText::_('RSFL_SETTINGS_MENU'), 'index.php?option=com_rsfiles&task=settings'); 
		JSubMenuHelper::addEntry(JText::_('RSFL_UPDATES_MENU'), 'index.php?option=com_rsfiles&task=updates'); 		
	
		$rsfilesConfig = rsfilesHelper::getConfig();
		$this->assignRef('rsfilesConfig',$rsfilesConfig);
		$task=JRequest::getVar('task','','request');
		switch($task)
		{
			
			case 'reports':
			{
				JToolBarHelper::title(JText::_('RSFL_REPORTS'),'rsfl-reports');
				JToolBarHelper::deleteList();
				JToolBarHelper::custom('rsfiles','rsfiles-32','rsfiles-32',JText::_('RSFL_PRODUCT'),false);
				
				$cid = JRequest::getVar('id');
				if(empty($cid)) $mainframe->redirect('index.php?option=com_rsfiles&task=files');
				
				$data = $this->get('Data');
				$pagination=$this->get('pagination');
				
				$this->assignRef('data',$data);
				$this->assignRef('pagination',$pagination);
				
			} break;
			
			case 'viewreport':
			{
				$cid = JRequest::getInt('cid');
				if(empty($cid)) $mainframe->redirect('index.php?option=com_rsfiles&task=files');
				JToolBarHelper::title(JText::_('RSFL_REPORT','generic.png'));
				JToolBarHelper::cancel();
				
				$data = $this->get('Report');				
				$this->assignRef('data',$data);
			
			} break;
		}
		
		
		parent::display($tpl);
	}
}