本文整理汇总了PHP中KunenaForumCategoryHelper::getSubscriptions方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaForumCategoryHelper::getSubscriptions方法的具体用法?PHP KunenaForumCategoryHelper::getSubscriptions怎么用?PHP KunenaForumCategoryHelper::getSubscriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaForumCategoryHelper
的用法示例。
在下文中一共展示了KunenaForumCategoryHelper::getSubscriptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCatsubcriptions
public function getCatsubcriptions()
{
$db = JFactory::getDBO();
$userid = $this->getState($this->getName() . '.id');
$subscatslist = KunenaForumCategoryHelper::getSubscriptions($userid);
return $subscatslist;
}
示例2: getCategories
public function getCategories()
{
if ($this->items === false) {
$this->items = array();
$catid = $this->getState('item.id');
$layout = $this->getState('layout');
$flat = false;
if ($layout == 'user') {
$categories[0] = KunenaForumCategoryHelper::getSubscriptions();
$flat = true;
} elseif ($catid) {
$categories[0] = KunenaForumCategoryHelper::getCategories($catid);
if (empty($categories[0])) {
return array();
}
} else {
$categories[0] = KunenaForumCategoryHelper::getChildren();
}
if ($flat) {
$allsubcats = $categories[0];
} else {
$allsubcats = KunenaForumCategoryHelper::getChildren(array_keys($categories[0]), 1);
}
if (empty($allsubcats)) {
return array();
}
KunenaForumCategoryHelper::getNewTopics(array_keys($allsubcats));
$modcats = array();
$lastpostlist = array();
$userlist = array();
$topiclist = array();
foreach ($allsubcats as $subcat) {
if ($flat || isset($categories[0][$subcat->parent_id])) {
$last = $subcat->getLastCategory();
if ($last->last_topic_id) {
// Get list of topics
$topiclist[$last->last_topic_id] = $last->last_topic_id;
}
if ($this->config->listcat_show_moderators) {
// Get list of moderators
$subcat->moderators = $subcat->getModerators(false, false);
$userlist += $subcat->moderators;
}
if ($this->me->isModerator($subcat)) {
$modcats[] = $subcat->id;
}
}
$categories[$subcat->parent_id][] = $subcat;
}
// Prefetch topics
$topics = KunenaForumTopicHelper::getTopics($topiclist);
foreach ($topics as $topic) {
// Prefetch users
$userlist[$topic->last_post_userid] = $topic->last_post_userid;
$lastpostlist[$topic->id] = $topic->last_post_id;
}
if ($this->me->ordering != 0) {
$topic_ordering = $this->me->ordering == 1 ? true : false;
} else {
$topic_ordering = $this->config->default_sort == 'asc' ? false : true;
}
$this->pending = array();
if ($this->me->userid && count($modcats)) {
$catlist = implode(',', $modcats);
$db = JFactory::getDBO();
$db->setQuery("SELECT catid, COUNT(*) AS count\n\t\t\t\tFROM #__kunena_messages\n\t\t\t\tWHERE catid IN ({$catlist}) AND hold=1\n\t\t\t\tGROUP BY catid");
$pending = $db->loadAssocList();
KunenaError::checkDatabaseError();
foreach ($pending as $item) {
if ($item['count']) {
$this->pending[$item['catid']] = $item['count'];
}
}
}
// Fix last post position when user can see unapproved or deleted posts
if ($lastpostlist && !$topic_ordering && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus())) {
KunenaForumMessageHelper::getMessages($lastpostlist);
KunenaForumMessageHelper::loadLocation($lastpostlist);
}
// Prefetch all users/avatars to avoid user by user queries during template iterations
KunenaUserHelper::loadUsers($userlist);
if ($flat) {
$this->items = $allsubcats;
} else {
$this->items = $categories;
}
}
return $this->items;
}