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


PHP KunenaForumTopicHelper::getTopics方法代码示例

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


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

示例1: getSubscriptions

	public function getSubscriptions()
	{
		$db     = JFactory::getDBO();
		$userid = $this->getState($this->getName() . '.id');

		$db->setQuery("SELECT topic_id AS thread FROM #__kunena_user_topics WHERE user_id='$userid' AND subscribed=1");
		$subslist = (array) $db->loadObjectList();

		if (KunenaError::checkDatabaseError())
		{
			return array();
		}

		$topic_list = array();

		if (!empty($subslist))
		{
			foreach ($subslist as $sub)
			{
				$topic_list[] = $sub->thread;
			}

			$topic_list = KunenaForumTopicHelper::getTopics($topic_list);
		}

		return $topic_list;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:27,代码来源:user.php

示例2: before

	/**
	 * Prepare user attachments list.
	 *
	 * @return void
	 */
	protected function before()
	{
		parent::before();

		$userid = $this->input->getInt('userid');
		$params = array('file' => '1', 'image' => '1', 'orderby' => 'desc', 'limit' => '30');

		$this->template = KunenaFactory::getTemplate();
		$this->me = KunenaUserHelper::getMyself();
		$this->profile = KunenaUserHelper::get($userid);
		$this->attachments = KunenaAttachmentHelper::getByUserid($this->profile, $params);

		// Pre-load messages.
		$messageIds = array();

		foreach ($this->attachments as $attachment)
		{
			$messageIds[] = (int) $attachment->mesid;
		}

		$messages = KunenaForumMessageHelper::getMessages($messageIds, 'none');

		// Pre-load topics.
		$topicIds = array();

		foreach ($messages as $message)
		{
			$topicIds[] = $message->thread;
		}

		KunenaForumTopicHelper::getTopics($topicIds, 'none');

		$this->headerText = JText::_('COM_KUNENA_MANAGE_ATTACHMENTS');
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:39,代码来源:display.php

示例3: 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');
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:50,代码来源:display.php

示例4: getPosts

	protected function getPosts() {
		$this->topics = array();

		$start = $this->getState ( 'list.start' );
		$limit = $this->getState ( 'list.limit' );
		$params = array();
		$params['mode'] = $this->getState ( 'list.mode' );
		$params['reverse'] = ! $this->getState ( 'list.categories.in' );
		$params['starttime'] = $this->getState ( 'list.time' );
		$params['user'] = $this->getState ( 'user' );
		list ($this->total, $this->messages) = KunenaForumMessageHelper::getLatestMessages($this->getState ( 'list.categories' ), $start, $limit, $params);

		$topicids = array();
		foreach ( $this->messages as $message ) {
			$topicids[$message->thread] = $message->thread;
		}
		$authorise = 'read';
		switch ($params['mode']) {
			case 'unapproved':
				$authorise = 'approve';
				break;
			case 'deleted':
				$authorise = 'undelete';
				break;
		}
		$this->topics = KunenaForumTopicHelper::getTopics ( $topicids, $authorise );
		$this->_common();
	}
开发者ID:rich20,项目名称:Kunena,代码行数:28,代码来源:topics.php

示例5: displayAttachments

 /**
  *
  */
 function displayAttachments()
 {
     $this->title = JText::_('COM_KUNENA_MANAGE_ATTACHMENTS');
     $this->items = $this->userattachs;
     if (!empty($this->userattachs)) {
         // Preload messages
         $attach_mesids = array();
         foreach ($this->userattachs as $attach) {
             $attach_mesids[] = (int) $attach->mesid;
         }
         $messages = KunenaForumMessageHelper::getMessages($attach_mesids, 'none');
         // Preload topics
         $topic_ids = array();
         foreach ($messages as $message) {
             $topic_ids[] = $message->thread;
         }
         KunenaForumTopicHelper::getTopics($topic_ids, 'none');
     }
     echo $this->loadTemplateFile('attachments');
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:23,代码来源:view.html.php

示例6: getResults

 public function getResults()
 {
     if ($this->messages !== false) {
         return $this->messages;
     }
     $q = $this->getState('searchwords');
     if (!$q && !$this->getState('query.searchuser')) {
         $this->setError(JText::_('COM_KUNENA_SEARCH_ERR_SHORTKEYWORD'));
         return array();
     }
     /* get results */
     $hold = $this->getState('query.show');
     if ($hold == 1) {
         $mode = 'unapproved';
     } elseif ($hold >= 2) {
         $mode = 'deleted';
     } else {
         $mode = 'recent';
     }
     $params = array('mode' => $mode, 'childforums' => $this->getState('query.childforums'), 'where' => $this->buildWhere(), 'orderby' => $this->buildOrderBy(), 'starttime' => -1);
     $limitstart = $this->getState('list.start');
     $limit = $this->getState('list.limit');
     list($this->total, $this->messages) = KunenaForumMessageHelper::getLatestMessages($this->getState('query.catids'), $limitstart, $limit, $params);
     if ($this->total < $limitstart) {
         $this->setState('list.start', intval($this->total / $limit) * $limit);
     }
     $topicids = array();
     $userids = array();
     foreach ($this->messages as $message) {
         $topicids[$message->thread] = $message->thread;
         $userids[$message->userid] = $message->userid;
     }
     if ($topicids) {
         $topics = KunenaForumTopicHelper::getTopics($topicids);
         foreach ($topics as $topic) {
             $userids[$topic->first_post_userid] = $topic->first_post_userid;
         }
     }
     KunenaUserHelper::loadUsers($userids);
     KunenaForumMessageHelper::loadLocation($this->messages);
     if (empty($this->messages)) {
         $this->app->enqueueMessage(JText::sprintf('COM_KUNENA_SEARCH_NORESULTS_FOUND', $q));
     }
     return $this->messages;
 }
开发者ID:sillysachin,项目名称:teamtogether,代码行数:45,代码来源:search.php

示例7: restore

 function restore()
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     $cid = JRequest::getVar('cid', array(), 'post', 'array');
     // Array of integers
     JArrayHelper::toInteger($cid);
     $type = JRequest::getCmd('type', 'topics', 'post');
     if (empty($cid)) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_A_NO_MESSAGES_SELECTED'), 'notice');
         $this->app->redirect(KunenaRoute::_($this->baseurl, false));
     }
     $nb_items = 0;
     if ($type == 'messages') {
         $messages = KunenaForumMessageHelper::getMessages($cid, 'none');
         foreach ($messages as $target) {
             if ($target->publish(KunenaForum::PUBLISHED)) {
                 $nb_items++;
             } else {
                 $this->app->enqueueMessage($target->getError(), 'notice');
             }
         }
     } elseif ($type == 'topics') {
         $topics = KunenaForumTopicHelper::getTopics($cid, 'none');
         foreach ($topics as $target) {
             if ($target->publish(KunenaForum::PUBLISHED)) {
                 $nb_items++;
             } else {
                 $this->app->enqueueMessage($target->getError(), 'notice');
             }
         }
     } else {
         // Error...
     }
     if ($nb_items > 0) {
         $this->app->enqueueMessage(JText::sprintf('COM_KUNENA_TRASH_ITEMS_RESTORE_DONE', $nb_items));
     }
     KunenaUserHelper::recount();
     KunenaForumTopicHelper::recount();
     KunenaForumCategoryHelper::recount();
     $this->app->redirect(KunenaRoute::_($this->baseurl, false));
 }
开发者ID:proyectoseb,项目名称:University,代码行数:44,代码来源:trash.php

示例8: unsubscribe

	function unsubscribe() {
		$app = JFactory::getApplication ();
		if (! JRequest::checkToken ()) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
			$this->redirectBack ();
		}

		$topics = KunenaForumTopicHelper::getTopics(array_keys(JRequest::getVar('topics', array ( 0 ), 'post', 'array')));
		if ( KunenaForumTopicHelper::subscribe(array_keys($topics), 0) ) {
			$app->enqueueMessage ( JText::_('COM_KUNENA_USER_UNSUBSCRIBE_YES') );
		} else {
			$app->enqueueMessage ( JText::_('COM_KUNENA_POST_NO_UNSUBSCRIBED_TOPIC') );
		}
		$this->redirectBack ();
	}
