<?php
/**
 * @package		Joomla.Administrator
 * @subpackage	com_spstgsrv
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License, see LICENSE.php
 */

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

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

/**
 * SPStgSrv Controller
 *
 * @package		Joomla.Administrator
 * @subpackage	com_spstgsrv
 * @since		1.5
 */
class SPStgSrvController extends JControllerLegacy
{
	public function display($cachable = false, $urlparams = false)
	{
		require_once JPATH_COMPONENT.'/helpers/spstgsrv.php';

		// Get the document object.
		$document = JFactory::getDocument();

		// Set the default view name and format from the Request.
		$vName		= JRequest::getCmd('view', 'log');
		$vFormat	= $document->getType();
		$lName		= JRequest::getCmd('layout', 'default');
                
                if ($vName != 'log')
                    return parent::display();

		// Get and render the view.
		if ($view = $this->getView($vName, $vFormat)) {
			
			// Get the model for the view.
			$model = $this->getModel($vName);

			// Push the model into the view (as default).
			$view->setModel($model, true);
			$view->setLayout($lName);

			// Push document object into the view.
			$view->assignRef('document', $document);
			// Load the submenu.
			SPStgSrvHelper::addSubmenu($vName);
            
			$view->display();
		}

		return $this;
	}
}
