<?php
/**
 * @version		$Id: samples.php 132 2009-06-23 07:25:22Z eddieajau $
 * @copyright	Copyright (C) 2009 New Life in IT Pty Ltd. All rights reserved.
 * @license		GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
 * @link		http://www.theartofjoomla.com
 */

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

jimport('joomla.application.component.controller');

/**
 * The Setup Controller
 *
 * @package		TAOJ.Quanta
 * @subpackage	com_quanta
 */
class QuantaControllerSamples extends JController
{
	/**
	 * Method to manually install the component.
	 *
	 * @return	void
	 */
	public function add()
	{
		// Get the setup model.
		$model = &$this->getModel('Samples');

		// Attempt to install the sample data.
		if (!$model->add()) {
			$this->setMessage(JText::sprintf('TAOJ_Sample_Add_failed', $model->getError()), 'notice');
		}
		else {
			$this->setMessage(JText::_('TAOJ_Sample_add_success'));
		}

		// Set the redirect.
		$this->setRedirect('index.php?option=com_quanta&view=charts');
	}

	/**
	 * Method to manually install the component.
	 *
	 * @return	void
	 */
	public function remove()
	{
		// Get the setup model.
		$model = &$this->getModel('Samples');

		// Attempt to install the sample data.
		if (!$model->remove()) {
			$this->setMessage(JText::sprintf('TAOJ_Sample_Remove_failed', $model->getError()), 'notice');
		}
		else {
			$this->setMessage(JText::_('TAOJ_Sample_remove_success'));
		}

		// Set the redirect.
		$this->setRedirect('index.php?option=com_quanta&view=charts');
	}
}