Source for file helper.php

Documentation is available at helper.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  mod_logged
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Helper for mod_logged
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  mod_logged
  17.  * @since       1.5
  18.  */
  19. abstract class ModLoggedHelper
  20. {
  21.     /**
  22.      * Get a list of logged users.
  23.      *
  24.      * @param   JRegistry  &$params  The module parameters.
  25.      *
  26.      * @return  mixed  An array of users, or false on error.
  27.      *
  28.      * @throws  RuntimeException
  29.      */
  30.     public static function getList(&$params)
  31.     {
  32.         $db    JFactory::getDbo();
  33.         $user  JFactory::getUser();
  34.         $query $db->getQuery(true)
  35.             ->select('s.time, s.client_id, u.id, u.name, u.username')
  36.             ->from('#__session AS s')
  37.             ->join('LEFT''#__users AS u ON s.userid = u.id')
  38.             ->where('s.guest = 0');
  39.         $db->setQuery($query0$params->get('count'5));
  40.  
  41.         try
  42.         {
  43.             $results $db->loadObjectList();
  44.         }
  45.         catch (RuntimeException $e)
  46.         {
  47.             throw $e;
  48.         }
  49.  
  50.         foreach ($results as $k => $result)
  51.         {
  52.             $results[$k]->logoutLink '';
  53.  
  54.             if ($user->authorise('core.manage''com_users'))
  55.             {
  56.                 $results[$k]->editLink   JRoute::_('index.php?option=com_users&task=user.edit&id=' $result->id);
  57.                 $results[$k]->logoutLink JRoute::_('index.php?option=com_login&task=logout&uid=' $result->id '&' JSession::getFormToken('=1');
  58.             }
  59.  
  60.             if ($params->get('name'1== 0)
  61.             {
  62.                 $results[$k]->name $results[$k]->username;
  63.             }
  64.         }
  65.  
  66.         return $results;
  67.     }
  68.  
  69.     /**
  70.      * Get the alternate title for the module
  71.      *
  72.      * @param   JRegistry  $params  The module parameters.
  73.      *
  74.      * @return  string    The alternate title for the module.
  75.      */
  76.     public static function getTitle($params)
  77.     {
  78.         return JText::plural('MOD_LOGGED_TITLE'$params->get('count'));
  79.     }
  80. }

Documentation generated on Tue, 19 Nov 2013 15:04:24 +0100 by phpDocumentor 1.4.3