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


PHP KunenaForumTopicHelper::getLatestTopics方法代码示例

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


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

示例1: before

 /**
  * Prepare category display.
  *
  * @return void
  *
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     require_once KPATH_SITE . '/models/category.php';
     $this->model = new KunenaModelCategory();
     $this->me = KunenaUserHelper::getMyself();
     $catid = $this->input->getInt('catid');
     $limitstart = $this->input->getInt('limitstart', 0);
     $limit = $this->input->getInt('limit', 0);
     if ($limit < 1 || $limit > 100) {
         $limit = $this->config->threads_per_page;
     }
     // TODO:
     $direction = 'DESC';
     $this->category = KunenaForumCategoryHelper::get($catid);
     $this->category->tryAuthorise();
     $this->headerText = JText::_('COM_KUNENA_THREADS_IN_FORUM') . ': ' . $this->category->name;
     $topic_ordering = $this->category->topic_ordering;
     $access = KunenaAccess::getInstance();
     $hold = $access->getAllowedHold($this->me, $catid);
     $moved = 1;
     $params = array('hold' => $hold, 'moved' => $moved);
     switch ($topic_ordering) {
         case 'alpha':
             $params['orderby'] = 'tt.ordering DESC, tt.subject ASC ';
             break;
         case 'creation':
             $params['orderby'] = 'tt.ordering DESC, tt.first_post_time ' . $direction;
             break;
         case 'lastpost':
         default:
             $params['orderby'] = 'tt.ordering DESC, tt.last_post_time ' . $direction;
     }
     list($this->total, $this->topics) = KunenaForumTopicHelper::getLatestTopics($catid, $limitstart, $limit, $params);
     if ($this->total > 0) {
         // Collect user ids for avatar prefetch when integrated.
         $userlist = array();
         $lastpostlist = array();
         foreach ($this->topics as $topic) {
             $userlist[intval($topic->first_post_userid)] = intval($topic->first_post_userid);
             $userlist[intval($topic->last_post_userid)] = intval($topic->last_post_userid);
             $lastpostlist[intval($topic->last_post_id)] = intval($topic->last_post_id);
         }
         // Prefetch all users/avatars to avoid user by user queries during template iterations.
         if (!empty($userlist)) {
             KunenaUserHelper::loadUsers($userlist);
         }
         KunenaForumTopicHelper::getUserTopics(array_keys($this->topics));
         KunenaForumTopicHelper::getKeywords(array_keys($this->topics));
         $lastreadlist = KunenaForumTopicHelper::fetchNewStatus($this->topics);
         // Fetch last / new post positions when user can see unapproved or deleted posts.
         if ($lastreadlist || $this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus()) {
             KunenaForumMessageHelper::loadLocation($lastpostlist + $lastreadlist);
         }
     }
     $this->topicActions = $this->model->getTopicActions();
     $this->actionMove = $this->model->getActionMove();
     $this->pagination = new KunenaPagination($this->total, $limitstart, $limit);
     $this->pagination->setDisplayedPages(5);
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:67,代码来源:display.php

示例2: getTopicOptions

	/**
	 * Method to get the options of the topic
	 *
	 * @return array
	 */
	public function getTopicOptions()
	{
		$options = array();

		// Start with default options.
		if (!$this->message)
		{
			$options[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_MOVE_TOPIC'));
		}
		else
		{
			$options[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_CREATE_TOPIC'));
		}

		$options[] = JHtml::_('select.option', -1, JText::_('COM_KUNENA_MODERATION_ENTER_TOPIC'));

		// Then list a few topics.
		$db     = JFactory::getDbo();
		$params = array(
			'orderby' => 'tt.last_post_time DESC',
			'where'   => " AND tt.id != {$db->Quote($this->topic->id)} ");
		list ($total, $topics) = KunenaForumTopicHelper::getLatestTopics($this->category->id, 0, 30, $params);

		foreach ($topics as $topic)
		{
			$options[] = JHtml::_('select.option', $topic->id, $this->escape($topic->subject));
		}

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

示例3: testGetTopics

	/**
	 * Test getTopics()
	 */
	public function testGetTopics() {
		list($count, $topics) = KunenaForumTopicHelper::getLatestTopics(false, 0, 20);
		$topicusers = KunenaForumTopicUserHelper::getTopics($topics);
		foreach ($topics as $topic) {
			$this->assertTrue(isset($topicusers[$topic->id]));
			$this->assertEquals($topic->id, $topicusers[$topic->id]->topic_id);
		}
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:11,代码来源:KunenaForumTopicUserHelperTest.php

示例4: testNew

	/**
	 * Test new KunenaForumTopicUser()
	 */
	public function testNew() {
		$admin = KunenaFactory::getUser('admin');
		list($count, $topics) = KunenaForumTopicHelper::getLatestTopics(false, 0, 1);
		self::$topic = reset($topics);
		$topicuser = new KunenaForumTopicUser(self::$topic->id, $admin);
		$this->assertInstanceOf('KunenaForumTopicUser', $topicuser);
		$this->assertFalse($topicuser->exists());
		$this->assertEquals(self::$topic->id, $topicuser->topic_id);
		$this->assertEquals($admin->userid, $topicuser->user_id);
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:13,代码来源:KunenaForumTopicUserTest.php

示例5: doprune

	function doprune() {
		$app = JFactory::getApplication ();
		if (!JRequest::checkToken()) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
			$this->setRedirect(KunenaRoute::_($this->baseurl, false));
			return;
		}
		$category = KunenaForumCategoryHelper::get(JRequest::getInt ( 'prune_forum', 0 ));
		if (!$category->authorise('admin')) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_CHOOSEFORUMTOPRUNE' ), 'error' );
			$this->setRedirect(KunenaRoute::_($this->baseurl, false));
			return;
		}

		// Convert days to seconds for timestamp functions...
		$prune_days = JRequest::getInt ( 'prune_days', 36500 );
		$prune_date = JFactory::getDate()->toUnix() - ($prune_days * 86400);

		$trashdelete = JRequest::getInt( 'trashdelete', 0);

		// Get up to 100 oldest topics to be deleted
		$params = array(
			'orderby'=>'tt.last_post_time ASC',
			'where'=>"AND tt.last_post_time<{$prune_date} AND ordering=0",
		);
		list($count, $topics) = KunenaForumTopicHelper::getLatestTopics($category->id, 0, 100, $params);
		$deleted = 0;
		foreach ( $topics as $topic ) {
			$deleted++;
			if ( $trashdelete ) $topic->delete(false);
			else $topic->trash();
		}
		KunenaUserHelper::recount();
		KunenaForumCategoryHelper::recount();
		KunenaForumMessageAttachmentHelper::cleanup();
		if ( $trashdelete ) $app->enqueueMessage ( "" . JText::_('COM_KUNENA_FORUMPRUNEDFOR') . " " . $prune_days . " " . JText::_('COM_KUNENA_PRUNEDAYS') . "; " . JText::_('COM_KUNENA_PRUNEDELETED') . " {$deleted}/{$count} " . JText::_('COM_KUNENA_PRUNETHREADS') );
		else $app->enqueueMessage ( "" . JText::_('COM_KUNENA_FORUMPRUNEDFOR') . " " . $prune_days . " " . JText::_('COM_KUNENA_PRUNEDAYS') . "; " . JText::_('COM_KUNENA_PRUNETRASHED') . " {$deleted}/{$count} " . JText::_('COM_KUNENA_PRUNETHREADS') );
		$this->setRedirect(KunenaRoute::_($this->baseurl, false));
	}
开发者ID:rich20,项目名称:Kunena,代码行数:39,代码来源:prune.php

示例6: getTopicsItems

	/**
	 * Method to get all deleted topics.
	 *
	 * @return	Array
	 * @since	1.6
	 */
	public function getTopicsItems() {
		/*$db = JFactory::getDBO ();
		$where = '';
		if ($this->getState ( 'list.search')) {
			$where = ' AND LOWER( subject ) LIKE '.$db->Quote( '%'.$db->getEscaped( $this->getState ( 'list.search'), true ).'%', false ).' OR LOWER( username )LIKE '.$db->Quote( '%'.$db->getEscaped( $this->getState ( 'list.search'), true ).'%', false ).' OR id LIKE '.$db->Quote( '%'.$db->getEscaped( $this->getState ( 'list.search'), true ).'%', false );
		}*/

		$cats = KunenaForumCategoryHelper::getCategories();
		$cats_array =array();
		foreach ($cats as $cat) {
			if ( $cat->id ) $cats_array[] = $cat->id;
		}
		list($total,$topics) = KunenaForumTopicHelper::getLatestTopics ( $cats_array, $this->getState('list.start'), $this->getState('list.limit'), array ('hold' => '2,3') );
		$this->setState ( 'list.total', $total );

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

示例7: getUserTopics

	protected function getUserTopics() {
		$catid = $this->getState ( 'item.id' );
		$limitstart = $this->getState ( 'list.start' );
		$limit = $this->getState ( 'list.limit' );

		$latestcategory = $this->getState ( 'list.categories' );
		$latestcategory_in = $this->getState ( 'list.categories.in' );

		$started = false;
		$posts = false;
		$favorites = false;
		$subscriptions = false;
		// Set order by
		$orderby = "tt.last_post_time DESC";
		switch ($this->getState ( 'list.mode' )) {
			case 'posted' :
				$posts = true;
				$orderby = "ut.last_post_id DESC";
				break;
			case 'started' :
				$started = true;
				break;
			case 'favorites' :
				$favorites = true;
				break;
			case 'subscriptions' :
				$subscriptions = true;
				break;
			default :
				$posts = true;
				$favorites = true;
				$subscriptions = true;
				$orderby = "ut.favorite DESC, tt.last_post_time DESC";
				break;
		}

		$params = array (
			'reverse' => ! $latestcategory_in,
			'orderby' => $orderby,
			'hold' => 0,
			'user' => $this->getState ( 'user' ),
			'started' => $started,
			'posted' => $posts,
			'favorited' => $favorites,
			'subscribed' => $subscriptions );

		list ( $this->total, $this->topics ) = KunenaForumTopicHelper::getLatestTopics ( $latestcategory, $limitstart, $limit, $params );
		$this->_common ();
	}
开发者ID:rich20,项目名称:Kunena,代码行数:49,代码来源:topics.php

示例8: displayModerate

 protected function displayModerate($tpl = null)
 {
     $this->mesid = JRequest::getInt('mesid', 0);
     $this->id = $this->state->get('item.id');
     $this->catid = $this->state->get('item.catid');
     if ($this->config->topicicons) {
         $this->topicIcons = $this->ktemplate->getTopicIcons(false);
     }
     if (!$this->mesid) {
         $this->topic = KunenaForumTopicHelper::get($this->id);
         if (!$this->topic->authorise('move')) {
             $this->app->enqueueMessage($this->topic->getError(), 'notice');
             return;
         }
     } else {
         $this->message = KunenaForumMessageHelper::get($this->mesid);
         if (!$this->message->authorise('move')) {
             $this->app->enqueueMessage($this->message->getError(), 'notice');
             return;
         }
         $this->topic = $this->message->getTopic();
     }
     $this->category = $this->topic->getCategory();
     $options = array();
     if (!$this->mesid) {
         $options[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_MOVE_TOPIC'));
     } else {
         $options[] = JHtml::_('select.option', 0, JText::_('COM_KUNENA_MODERATION_CREATE_TOPIC'));
     }
     $options[] = JHtml::_('select.option', -1, JText::_('COM_KUNENA_MODERATION_ENTER_TOPIC'));
     $db = JFactory::getDBO();
     $params = array('orderby' => 'tt.last_post_time DESC', 'where' => " AND tt.id != {$db->Quote($this->topic->id)} ");
     list($total, $topics) = KunenaForumTopicHelper::getLatestTopics($this->catid, 0, 30, $params);
     foreach ($topics as $cur) {
         $options[] = JHtml::_('select.option', $cur->id, $this->escape($cur->subject));
     }
     $this->topiclist = JHtml::_('select.genericlist', $options, 'targettopic', 'class="inputbox"', 'value', 'text', 0, 'kmod_topics');
     $options = array();
     $cat_params = array('sections' => 0, 'catid' => 0);
     $this->categorylist = JHtml::_('kunenaforum.categorylist', 'targetcategory', 0, $options, $cat_params, 'class="inputbox kmove_selectbox"', 'value', 'text', $this->catid, 'kmod_categories');
     if (isset($this->message)) {
         $this->user = KunenaFactory::getUser($this->message->userid);
         $username = $this->message->getAuthor()->getName();
         $this->userLink = $this->message->userid ? JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=user&layout=moderate&userid=' . $this->message->userid, $username . ' (' . $this->message->userid . ')', $username . ' (' . $this->message->userid . ')') : null;
     }
     if ($this->mesid) {
         // Get thread and reply count from current message:
         $query = "SELECT COUNT(mm.id) AS replies FROM #__kunena_messages AS m\r\n\t\t\t\tINNER JOIN #__kunena_messages AS t ON m.thread=t.id\r\n\t\t\t\tLEFT JOIN #__kunena_messages AS mm ON mm.thread=m.thread AND mm.time > m.time\r\n\t\t\t\tWHERE m.id={$db->Quote($this->mesid)}";
         $db->setQuery($query, 0, 1);
         $this->replies = $db->loadResult();
         if (KunenaError::checkDatabaseError()) {
             return;
         }
     }
     $this->render('Topic/Moderate', $tpl);
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:56,代码来源:view.html.php

示例9: getCategoryTree

 static function getCategoryTree($xmap, $parent, &$params, $parentCat)
 {
     $db = JFactory::getDBO();
     // Load categories
     if (self::getKunenaMajorVersion() >= '2.0') {
         // Kunena 2.0+
         $catlink = 'index.php?option=com_kunena&view=category&catid=%s&Itemid=' . $parent->id;
         $toplink = 'index.php?option=com_kunena&view=topic&catid=%s&id=%s&Itemid=' . $parent->id;
         // kimport('kunena.forum.category.helper');
         $categories = KunenaForumCategoryHelper::getChildren($parentCat);
     } else {
         $catlink = 'index.php?option=com_kunena&func=showcat&catid=%s&Itemid=' . $parent->id;
         $toplink = 'index.php?option=com_kunena&func=view&catid=%s&id=%s&Itemid=' . $parent->id;
         if (self::getKunenaMajorVersion() >= '1.6') {
             // Kunena 1.6+
             kimport('session');
             $session = KunenaFactory::getSession();
             $session->updateAllowedForums();
             $allowed = $session->allowed;
             $query = "SELECT id, name FROM `#__kunena_categories` WHERE parent={$parentCat} AND id IN ({$allowed}) ORDER BY ordering";
         } else {
             // Kunena 1.0+
             $query = "SELECT id, name FROM `{$params['table_prefix']}_categories` WHERE parent={$parentCat} AND published=1 AND pub_access=0 ORDER BY ordering";
         }
         $db->setQuery($query);
         $categories = $db->loadObjectList();
     }
     /* get list of categories */
     $xmap->changeLevel(1);
     foreach ($categories as $cat) {
         $node = new stdclass();
         $node->id = $parent->id;
         $node->browserNav = $parent->browserNav;
         $node->uid = 'com_kunenac' . $cat->id;
         $node->name = $cat->name;
         $node->priority = $params['cat_priority'];
         $node->changefreq = $params['cat_changefreq'];
         $node->link = sprintf($catlink, $cat->id);
         $node->expandible = true;
         $node->secure = $parent->secure;
         if ($xmap->printNode($node) !== FALSE) {
             xmap_com_kunena::getCategoryTree($xmap, $parent, $params, $cat->id);
         }
     }
     if ($params['include_topics']) {
         if (self::getKunenaMajorVersion() >= '2.0') {
             // Kunena 2.0+
             // kimport('kunena.forum.topic.helper');
             // TODO: orderby parameter is missing:
             $topics = KunenaForumTopicHelper::getLatestTopics($parentCat, 0, $params['limit'], array('starttime', $params['days']));
             if (count($topics) == 2 && is_numeric($topics[0])) {
                 $topics = $topics[1];
             }
         } else {
             $access = KunenaFactory::getAccessControl();
             $hold = $access->getAllowedHold(self::$profile, $parentCat);
             // Kunena 1.0+
             $query = "SELECT t.id, t.catid, t.subject, max(m.time) as time, count(m.id) as msgcount\n                    FROM {$params['table_prefix']}_messages t\n                    INNER JOIN {$params['table_prefix']}_messages AS m ON t.id = m.thread\n                    WHERE t.catid={$parentCat} AND t.parent=0\n                    AND t.hold in ({$hold})\n                    GROUP BY m.`thread`\n                    ORDER BY {$params['topics_order']} DESC";
             if ($params['days']) {
                 $query = "SELECT * FROM ({$query}) as topics WHERE time >= {$params['days']}";
             }
             #echo str_replace('#__','mgbj2_',$query);
             $db->setQuery($query, 0, $params['limit']);
             $topics = $db->loadObjectList();
         }
         //get list of topics
         foreach ($topics as $topic) {
             $node = new stdclass();
             $node->id = $parent->id;
             $node->browserNav = $parent->browserNav;
             $node->uid = 'com_kunenat' . $topic->id;
             $node->name = $topic->subject;
             $node->priority = $params['topic_priority'];
             $node->changefreq = $params['topic_changefreq'];
             $node->modified = intval(@$topic->last_post_time ? $topic->last_post_time : $topic->time);
             $node->link = sprintf($toplink, @$topic->category_id ? $topic->category_id : $topic->catid, $topic->id);
             $node->expandible = false;
             $node->secure = $parent->secure;
             if ($xmap->printNode($node) !== FALSE) {
                 // Pagination will not work with K2.0, revisit this when that version is out and stable
                 if ($params['include_pagination'] && isset($topic->msgcount) && $topic->msgcount > self::$config->messages_per_page) {
                     $msgPerPage = self::$config->messages_per_page;
                     $threadPages = ceil($topic->msgcount / $msgPerPage);
                     for ($i = 2; $i <= $threadPages; $i++) {
                         $subnode = new stdclass();
                         $subnode->id = $node->id;
                         $subnode->uid = $node->uid . 'p' . $i;
                         $subnode->name = "[{$i}]";
                         $subnode->seq = $i;
                         $subnode->link = $node->link . '&limit=' . $msgPerPage . '&limitstart=' . ($i - 1) * $msgPerPage;
                         $subnode->browserNav = $node->browserNav;
                         $subnode->priority = $node->priority;
                         $subnode->changefreq = $node->changefreq;
                         $subnode->modified = $node->modified;
                         $subnode->secure = $node->secure;
                         $xmap->printNode($subnode);
                     }
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:jooservices,项目名称:Crexmap,代码行数:101,代码来源:com_kunena.php

示例10: getTopics

 public function getTopics()
 {
     if ($this->topics === false) {
         $catid = $this->getState('item.id');
         $limitstart = $this->getState('list.start');
         $limit = $this->getState('list.limit');
         $format = $this->getState('format');
         $topic_ordering = $this->getCategory()->topic_ordering;
         $access = KunenaAccess::getInstance();
         $hold = $format == 'feed' ? 0 : $access->getAllowedHold($this->me, $catid);
         $moved = $format == 'feed' ? 0 : 1;
         $params = array('hold' => $hold, 'moved' => $moved);
         switch ($topic_ordering) {
             case 'alpha':
                 $params['orderby'] = 'tt.ordering DESC, tt.subject ASC ';
                 break;
             case 'creation':
                 $params['orderby'] = 'tt.ordering DESC, tt.first_post_time ' . strtoupper($this->getState('list.direction'));
                 break;
             case 'lastpost':
             default:
                 $params['orderby'] = 'tt.ordering DESC, tt.last_post_time ' . strtoupper($this->getState('list.direction'));
         }
         if ($format == 'feed') {
             $catid = array_keys(KunenaForumCategoryHelper::getChildren($catid, 100) + array($catid => 1));
         }
         list($this->total, $this->topics) = KunenaForumTopicHelper::getLatestTopics($catid, $limitstart, $limit, $params);
         if ($this->total > 0) {
             // collect user ids for avatar prefetch when integrated
             $userlist = array();
             $lastpostlist = array();
             foreach ($this->topics as $topic) {
                 $userlist[intval($topic->first_post_userid)] = intval($topic->first_post_userid);
                 $userlist[intval($topic->last_post_userid)] = intval($topic->last_post_userid);
                 $lastpostlist[intval($topic->last_post_id)] = intval($topic->last_post_id);
             }
             // Prefetch all users/avatars to avoid user by user queries during template iterations
             if (!empty($userlist)) {
                 KunenaUserHelper::loadUsers($userlist);
             }
             KunenaForumTopicHelper::getUserTopics(array_keys($this->topics));
             KunenaForumTopicHelper::getKeywords(array_keys($this->topics));
             $lastreadlist = KunenaForumTopicHelper::fetchNewStatus($this->topics);
             // Fetch last / new post positions when user can see unapproved or deleted posts
             if (($lastpostlist || $lastreadlist) && ($this->me->isAdmin() || KunenaAccess::getInstance()->getModeratorStatus())) {
                 KunenaForumMessageHelper::loadLocation($lastpostlist + $lastreadlist);
             }
         }
     }
     return $this->topics;
 }
开发者ID:madcsaba,项目名称:li-de,代码行数:51,代码来源:category.php

示例11: topics

	/**
	 * @return array
	 */
	public function topics()
	{
		$options			=	array();

		if ( $this->installed() ) {
			$rows			=	KunenaForumTopicHelper::getLatestTopics();

			if ( $rows[1] ) foreach ( $rows[1] as $row ) {
				$options[]	=	moscomprofilerHTML::makeOption( (string) $row->id, $row->subject );
			}
		}

		return $options;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:17,代码来源:kunena.php

示例12: displayModerate

	protected function displayModerate($tpl = null) {
		$this->mesid = JRequest::getInt('mesid', 0);
		$this->id = $this->state->get('item.id');
		$this->catid = $this->state->get('item.catid');
		$this->config = KunenaFactory::getConfig();
		$app = JFactory::getApplication();

		if (!$this->mesid) {
			$this->topic = KunenaForumTopicHelper::get($this->id);
			if (!$this->topic->authorise('move')) {
				$app->enqueueMessage ( $this->topic->getError(), 'notice' );
				return;
			}
		} else {
			$this->message = KunenaForumMessageHelper::get($this->mesid);
			if (!$this->message->authorise('move')) {
				$app->enqueueMessage ( $this->message->getError(), 'notice' );
				return;
			}
			$this->topic = $this->message->getTopic();
		}
		$this->category = $this->topic->getCategory();

		$options =array ();
		if (!$this->mesid) {
			$options [] = JHTML::_ ( 'select.option', 0, JText::_ ( 'COM_KUNENA_MODERATION_MOVE_TOPIC' ) );
		} else {
			$options [] = JHTML::_ ( 'select.option', 0, JText::_ ( 'COM_KUNENA_MODERATION_CREATE_TOPIC' ) );
		}
		$options [] = JHTML::_ ( 'select.option', -1, JText::_ ( 'COM_KUNENA_MODERATION_ENTER_TOPIC' ) );

		$db = JFactory::getDBO();
		$params = array(
			'orderby'=>'tt.last_post_time DESC',
			'where'=>" AND tt.id != {$db->Quote($this->topic->id)} ");
		list ($total, $topics) = KunenaForumTopicHelper::getLatestTopics($this->catid, 0, 30, $params);
		foreach ( $topics as $cur ) {
			$options [] = JHTML::_ ( 'select.option', $cur->id, $this->escape ( $cur->subject ) );
		}
		$this->topiclist = JHTML::_ ( 'select.genericlist', $options, 'targettopic', 'class="inputbox"', 'value', 'text', 0, 'kmod_topics' );

		$options = array ();
		$cat_params = array ('sections'=>0, 'catid'=>0);
		$this->assignRef ( 'categorylist', JHTML::_('kunenaforum.categorylist', 'targetcategory', 0, $options, $cat_params, 'class="inputbox kmove_selectbox"', 'value', 'text', $this->catid, 'kmod_categories'));
		if (isset($this->message)) $this->user = KunenaFactory::getUser($this->message->userid);

		if ($this->mesid) {
			// Get thread and reply count from current message:
			$query = "SELECT COUNT(mm.id) AS replies FROM #__kunena_messages AS m
				INNER JOIN #__kunena_messages AS t ON m.thread=t.id
				LEFT JOIN #__kunena_messages AS mm ON mm.thread=m.thread AND mm.id > m.id
				WHERE m.id={$db->Quote($this->mesid)}";
			$db->setQuery ( $query, 0, 1 );
			$this->replies = $db->loadResult ();
			if (KunenaError::checkDatabaseError()) return;
		}

		$this->display($tpl);
	}
开发者ID:rich20,项目名称:Kunena,代码行数:59,代码来源:view.html.php

示例13: unSubscribe

 /**
  * Un-subscribe from a topic
  *
  * @param  string|int   $postid  Forum Post id
  * @param  UserTable    $user    Viewed at User
  * @param  PluginTable  $plugin  Current Plugin
  * @return boolean               Result
  */
 public static function unSubscribe($postid, $user, $plugin)
 {
     if (!class_exists('KunenaForumTopicHelper')) {
         return false;
     }
     if ($postid == 'all') {
         $topics = KunenaForumTopicHelper::getLatestTopics(false, 0, 0, array('user' => (int) $user->id, 'subscribed' => true));
         $ids = array_keys(array_pop($topics));
     } else {
         $ids = array((int) $postid);
     }
     if (!$ids || !KunenaForumTopicHelper::subscribe($ids, 0, (int) $user->id)) {
         return false;
     }
     return true;
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:24,代码来源:kunena20.php

示例14: getTopics

 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  * @param int $catid
  */
 private static function getTopics($xmap, stdClass $parent, array &$params, $catid)
 {
     self::getCategoryTree($xmap, $parent, $params, $catid);
     if (!$params['include_topics']) {
         return;
     }
     /** @var KunenaForumTopic[] $topics */
     $topics = KunenaForumTopicHelper::getLatestTopics($catid, 0, $params['limit'], array('nolimit' => true, 'starttime' => $params['days']));
     $topics = $topics[1];
     if (empty($topics)) {
         return;
     }
     $xmap->changeLevel(1);
     foreach ($topics as $topic) {
         $node = new stdClass();
         $node->id = $parent->id;
         $node->browserNav = $parent->browserNav;
         $node->uid = $parent->uid . '_t_' . $topic->id;
         $node->name = $topic->subject;
         $node->priority = $params['topic_priority'];
         $node->changefreq = $params['topic_changefreq'];
         $node->modified = $topic->last_post_time;
         $node->link = 'index.php?option=com_kunena&view=topic&catid=' . $topic->category_id . '&id=' . $topic->id;
         $node->secure = $parent->secure;
         if ($xmap->printNode($node) && $params['include_pagination']) {
             $msgPerPage = KunenaFactory::getConfig()->get('messages_per_page');
             $threadPages = ceil($topic->getTotal() / $msgPerPage);
             if ($threadPages > 1) {
                 $xmap->changeLevel(1);
                 for ($i = 2; $i <= $threadPages; $i++) {
                     $subnode = new stdClass();
                     $subnode->id = $node->id;
                     $subnode->uid = $node->uid . '_p_' . $i;
                     $subnode->name = '[' . $i . ']';
                     $subnode->link = $node->link . '&limitstart=' . ($i - 1) * $msgPerPage;
                     $subnode->browserNav = $node->browserNav;
                     $subnode->priority = $node->priority;
                     $subnode->changefreq = $node->changefreq;
                     $subnode->modified = $node->modified;
                     $subnode->secure = $node->secure;
                     $xmap->printNode($subnode);
                 }
                 $xmap->changeLevel(-1);
             }
         }
     }
     $xmap->changeLevel(-1);
 }
开发者ID:b2un0,项目名称:joomla-plugin-xmap-kunena,代码行数:54,代码来源:com_kunena.php

示例15: getUserFavorites

 /**
  * Puts users subscription posts into object
  *
  * @param moscomprofilerUser $user
  * @param object             $forum
  * @return object
  */
 function getUserFavorites($user, $forum)
 {
     global $_CB_database;
     $pagingParams = $this->_getPaging(array(), array('ffavs_'));
     $postsNumber = $this->params->get('postsNumber', 10);
     if ($forum->prefix != 'kunena' || $forum->prefix == 'kunena' && !class_exists('KunenaForum')) {
         switch ($pagingParams['ffavs_sortby']) {
             case 'subjectASC':
                 $order = 'a.' . $_CB_database->NameQuote('subject') . ' ASC';
                 break;
             case 'subjectDESC':
                 $order = 'a.' . $_CB_database->NameQuote('subject') . ' DESC';
                 break;
             case 'categoryASC':
                 $order = 'b.' . $_CB_database->NameQuote('id') . ' ASC';
                 break;
             case 'categoryDESC':
                 $order = 'b.' . $_CB_database->NameQuote('id') . ' DESC';
                 break;
             case 'dateASC':
                 $order = 'a.' . $_CB_database->NameQuote('time') . ' ASC';
                 break;
             case 'dateDESC':
             default:
                 $order = 'a.' . $_CB_database->NameQuote('time') . ' DESC';
                 break;
         }
         $query = 'SELECT a.*' . ', b.' . $_CB_database->NameQuote('name') . ' AS catname' . "\n FROM " . $_CB_database->NameQuote('#__' . $forum->prefix . '_messages') . ' AS a' . ', ' . $_CB_database->NameQuote('#__' . $forum->prefix . '_categories') . ' AS b' . ', ' . $_CB_database->NameQuote('#__' . $forum->prefix . '_favorites') . ' AS s' . "\n WHERE a." . $_CB_database->NameQuote('id') . ' = s.' . $_CB_database->NameQuote('thread') . "\n AND a." . $_CB_database->NameQuote('catid') . ' = b.' . $_CB_database->NameQuote('id') . "\n AND s." . $_CB_database->NameQuote('userid') . ' = ' . (int) $user->id . "\n ORDER BY " . $order;
         $_CB_database->setQuery($query, (int) ($pagingParams['ffavs_limitstart'] ? $pagingParams['ffavs_limitstart'] : 0), (int) $postsNumber);
         $favs = $_CB_database->loadObjectList();
     } elseif (class_exists('KunenaForumTopicHelper')) {
         switch ($pagingParams['ffavs_sortby']) {
             case 'subjectASC':
                 $order = 'tt.' . $_CB_database->NameQuote('subject') . ' ASC';
                 break;
             case 'subjectDESC':
                 $order = 'tt.' . $_CB_database->NameQuote('subject') . ' DESC';
                 break;
             case 'categoryASC':
                 $order = 'tt.' . $_CB_database->NameQuote('category_id') . ' ASC';
                 break;
             case 'categoryDESC':
                 $order = 'tt.' . $_CB_database->NameQuote('category_id') . ' DESC';
                 break;
             case 'dateASC':
                 $order = 'tt.' . $_CB_database->NameQuote('first_post_time') . ' ASC';
                 break;
             case 'dateDESC':
             default:
                 $order = 'tt.' . $_CB_database->NameQuote('first_post_time') . ' DESC';
                 break;
         }
         $params = array('user' => (int) $user->id, 'favorited' => true, 'starttime' => -1, 'orderby' => $order);
         $favs = array_pop(KunenaForumTopicHelper::getLatestTopics(false, (int) ($pagingParams['ffavs_limitstart'] ? $pagingParams['ffavs_limitstart'] : 0), (int) $postsNumber, $params));
         if ($favs) {
             foreach ($favs as $k => $fav) {
                 $favs[$k]->set('time', $fav->first_post_time);
                 $favs[$k]->set('catid', $fav->getCategory()->id);
                 $favs[$k]->set('catname', $fav->getCategory()->name);
                 $favs[$k]->set('thread', $fav->id);
             }
         }
     } else {
         $favs = null;
     }
     return $favs ? $favs : null;
 }
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:74,代码来源:cb.simpleboardtab.model.php


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