__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* @copyright Copyright (C) 2011 Simplify Your Web, Inc. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE.txt
*/
namespace SYW\Module\LatestNewsEnhanced\Site\Field;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\ListField;
use Joomla\Database\Exception\ExecutionFailureException;
/**
* Author selection
*/
class AuthorselectField extends ListField
{
public $type = 'Authorselect';
protected $option;
protected function getOptions()
{
$options = array();
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName('id', 'value'));
$query->select($db->quoteName('name', 'text'));
$query->from($db->quoteName('#__users'));
$query->where('id IN (select distinct(created_by) from #__content)');
$query->order('name', 'ASC');
// $query = $db->getQuery(true)
// ->select('u.id AS value, u.name AS text')
// ->from('#__users AS u')
// ->join('INNER', '#__content AS c ON c.created_by = u.id')
// ->group('u.id, u.name')
// ->order('u.name');
$db->setQuery($query);
try {
$authors = $db->loadObjectList();
} catch (ExecutionFailureException $e) {
$authors = array();
}
$options = array_merge($options, $authors);
// Merge any additional options in the XML definition.
$options = array_merge(parent::getOptions(), $options);
return $options;
}
public function setup(\SimpleXMLElement $element, $value, $group = null)
{
$return = parent::setup($element, $value, $group);
if ($return) {
$this->option = isset($this->element['option']) ? $this->element['option'] : '';
}
return $return;
}
}
?>| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AnimationselectField.php | File | 2.76 KB | 0664 |
|
| AuthoraliasselectField.php | File | 1.54 KB | 0664 |
|
| AuthorselectField.php | File | 1.66 KB | 0664 |
|
| CalendarselectField.php | File | 2.44 KB | 0664 |
|
| CheckboxesfreeField.php | File | 643 B | 0664 |
|
| ColorthemeselectField.php | File | 2.05 KB | 0664 |
|
| DatasourceselectField.php | File | 1.07 KB | 0664 |
|
| DateselectField.php | File | 2.64 KB | 0664 |
|
| DetailselectField.php | File | 7.29 KB | 0664 |
|
| HeadselectField.php | File | 7.85 KB | 0664 |
|
| LinkselectField.php | File | 3.11 KB | 0664 |
|
| ListfreeField.php | File | 558 B | 0664 |
|
| RelatedselectField.php | File | 1.45 KB | 0664 |
|
| StyleselectField.php | File | 2.42 KB | 0664 |
|
| TextselectField.php | File | 2.88 KB | 0664 |
|
| TitleselectField.php | File | 2.86 KB | 0664 |
|