[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/administrator/components/com_messages/models/fields/ -> usermessages.php (source)

   1  <?php
   2  /**
   3   * @package        Joomla.Administrator
   4   * @subpackage    com_messages
   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  JFormHelper::loadFieldClass('user');
  12  
  13  /**
  14   * Supports an modal select of user that have access to com_messages
  15   */
  16  class JFormFieldUserMessages extends JFormFieldUser
  17  {
  18      /**
  19       * The form field type.
  20       *
  21       * @var        string
  22       * @since    1.6
  23       */
  24      public $type = 'UserMessages';
  25  
  26      /**
  27       * Method to get the filtering groups (null means no filtering)
  28       *
  29       * @return    array|null    array of filtering groups or null.
  30       * @since    1.6
  31       */
  32  	protected function getGroups()
  33      {
  34          // Compute usergroups
  35          $db = JFactory::getDbo();
  36          $query = $db->getQuery(true);
  37          $query->select('id');
  38          $query->from('#__usergroups');
  39          $db->setQuery($query);
  40          $groups = $db->loadColumn();
  41  
  42          // Check for a database error.
  43          if ($db->getErrorNum()) {
  44              JError::raiseNotice(500, $db->getErrorMsg());
  45              return null;
  46          }
  47  
  48          foreach ($groups as $i=>$group)
  49          {
  50              if (JAccess::checkGroup($group, 'core.admin')) {
  51                  continue;
  52              }
  53              if (!JAccess::checkGroup($group, 'core.manage', 'com_messages')) {
  54                  unset($groups[$i]);
  55                  continue;
  56              }
  57              if (!JAccess::checkGroup($group, 'core.login.admin')) {
  58                  unset($groups[$i]);
  59                  continue;
  60              }
  61          }
  62          return array_values($groups);
  63      }
  64  
  65      /**
  66       * Method to get the users to exclude from the list of users
  67       *
  68       * @return    array|null array of users to exclude or null to to not exclude them
  69       * @since    1.6
  70       */
  71  	protected function getExcluded()
  72      {
  73          return array(JFactory::getUser()->id);
  74      }
  75  }


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