[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_languages/src/View/Installed/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_languages
   6   *
   7   * @copyright   (C) 2009 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\Languages\Administrator\View\Installed;
  12  
  13  use Joomla\CMS\Helper\ContentHelper;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\CMS\MVC\View\GenericDataException;
  16  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  17  use Joomla\CMS\Toolbar\Toolbar;
  18  use Joomla\CMS\Toolbar\ToolbarHelper;
  19  
  20  // phpcs:disable PSR1.Files.SideEffects
  21  \defined('_JEXEC') or die;
  22  // phpcs:enable PSR1.Files.SideEffects
  23  
  24  /**
  25   * Displays a list of the installed languages.
  26   *
  27   * @since  1.6
  28   */
  29  class HtmlView extends BaseHtmlView
  30  {
  31      /**
  32       * Option (component) name
  33       *
  34       * @var string
  35       */
  36      protected $option = null;
  37  
  38      /**
  39       * The pagination object
  40       *
  41       * @var  \Joomla\CMS\Pagination\Pagination
  42       */
  43      protected $pagination;
  44  
  45      /**
  46       * Languages information
  47       *
  48       * @var array
  49       */
  50      protected $rows = null;
  51  
  52      /**
  53       * The model state
  54       *
  55       * @var    \Joomla\CMS\Object\CMSObject
  56       *
  57       * @since  4.0.0
  58       */
  59      protected $state;
  60  
  61      /**
  62       * Form object for search filters
  63       *
  64       * @var    \Joomla\CMS\Form\Form
  65       *
  66       * @since  4.0.0
  67       */
  68      public $filterForm;
  69  
  70      /**
  71       * The active search filters
  72       *
  73       * @var    array
  74       * @since  4.0.0
  75       */
  76      public $activeFilters;
  77  
  78      /**
  79       * Display the view.
  80       *
  81       * @param   string  $tpl  The name of the template file to parse.
  82       *
  83       * @return  void
  84       */
  85      public function display($tpl = null)
  86      {
  87          $this->option        = $this->get('Option');
  88          $this->pagination    = $this->get('Pagination');
  89          $this->rows          = $this->get('Data');
  90          $this->total         = $this->get('Total');
  91          $this->state         = $this->get('State');
  92          $this->filterForm    = $this->get('FilterForm');
  93          $this->activeFilters = $this->get('ActiveFilters');
  94  
  95          // Check for errors.
  96          if (count($errors = $this->get('Errors'))) {
  97              throw new GenericDataException(implode("\n", $errors), 500);
  98          }
  99  
 100          $this->addToolbar();
 101  
 102          parent::display($tpl);
 103      }
 104  
 105      /**
 106       * Add the page title and toolbar.
 107       *
 108       * @return  void
 109       *
 110       * @since   1.6
 111       */
 112      protected function addToolbar()
 113      {
 114          $canDo = ContentHelper::getActions('com_languages');
 115  
 116          if ((int) $this->state->get('client_id') === 1) {
 117              ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_INSTALLED_ADMIN_TITLE'), 'comments langmanager');
 118          } else {
 119              ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_INSTALLED_SITE_TITLE'), 'comments langmanager');
 120          }
 121  
 122          if ($canDo->get('core.edit.state')) {
 123              ToolbarHelper::makeDefault('installed.setDefault');
 124              ToolbarHelper::divider();
 125          }
 126  
 127          if ($canDo->get('core.admin')) {
 128              // Add install languages link to the lang installer component.
 129              $bar = Toolbar::getInstance('toolbar');
 130  
 131              // Switch administrator language
 132              if ($this->state->get('client_id', 0) == 1) {
 133                  ToolbarHelper::custom('installed.switchadminlanguage', 'refresh', '', 'COM_LANGUAGES_SWITCH_ADMIN', true);
 134                  ToolbarHelper::divider();
 135              }
 136  
 137              $bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages');
 138              ToolbarHelper::divider();
 139  
 140              ToolbarHelper::preferences('com_languages');
 141              ToolbarHelper::divider();
 142          }
 143  
 144          ToolbarHelper::help('Languages:_Installed');
 145      }
 146  }


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