當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DiscussHelper::getPagination方法代碼示例

本文整理匯總了PHP中DiscussHelper::getPagination方法的典型用法代碼示例。如果您正苦於以下問題:PHP DiscussHelper::getPagination方法的具體用法?PHP DiscussHelper::getPagination怎麽用?PHP DiscussHelper::getPagination使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DiscussHelper的用法示例。


在下文中一共展示了DiscussHelper::getPagination方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getPagination

 /**
  * Method to get a pagination object for the posts
  *
  * @access public
  * @return integer
  */
 public function getPagination($parent_id = 0, $sort = 'latest', $filter = '', $category = '', $featuredOnly = 'all')
 {
     $this->_parent = $parent_id;
     // Lets load the content if it doesn't already exist
     if (empty($this->_pagination)) {
         $this->_pagination = DiscussHelper::getPagination($this->getTotal($sort, $filter, $category, $featuredOnly), $this->getState('limitstart'), $this->getState('limit'));
     }
     return $this->_pagination;
 }
開發者ID:pguilford,項目名稱:vcomcc,代碼行數:15,代碼來源:search.php

示例2: getConversations

 /**
  * Retrieves a list of conversations for a particular node
  *
  * @since	3.0
  * @access	public
  * @param	int		The current user id of the viewer
  */
 public function getConversations($userId, $options = array())
 {
     $db = DiscussHelper::getDBO();
     $query = 'SELECT a.*,b.' . $db->nameQuote('message') . ',c.' . $db->nameQuote('isread') . 'FROM ' . $db->nameQuote('#__discuss_conversations') . ' AS a ' . 'INNER JOIN ' . $db->nameQuote('#__discuss_conversations_message') . ' AS b ' . 'ON a.' . $db->nameQuote('id') . ' = b.' . $db->nameQuote('conversation_id') . ' ' . 'INNER JOIN ' . $db->nameQuote('#__discuss_conversations_message_maps') . ' AS c ' . 'ON c.' . $db->nameQuote('message_id') . ' = b.' . $db->nameQuote('id') . ' ' . 'WHERE c.' . $db->nameQuote('user_id') . ' = ' . $db->Quote($userId);
     // @rule: Process any additional filters here.
     if (isset($options['archives']) && $options['archives']) {
         $query .= ' AND c.' . $db->nameQuote('state') . ' = ' . $db->Quote(DISCUSS_CONVERSATION_ARCHIVED);
     } else {
         $query .= ' AND c.' . $db->nameQuote('state') . ' = ' . $db->Quote(DISCUSS_CONVERSATION_PUBLISHED);
     }
     // @rule: Respect filter options
     if (isset($options['filter'])) {
         switch ($options['filter']) {
             case 'unread':
                 $query .= ' AND c.' . $db->nameQuote('isread') . '=' . $db->Quote(DISCUSS_CONVERSATION_UNREAD);
                 break;
         }
     }
     $query .= ' GROUP BY b.' . $db->nameQuote('conversation_id');
     $sorting = isset($options['sorting']) ? $options['sorting'] : 'latest';
     switch ($sorting) {
         case 'latest':
         default:
             $query .= ' ORDER BY a.' . $db->nameQuote('lastreplied') . ' DESC';
             break;
     }
     // If limit is provided, only show certain number of items.
     if (isset($options['limit'])) {
         $limit = $options['limit'];
         $query .= ' LIMIT 0,' . $limit;
     } else {
         $limitstart = $this->getState('limitstart');
         $limit = $this->getState('limit');
         $paginationQuery = str_ireplace('SELECT a.*,b.' . $db->nameQuote('message') . ',c.' . $db->nameQuote('isread'), 'SELECT COUNT(1) AS count FROM ( SELECT a.* ', $query);
         $paginationQuery .= ') AS x';
         $db->setQuery($paginationQuery);
         $total = $db->loadResult();
         $this->_pagination = DiscussHelper::getPagination($total, $limitstart, $limit);
         $query .= ' LIMIT ' . $limitstart . ' , ' . $limit;
     }
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     if (!$rows) {
         return $rows;
     }
     foreach ($rows as $row) {
         $conversation = DiscussHelper::getTable('Conversation');
         $conversation->bind($row);
         $conversations[] = $conversation;
     }
     return $conversations;
 }
