Source for file controller.php

Documentation is available at controller.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_categories
  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.  * Categories view class for the Category package.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_categories
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * @var    string  The extension for which the categories apply.
  22.      * @since  1.6
  23.      */
  24.     protected $extension;
  25.  
  26.     /**
  27.      * Constructor.
  28.      *
  29.      * @param   array  $config  An optional associative array of configuration settings.
  30.      *
  31.      * @see     JController
  32.      * @since   1.6
  33.      */
  34.     public function __construct($config array())
  35.     {
  36.         parent::__construct($config);
  37.  
  38.         // Guess the JText message prefix. Defaults to the option.
  39.         if (empty($this->extension))
  40.         {
  41.             $this->extension = $this->input->get('extension''com_content');
  42.         }
  43.     }
  44.  
  45.     /**
  46.      * Method to display a view.
  47.      *
  48.      * @param   boolean      $cachable   If true, the view output will be cached
  49.      * @param   array        $urlparams  An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  50.      *
  51.      * @return  JController  This object to support chaining.
  52.      *
  53.      * @since   1.5
  54.      */
  55.     public function display($cachable false$urlparams false)
  56.     {
  57.         // Get the document object.
  58.         $document JFactory::getDocument();
  59.  
  60.         // Set the default view name and format from the Request.
  61.         $vName   $this->input->get('view''categories');
  62.         $vFormat $document->getType();
  63.         $lName   $this->input->get('layout''default');
  64.         $id      $this->input->getInt('id');
  65.  
  66.         // Check for edit form.
  67.         if ($vName == 'category' && $lName == 'edit' && !$this->checkEditId('com_categories.edit.category'$id))
  68.         {
  69.             // Somehow the person just went to the form - we don't allow that.
  70.             $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID'$id));
  71.             $this->setMessage($this->getError()'error');
  72.             $this->setRedirect(JRoute::_('index.php?option=com_categories&view=categories&extension=' $this->extensionfalse));
  73.  
  74.             return false;
  75.         }
  76.  
  77.         // Get and render the view.
  78.         if ($view $this->getView($vName$vFormat))
  79.         {
  80.             // Get the model for the view.
  81.             $model $this->getModel($vName'CategoriesModel'array('name' => $vName '.' substr($this->extension4)));
  82.  
  83.             // Push the model into the view (as default).
  84.             $view->setModel($modeltrue);
  85.             $view->setLayout($lName);
  86.  
  87.             // Push document object into the view.
  88.             $view->document $document;
  89.  
  90.             // Load the submenu.
  91.             require_once JPATH_COMPONENT '/helpers/categories.php';
  92.  
  93.             CategoriesHelper::addSubmenu($model->getState('filter.extension'));
  94.             $view->display();
  95.         }
  96.  
  97.         return $this;
  98.     }
  99. }

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