[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_installer
   6   *
   7   * @copyright   (C) 2012 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\Languages;
  12  
  13  use Joomla\CMS\Access\Exception\NotAllowed;
  14  use Joomla\CMS\Factory;
  15  use Joomla\CMS\Helper\ContentHelper;
  16  use Joomla\CMS\Language\LanguageHelper;
  17  use Joomla\CMS\Language\Text;
  18  use Joomla\CMS\MVC\View\GenericDataException;
  19  use Joomla\CMS\Toolbar\ToolbarHelper;
  20  use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
  21  
  22  // phpcs:disable PSR1.Files.SideEffects
  23  \defined('_JEXEC') or die;
  24  // phpcs:enable PSR1.Files.SideEffects
  25  
  26  /**
  27   * Extension Manager Language Install View
  28   *
  29   * @since  2.5.7
  30   */
  31  class HtmlView extends InstallerViewDefault
  32  {
  33      /**
  34       * @var object item list
  35       */
  36      protected $items;
  37  
  38      /**
  39       * @var object pagination information
  40       */
  41      protected $pagination;
  42  
  43      /**
  44       * Display the view.
  45       *
  46       * @param   null  $tpl  template to display
  47       *
  48       * @return mixed|void
  49       */
  50      public function display($tpl = null)
  51      {
  52          if (!$this->getCurrentUser()->authorise('core.admin')) {
  53              throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
  54          }
  55  
  56          // Get data from the model.
  57          $this->items         = $this->get('Items');
  58          $this->pagination    = $this->get('Pagination');
  59          $this->filterForm    = $this->get('FilterForm');
  60          $this->activeFilters = $this->get('ActiveFilters');
  61          $this->installedLang = LanguageHelper::getInstalledLanguages();
  62  
  63          // Check for errors.
  64          if (count($errors = $this->get('Errors'))) {
  65              throw new GenericDataException(implode("\n", $errors), 500);
  66          }
  67  
  68          parent::display($tpl);
  69      }
  70  
  71      /**
  72       * Add the page title and toolbar.
  73       *
  74       * @return void
  75       */
  76      protected function addToolbar()
  77      {
  78          $canDo = ContentHelper::getActions('com_installer');
  79          ToolbarHelper::title(Text::_('COM_INSTALLER_HEADER_' . $this->getName()), 'puzzle-piece install');
  80  
  81          if ($canDo->get('core.admin')) {
  82              parent::addToolbar();
  83  
  84              ToolbarHelper::help('Extensions:_Languages');
  85          }
  86      }
  87  }


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