当前位置: 首页>>代码示例>>PHP>>正文


PHP KunenaUserHelper::getOnlineUsers方法代码示例

本文整理汇总了PHP中KunenaUserHelper::getOnlineUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaUserHelper::getOnlineUsers方法的具体用法?PHP KunenaUserHelper::getOnlineUsers怎么用?PHP KunenaUserHelper::getOnlineUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KunenaUserHelper的用法示例。


在下文中一共展示了KunenaUserHelper::getOnlineUsers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: before

 /**
  * Prepare Who is online display.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $this->config = KunenaConfig::getInstance();
     if (!$this->config->get('showwhoisonline')) {
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
     }
     $me = KunenaUserHelper::getMyself();
     $moderator = intval($me->isModerator()) + intval($me->isAdmin());
     $users = KunenaUserHelper::getOnlineUsers();
     KunenaUserHelper::loadUsers(array_keys($users));
     $onlineusers = KunenaUserHelper::getOnlineCount();
     $who = '<strong>' . $onlineusers['user'] . ' </strong>';
     if ($onlineusers['user'] == 1) {
         $who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBER') . '&nbsp;';
     } else {
         $who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBERS') . '&nbsp;';
     }
     $who .= JText::_('COM_KUNENA_WHO_AND');
     $who .= '<strong> ' . $onlineusers['guest'] . ' </strong>';
     if ($onlineusers['guest'] == 1) {
         $who .= JText::_('COM_KUNENA_WHO_ONLINE_GUEST') . '&nbsp;';
     } else {
         $who .= JText::_('COM_KUNENA_WHO_ONLINE_GUESTS') . '&nbsp;';
     }
     $who .= JText::_('COM_KUNENA_WHO_ONLINE_NOW');
     $this->membersOnline = $who;
     $this->onlineList = array();
     $this->hiddenList = array();
     foreach ($users as $userid => $usertime) {
         $user = KunenaUserHelper::get($userid);
         if (!$user->showOnline) {
             if ($moderator) {
                 $this->hiddenList[$user->getName()] = $user;
             }
         } else {
             $this->onlineList[$user->getName()] = $user;
         }
     }
     ksort($this->onlineList);
     ksort($this->hiddenList);
     $profile = KunenaFactory::getProfile();
     $this->usersUrl = $profile->getUserListURL();
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:51,代码来源:display.php

示例2: displayWhosonline

	function displayWhosonline($tpl = null) {
		$moderator = intval($this->me->isModerator());
		$cache = JFactory::getCache('com_kunena', 'output');
		if ($cache->start("{$this->template->name}.common.whosonline.{$moderator}", "com_kunena.template")) return;

		$this->my = JFactory::getUser();

		$users = KunenaUserHelper::getOnlineUsers();
		KunenaUserHelper::loadUsers(array_keys($users));
		$onlineusers = KunenaUserHelper::getOnlineCount();

		$who = '<strong>'.$onlineusers['user'].' </strong>';
		if($onlineusers['user']==1) {
			$who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBER').'&nbsp;';
		} else {
			$who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBERS').'&nbsp;';
		}
		$who .= JText::_('COM_KUNENA_WHO_AND');
		$who .= '<strong> '. $onlineusers['guest'].' </strong>';
		if($onlineusers['guest']==1) {
			$who .= JText::_('COM_KUNENA_WHO_ONLINE_GUEST').'&nbsp;';
		} else {
			$who .= JText::_('COM_KUNENA_WHO_ONLINE_GUESTS').'&nbsp;';
		}
		$who .= JText::_('COM_KUNENA_WHO_ONLINE_NOW');
		$this->membersOnline = $who;

		$this->onlineList = array();
		$this->hiddenList = array();
		foreach ($users as $userid=>$usertime) {
			$user = KunenaUserHelper::get($userid);
			if ( !$user->showOnline ) {
				if ($this->me->isModerator()) $this->hiddenList[$user->getName()] = $user;
			} else {
				$this->onlineList[$user->getName()] = $user;
			}
		}
		ksort($this->onlineList);
		ksort($this->hiddenList);

		$this->usersURL = KunenaRoute::_('index.php?option=com_kunena&view=user&layout=list');

		$result = $this->loadTemplate($tpl);
		if (JError::isError($result)) {
			return $result;
		}
		echo $result;
		$cache->end();
	}
开发者ID:rich20,项目名称:Kunena,代码行数:49,代码来源:view.html.php


注:本文中的KunenaUserHelper::getOnlineUsers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。