/** * @param int $limit * * @return array */ public function loadTopPosters($limit = 0) { $limit = $limit ? $limit : $this->_config->popusercount; if (count($this->topPosters) < $limit) { $this->topPosters = KunenaUserHelper::getTopPosters($limit); $top = reset($this->topPosters); if (!$top) { return array(); } $top->title = JText::_('COM_KUNENA_LIB_STAT_TOP_POSTERS'); $top->titleName = JText::_('COM_KUNENA_USERNAME'); $top->titleCount = JText::_('COM_KUNENA_USRL_POSTS'); foreach ($this->topPosters as &$item) { $item = clone $item; $item->link = KunenaUserHelper::get($item->id)->getLink(); $item->percent = round(100 * $item->count / $top->count); } } return array_slice($this->topPosters, 0, $limit); }
public function loadTopPosters($limit=0) { $limit = $limit ? $limit : $this->_config->popusercount; if (count($this->topPosters) < $limit) { $this->topPosters = KunenaUserHelper::getTopPosters($limit); $top = reset($this->topPosters); if (empty($top->count)) { $this->topPosters = array(); return; } foreach ($this->topPosters as $item) { $item->link = CKunenaLink::GetProfileLink($item->id); $item->percent = round(100 * $item->count / $top->count); } $top->title = JText::_('COM_KUNENA_STAT_TOP') .' '. $limit .' '. JText::_('COM_KUNENA_STAT_POPULAR') .' '. JText::_('COM_KUNENA_STAT_POPULAR_USER_TMSG'); $top->titleName = JText::_('COM_KUNENA_USRL_USERNAME'); $top->titleCount = JText::_('COM_KUNENA_USRL_POSTS'); } return array_slice($this->topPosters, 0, $limit); }