[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_config/src/View/Application/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_config
   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\Config\Administrator\View\Application;
  12  
  13  use Joomla\CMS\Component\ComponentHelper;
  14  use Joomla\CMS\Factory;
  15  use Joomla\CMS\Language\Text;
  16  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  17  use Joomla\CMS\Toolbar\ToolbarHelper;
  18  use Joomla\Component\Config\Administrator\Helper\ConfigHelper;
  19  
  20  // phpcs:disable PSR1.Files.SideEffects
  21  \defined('_JEXEC') or die;
  22  // phpcs:enable PSR1.Files.SideEffects
  23  
  24  /**
  25   * View for the global configuration
  26   *
  27   * @since  3.2
  28   */
  29  class HtmlView extends BaseHtmlView
  30  {
  31      /**
  32       * The model state
  33       *
  34       * @var    \Joomla\CMS\Object\CMSObject
  35       * @since  3.2
  36       */
  37      public $state;
  38  
  39      /**
  40       * The form object
  41       *
  42       * @var    \Joomla\CMS\Form\Form
  43       * @since  3.2
  44       */
  45      public $form;
  46  
  47      /**
  48       * The data to be displayed in the form
  49       *
  50       * @var   array
  51       * @since 3.2
  52       */
  53      public $data;
  54  
  55      /**
  56       * Execute and display a template script.
  57       *
  58       * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  59       *
  60       * @return  void
  61       *
  62       * @see     \JViewLegacy::loadTemplate()
  63       * @since   3.0
  64       */
  65      public function display($tpl = null)
  66      {
  67          try {
  68              // Load Form and Data
  69              $form = $this->get('form');
  70              $data = $this->get('data');
  71              $user = $this->getCurrentUser();
  72          } catch (\Exception $e) {
  73              Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
  74  
  75              return;
  76          }
  77  
  78          // Bind data
  79          if ($form && $data) {
  80              $form->bind($data);
  81          }
  82  
  83          // Get the params for com_users.
  84          $usersParams = ComponentHelper::getParams('com_users');
  85  
  86          // Get the params for com_media.
  87          $mediaParams = ComponentHelper::getParams('com_media');
  88  
  89          $this->form        = &$form;
  90          $this->data        = &$data;
  91          $this->usersParams = &$usersParams;
  92          $this->mediaParams = &$mediaParams;
  93          $this->components  = ConfigHelper::getComponentsWithConfig();
  94          ConfigHelper::loadLanguageForComponents($this->components);
  95  
  96          $this->userIsSuperAdmin = $user->authorise('core.admin');
  97  
  98          $this->addToolbar();
  99  
 100          parent::display($tpl);
 101      }
 102  
 103      /**
 104       * Add the page title and toolbar.
 105       *
 106       * @return  void
 107       *
 108       * @since   3.2
 109       */
 110      protected function addToolbar()
 111      {
 112          ToolbarHelper::title(Text::_('COM_CONFIG_GLOBAL_CONFIGURATION'), 'cog config');
 113          ToolbarHelper::apply('application.apply');
 114          ToolbarHelper::divider();
 115          ToolbarHelper::save('application.save');
 116          ToolbarHelper::divider();
 117          ToolbarHelper::cancel('application.cancel', 'JTOOLBAR_CLOSE');
 118          ToolbarHelper::divider();
 119          ToolbarHelper::inlinehelp();
 120          ToolbarHelper::help('Site_Global_Configuration');
 121      }
 122  }


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