[ 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_messages 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\Messages\Administrator\Field; 12 13 use Joomla\CMS\Access\Access; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\Form\Field\UserField; 16 17 // phpcs:disable PSR1.Files.SideEffects 18 \defined('_JEXEC') or die; 19 // phpcs:enable PSR1.Files.SideEffects 20 21 /** 22 * Supports a modal select of users that have access to com_messages 23 * 24 * @since 1.6 25 */ 26 class UserMessagesField extends UserField 27 { 28 /** 29 * The form field type. 30 * 31 * @var string 32 * @since 1.6 33 */ 34 public $type = 'UserMessages'; 35 36 /** 37 * Method to get the filtering groups (null means no filtering) 38 * 39 * @return array|null array of filtering groups or null. 40 * 41 * @since 1.6 42 */ 43 protected function getGroups() 44 { 45 // Compute usergroups 46 $db = $this->getDatabase(); 47 $query = $db->getQuery(true) 48 ->select('id') 49 ->from('#__usergroups'); 50 $db->setQuery($query); 51 52 try { 53 $groups = $db->loadColumn(); 54 } catch (\RuntimeException $e) { 55 Factory::getApplication()->enqueueMessage($e->getMessage(), 'notice'); 56 57 return null; 58 } 59 60 foreach ($groups as $i => $group) { 61 if (Access::checkGroup($group, 'core.admin')) { 62 continue; 63 } 64 65 if (!Access::checkGroup($group, 'core.manage', 'com_messages')) { 66 unset($groups[$i]); 67 continue; 68 } 69 70 if (!Access::checkGroup($group, 'core.login.admin')) { 71 unset($groups[$i]); 72 } 73 } 74 75 return array_values($groups); 76 } 77 78 /** 79 * Method to get the users to exclude from the list of users 80 * 81 * @return array|null array of users to exclude or null to to not exclude them 82 * 83 * @since 1.6 84 */ 85 protected function getExcluded() 86 { 87 return array(Factory::getUser()->id); 88 } 89 }
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 |