本文整理汇总了PHP中KunenaUserHelper::_online方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaUserHelper::_online方法的具体用法?PHP KunenaUserHelper::_online怎么用?PHP KunenaUserHelper::_online使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaUserHelper
的用法示例。
在下文中一共展示了KunenaUserHelper::_online方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOnlineUsers
public static function getOnlineUsers()
{
if (self::$_online === null) {
$db = JFactory::getDBO();
$query = "SELECT s.userid, s.time\n\t\t\t\tFROM #__session AS s\n\t\t\t\tWHERE s.client_id=0 AND s.userid>0\n\t\t\t\tGROUP BY s.userid\n\t\t\t\tORDER BY s.time DESC";
$db->setQuery($query);
self::$_online = $db->loadObjectList('userid');
KunenaError::checkDatabaseError();
}
return self::$_online;
}
示例2: getOnlineUsers
/**
* Get the list of users online by giving list of userid
*
* @return array
*/
public static function getOnlineUsers()
{
if (self::$_online === null) {
$app = JFactory::getApplication();
$config = KunenaFactory::getConfig();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('userid, MAX(time) AS time')->from('#__session')->where('client_id=0 AND userid>0')->group('userid')->order('time DESC');
if ($config->show_session_type == 2 && $config->show_session_starttime != 0) {
// Calculate x minutes by using Kunena setting.
$time = JFactory::getDate()->toUnix() - $config->show_session_starttime;
$query->where('time > ' . $time);
} elseif ($config->show_session_type > 0) {
// Calculate Joomla session expiration point.
$time = JFactory::getDate()->toUnix() - $app->getCfg('lifetime', 15) * 60;
$query->where('time > ' . $time);
}
$db->setQuery($query);
self::$_online = (array) $db->loadObjectList('userid');
KunenaError::checkDatabaseError();
}
return self::$_online;
}