/
home
/
assocoweys
/
avexp
/
modules
/
mod_latestnewsenhanced
/
fields
/
Upload File
HOME
<?php /** * @copyright Copyright (C) 2011 Simplify Your Web, Inc. All rights reserved. * @license GNU General Public License version 3 or later; see LICENSE.txt */ // no direct access defined( '_JEXEC' ) or die; jimport('syw.k2'); jimport('joomla.filesystem.folder'); JFormHelper::loadFieldClass('list'); /** * unused */ class JFormFieldAuthorSelect extends JFormFieldList { protected $type = 'AuthorSelect'; protected function getOptions() { $options = array(); // ? not used so far //if (SYWK2::exists()) { //$options[] = JHTML::_('select.option', 'k2_user', JText::_('MOD_LATESTNEWSENHANCEDEXTENDED_VALUE_K2USER'), 'value', 'text', $disable=true ); //} // test the fields folder first to avoid message warning that the component is missing if (JFolder::exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler') && JComponentHelper::isEnabled('com_comprofiler')) { $options[] = JHTML::_('select.option', 'cb_user_profile', JText::_('MOD_LATESTNEWSENHANCEDEXTENDED_VALUE_CBUSERPROFILE'), 'value', 'text', $disable=true ); } // content authors thru SQL // old // select id, name, username from #__users where id IN (select distinct(created_by) from #__content) order by name ASC $db = Factory::getDbo(); $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 (RuntimeException $e) { $authors = array(); } $options = array_merge($options, $authors); // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } } ?>