開發者ID:BetterBetterBetter,項目名稱:B3App,代碼行數:59,代碼來源:conversation.php

示例3: getRepliesFromUser

 /**
  * Retrieve replies from a specific user
  **/
 public function getRepliesFromUser($userId, $ordering = '')
 {
     $db = DiscussHelper::getDBO();
     $date = DiscussHelper::getDate();
     $limitstart = $this->getState('limitstart');
     $limit = $this->getState('limit');
     $query = 'SELECT DATEDIFF(' . $db->Quote($date->toMySQL()) . ', b.`created`) as `noofdays`, ';
     $query .= ' DATEDIFF(' . $db->Quote($date->toMySQL()) . ', b.`created`) as `daydiff`, TIMEDIFF(' . $db->Quote($date->toMySQL()) . ', b.`created`) as `timediff`,';
     $query .= ' b.`id`, b.`title`, b.`alias`, b.`created`, b.`modified`, b.`replied`,b.`legacy`,';
     $query .= ' b.`content`, b.`category_id`, b.`published`, b.`ordering`, b.`vote`, a.`hits`, b.`islock`,';
     $query .= ' b.`featured`, b.`isresolve`, b.`isreport`, b.`user_id`, b.`parent_id`,';
     $query .= ' b.`user_type`, b.`poster_name`, b.`poster_email`, b.`num_likes`,';
     $query .= ' b.`num_negvote`, b.`sum_totalvote`, b.`answered`,';
     $query .= ' b.`post_status`, b.`post_type`, pt.`title` AS `post_type_title`,pt.`suffix` AS `post_type_suffix`,';
     $query .= ' count(a.id) as `num_replies`,';
     $query .= ' c.`title` as `category`, b.`password`';
     $query .= ' FROM ' . $db->nameQuote('#__discuss_posts') . ' AS a ';
     $query .= ' INNER JOIN ' . $db->nameQuote('#__discuss_posts') . ' AS b ';
     $query .= ' ON a.' . $db->nameQuote('parent_id') . ' = b.' . $db->nameQuote('id');
     $query .= ' LEFT JOIN ' . $db->nameQuote('#__discuss_category') . ' AS c';
     $query .= ' ON c.' . $db->nameQuote('id') . ' = b.' . $db->nameQuote('category_id');
     $query .= ' LEFT JOIN ' . $db->nameQuote('#__discuss_post_types') . ' AS pt';
     $query .= ' ON b.`post_type` = pt.' . $db->nameQuote('alias');
     $query .= ' WHERE a.' . $db->nameQuote('user_id') . ' = ' . $db->Quote($userId);
     $query .= ' AND a.' . $db->nameQuote('published') . ' = ' . $db->Quote(1);
     $query .= ' AND a.`parent_id` != ' . $db->Quote('0');
     $query .= ' AND b.' . $db->nameQuote('published') . ' = ' . $db->Quote(1);
     $query .= ' AND b.`parent_id` = ' . $db->Quote('0');
     $query .= ' GROUP BY b.`id`';
     if (!empty($ordering)) {
         if ($ordering == 'latest') {
             $query .= ' ORDER BY a.`created` DESC';
         }
     }
     $this->_total = $this->_getListCount($query);
     $this->_pagination = DiscussHelper::getPagination($this->_total, $limitstart, $limit);
     $this->_data = $this->_getList($query, $limitstart, $limit);
     return $this->_data;
 }
開發者ID:BetterBetterBetter,項目名稱:B3App,代碼行數:42,代碼來源:posts.php

示例4: getPagination

 /**
  * Method to get a pagination object for the categories
  *
  * @access public
  * @return integer
  */
 function getPagination()
 {
     // Lets load the content if it doesn't already exist
     if (empty($this->_pagination)) {
         $this->_pagination = DiscussHelper::getPagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit'));
     }
     return $this->_pagination;
 }
開發者ID:BetterBetterBetter,項目名稱:B3App,代碼行數:14,代碼來源:users.php


注:本文中的DiscussHelper::getPagination方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。