[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_installer
   6   *
   7   * @copyright   (C) 2008 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\Manage;
  12  
  13  use Joomla\CMS\Form\Form;
  14  use Joomla\CMS\Helper\ContentHelper;
  15  use Joomla\CMS\MVC\View\GenericDataException;
  16  use Joomla\CMS\Pagination\Pagination;
  17  use Joomla\CMS\Toolbar\Toolbar;
  18  use Joomla\CMS\Toolbar\ToolbarHelper;
  19  use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault;
  20  
  21  // phpcs:disable PSR1.Files.SideEffects
  22  \defined('_JEXEC') or die;
  23  // phpcs:enable PSR1.Files.SideEffects
  24  
  25  /**
  26   * Extension Manager Manage View
  27   *
  28   * @since  1.6
  29   */
  30  class HtmlView extends InstallerViewDefault
  31  {
  32      /**
  33       * List of updatesites
  34       *
  35       * @var    \stdClass[]
  36       */
  37      protected $items;
  38  
  39      /**
  40       * Pagination object
  41       *
  42       * @var    Pagination
  43       */
  44      protected $pagination;
  45  
  46      /**
  47       * Form object
  48       *
  49       * @var    Form
  50       */
  51      protected $form;
  52  
  53      /**
  54       * Display the view.
  55       *
  56       * @param   string  $tpl  Template
  57       *
  58       * @return  mixed|void
  59       *
  60       * @since   1.6
  61       */
  62      public function display($tpl = null)
  63      {
  64          // Get data from the model.
  65          $this->items         = $this->get('Items');
  66          $this->pagination    = $this->get('Pagination');
  67          $this->filterForm    = $this->get('FilterForm');
  68          $this->activeFilters = $this->get('ActiveFilters');
  69  
  70          // Check for errors.
  71          if (count($errors = $this->get('Errors'))) {
  72              throw new GenericDataException(implode("\n", $errors), 500);
  73          }
  74  
  75          // Display the view.
  76          parent::display($tpl);
  77      }
  78  
  79      /**
  80       * Add the page title and toolbar.
  81       *
  82       * @return  void
  83       *
  84       * @since   1.6
  85       */
  86      protected function addToolbar()
  87      {
  88          $toolbar = Toolbar::getInstance('toolbar');
  89          $canDo   = ContentHelper::getActions('com_installer');
  90  
  91          if ($canDo->get('core.edit.state')) {
  92              $toolbar->publish('manage.publish')
  93                  ->text('JTOOLBAR_ENABLE')
  94                  ->listCheck(true);
  95              $toolbar->unpublish('manage.unpublish')
  96                  ->text('JTOOLBAR_DISABLE')
  97                  ->listCheck(true);
  98              $toolbar->divider();
  99          }
 100  
 101          $toolbar->standardButton('refresh')
 102              ->text('JTOOLBAR_REFRESH_CACHE')
 103              ->task('manage.refresh')
 104              ->listCheck(true);
 105          $toolbar->divider();
 106  
 107          if ($canDo->get('core.delete')) {
 108              $toolbar->delete('manage.remove')
 109                  ->text('JTOOLBAR_UNINSTALL')
 110                  ->message('COM_INSTALLER_CONFIRM_UNINSTALL')
 111                  ->listCheck(true);
 112              $toolbar->divider();
 113          }
 114  
 115          if ($canDo->get('core.manage')) {
 116              ToolbarHelper::link('index.php?option=com_installer&view=install', 'COM_INSTALLER_TOOLBAR_INSTALL_EXTENSIONS', 'upload');
 117              $toolbar->divider();
 118          }
 119  
 120          parent::addToolbar();
 121          $toolbar->help('Extensions:_Manage');
 122      }
 123  }


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