[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_cpanel
   6   *
   7   * @copyright   (C) 2017 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\Cpanel\Administrator\Controller;
  12  
  13  use Joomla\CMS\MVC\Controller\BaseController;
  14  use Joomla\CMS\Router\Route;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * Cpanel Controller
  22   *
  23   * @since  1.5
  24   */
  25  class DisplayController extends BaseController
  26  {
  27      /**
  28       * The default view.
  29       *
  30       * @var    string
  31       * @since  1.6
  32       */
  33      protected $default_view = 'cpanel';
  34  
  35      /**
  36       * Typical view method for MVC based architecture
  37       *
  38       * This function is provide as a default implementation, in most cases
  39       * you will need to override it in your own controllers.
  40       *
  41       * @param   boolean  $cachable   If true, the view output will be cached
  42       * @param   array    $urlparams  An array of safe url parameters and their variable types, for valid values see {@link \JFilterInput::clean()}.
  43       *
  44       * @return  static  An instance of the current object to support chaining.
  45       *
  46       * @since   3.0
  47       */
  48      public function display($cachable = false, $urlparams = array())
  49      {
  50          /*
  51           * Set the template - this will display cpanel.php
  52           * from the selected admin template.
  53           */
  54          $this->input->set('tmpl', 'cpanel');
  55  
  56          return parent::display($cachable, $urlparams);
  57      }
  58  
  59      /**
  60       * Method to add a module to a dashboard
  61       *
  62       * @since   4.0.0
  63       *
  64       * @return  void
  65       */
  66      public function addModule()
  67      {
  68          $position = $this->input->get('position', 'cpanel');
  69          $function = $this->input->get('function');
  70  
  71          $appendLink = '';
  72  
  73          if ($function) {
  74              $appendLink .= '&function=' . $function;
  75          }
  76  
  77          if (substr($position, 0, 6) != 'cpanel') {
  78              $position = 'cpanel';
  79          }
  80  
  81          $this->app->setUserState('com_modules.modules.filter.position', $position);
  82          $this->app->setUserState('com_modules.modules.client_id', '1');
  83  
  84          $this->setRedirect(Route::_('index.php?option=com_modules&view=select&tmpl=component&layout=modal' . $appendLink, false));
  85      }
  86  }


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