<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
//require_once(JPATH_BASE.DS.'components'.DS.'com_kiodict'.DS.'helpers'.DS.'dictionary.php');
jimport( 'joomla.application.component.controller' );

define('MODEL_NAME', 'Settings');


class KipControllerSettings extends JController
{
	function __construct( $default = array()){
		parent::__construct( $default );

		$this->registerTask( 'apply', 		'save');
	}

	function save()
	{
		global $option;
		JRequest::checkToken() or jexit( 'Invalid Token' );

		$model	=& $this->getModel(MODEL_NAME);

		if ($model->store()) {
			$msg = JText::_( 'Configuration Saved' );
			$cache = & JFactory::getCache($option);
			$cache->clean();
		} else {
			$msg = $item->getError();
		}


		switch ( $this->_task ) {
			case 'apply':
				$this->setRedirect( 'index.php?option='.$option.'&view='.$model->getName() , $msg );
				break;

			case 'save':
			default:
				$this->setRedirect( 'index.php?option='.$option, $msg );
				break;
		}
	}


	
	
}