Source for file banners.php

Documentation is available at banners.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.  * Banners list controller class.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_banners
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * @var        string    The prefix to use with controller messages.
  22.      * @since   1.6
  23.      */
  24.     protected $text_prefix = 'COM_BANNERS_BANNERS';
  25.  
  26.     /**
  27.      * Constructor.
  28.      *
  29.      * @param   array An optional associative array of configuration settings.
  30.      * @see     JController
  31.      * @since   1.6
  32.      */
  33.     public function __construct($config array())
  34.     {
  35.         parent::__construct($config);
  36.  
  37.         $this->registerTask('sticky_unpublish',    'sticky_publish');
  38.     }
  39.  
  40.     /**
  41.      * Proxy for getModel.
  42.      * @since   1.6
  43.      */
  44.     public function getModel($name 'Banner'$prefix 'BannersModel'$config array('ignore_request' => true))
  45.     {
  46.         $model parent::getModel($name$prefix$config);
  47.         return $model;
  48.     }
  49.  
  50.     /**
  51.      * @since   1.6
  52.      */
  53.     public function sticky_publish()
  54.     {
  55.         // Check for request forgeries.
  56.         JSession::checkToken(or jexit(JText::_('JINVALID_TOKEN'));
  57.  
  58.         $ids    $this->input->get('cid'array()'array');
  59.         $values array('sticky_publish' => 1'sticky_unpublish' => 0);
  60.         $task   $this->getTask();
  61.         $value  JArrayHelper::getValue($values$task0'int');
  62.  
  63.         if (empty($ids))
  64.         {
  65.             JError::raiseWarning(500JText::_('COM_BANNERS_NO_BANNERS_SELECTED'));
  66.         }
  67.         else
  68.         {
  69.             // Get the model.
  70.             $model    $this->getModel();
  71.  
  72.             // Change the state of the records.
  73.             if (!$model->stick($ids$value))
  74.             {
  75.                 JError::raiseWarning(500$model->getError());
  76.             else {
  77.                 if ($value == 1)
  78.                 {
  79.                     $ntext 'COM_BANNERS_N_BANNERS_STUCK';
  80.                 else {
  81.                     $ntext 'COM_BANNERS_N_BANNERS_UNSTUCK';
  82.                 }
  83.                 $this->setMessage(JText::plural($ntextcount($ids)));
  84.             }
  85.         }
  86.  
  87.         $this->setRedirect('index.php?option=com_banners&view=banners');
  88.     }
  89. }

Documentation generated on Tue, 19 Nov 2013 14:54:20 +0100 by phpDocumentor 1.4.3