[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_installer/src/View/Installer/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_installer
   6   *
   7   * @copyright   (C) 2007 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\Installer\Administrator\View\Installer;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Helper\ContentHelper;
  15  use Joomla\CMS\Language\Text;
  16  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  17  use Joomla\CMS\Toolbar\ToolbarHelper;
  18  
  19  // phpcs:disable PSR1.Files.SideEffects
  20  \defined('_JEXEC') or die;
  21  // phpcs:enable PSR1.Files.SideEffects
  22  
  23  /**
  24   * Extension Manager Default View
  25   *
  26   * @since  1.5
  27   */
  28  class HtmlView extends BaseHtmlView
  29  {
  30      /**
  31       * The model state
  32       *
  33       * @var    \Joomla\CMS\Object\CMSObject
  34       *
  35       * @since  4.0.0
  36       */
  37      public $state;
  38  
  39      /**
  40       * True if there are extension messages to be displayed
  41       *
  42       * @var    boolean
  43       *
  44       * @since  4.0.0
  45       */
  46      public $showMessage;
  47  
  48      /**
  49       * Constructor.
  50       *
  51       * @param   array  $config  Configuration array
  52       *
  53       * @since   1.5
  54       */
  55      public function __construct($config = null)
  56      {
  57          parent::__construct($config);
  58  
  59          $this->_addPath('template', $this->_basePath . '/tmpl/installer');
  60          $this->_addPath('template', JPATH_THEMES . '/' . Factory::getApplication()->getTemplate() . '/html/com_installer/installer');
  61      }
  62  
  63      /**
  64       * Display the view.
  65       *
  66       * @param   string  $tpl  Template
  67       *
  68       * @return  void
  69       *
  70       * @since   1.5
  71       */
  72      public function display($tpl = null)
  73      {
  74          // Get data from the model.
  75          $state = $this->get('State');
  76  
  77          // Are there messages to display?
  78          $showMessage = false;
  79  
  80          if (is_object($state)) {
  81              $message1    = $state->get('message');
  82              $message2    = $state->get('extension_message');
  83              $showMessage = ($message1 || $message2);
  84          }
  85  
  86          $this->showMessage = $showMessage;
  87          $this->state       = &$state;
  88  
  89          $this->addToolbar();
  90          parent::display($tpl);
  91      }
  92  
  93      /**
  94       * Add the page title and toolbar.
  95       *
  96       * @return  void
  97       *
  98       * @since   1.6
  99       */
 100      protected function addToolbar()
 101      {
 102          $canDo = ContentHelper::getActions('com_installer');
 103          ToolbarHelper::title(Text::_('COM_INSTALLER_HEADER_' . strtoupper($this->getName())), 'puzzle-piece install');
 104  
 105          if ($canDo->get('core.admin') || $canDo->get('core.options')) {
 106              ToolbarHelper::preferences('com_installer');
 107              ToolbarHelper::divider();
 108          }
 109      }
 110  }


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