[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_banners/src/Controller/ -> DisplayController.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_banners
   6   *
   7   * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Banners\Administrator\Controller;
  12  
  13  use Joomla\CMS\Language\Text;
  14  use Joomla\CMS\MVC\Controller\BaseController;
  15  use Joomla\CMS\Router\Route;
  16  use Joomla\Component\Banners\Administrator\Helper\BannersHelper;
  17  
  18  // phpcs:disable PSR1.Files.SideEffects
  19  \defined('_JEXEC') or die;
  20  // phpcs:enable PSR1.Files.SideEffects
  21  
  22  /**
  23   * Banners master display controller.
  24   *
  25   * @since  1.6
  26   */
  27  class DisplayController extends BaseController
  28  {
  29      /**
  30       * The default view.
  31       *
  32       * @var    string
  33       * @since  1.6
  34       */
  35      protected $default_view = 'banners';
  36  
  37      /**
  38       * Method to display a view.
  39       *
  40       * @param   boolean  $cachable   If true, the view output will be cached
  41       * @param   array    $urlparams  An array of safe URL parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
  42       *
  43       * @return  BaseController|boolean  This object to support chaining.
  44       *
  45       * @since   1.5
  46       */
  47      public function display($cachable = false, $urlparams = array())
  48      {
  49          BannersHelper::updateReset();
  50  
  51          $view   = $this->input->get('view', 'banners');
  52          $layout = $this->input->get('layout', 'default');
  53          $id     = $this->input->getInt('id');
  54  
  55          // Check for edit form.
  56          if ($view == 'banner' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.banner', $id)) {
  57              // Somehow the person just went to the form - we don't allow that.
  58              if (!\count($this->app->getMessageQueue())) {
  59                  $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error');
  60              }
  61  
  62              $this->setRedirect(Route::_('index.php?option=com_banners&view=banners', false));
  63  
  64              return false;
  65          } elseif ($view == 'client' && $layout == 'edit' && !$this->checkEditId('com_banners.edit.client', $id)) {
  66              // Somehow the person just went to the form - we don't allow that.
  67              if (!\count($this->app->getMessageQueue())) {
  68                  $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error');
  69              }
  70  
  71              $this->setRedirect(Route::_('index.php?option=com_banners&view=clients', false));
  72  
  73              return false;
  74          }
  75  
  76          return parent::display();
  77      }
  78  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer