[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_installer
   6   *
   7   * @copyright   (C) 2014 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\Updatesites;
  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\Model\UpdatesitesModel;
  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 Update Sites View
  28   *
  29   * @since  3.4
  30   */
  31  class HtmlView extends InstallerViewDefault
  32  {
  33      /**
  34       * The search tools form
  35       *
  36       * @var    Form
  37       * @since  3.4
  38       */
  39      public $filterForm;
  40  
  41      /**
  42       * The active search filters
  43       *
  44       * @var    array
  45       * @since  3.4
  46       */
  47      public $activeFilters = [];
  48  
  49      /**
  50       * List of updatesites
  51       *
  52       * @var    \stdClass[]
  53       * @since 3.4
  54       */
  55      protected $items;
  56  
  57      /**
  58       * Pagination object
  59       *
  60       * @var    Pagination
  61       * @since 3.4
  62       */
  63      protected $pagination;
  64  
  65      /**
  66       * Display the view
  67       *
  68       * @param   string  $tpl  Template
  69       *
  70       * @return  mixed|void
  71       *
  72       * @since   3.4
  73       *
  74       * @throws  \Exception on errors
  75       */
  76      public function display($tpl = null): void
  77      {
  78          /** @var UpdatesitesModel $model */
  79          $model               = $this->getModel();
  80          $this->items         = $model->getItems();
  81          $this->pagination    = $model->getPagination();
  82          $this->filterForm    = $model->getFilterForm();
  83          $this->activeFilters = $model->getActiveFilters();
  84  
  85          // Check for errors.
  86          if (count($errors = $model->getErrors())) {
  87              throw new GenericDataException(implode("\n", $errors), 500);
  88          }
  89  
  90          // Display the view
  91          parent::display($tpl);
  92      }
  93  
  94      /**
  95       * Add the page title and toolbar.
  96       *
  97       * @return  void
  98       *
  99       * @since   3.4
 100       */
 101      protected function addToolbar(): void
 102      {
 103          $canDo = ContentHelper::getActions('com_installer');
 104  
 105          // Get the toolbar object instance
 106          $toolbar = Toolbar::getInstance('toolbar');
 107  
 108          if ($canDo->get('core.edit.state')) {
 109              $dropdown = $toolbar->dropdownButton('status-group')
 110                  ->text('JTOOLBAR_CHANGE_STATUS')
 111                  ->toggleSplit(false)
 112                  ->icon('icon-ellipsis-h')
 113                  ->buttonClass('btn btn-action')
 114                  ->listCheck(true);
 115  
 116              $childBar = $dropdown->getChildToolbar();
 117  
 118              $childBar->publish('updatesites.publish', 'JTOOLBAR_ENABLE')->listCheck(true);
 119              $childBar->unpublish('updatesites.unpublish', 'JTOOLBAR_DISABLE')->listCheck(true);
 120  
 121              if ($canDo->get('core.delete')) {
 122                  $childBar->delete('updatesites.delete')->listCheck(true);
 123              }
 124  
 125              $childBar->checkin('updatesites.checkin')->listCheck(true);
 126          }
 127  
 128          if ($canDo->get('core.admin') || $canDo->get('core.options')) {
 129              ToolbarHelper::custom('updatesites.rebuild', 'refresh', '', 'JTOOLBAR_REBUILD', false);
 130          }
 131  
 132          parent::addToolbar();
 133  
 134          ToolbarHelper::help('Extensions:_Update_Sites');
 135      }
 136  }


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