<?php
/**
 * @version		3.0.0
 * @package		JomLand TicketCenter
 * @copyright	Copyright (C) 2010 JomLand.com. All rights reserved.
 * @link 		www.jomland.com
 * @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */

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

class JLTicketCenterControllerSetup extends JLTicketCenterController
{
	function __construct()
	{
		parent::__construct();

		$this->registerTask('add', 'edit' );
	}


	function display($cachable = false, $urlparams = array())
	{
		JRequest::setVar( 'view', 'setup' );

		parent::display();
	}


	function save()
	{
		JSession::checkToken('request') or die( 'Invalid Token' );


		$model = $this->getModel('setup');

		$post	= JRequest::get('post');
		$post['order_sign'] 	  = JRequest::getVar('order_sign', '', 'post', 'string', JREQUEST_ALLOWRAW);
		$post['ticket_remarks']   = JRequest::getVar('ticket_remarks', '', 'post', 'string', JREQUEST_ALLOWRAW);
		$post['ticket_site_desc'] = JRequest::getVar('ticket_site_desc', '', 'post', 'string', JREQUEST_ALLOWRAW);

		if ($model->store($post)) {
			$msg = JText::_('Setup Saved!');
		} else {
			$msg = JText::_('Error Saving Setup' );
		}

		$task	= JRequest::getCmd('task');

		$id	= JRequest::getVar( 'id', 0, 'post');

		switch ($task)
		{
			case 'apply':
				$link = 'index.php?option=com_jlticketcenter&controller='.JRequest::getWord('controller').'&task=edit&cid[]='.$id;
				break;

			case 'save':
			default:


				break;
		}

		$link = 'index.php?option=com_jlticketcenter&controller=setup';

		$this->setRedirect($link, $msg);
	}//EOF save


}