Source for file display.php

Documentation is available at display.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  Joomla.Libraries
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die('Restricted access');
  11.  
  12. /**
  13.  * Base Display Controller
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_config
  17.  * @since       3.2
  18. */
  19. {
  20.     /**
  21.      * Application object - Redeclared for proper typehinting
  22.      *
  23.      * @var    JApplicationCms 
  24.      * @since  3.2
  25.      */
  26.     protected $app;
  27.  
  28.     /**
  29.      * Prefix for the view and model classes
  30.      *
  31.      * @var    string 
  32.      * @since  3.2
  33.      */
  34.     public $prefix = 'Config';
  35.  
  36.     /**
  37.      * Execute the controller.
  38.      *
  39.      * @return  mixed  A rendered view or true
  40.      *
  41.      * @since   3.2
  42.      */
  43.     public function execute()
  44.     {
  45.         // Get the document object.
  46.         $document JFactory::getDocument();
  47.  
  48.         $componentFolder $this->input->getWord('option''com_config');
  49.  
  50.         if ($this->app->isAdmin())
  51.         {
  52.             $viewName $this->input->getWord('view''application');
  53.         }
  54.         else
  55.         {
  56.             $viewName $this->input->getWord('view''config');
  57.         }
  58.  
  59.         $viewFormat $document->getType();
  60.         $layoutName $this->input->getWord('layout''default');
  61.  
  62.         // Register the layout paths for the view
  63.         $paths new SplPriorityQueue;
  64.  
  65.         if ($this->app->isAdmin())
  66.         {
  67.             $paths->insert(JPATH_ADMINISTRATOR '/components/' $componentFolder '/view/' $viewName '/tmpl'1);
  68.         }
  69.         else
  70.         {
  71.             $paths->insert(JPATH_BASE '/components/' $componentFolder '/view/' $viewName '/tmpl'1);
  72.         }
  73.  
  74.         $viewClass  $this->prefix . 'View' ucfirst($viewNameucfirst($viewFormat);
  75.         $modelClass $this->prefix . 'Model' ucfirst($viewName);
  76.  
  77.         if (class_exists($viewClass))
  78.         {
  79.             $model new $modelClass;
  80.  
  81.             // Access check.
  82.             if (!JFactory::getUser()->authorise('core.admin'$model->getState('component.option')))
  83.             {
  84.                 $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')'error');
  85.  
  86.                 return;
  87.             }
  88.  
  89.             $view new $viewClass($model$paths);
  90.  
  91.             $view->setLayout($layoutName);
  92.  
  93.             // Push document object into the view.
  94.             $view->document $document;
  95.  
  96.             // Reply for service requests
  97.             if ($viewFormat == 'json')
  98.             {
  99.                 return $view->render();
  100.             }
  101.  
  102.             // Render view.
  103.             echo $view->render();
  104.         }
  105.  
  106.         return true;
  107.     }
  108. }

Documentation generated on Tue, 19 Nov 2013 15:01:35 +0100 by phpDocumentor 1.4.3