<?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 rsfilesControllerStatistics extends rsfilesController
{
	/**
	 * constructor (registers additional tasks to methods)
	 * @return void
	 */
	function __construct()
	{
		parent::__construct();

		// Register Extra tasks
		$this->registerTask('apply' ,  'save');
		$this->registerTask( 'unpublish' , 'publish');
	}

	/**
	 * remove record(s)
	 * @return void
	 */
	function remove()
	{
		$db = JFactory::getDBO();
		$model = $this->getModel('statistics');
		$post = JRequest::get('post');
		
		$db->setQuery("DELETE FROM #__rsfiles_statistics WHERE IdFile = ".$post['IdFile']);
		$db->query();
		
		$this->setRedirect( 'index.php?option=com_rsfiles&task=viewstatistic&cid='.$post['IdFile'], JText::_('RSFL_LOG_EMPTY') ); 
	}

	/**
	 * cancel editing a record
	 * @return void
	 */
	function cancel()
	{
		$msg = JText::_('RSFL_CANCEL' );
		$this->setRedirect( 'index.php?option=com_rsfiles&task=statistics', $msg );
	}
}