Source for file display.php

Documentation is available at display.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_config
  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;
  11.  
  12. /**
  13.  * Display Controller for global configuration
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_config
  17.  * @since       3.2
  18. */
  19. {
  20.     /**
  21.      * Method to display global configuration.
  22.      *
  23.      * @return  boolean    True on success, false on failure.
  24.      *
  25.      * @since   3.2
  26.      */
  27.     public function execute()
  28.     {
  29.         // Get the application
  30.         $app = $this->getApplication();
  31.  
  32.         // Get the document object.
  33.         $document     = JFactory::getDocument();
  34.  
  35.         $viewName     = $this->input->getWord('view', 'config');
  36.         $viewFormat   = $document->getType();
  37.         $layoutName   = $this->input->getWord('layout', 'default');
  38.  
  39.         // Access back-end com_config
  40.         JLoader::registerPrefix(ucfirst($viewName), JPATH_ADMINISTRATOR . '/components/com_config');
  41.         $displayClass = new ConfigControllerApplicationDisplay;
  42.  
  43.         // Set back-end required params
  44.         $document->setType('json');
  45.         $app->input->set('view', 'application');
  46.  
  47.         // Execute back-end controller
  48.         $serviceData = json_decode($displayClass->execute(), true);
  49.  
  50.         // Reset params back after requesting from service
  51.         $document->setType('html');
  52.         $app->input->set('view', $viewName);
  53.  
  54.         // Register the layout paths for the view
  55.         $paths = new SplPriorityQueue;
  56.         $paths->insert(JPATH_COMPONENT . '/view/' . $viewName . '/tmpl', 'normal');
  57.  
  58.         $viewClass  = 'ConfigView' . ucfirst($viewName) . ucfirst($viewFormat);
  59.         $modelClass = 'ConfigModel' . ucfirst($viewName);
  60.  
  61.         if (class_exists($viewClass))
  62.         {
  63.             if ($viewName != 'close')
  64.             {
  65.                 $model = new $modelClass;
  66.  
  67.                 // Access check.
  68.                 if (!JFactory::getUser()->authorise('core.admin', $model->getState('component.option')))
  69.                 {
  70.                     return;
  71.                 }
  72.             }
  73.  
  74.             $view = new $viewClass($model, $paths);
  75.  
  76.             $view->setLayout($layoutName);
  77.  
  78.             // Push document object into the view.
  79.             $view->document = $document;
  80.  
  81.             // Load form and bind data
  82.             $form = $model->getForm();
  83.  
  84.             if ($form)
  85.             {
  86.                 $form->bind($serviceData);
  87.             }
  88.  
  89.             // Set form and data to the view
  90.             $view->form = &$form;
  91.             $view->data = &$serviceData;
  92.  
  93.             // Render view.
  94.             echo $view->render();
  95.         }
  96.  
  97.         return true;
  98.     }
  99. }

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