[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_categories/controllers/ -> categories.php (source)

   1  <?php
   2  /**
   3   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   4   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   5   */
   6  
   7  defined('_JEXEC') or die;
   8  
   9  jimport('joomla.application.component.controlleradmin');
  10  
  11  /**
  12   * The Categories List Controller
  13   *
  14   * @package        Joomla.Administrator
  15   * @subpackage    com_categories
  16   * @since        1.6
  17   */
  18  class CategoriesControllerCategories extends JControllerAdmin
  19  {
  20      /**
  21       * Proxy for getModel
  22       *
  23       * @param    string    $name    The model name. Optional.
  24       * @param    string    $prefix    The class prefix. Optional.
  25       *
  26       * @return    object    The model.
  27       * @since    1.6
  28       */
  29  	function getModel($name = 'Category', $prefix = 'CategoriesModel', $config = array('ignore_request' => true))
  30      {
  31          $model = parent::getModel($name, $prefix, $config);
  32          return $model;
  33      }
  34  
  35      /**
  36       * Rebuild the nested set tree.
  37       *
  38       * @return    bool    False on failure or error, true on success.
  39       * @since    1.6
  40       */
  41  	public function rebuild()
  42      {
  43          JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
  44  
  45          $extension = JRequest::getCmd('extension');
  46          $this->setRedirect(JRoute::_('index.php?option=com_categories&view=categories&extension='.$extension, false));
  47  
  48          // Initialise variables.
  49          $model = $this->getModel();
  50  
  51          if ($model->rebuild()) {
  52              // Rebuild succeeded.
  53              $this->setMessage(JText::_('COM_CATEGORIES_REBUILD_SUCCESS'));
  54              return true;
  55          } else {
  56              // Rebuild failed.
  57              $this->setMessage(JText::_('COM_CATEGORIES_REBUILD_FAILURE'));
  58              return false;
  59          }
  60      }
  61  
  62      /**
  63       * Save the manual order inputs from the categories list page.
  64       *
  65       * @return    void
  66       * @since    1.6
  67       */
  68  	public function saveorder()
  69      {
  70          JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
  71  
  72          // Get the arrays from the Request
  73          $order    = JRequest::getVar('order',    null, 'post', 'array');
  74          $originalOrder = explode(',', JRequest::getString('original_order_values'));
  75  
  76          // Make sure something has changed
  77          if (!($order === $originalOrder)) {
  78              parent::saveorder();
  79          } else {
  80              // Nothing to reorder
  81              $this->setRedirect(JRoute::_('index.php?option='.$this->option.'&view='.$this->view_list, false));
  82              return true;
  83          }
  84      }
  85  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1