[ 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_actionlogs 6 * 7 * @copyright (C) 2018 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\Actionlogs\Administrator\Field; 12 13 use Joomla\CMS\Form\Field\ListField; 14 15 // phpcs:disable PSR1.Files.SideEffects 16 \defined('_JEXEC') or die; 17 // phpcs:enable PSR1.Files.SideEffects 18 19 /** 20 * Field to load a list of all users that have logged actions 21 * 22 * @since 3.9.0 23 */ 24 class LogcreatorField extends ListField 25 { 26 /** 27 * Cached array of the category items. 28 * 29 * @var array 30 * @since 3.9.0 31 */ 32 protected static $options = []; 33 34 /** 35 * The form field type. 36 * 37 * @var string 38 * @since 3.9.0 39 */ 40 protected $type = 'LogCreator'; 41 42 /** 43 * Method to get the options to populate list 44 * 45 * @return array The field option objects. 46 * 47 * @since 3.9.0 48 */ 49 protected function getOptions() 50 { 51 // Accepted modifiers 52 $hash = md5($this->element); 53 54 if (!isset(static::$options[$hash])) { 55 static::$options[$hash] = parent::getOptions(); 56 57 $db = $this->getDatabase(); 58 59 // Construct the query 60 $query = $db->getQuery(true) 61 ->select($db->quoteName('u.id', 'value')) 62 ->select($db->quoteName('u.username', 'text')) 63 ->from($db->quoteName('#__users', 'u')) 64 ->join('INNER', $db->quoteName('#__action_logs', 'c') . ' ON ' . $db->quoteName('c.user_id') . ' = ' . $db->quoteName('u.id')) 65 ->group($db->quoteName('u.id')) 66 ->group($db->quoteName('u.username')) 67 ->order($db->quoteName('u.username')); 68 69 // Setup the query 70 $db->setQuery($query); 71 72 // Return the result 73 if ($options = $db->loadObjectList()) { 74 static::$options[$hash] = array_merge(static::$options[$hash], $options); 75 } 76 } 77 78 return static::$options[$hash]; 79 } 80 }
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 |