[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_users 6 * 7 * @copyright (C) 2007 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\Users; 12 13 use Joomla\CMS\Factory; 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\Toolbar; 20 use Joomla\CMS\Toolbar\ToolbarHelper; 21 use Joomla\Database\DatabaseDriver; 22 23 // phpcs:disable PSR1.Files.SideEffects 24 \defined('_JEXEC') or die; 25 // phpcs:enable PSR1.Files.SideEffects 26 27 /** 28 * View class for a list of users. 29 * 30 * @since 1.6 31 */ 32 class HtmlView extends BaseHtmlView 33 { 34 /** 35 * The item data. 36 * 37 * @var object 38 * @since 1.6 39 */ 40 protected $items; 41 42 /** 43 * The pagination object. 44 * 45 * @var \Joomla\CMS\Pagination\Pagination 46 * @since 1.6 47 */ 48 protected $pagination; 49 50 /** 51 * The model state. 52 * 53 * @var CMSObject 54 * @since 1.6 55 */ 56 protected $state; 57 58 /** 59 * A Form instance with filter fields. 60 * 61 * @var \Joomla\CMS\Form\Form 62 * 63 * @since 3.6.3 64 */ 65 public $filterForm; 66 67 /** 68 * An array with active filters. 69 * 70 * @var array 71 * @since 3.6.3 72 */ 73 public $activeFilters; 74 75 /** 76 * An ACL object to verify user rights. 77 * 78 * @var CMSObject 79 * @since 3.6.3 80 */ 81 protected $canDo; 82 83 /** 84 * An instance of DatabaseDriver. 85 * 86 * @var DatabaseDriver 87 * @since 3.6.3 88 * 89 * @deprecated 5.0 Will be removed without replacement 90 */ 91 protected $db; 92 93 /** 94 * Display the view 95 * 96 * @param string $tpl The name of the template file to parse; automatically searches through the template paths. 97 * 98 * @return void 99 */ 100 public function display($tpl = null) 101 { 102 $this->items = $this->get('Items'); 103 $this->pagination = $this->get('Pagination'); 104 $this->state = $this->get('State'); 105 $this->filterForm = $this->get('FilterForm'); 106 $this->activeFilters = $this->get('ActiveFilters'); 107 $this->canDo = ContentHelper::getActions('com_users'); 108 $this->db = Factory::getDbo(); 109 110 // Check for errors. 111 if (count($errors = $this->get('Errors'))) { 112 throw new GenericDataException(implode("\n", $errors), 500); 113 } 114 115 $this->addToolbar(); 116 parent::display($tpl); 117 } 118 119 /** 120 * Add the page title and toolbar. 121 * 122 * @return void 123 * 124 * @since 1.6 125 */ 126 protected function addToolbar() 127 { 128 $canDo = $this->canDo; 129 $user = $this->getCurrentUser(); 130 131 // Get the toolbar object instance 132 $toolbar = Toolbar::getInstance('toolbar'); 133 134 ToolbarHelper::title(Text::_('COM_USERS_VIEW_USERS_TITLE'), 'users user'); 135 136 if ($canDo->get('core.create')) { 137 $toolbar->addNew('user.add'); 138 } 139 140 if ($canDo->get('core.edit.state') || $canDo->get('core.admin')) { 141 $dropdown = $toolbar->dropdownButton('status-group') 142 ->text('JTOOLBAR_CHANGE_STATUS') 143 ->toggleSplit(false) 144 ->icon('icon-ellipsis-h') 145 ->buttonClass('btn btn-action') 146 ->listCheck(true); 147 148 $childBar = $dropdown->getChildToolbar(); 149 150 $childBar->publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true); 151 $childBar->unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true); 152 $childBar->standardButton('unblock') 153 ->text('COM_USERS_TOOLBAR_UNBLOCK') 154 ->task('users.unblock') 155 ->listCheck(true); 156 157 // Add a batch button 158 if ( 159 $user->authorise('core.create', 'com_users') 160 && $user->authorise('core.edit', 'com_users') 161 && $user->authorise('core.edit.state', 'com_users') 162 ) { 163 $childBar->popupButton('batch') 164 ->text('JTOOLBAR_BATCH') 165 ->selector('collapseModal') 166 ->listCheck(true); 167 } 168 169 if ($canDo->get('core.delete')) { 170 $childBar->delete('users.delete') 171 ->text('JTOOLBAR_DELETE') 172 ->message('JGLOBAL_CONFIRM_DELETE') 173 ->listCheck(true); 174 } 175 } 176 177 if ($canDo->get('core.admin') || $canDo->get('core.options')) { 178 $toolbar->preferences('com_users'); 179 } 180 181 $toolbar->help('Users'); 182 } 183 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |