[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_banners/controllers/ -> tracks.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  // No direct access.
   8  defined('_JEXEC') or die;
   9  
  10  jimport('joomla.application.component.controller');
  11  
  12  /**
  13   * Tracks list controller class.
  14   *
  15   * @package        Joomla.Administrator
  16   * @subpackage    com_banners
  17   * @since        1.6
  18   */
  19  class BannersControllerTracks extends JController
  20  {
  21      /**
  22       * @var        string    The context for persistent state.
  23       * @since    1.6
  24       */
  25      protected $context = 'com_banners.tracks';
  26  
  27      /**
  28       * Method to get a model object, loading it if required.
  29       *
  30       * @param   string  $name    The model name. Optional.
  31       * @param   string  $prefix  The class prefix. Optional.
  32       * @param   array   $config  Configuration array for model. Optional.
  33       *
  34       * @return  object  The model.
  35       *
  36       * @since   1.6
  37       */
  38  	public function getModel($name = 'Tracks', $prefix = 'BannersModel', $config = array('ignore_request' => true))
  39      {
  40          $model = parent::getModel($name, $prefix, $config);
  41          return $model;
  42      }
  43  
  44      /**
  45       * Method to remove a record.
  46       *
  47       * @return    void
  48       * @since    1.6
  49       */
  50  	public function delete()
  51      {
  52          // Check for request forgeries.
  53          JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
  54  
  55          // Get the model.
  56          $model = $this->getModel();
  57  
  58          // Load the filter state.
  59          $app = JFactory::getApplication();
  60  
  61          $type = $app->getUserState($this->context.'.filter.type');
  62          $model->setState('filter.type', $type);
  63  
  64          $begin = $app->getUserState($this->context.'.filter.begin');
  65          $model->setState('filter.begin', $begin);
  66  
  67          $end = $app->getUserState($this->context.'.filter.end');
  68          $model->setState('filter.end', $end);
  69  
  70          $categoryId = $app->getUserState($this->context.'.filter.category_id');
  71          $model->setState('filter.category_id', $categoryId);
  72  
  73          $clientId = $app->getUserState($this->context.'.filter.client_id');
  74          $model->setState('filter.client_id', $clientId);
  75  
  76          $model->setState('list.limit', 0);
  77          $model->setState('list.start', 0);
  78  
  79          $count = $model->getTotal();
  80          // Remove the items.
  81          if (!$model->delete()) {
  82              JError::raiseWarning(500, $model->getError());
  83          } else {
  84              $this->setMessage(JText::plural('COM_BANNERS_TRACKS_N_ITEMS_DELETED', $count));
  85          }
  86  
  87          $this->setRedirect('index.php?option=com_banners&view=tracks');
  88      }
  89  }


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