Source for file tracks.php

Documentation is available at tracks.php

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

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