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('Restricted access');
  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''templates');
  36.         $viewFormat   $document->getType();
  37.         $layoutName   $this->input->getWord('layout''default');
  38.  
  39.         // Access back-end com_config
  40.         JLoader::register('TemplatesController'JPATH_ADMINISTRATOR '/components/com_templates/controller.php');
  41.         JLoader::register('TemplatesViewStyle'JPATH_ADMINISTRATOR '/components/com_templates/views/style/view.json.php');
  42.         JLoader::register('TemplatesModelStyle'JPATH_ADMINISTRATOR '/components/com_templates/models/style.php');
  43.  
  44.         $displayClass new TemplatesController;
  45.  
  46.         // Set back-end required params
  47.         $document->setType('json');
  48.         $this->input->set('id'$app->getTemplate('template')->id);
  49.  
  50.         // Execute back-end controller
  51.         $serviceData json_decode($displayClass->display()true);
  52.  
  53.         // Reset params back after requesting from service
  54.         $document->setType('html');
  55.         $this->input->set('view'$viewName);
  56.  
  57.         // Register the layout paths for the view
  58.         $paths new SplPriorityQueue;
  59.         $paths->insert(JPATH_COMPONENT '/view/' $viewName '/tmpl''normal');
  60.  
  61.         $viewClass  'ConfigView' ucfirst($viewNameucfirst($viewFormat);
  62.         $modelClass 'ConfigModel' ucfirst($viewName);
  63.  
  64.         if (class_exists($viewClass))
  65.         {
  66.             if ($viewName != 'close')
  67.             {
  68.                 $model new $modelClass;
  69.  
  70.                 // Access check.
  71.                 if (!JFactory::getUser()->authorise('core.admin'$model->getState('component.option')))
  72.                 {
  73.                     $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR')'error');
  74.  
  75.                     return;
  76.                 }
  77.             }
  78.  
  79.             $view new $viewClass($model$paths);
  80.  
  81.             $view->setLayout($layoutName);
  82.  
  83.             // Push document object into the view.
  84.             $view->document $document;
  85.  
  86.             // Load form and bind data
  87.             $form $model->getForm();
  88.  
  89.             if ($form)
  90.             {
  91.                 $form->bind($serviceData);
  92.             }
  93.  
  94.             // Set form and data to the view
  95.             $view->form &$form;
  96.  
  97.             // Render view.
  98.             echo $view->render();
  99.         }
  100.  
  101.         return true;
  102.     }
  103. }

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