PageRenderTime 62ms CodeModel.GetById 28ms app.highlight 2ms RepoModel.GetById 22ms app.codeStats 0ms

/administrator/components/com_config/controller.php

https://bitbucket.org/eternaware/joomus
PHP | 69 lines | 25 code | 10 blank | 34 comment | 4 complexity | e47c6fd5f5ad92c264cb95c03f1ee38f MD5 | raw file
Possible License(s): LGPL-2.1
 1<?php
 2/**
 3 * @package     Joomla.Administrator
 4 * @subpackage  com_config
 5 *
 6 * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 7 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 8 */
 9
10defined('_JEXEC') or die;
11
12/**
13 * Config Component Controller
14 *
15 * @package     Joomla.Administrator
16 * @subpackage  com_config
17 * @since       1.5
18 */
19class ConfigController extends JControllerLegacy
20{
21	/**
22	 * @var		string	The default view.
23	 * @since	1.6
24	 */
25	protected $default_view = 'application';
26
27	/**
28	 * Method to display the view.
29	 *
30	 * @param	boolean			If true, the view output will be cached
31	 * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
32	 *
33	 * @return	JController		This object to support chaining.
34	 * @since	1.5
35	 */
36	public function display($cachable = false, $urlparams = false)
37	{
38		// Get the document object.
39		$document	= JFactory::getDocument();
40
41		// Set the default view name and format from the Request.
42		$vName   = $this->input->get('view', 'application');
43		$vFormat = $document->getType();
44		$lName   = $this->input->get('layout', 'default');
45
46		// Get and render the view.
47		if ($view = $this->getView($vName, $vFormat)) {
48			if ($vName != 'close') {
49				// Get the model for the view.
50				$model = $this->getModel($vName);
51
52				// Access check.
53				if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option'))) {
54					return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
55				}
56
57				// Push the model into the view (as default).
58				$view->setModel($model, true);
59			}
60
61			$view->setLayout($lName);
62
63			// Push document object into the view.
64			$view->document = $document;
65
66			$view->display();
67		}
68	}
69}