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


PHP DiscussHelper::getVoters方法代码示例

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


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

示例1: formatReplies

 public static function formatReplies($result, $category = null)
 {
     $config = DiscussHelper::getConfig();
     if (!$result) {
         return $result;
     }
     $my = JFactory::getUser();
     $replies = array();
     for ($i = 0; $i < count($result); $i++) {
         $row =& $result[$i];
         $reply = DiscussHelper::getTable('Post');
         $reply->bind($row);
         $response = new stdClass();
         if ($row->user_id == 0 || $row->user_type == DISCUSS_POSTER_GUEST) {
             $response->id = '0';
             $response->name = 'Guest';
             // TODO: user the poster_name
         } else {
             $replier = JFactory::getUser($row->user_id);
             $response->id = $replier->id;
             $response->name = $replier->name;
         }
         //load porfile info and auto save into table if user is not already exist in discuss's user table.
         $creator = DiscussHelper::getTable('Profile');
         $creator->load($response->id);
         $reply->user = $creator;
         $reply->content_raw = $row->content;
         $reply->isVoted = $row->isVoted;
         $reply->total_vote_cnt = $row->total_vote_cnt;
         $reply->title = DiscussHelper::wordFilter($reply->title);
         $reply->content = DiscussHelper::wordFilter($reply->content);
         // Legacy fix when switching from WYSIWYG editor to bbcode.
         $reply->content = EasyDiscussParser::html2bbcode($reply->content);
         // Parse bbcodes.
         $reply->content = self::parseContent($reply->content, true);
         // Parse @username links.
         $reply->content = DiscussHelper::getHelper('String')->nameToLink($reply->content);
         // set for vote status
         $reply->voted = $reply->hasVoted();
         // get total vote for this reply
         $reply->totalVote = $reply->sum_totalvote;
         // get the 5 latest voters
         $voters = DiscussHelper::getVoters($row->id);
         $reply->voters = $voters->voters;
         $reply->shownVoterCount = $voters->shownVoterCount;
         $reply->minimize = DiscussHelper::getHelper('Post')->toMinimizePost($row->sum_totalvote);
         $reply->likesAuthor = DiscussHelper::getHelper('Likes')->getLikesHTML($row->id, null, null, $reply->getLikeAuthorsObject($row->id));
         $reply->isLike = DiscussHelper::getHelper('Post')->isLiked($row->id);
         // get reply comments
         $commentLimit = $config->get('main_comment_pagination') ? $config->get('main_comment_pagination_count') : null;
         $comments = $reply->getComments($commentLimit);
         $reply->comments = false;
         if ($config->get('main_comment')) {
             $reply->comments = DiscussHelper::formatComments($comments);
         }
         // get reply comments count
         $reply->commentsCount = $reply->getTotalComments();
         // @rule: Check for url references
         $reply->references = $reply->getReferences();
         $reply->content = DiscussHelper::formatContent($reply);
         if ($config->get('main_content_trigger_replies')) {
             // Move aside the original content_raw
             $content_raw_temp = $reply->content_raw;
             // Add the br tags in the content, we do it here so that the content triggers's javascript will not get added with br tags
             // $reply->content_raw = DiscussHelper::bbcodeHtmlSwitcher( $reply, 'reply', false );
             // process content plugins
             DiscussEventsHelper::importPlugin('content');
             DiscussEventsHelper::onContentPrepare('reply', $reply);
             $reply->event = new stdClass();
             $results = DiscussEventsHelper::onContentBeforeDisplay('reply', $reply);
             $reply->event->beforeDisplayContent = trim(implode("\n", $results));
             $results = DiscussEventsHelper::onContentAfterDisplay('reply', $reply);
             $reply->event->afterDisplayContent = trim(implode("\n", $results));
             // Assign the processed content back
             // $reply->content = $reply->content_raw;
             // Move back the original content_raw
             $reply->content_raw = $content_raw_temp;
         }
         $reply->access = $reply->getAccess($category);
         $replies[] = $reply;
     }
     return $replies;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:83,代码来源:helper.php

示例2: getMoreVoters

 public function getMoreVoters($postid = null, $limit = null)
 {
     $disjax = new disjax();
     $voteModel = $this->getModel('votes');
     $total = $voteModel->getTotalVotes($postid);
     if (!empty($total)) {
         $voters = DiscussHelper::getVoters($postid, $limit);
         $msg = JText::sprintf('COM_EASYDISCUSS_VOTES_BY', $voters->voters);
         if ($voters->shownVoterCount < $total) {
             $limit += '5';
             $msg .= '[<a href="javascript:void(0);" onclick="disjax.load(\'post\', \'getMoreVoters\', \'' . $postid . '\', \'' . $limit . '\');">' . JText::_('COM_EASYDISCUSS_MORE') . '</a>]';
         }
         $disjax->assign('dc_reply_voters_' . $postid, $msg);
     }
     $disjax->send();
     return;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:17,代码来源:view.ajax.php


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