Source for file controller.php

Documentation is available at controller.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_templates
  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.  * Templates manager master display controller.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_templates
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * @var        string    The default view.
  22.      * @since   1.6
  23.      */
  24.     protected $default_view = 'styles';
  25.  
  26.     /**
  27.      * Method to display a view.
  28.      *
  29.      * @param   boolean  $cachable   If true, the view output will be cached
  30.      * @param   boolean  $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  31.      *
  32.      * @return  TemplatesController  This object to support chaining.
  33.      *
  34.      * @since   1.5
  35.      */
  36.     public function display($cachable false$urlparams false)
  37.     {
  38.         $view   $this->input->get('view''styles');
  39.         $layout $this->input->get('layout''default');
  40.         $id     $this->input->getInt('id');
  41.  
  42.         $document JFactory::getDocument();
  43.  
  44.         // For JSON requests
  45.         if ($document->getType(== 'json')
  46.         {
  47.             $view new TemplatesViewStyle;
  48.  
  49.             // Get/Create the model
  50.             if ($model new TemplatesModelStyle)
  51.             {
  52.                 $model->addTablePath(JPATH_ADMINISTRATOR '/components/com_templates/tables');
  53.  
  54.                 // Push the model into the view (as default)
  55.                 $view->setModel($modeltrue);
  56.             }
  57.  
  58.             $view->document $document;
  59.  
  60.             return $view->display();
  61.         }
  62.  
  63.         // Check for edit form.
  64.         if ($view == 'style' && $layout == 'edit' && !$this->checkEditId('com_templates.edit.style'$id))
  65.         {
  66.             // Somehow the person just went to the form - we don't allow that.
  67.             $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID'$id));
  68.             $this->setMessage($this->getError()'error');
  69.             $this->setRedirect(JRoute::_('index.php?option=com_templates&view=styles'false));
  70.  
  71.             return false;
  72.         }
  73.  
  74.         return parent::display();
  75.     }
  76. }

Documentation generated on Tue, 19 Nov 2013 14:57:26 +0100 by phpDocumentor 1.4.3