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

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


class rsfilesControllerReports extends rsfilesController
{
	/**
	 * constructor (registers additional tasks to methods)
	 * @return void
	 */
	function __construct()
	{
		parent::__construct();
	}
	
	/**
	 * remove record(s)
	 * @return void
	 */
	function remove()
	{
		$db = JFactory::getDBO();
		$cids=JRequest::getVar('cid',array(0),'post','array');
		$id = JRequest::getVar('id');
		
		if(!empty($cids))
		{
			$db->setQuery("DELETE FROM #__rsfiles_reports WHERE IdReport IN(".implode(',',$cids).") ");
			$db->query();
		}
		
		$this->setRedirect('index.php?option=com_rsfiles&task=reports&id='.$id); 
	}

	/**
	 * cancel editing a record
	 * @return void
	 */
	function cancel()
	{
		$db = JFactory::getDBO();
		$post = JRequest::get('post');
		
		$db->setQuery("SELECT FilePath FROM #__rsfiles_files WHERE IdFile = ".$post['IdFile']);
		$id = $db->loadResult();
		
		$this->setRedirect( 'index.php?option=com_rsfiles&task=reports&id='.$id );
	}
	
}