开发者ID:rich20,项目名称:Kunena,代码行数:15,代码来源:topics.php

示例9: getPurgeItems

 /**
  * Method to get details on selected items.
  *
  * @return	Array
  * @since	1.6
  */
 public function getPurgeItems()
 {
     $ids = $this->app->getUserState('com_kunena.purge');
     $topic = $this->app->getUserState('com_kunena.topic');
     $message = $this->app->getUserState('com_kunena.message');
     $ids = implode(',', $ids);
     if ($topic) {
         $items = KunenaForumTopicHelper::getTopics($ids);
     } elseif ($message) {
         $items = KunenaForumMessageHelper::getMessages($ids);
     } else {
     }
     return $items;
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:20,代码来源:trash.php

示例10: getByTopics

	static public function getByTopics($ids = false, $userid = 0)
	{
		$userid = (int) $userid;

		if ($ids === false)
		{
			$ids = array_keys(KunenaForumTopicHelper::getTopics());
		}
		elseif (is_array ($ids))
		{
			$ids = array_unique($ids);
		}
		else
		{
			$ids = array($ids);
			$single = true;
		}

		self::loadTopics($ids, $userid);

		$list = array ();

		if (isset($single))
		{
			$list = !empty(self::$_users [$userid][end($ids)]) ? self::$_users [$userid][end($ids)] : array();
		}
		else
		{
			foreach ( $ids as $id )
			{
				if (!empty(self::$_users [$userid][$id]))
				{
					$list [$id] = self::$_users [$userid][$id];
				}
			}
		}

		return $list;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:39,代码来源:helper.php

示例11: find

 /**
  * Get topics.
  *
  * @param  string  $access  Kunena action access control check.
  * @return array|KunenaForumTopic[]
  */
 public function find($access = 'read')
 {
     $results = parent::find();
     return KunenaForumTopicHelper::getTopics($results, $access);
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:11,代码来源:finder.php

示例12: unsubscribe

 function unsubscribe()
 {
     if (!JSession::checkToken('post')) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         $this->setRedirectBack();
         return;
     }
     $ids = array_keys(JRequest::getVar('topics', array(), 'post', 'array'));
     // Array of integer keys
     JArrayHelper::toInteger($ids);
     $topics = KunenaForumTopicHelper::getTopics($ids);
     if (KunenaForumTopicHelper::subscribe(array_keys($topics), 0)) {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_USER_UNSUBSCRIBE_YES'));
     } else {
         $this->app->enqueueMessage(JText::_('COM_KUNENA_POST_NO_UNSUBSCRIBED_TOPIC'));
     }
     $this->setRedirectBack();
 }
开发者ID:russelljuwai,项目名称:Kunena-Forum,代码行数:18,代码来源:topics.php

示例13: 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;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:89,代码来源:category.php

示例14: before

 /**
  * Prepare category index display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $this->me = KunenaUserHelper::getMyself();
     // Get sections to display.
     $catid = $this->input->getInt('catid', 0);
     if ($catid) {
         $sections = KunenaForumCategoryHelper::getCategories($catid);
     } else {
         $sections = KunenaForumCategoryHelper::getChildren();
     }
     $sectionIds = array();
     $this->more[$catid] = 0;
     foreach ($sections as $key => $category) {
         $this->categories[$category->id] = array();
         $this->more[$category->id] = 0;
         // Display only categories which are supposed to show up.
         if ($catid || $category->params->get('display.index.parent', 3) > 0) {
             if ($catid || $category->params->get('display.index.children', 3) > 1) {
                 $sectionIds[] = $category->id;
             } else {
                 $this->more[$category->id]++;
             }
         } else {
             $this->more[$category->parent_id]++;
             unset($sections[$key]);
             continue;
         }
     }
     // Get categories and subcategories.
     if (empty($sections)) {
         return;
     }
     $this->sections = $sections;
     $categories = KunenaForumCategoryHelper::getChildren($sectionIds);
     if (empty($categories)) {
         return;
     }
     $categoryIds = array();
     $topicIds = array();
     $userIds = array();
     $postIds = array();
     foreach ($categories as $key => $category) {
         $this->more[$category->id] = 0;
         // Display only categories which are supposed to show up.
         if ($catid || $category->params->get('display.index.parent', 3) > 1) {
             if ($catid || $category->getParent()->params->get('display.index.children', 3) > 2 && $category->params->get('display.index.children', 3) > 2) {
                 $categoryIds[] = $category->id;
             } else {
                 $this->more[$category->id]++;
             }
         } else {
             $this->more[$category->parent_id]++;
             unset($categories[$key]);
             continue;
         }
         // Get list of topics.
         $last = $category->getLastCategory();
         if ($last->last_topic_id) {
             $topicIds[$last->last_topic_id] = $last->last_topic_id;
         }
         $this->categories[$category->parent_id][] = $category;
         $rssURL = $category->getRSSUrl();
         if (!empty($rssURL)) {
             $category->rssURL = $category->getRSSUrl();
         }
     }
     $subcategories = KunenaForumCategoryHelper::getChildren($categoryIds);
     foreach ($subcategories as $category) {
         // Display only categories which are supposed to show up.
         if ($catid || $category->params->get('display.index.parent', 3) > 2) {
             $this->categories[$category->parent_id][] = $category;
         } else {
             $this->more[$category->parent_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.
     $this->pending = array();
     if ($this->me->exists() && !$this->me->isBanned()) {
         // Load new topic counts.
         KunenaForumCategoryHelper::getNewTopics(array_keys($categories + $subcategories));
         // Get categories which are moderated by current user.
         $access = KunenaAccess::getInstance();
         $moderate = $access->getAdminStatus($this->me) + $access->getModeratorStatus($this->me);
         if (!empty($moderate[0])) {
             // Global moderators.
//.........这里部分代码省略.........
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:101,代码来源:display.php

示例15: getPurgeItems

	/**
	 * Method to get details on selected items.
	 *
	 * @return	Array
	 * @since	1.6
	 */
	public function getPurgeItems() {
		kimport('kunena.error');

		$app = JFactory::getApplication ();

		$ids = $app->getUserState ( 'com_kunena.purge' );
		$topic = $app->getUserState('com_kunena.topic');
		$message = $app->getUserState('com_kunena.message');

		$ids = implode ( ',', $ids );

		if ( $topic ) {
			$items = KunenaForumTopicHelper::getTopics($ids);
		} elseif ( $message ) {
			$items = KunenaForumMessageHelper::getMessages($ids);
		} else {

		}

		return $items;
	}
开发者ID:rich20,项目名称:Kunena,代码行数:27,代码来源:trash.php


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