[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_users/src/View/Debuguser/ -> HtmlView.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_users
   6   *
   7   * @copyright   (C) 2010 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\Users\Administrator\View\Debuguser;
  12  
  13  use Joomla\CMS\Access\Exception\NotAllowed;
  14  use Joomla\CMS\Helper\ContentHelper;
  15  use Joomla\CMS\Language\Text;
  16  use Joomla\CMS\MVC\View\GenericDataException;
  17  use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
  18  use Joomla\CMS\Object\CMSObject;
  19  use Joomla\CMS\Toolbar\ToolbarHelper;
  20  use Joomla\CMS\User\User;
  21  
  22  // phpcs:disable PSR1.Files.SideEffects
  23  \defined('_JEXEC') or die;
  24  // phpcs:enable PSR1.Files.SideEffects
  25  
  26  /**
  27   * View class for a list of User ACL permissions.
  28   *
  29   * @since  1.6
  30   */
  31  class HtmlView extends BaseHtmlView
  32  {
  33      /**
  34       * List of component actions
  35       *
  36       * @var  array
  37       */
  38      protected $actions;
  39  
  40      /**
  41       * The item data.
  42       *
  43       * @var   object
  44       * @since 1.6
  45       */
  46      protected $items;
  47  
  48      /**
  49       * The pagination object.
  50       *
  51       * @var   \Joomla\CMS\Pagination\Pagination
  52       * @since 1.6
  53       */
  54      protected $pagination;
  55  
  56      /**
  57       * The model state.
  58       *
  59       * @var   CMSObject
  60       * @since 1.6
  61       */
  62      protected $state;
  63  
  64      /**
  65       * The user object of the user being debugged.
  66       *
  67       * @var   User
  68       */
  69      protected $user;
  70  
  71      /**
  72       * Form object for search filters
  73       *
  74       * @var  \Joomla\CMS\Form\Form
  75       */
  76      public $filterForm;
  77  
  78      /**
  79       * The active search filters
  80       *
  81       * @var  array
  82       */
  83      public $activeFilters;
  84  
  85      /**
  86       * Display the view
  87       *
  88       * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  89       *
  90       * @return  void
  91       */
  92      public function display($tpl = null)
  93      {
  94          // Access check.
  95          if (!$this->getCurrentUser()->authorise('core.manage', 'com_users')) {
  96              throw new NotAllowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
  97          }
  98  
  99          $this->actions       = $this->get('DebugActions');
 100          $this->items         = $this->get('Items');
 101          $this->pagination    = $this->get('Pagination');
 102          $this->state         = $this->get('State');
 103          $this->user          = $this->get('User');
 104          $this->filterForm    = $this->get('FilterForm');
 105          $this->activeFilters = $this->get('ActiveFilters');
 106  
 107          // Check for errors.
 108          if (count($errors = $this->get('Errors'))) {
 109              throw new GenericDataException(implode("\n", $errors), 500);
 110          }
 111  
 112          $this->addToolbar();
 113  
 114          parent::display($tpl);
 115      }
 116  
 117      /**
 118       * Add the page title and toolbar.
 119       *
 120       * @return  void
 121       *
 122       * @since   1.6
 123       */
 124      protected function addToolbar()
 125      {
 126          $canDo = ContentHelper::getActions('com_users');
 127  
 128          ToolbarHelper::title(Text::sprintf('COM_USERS_VIEW_DEBUG_USER_TITLE', $this->user->id, $this->escape($this->user->name)), 'users user');
 129          ToolbarHelper::cancel('user.cancel', 'JTOOLBAR_CLOSE');
 130  
 131          if ($canDo->get('core.admin') || $canDo->get('core.options')) {
 132              ToolbarHelper::preferences('com_users');
 133              ToolbarHelper::divider();
 134          }
 135  
 136          ToolbarHelper::help('Permissions_for_User');
 137      }
 138  }


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