本文整理汇总了PHP中KunenaForumCategoryHelper::getLatestSubscriptions方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaForumCategoryHelper::getLatestSubscriptions方法的具体用法?PHP KunenaForumCategoryHelper::getLatestSubscriptions怎么用?PHP KunenaForumCategoryHelper::getLatestSubscriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaForumCategoryHelper
的用法示例。
在下文中一共展示了KunenaForumCategoryHelper::getLatestSubscriptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLastestCategories
public function getLastestCategories() {
if ( $this->items === false ) {
$this->items = array();
$user = KunenaFactory::getUser();
list($total,$categories) = KunenaForumCategoryHelper::getLatestSubscriptions($user->userid);
$this->items = $categories;
}
return $this->items;
}
示例2: before
/**
* Prepare category subscriptions display.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
$me = KunenaUserHelper::getMyself();
if (!$me->exists()) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 401);
}
$limit = $this->input->getInt('limit', 0);
if ($limit < 1 || $limit > 100) {
$limit = 20;
}
$limitstart = $this->input->getInt('limitstart', 0);
if ($limitstart < 0) {
$limitstart = 0;
}
list($total, $this->categories) = KunenaForumCategoryHelper::getLatestSubscriptions($me->userid);
$topicIds = array();
$userIds = array();
$postIds = array();
foreach ($this->categories as $category) {
// Get list of topics.
if ($category->last_topic_id) {
$topicIds[$category->last_topic_id] = $category->last_topic_id;
}
}
// Pre-fetch topics (also display unauthorized topics as they are in allowed categories).
$topics = KunenaForumTopicHelper::getTopics($topicIds, 'none');
// Pre-fetch users (and get last post ids for moderators).
foreach ($topics as $topic) {
$userIds[$topic->last_post_userid] = $topic->last_post_userid;
$postIds[$topic->id] = $topic->last_post_id;
}
KunenaUserHelper::loadUsers($userIds);
KunenaForumMessageHelper::getMessages($postIds);
// Pre-fetch user related stuff.
if ($me->exists() && !$me->isBanned()) {
// Load new topic counts.
KunenaForumCategoryHelper::getNewTopics(array_keys($this->categories));
}
$this->actions = $this->getActions();
$this->pagination = new JPagination($total, $limitstart, $limit);
$this->headerText = JText::_('COM_KUNENA_CATEGORY_SUBSCRIPTIONS');
}
示例3: unSubscribeCategory
/**
* Un-subscribe from a category
*
* @param string|int $catid Forum Category id
* @param UserTable $user Viewed at User
* @param PluginTable $plugin Current Plugin
* @return boolean Result
*/
public static function unSubscribeCategory($catid, $user, $plugin)
{
if (!class_exists('KunenaForumCategoryHelper')) {
return false;
}
if ($catid == 'all') {
$categories = KunenaForumCategoryHelper::getLatestSubscriptions((int) $user->id, 0, 0);
$ids = array_keys(array_pop($categories));
} else {
$ids = array((int) $catid);
}
if (!$ids || !KunenaForumCategoryHelper::subscribe($ids, 0, (int) $user->id)) {
return false;
}
return true;
}
示例4: unSubscribeCategory
/**
* Un-subscribe from a category
*
* @param string|int $catid Forum Category id
* @param UserTable $user Viewed at User
* @param PluginTable $plugin Current Plugin
* @return boolean Result
*/
static public function unSubscribeCategory( $catid, $user, /** @noinspection PhpUnusedParameterInspection */ $plugin )
{
if ( ! class_exists( 'KunenaForumCategoryHelper' ) ) {
return false;
}
if ( $catid == 'all' ) {
$categories = KunenaForumCategoryHelper::getLatestSubscriptions( (int) $user->id, 0, 0 );
$ids = array_keys( array_pop( $categories ) );
} else {
$ids = array( (int) $catid );
}
if ( ( ! $ids ) || ( ! KunenaForumCategoryHelper::subscribe( $ids, 0, (int) $user->id ) ) ) {
return false;
}
return true;
}