- md5
- 4c2e5f1d8f29cbf935f1c117816c6d58
- sha1
- 97e94ddcf8c0b47326383ab97657b8bb9d926e7e
- sha256
- 2266bc17ca496a8b88bb7a27f29d3a651252db66c99cfcc5cb92268e8faafbc6
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
<?php
/**
* @version $Id: author.php 20196 2011-01-09 02:40:25Z ian $
* @package Joomla.Administrator
* @subpackage Articles
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Renders a author element
*
* @package Joomla
* @subpackage Articles
* @since 1.5
*/
class JElementAuthor extends JElement
{
/**
* The name of the element.
*
* @var string
*/
var $_name = 'Author';
function fetchElement($name, $value, &$node, $control_name)
{
$access = JFactory::getACL();
// Include user in groups that have access to edit their articles, other articles, or manage content.
$action = array('com_content.article.edit_own', 'com_content.article.edit_article', 'com_content.manage');
$groups = $access->getAuthorisedUsergroups($action, true);
// Check the results of the access check.
if (!$groups) {
return false;
}
// Clean up and serialize.
JArrayHelper::toInteger($groups);
$groups = implode(',', $groups);
// Build the query to get the users.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('u.id AS value');
$query->select('u.name AS text');
$query->from('#__users AS u');
$query->join('INNER', '#__user_usergroup_map AS m ON m.user_id = u.id');
$query->where('u.block = 0');
$query->where('m.group_id IN ('.$groups.')');
// Get the users.
$db->setQuery((string) $query);
$users = $db->loadObjectList();
// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseNotice(500, $db->getErrorMsg());
return false;
}
return JHtml::_('select.genericlist', $users, $name, 'class="inputbox" size="1"', 'value', 'text', $value);
}
}
The same content is in 2 releases, Joomla 1.6.0 to 1.6.1. See them all, or every version of this file.