[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_content/elements/ -> author.php (source)

   1  <?php
   2  /**
   3   * @package        Joomla.Administrator
   4   * @subpackage    com_content
   5   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   6   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   7   */
   8  
   9  defined('_JEXEC') or die;
  10  
  11  /**
  12   * Renders an author element
  13   *
  14   * @package        Joomla.Administrator
  15   * @subpackage    com_content
  16   * @deprecated    JParameter is deprecated and will be removed in a future version. Use JForm instead.
  17   * @since        1.5
  18   */
  19  class JElementAuthor extends JElement
  20  {
  21      /**
  22       * The name of the element.
  23       *
  24       * @var        string
  25       */
  26      var    $_name = 'Author';
  27  
  28  	function fetchElement($name, $value, &$node, $control_name)
  29      {
  30          $access    = JFactory::getACL();
  31  
  32          // Include user in groups that have access to edit their articles, other articles, or manage content.
  33          $action = array('com_content.article.edit_own', 'com_content.article.edit_article', 'com_content.manage');
  34          $groups    = $access->getAuthorisedUsergroups($action, true);
  35  
  36          // Check the results of the access check.
  37          if (!$groups) {
  38              return false;
  39          }
  40  
  41          // Clean up and serialize.
  42          JArrayHelper::toInteger($groups);
  43          $groups = implode(',', $groups);
  44  
  45          // Build the query to get the users.
  46          $db = JFactory::getDbo();
  47          $query = $db->getQuery(true);
  48          $query->select('u.id AS value');
  49          $query->select('u.name AS text');
  50          $query->from('#__users AS u');
  51          $query->join('INNER', '#__user_usergroup_map AS m ON m.user_id = u.id');
  52          $query->where('u.block = 0');
  53          $query->where('m.group_id IN ('.$groups.')');
  54  
  55          // Get the users.
  56          $db->setQuery((string) $query);
  57          $users = $db->loadObjectList();
  58  
  59          // Check for a database error.
  60          if ($db->getErrorNum()) {
  61              JError::raiseNotice(500, $db->getErrorMsg());
  62              return false;
  63          }
  64  
  65          return JHtml::_('select.genericlist', $users, $name, 'class="inputbox" size="1"', 'value', 'text', $value);
  66      }
  67  }


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1