[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_postinstall/src/View/Messages/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_postinstall
   6   *
   7   * @copyright   (C) 2013 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\Postinstall\Administrator\View\Messages;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  16  use Joomla\CMS\Toolbar\Toolbar;
  17  use Joomla\CMS\Toolbar\ToolbarHelper;
  18  use Joomla\Component\Postinstall\Administrator\Model\MessagesModel;
  19  
  20  // phpcs:disable PSR1.Files.SideEffects
  21  \defined('_JEXEC') or die;
  22  // phpcs:enable PSR1.Files.SideEffects
  23  
  24  /**
  25   * Model class to display postinstall messages
  26   *
  27   * @since  3.2
  28   */
  29  class HtmlView extends BaseHtmlView
  30  {
  31      /**
  32       * Executes before rendering the page for the Browse task.
  33       *
  34       * @param   string  $tpl  Subtemplate to use
  35       *
  36       * @return  void
  37       *
  38       * @since   3.2
  39       */
  40      public function display($tpl = null)
  41      {
  42          /** @var MessagesModel $model */
  43          $model = $this->getModel();
  44  
  45          $this->items = $model->getItems();
  46  
  47          if (!\count($this->items)) {
  48              $this->setLayout('emptystate');
  49          }
  50  
  51          $this->joomlaFilesExtensionId = $model->getJoomlaFilesExtensionId();
  52          $this->eid                    = (int) $model->getState('eid', $this->joomlaFilesExtensionId);
  53  
  54          if (empty($this->eid)) {
  55              $this->eid = $this->joomlaFilesExtensionId;
  56          }
  57  
  58          $this->toolbar();
  59  
  60          $this->token = Factory::getSession()->getFormToken();
  61          $this->extension_options = $model->getComponentOptions();
  62  
  63          ToolbarHelper::title(Text::sprintf('COM_POSTINSTALL_MESSAGES_TITLE', $model->getExtensionName($this->eid)), 'bell');
  64  
  65          parent::display($tpl);
  66      }
  67  
  68      /**
  69       * displays the toolbar
  70       *
  71       * @return  void
  72       *
  73       * @since   3.6
  74       */
  75      private function toolbar()
  76      {
  77          $toolbar = Toolbar::getInstance('toolbar');
  78  
  79          if (!empty($this->items)) {
  80              $toolbar->unpublish('message.hideAll', 'COM_POSTINSTALL_HIDE_ALL_MESSAGES');
  81          }
  82  
  83          // Options button.
  84          if ($this->getCurrentUser()->authorise('core.admin', 'com_postinstall')) {
  85              $toolbar->preferences('com_postinstall');
  86              $toolbar->help('Post-installation_Messages_for_Joomla_CMS');
  87          }
  88      }
  89  }


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