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


PHP DiscussHelper::getModel方法代码示例

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


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

示例1: display

 public function display($tpl = null)
 {
     // @rule: Test for user access if on 1.6 and above
     if (DiscussHelper::getJoomlaVersion() >= '1.6') {
         if (!JFactory::getUser()->authorise('discuss.manage.post_types', 'com_easydiscuss')) {
             JFactory::getApplication()->redirect('index.php', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
             JFactory::getApplication()->close();
         }
     }
     // Initialise variables
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     $mainframe = JFactory::getApplication();
     // REMOVE THIS COMMENT LATER: Don't ever use $this->getModel because it will conflict with K2
     $model = DiscussHelper::getModel('Post_Types', true);
     $postTypes = $model->getTypes();
     $pagination = $this->get('Pagination');
     $filter_state = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.filter_state', 'filter_state', '*', 'word');
     $order = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.filter_order', 'filter_order', 'id', 'cmd');
     $orderDirection = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $browse = JRequest::getInt('browse', 0);
     $browseFunction = JRequest::getVar('browseFunction', '');
     $search = $mainframe->getUserStateFromRequest('com_easydiscuss.post_types.search', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     $this->assign('browseFunction', $browseFunction);
     $this->assign('browse', $browse);
     $this->assign('search', $search);
     $this->assign('postTypes', $postTypes);
     $this->assign('state', $this->getFilterState($filter_state));
     $this->assign('order', $order);
     $this->assign('orderDirection', $orderDirection);
     $this->assign('pagination', $pagination);
     parent::display($tpl);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:34,代码来源:view.html.php

示例2: save

 public function save()
 {
     JRequest::checkToken('request') or jexit('Invalid Token');
     $mainframe = JFactory::getApplication();
     $post = JRequest::get('post');
     $ids = isset($post['id']) ? $post['id'] : '';
     $starts = isset($post['start']) ? $post['start'] : '';
     $ends = isset($post['end']) ? $post['end'] : '';
     $titles = isset($post['title']) ? $post['title'] : '';
     $removal = isset($post['itemRemove']) ? $post['itemRemove'] : '';
     $model = DiscussHelper::getModel('Ranks', true);
     if (!empty($removal)) {
         $rids = explode(',', $removal);
         $model->removeRanks($rids);
     }
     if (!empty($ids)) {
         if (count($ids) > 0) {
             for ($i = 0; $i < count($ids); $i++) {
                 $data = array();
                 $data['id'] = $ids[$i];
                 $data['start'] = $starts[$i];
                 $data['end'] = $ends[$i];
                 $data['title'] = $titles[$i];
                 $ranks = DiscussHelper::getTable('Ranks');
                 $ranks->bind($data);
                 $ranks->store();
             }
         }
         //end if
     }
     //end if
     $message = JText::_('COM_EASYDISCUSS_RANKING_SUCCESSFULLY_UPDATED');
     DiscussHelper::setMessageQueue($message, DISCUSS_QUEUE_SUCCESS);
     $mainframe->redirect('index.php?option=com_easydiscuss&view=ranks');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:35,代码来源:ranks.php

示例3: history

 /**
  * Displays the user's points achievement history
  *
  * @since	2.0
  * @access	public
  */
 public function history($tmpl = null)
 {
     $app = JFactory::getApplication();
     $id = JRequest::getInt('id');
     if (!$id) {
         DiscussHelper::setMessageQueue(JText::_('Unable to locate the id of the user.'), DISCUSS_QUEUE_ERROR);
         $app->redirect('index.php?option=com_easydiscuss');
         $app->close();
     }
     $model = DiscussHelper::getModel('Points', true);
     $history = $model->getPointsHistory($id);
     foreach ($history as $item) {
         $date = DiscussDateHelper::dateWithOffSet($item->created);
         $item->created = $date->toFormat('%A, %b %e %Y');
         $points = DiscussHelper::getHelper('Points')->getPoints($item->command);
         if ($points) {
             if ($points[0]->rule_limit < 0) {
                 $item->class = 'badge-important';
                 $item->points = $points[0]->rule_limit;
             } else {
                 $item->class = 'badge-info';
                 $item->points = '+' . $points[0]->rule_limit;
             }
         } else {
             $item->class = 'badge-info';
             $item->points = '+';
         }
     }
     $theme = new DiscussThemes();
     $theme->set('history', $history);
     echo $theme->fetch('points.history.php');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:38,代码来源:view.html.php

示例4: parseEmails

 public function parseEmails()
 {
     require_once DISCUSS_CLASSES . '/mailbox.php';
     $config = DiscussHelper::getConfig();
     // Default email parser
     $mailer = new DiscussMailer();
     $state = $mailer->connect($config->get('main_email_parser_username'), $config->get('main_email_parser_password'));
     if ($state) {
         self::processEmails($mailer);
     }
     // Category email parser
     $model = DiscussHelper::getModel('Categories', true);
     $cats = $model->getAllCategories();
     if (is_array($cats)) {
         foreach ($cats as $cat) {
             $category = DiscussHelper::getTable('Category');
             $category->load($cat->id);
             $enable = explode(',', $category->getParam('cat_email_parser_switch'));
             if ($enable[0]) {
                 $catMail = explode(',', $category->getParam('cat_email_parser'));
                 $catPass = explode(',', $category->getParam('cat_email_parser_password'));
                 $mailer = new DiscussMailer();
                 $state = $mailer->connect($catMail[0], $catPass[0]);
                 if ($state) {
                     self::processEmails($mailer, $category);
                 }
             }
         }
     }
     return true;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:31,代码来源:mailqueue.php

示例5: getInput

    protected function getInput()
    {
        $model = DiscussHelper::getModel('Categories', true);
        $categories = $model->getAllCategories();
        $multiple = $this->element['multipleitems'];
        if (!is_array($this->value)) {
            $this->value = array($this->value);
        }
        ob_start();
        ?>
		<select name="<?php 
        echo $this->name;
        echo $multiple ? '[]' : '';
        ?>
" id="<?php 
        echo $this->name;
        ?>
"<?php 
        echo $multiple == 'true' ? ' multiple="multiple"' : '';
        ?>
>
			<?php 
        if ($categories) {
            ?>
	
				<?php 
            foreach ($categories as $category) {
                ?>
				<option value="<?php 
                echo $category->id;
                ?>
"<?php 
                echo in_array($category->id, $this->value) ? ' selected="selected"' : '';
                ?>
><?php 
                echo JText::_($category->title);
                ?>
</option>
				<?php 
            }
            ?>
			<?php 
        }
        ?>
		</select>
		<?php 
        $html = ob_get_contents();
        ob_end_clean();
        return $html;
    }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:50,代码来源:categories.php

示例6: getTagCloud

 public static function getTagCloud($params)
 {
     $mainframe = JFactory::getApplication();
     $order = $params->get('order', 'postcount');
     $sort = $params->get('sort', 'desc');
     $count = (int) trim($params->get('count', 0));
     $shuffeTags = $params->get('shuffleTags', TRUE);
     $pMinSize = $params->get('minsize', '10');
     $pMaxSize = $params->get('maxsize', '30');
     // 		if( !class_exists( 'EasyDiscussModelTags' ) )
     // 		{
     // 			jimport( 'joomla.application.component.model' );
     // 			JLoader::import( 'tags' , DISCUSS_MODELS );
     // 		}
     // 		$model		= JModel::getInstance( 'Tags' , 'EasyDiscussModel' );
     $model = DiscussHelper::getModel('Tags');
     $tagCloud = $model->getTagCloud($count, $order, $sort);
     $extraInfo = array();
     if ($shuffeTags) {
         shuffle($tagCloud);
     }
     foreach ($tagCloud as $item) {
         $extraInfo[] = $item->post_count;
     }
     $min_size = $pMinSize;
     $max_size = $pMaxSize;
     //$tags = tag_info();
     $minimum_count = 0;
     $maximum_count = 0;
     if (!empty($extraInfo)) {
         $minimum_count = min($extraInfo);
         $maximum_count = max($extraInfo);
     }
     $spread = $maximum_count - $minimum_count;
     if ($spread == 0) {
         $spread = 1;
     }
     $cloud_html = '';
     $cloud_tags = array();
     //foreach ($tags as $tag => $count)
     for ($i = 0; $i < count($tagCloud); $i++) {
         $row =& $tagCloud[$i];
         $size = $min_size + ($row->post_count - $minimum_count) * ($max_size - $min_size) / $spread;
         $row->fontsize = $size;
     }
     return $tagCloud;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:47,代码来源:helper.php

示例7: display

 function display($tpl = null)
 {
     $config = DiscussHelper::getConfig();
     $app = JFactory::getApplication();
     if (!$config->get('main_favorite')) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_FEATURE_IS_DISABLED'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
         $app->close();
     }
     DiscussHelper::setPageTitle(JText::_('COM_EASYDISCUSS_FAVOURITES_TITLE'));
     // @task: Add view
     $this->logView();
     DiscussHelper::setMeta();
     $postModel = DiscussHelper::getModel('Posts');
     $posts = $postModel->getData(true, 'latest', null, 'favourites');
     $posts = DiscussHelper::formatPost($posts);
     $theme = new DiscussThemes();
     $theme->set('posts', $posts);
     echo $theme->fetch('favourites.php');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:20,代码来源:view.html.php

示例8:

									</a>
									<?php 
                }
                ?>
								<?php 
            } else {
                ?>
									<?php 
                echo $post->reply->poster_name;
                ?>
								<?php 
            }
            ?>

								<?php 
            $lastReply = DiscussHelper::getModel('Posts')->getLastReply($post->id);
            ?>
								<a class="ml-5" href="<?php 
            echo DiscussRouter::getPostRoute($post->id) . '#' . JText::_('MOD_EASYDISCUSS_REPLY_PERMALINK') . '-' . $lastReply->id;
            ?>
" title="<?php 
            echo JText::_('MOD_EASYDISCUSS_VIEW_LAST_REPLY');
            ?>
"><?php 
            echo JText::_('MOD_EASYDISCUSS_VIEW_LAST_REPLY');
            ?>
</a>

							<?php 
        }
        ?>
开发者ID:pguilford,项目名称:vcomcc,代码行数:31,代码来源:default.php

示例9: defined

 */
// no direct access
defined('_JEXEC') or die('Restricted access');
$path = JPATH_ROOT . '/components/com_easydiscuss/helpers/helper.php';
jimport('joomla.filesystem.file');
if (!JFile::exists($path)) {
    return;
}
require_once $path;
// require_once (dirname(__FILE__) . '/helper.php');
DiscussHelper::loadStylesheet("module", "mod_easydiscuss_your_discussions");
$my = JFactory::getUser();
$config = DiscussHelper::getConfig();
$profile = DiscussHelper::getTable('Profile');
$profile->load($my->id);
$postsModel = DiscussHelper::getModel('Posts');
$count = $params->get('count', 5);
$posts = array();
$posts = $postsModel->getPostsBy('user', $profile->id, 'latest', '0', '', '', $count);
$posts = DiscussHelper::formatPost($posts);
if (!empty($posts)) {
    $posts = Discusshelper::getPostStatusAndTypes($posts);
    // foreach( $posts as $post )
    // {
    // 	// Translate post status from integer to string
    // 	switch( $post->post_status )
    // 	{
    // 		case '0':
    // 			$post->post_status = '';
    // 			break;
    // 		case '1':
开发者ID:pguilford,项目名称:vcomcc,代码行数:31,代码来源:mod_easydiscuss_your_discussions.php

示例10: like


//.........这里部分代码省略.........
     $postId = JRequest::getInt('postid');
     $post = DiscussHelper::getTable('Post');
     $post->load($postId);
     // Determine if the likes are enabled or not.
     if ($post->isReply() && !$config->get('main_likes_replies') || $post->isQuestion() && !$config->get('main_likes_discussions')) {
         return $ajax->reject();
     }
     // Do not allow non logged in users to like an item.
     if (!$my->id) {
         return $ajax->reject();
     }
     // Determine if the current user request is to like the post item or unlike.
     $isLike = !$post->isLikedBy($my->id);
     if ($isLike) {
         DiscussHelper::getHelper('Likes')->addLikes($post->id, 'post', $my->id);
     } else {
         // If this is an unlike request, we need to remove it.
         DiscussHelper::getHelper('Likes')->removeLikes($post->id, $my->id);
     }
     // Get the main question if this is a reply.
     if ($post->isReply()) {
         $question = DiscussHelper::getTable('Post');
         $question->load($post->parent_id);
     } else {
         $question = $post;
     }
     // Add JomSocial activity item if the post for the main discussion item if it has been liked.
     if ($post->published && $isLike) {
         // EasySocial instegrations
         DiscussHelper::getHelper('EasySocial')->notify('new.likes', $post, $question);
         DiscussHelper::getHelper('jomsocial')->addActivityLikes($post, $question);
         DiscussHelper::getHelper('easysocial')->likesStream($post, $question);
     }
     // Add a badge record for the user when they like a discussion
     // The record should only be added when the user liked another user's post.
     if ($post->isQuestion() && $isLike && $my->id != $post->user_id) {
         // Add logging for user.
         DiscussHelper::getHelper('History')->log('easydiscuss.like.discussion', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_LIKE_DISCUSSION', $question->title), $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.like.discussion', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.like.discussion', $my->id);
         // Assign badge for EasySocial
         DiscussHelper::getHelper('EasySocial')->assignBadge('like.question', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_LIKE_DISCUSSION', $question->title));
     }
     // Add a badge record for the user when they like a discussion
     // The record should only be added when the user liked another user's post.
     if ($post->isReply() && $isLike && $my->id != $post->user_id) {
         // Add logging for user.
         DiscussHelper::getHelper('History')->log('easydiscuss.like.reply', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_LIKE_REPLY', $post->title), $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.like.reply', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.like.reply', $my->id);
     }
     // Remove history when a user unlikes a discussion.
     if ($post->isQuestion() && !$isLike && $my->id != $post->user_id) {
         // Remove unlike
         DiscussHelper::getHelper('History')->removeLog('easydiscuss.like.discussion', $my->id, $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.unlike.discussion', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.unlike.discussion', $my->id);
     }
     // Remove history when a user unlikes a reply.
     if ($post->isReply() && !$isLike && $my->id != $post->user_id) {
         // Remove unlike
         DiscussHelper::getHelper('History')->removeLog('easydiscuss.like.reply', $my->id, $post->id);
         DiscussHelper::getHelper('Badges')->assign('easydiscuss.unlike.reply', $my->id);
         DiscussHelper::getHelper('Points')->assign('easydiscuss.unlike.reply', $my->id);
     }
     // Add notifications to the post owner.
     if ($post->user_id != $my->id) {
         $notification = DiscussHelper::getTable('Notifications');
         $text = $post->isQuestion() ? 'COM_EASYDISCUSS_LIKE_DISCUSSION_NOTIFICATION_TITLE' : 'COM_EASYDISCUSS_LIKE_REPLY_NOTIFICATION_TITLE';
         $title = $question->title;
         $likeType = $post->isQuestion() ? DISCUSS_NOTIFICATIONS_LIKES_DISCUSSION : DISCUSS_NOTIFICATIONS_LIKES_REPLIES;
         $notification->bind(array('title' => JText::sprintf($text, $title), 'cid' => $question->id, 'type' => $likeType, 'target' => $post->user_id, 'author' => $my->id, 'permalink' => 'index.php?option=com_easydiscuss&view=post&id=' . $question->id));
         $notification->store();
     }
     // Only send notification email if the post owner is a registered user.
     // And, it would not send email if the user that is liking on his own item.
     if ($post->user_id && $my->id != $post->user_id && $isLike && $config->get('notify_owner_like')) {
         // Send email to post / reply author that someone liked their post.
         $notify = DiscussHelper::getNotification();
         $profile = DiscussHelper::getTable('Profile');
         $profile->load($my->id);
         $emailSubject = JText::sprintf('COM_EASYDISCUSS_USER_LIKED_YOUR_POST', $profile->getName());
         $emailTemplate = 'email.like.post.php';
         $emailData = array();
         $emailData['authorName'] = $profile->getName();
         $emailData['authorAvatar'] = $profile->getAvatar();
         $emailData['replyContent'] = $post->content;
         $emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $question->id, false, true);
         $recipient = JFactory::getUser($post->user_id);
         $notify->addQueue($recipient->email, $emailSubject, '', $emailTemplate, $emailData);
     }
     // Get the like's text.
     $likeText = DiscussHelper::getHelper('Likes')->getLikesHTML($post->id, $my->id, 'post');
     if (!$likeText) {
         $likeText = JText::_('COM_EASYDISCUSS_BE_THE_FIRST_TO_LIKE');
     }
     $count = DiscussHelper::getModel('Likes')->getTotalLikes($postId);
     $ajax->resolve($likeText, $count);
     return $ajax->send();
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:view.ajax.php

示例11: removeBadges

 function removeBadges($userId)
 {
     $model = DiscussHelper::getModel('Badges');
     $state = $model->removeBadges($userId);
     if ($state == false) {
         JError::raiseError(500, $db->stderr());
     }
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:8,代码来源:easydiscussusers.php

示例12:

require_once $path;
// Load theme css here.
DiscussHelper::loadStylesheet("module", "mod_easydiscuss_navigation");
DiscussHelper::loadHeaders();
// Load component's language file.
JFactory::getLanguage()->load('com_easydiscuss', JPATH_ROOT);
JFactory::getLanguage()->load('mod_easydiscuss_navigation', JPATH_ROOT);
$my = JFactory::getUser();
// We need to detect if the user is browsing a particular category
$active = '';
$view = JRequest::getVar('view');
$layout = JRequest::getVar('layout');
$option = JRequest::getVar('option');
$id = JRequest::getInt('category_id');
if ($option == 'com_easydiscuss' && $view == 'post') {
    $postId = JRequest::getInt('id', 0);
    // update user's post read flag
    if (!empty($my->id) && !empty($postId)) {
        $profile = DiscussHelper::getTable('Profile');
        $profile->load($my->id);
        $profile->read($postId);
    }
}
$model = DiscussHelper::getModel('Categories');
$categories = $model->getCategoryTree();
$notificationModel = DiscussHelper::getModel('Notification');
$totalNotifications = $notificationModel->getTotalNotifications($my->id);
if ($option == 'com_easydiscuss' && $view == 'categories' && $layout == 'listings' && $id) {
    $active = $id;
}
require JModuleHelper::getLayoutPath('mod_easydiscuss_navigation');
开发者ID:pguilford,项目名称:vcomcc,代码行数:31,代码来源:mod_easydiscuss_navigation.php

示例13: mergeForm

 /**
  * Merges the current discussion into an existing discussion
  *
  * @since   1.0
  * @access  public
  * @param   string
  * @return
  */
 public function mergeForm($id)
 {
     $ajax = new Disjax();
     $model = DiscussHelper::getModel('Posts');
     $posts = $model->getDiscussions(array('limit' => DISCUSS_NO_LIMIT, 'exclude' => array($id)));
     $theme = new DiscussThemes();
     $theme->set('posts', $posts);
     $theme->set('current', $id);
     $content = $theme->fetch('ajax.post.merge.php', array('dialog' => true));
     $options = new stdClass();
     $options->content = $content;
     $options->title = JText::_('COM_EASYDISCUSS_MERGE_POST_TITLE');
     $buttons = array();
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_CLOSE');
     $button->action = 'disjax.closedlg();';
     $buttons[] = $button;
     $button = new stdClass();
     $button->title = JText::_('COM_EASYDISCUSS_BUTTON_MERGE');
     $button->form = '#frmMergePost';
     $button->className = 'btn-primary';
     $buttons[] = $button;
     $options->buttons = $buttons;
     $ajax->dialog($options);
     $ajax->send();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:34,代码来源:view.ajax.php

示例14: defined

 * See COPYRIGHT.php for copyright notices and details.
 */
// no direct access
defined('_JEXEC') or die('Restricted access');
$my = JFactory::getUser();
$stringHelper = DiscussHelper::getHelper('String');
$system = new stdClass();
$system->config = DiscussHelper::getConfig();
$system->my = JFactory::getUser();
$system->profile = DiscussHelper::getTable('Profile');
$system->profile->load($system->my->id);
// $profileModel 	= DiscussHelper::getTable( 'Profile' );
// $profile 		= $profileModel->load( $my->id );
if (!empty($my->id)) {
    $notificationModel = DiscussHelper::getModel('Notification');
    $conversationModel = DiscussHelper::getModel('Conversation');
    if (!empty($notificationModel)) {
        $notifications = $notificationModel->getTotalNotifications($my->id);
    }
    if (!empty($conversationModel)) {
        $totalMessages = $conversationModel->getCount($my->id, array('filter' => 'unread'));
    }
}
?>

<script type="text/javascript">
EasyDiscuss
.require()
.script( 'toolbar' )
.done(function($){
开发者ID:pguilford,项目名称:vcomcc,代码行数:30,代码来源:default.php

示例15: display

 /**
  * Displays the user's profile.
  *
  * @since	2.0
  * @access	public
  */
 function display($tmpl = null)
 {
     $doc = JFactory::getDocument();
     $app = JFactory::getApplication();
     $id = JRequest::getInt('id', null);
     $my = JFactory::getUser($id);
     $config = DiscussHelper::getConfig();
     // Custom parameters.
     $sort = JRequest::getString('sort', 'latest');
     $filteractive = JRequest::getString('filter', 'allposts');
     $viewType = JRequest::getString('viewtype', 'questions');
     $profile = DiscussHelper::getTable('Profile');
     $profile->load($my->id);
     // If profile is invalid, throw an error.
     if (!$profile->id) {
         // Show login form.
         $theme = new DiscussThemes();
         $theme->set('redirect', DiscussRouter::_('index.php?option=com_easydiscuss&view=profile', false));
         echo $theme->fetch('login.form.php');
         return;
     }
     $params = DiscussHelper::getRegistry($profile->params);
     $fields = array('facebook', 'linkedin', 'twitter', 'website');
     foreach ($fields as $site) {
         if ($params->get($site, '') != '') {
             if ($site == 'facebook' || $site == 'linkedin' || $site == 'twitter') {
                 $name = $params->get($site);
                 $url = 'www.' . $site . '.com/' . $name;
                 $params->set($site, DiscussUrlHelper::clean($url));
             }
             if ($site == 'website') {
                 $url = $params->get($site);
                 $params->set($site, DiscussUrlHelper::clean($url));
             }
         }
     }
     // Set the title for the page.
     DiscussHelper::setPageTitle(JText::sprintf('COM_EASYDISCUSS_PROFILE_PAGE_TITLE', $profile->getName()));
     // Set the pathway
     $this->setPathway(JText::_($profile->getName()));
     $postsModel = DiscussHelper::getModel('Posts');
     $tagsModel = DiscussHelper::getModel('Tags');
     $posts = array();
     $replies = array();
     $tagCloud = array();
     $badges = array();
     $unresolved = array();
     $pagination = null;
     $filterArr = array();
     $filterArr['viewtype'] = $viewType;
     $filterArr['id'] = $profile->id;
     switch ($viewType) {
         case 'replies':
             $replies = $postsModel->getRepliesFromUser($profile->id);
             $pagination = $postsModel->getPagination();
             $pagination = $pagination->getPagesLinks('profile', $filterArr, true);
             $replies = DiscussHelper::formatPost($replies);
             break;
         case 'unresolved':
             $unresolved = $postsModel->getUnresolvedFromUser($profile->id);
             $pagination = $postsModel->getPagination();
             $pagination = $pagination->getPagesLinks('profile', $filterArr, true);
             $unresolved = DiscussHelper::formatPost($unresolved);
             break;
         case 'questions':
         default:
             $posts = $postsModel->getPostsBy('user', $profile->id);
             $pagination = $postsModel->getPagination();
             $pagination = $pagination->getPagesLinks('profile', $filterArr, true);
             $posts = DiscussHelper::formatPost($posts);
             break;
     }
     // Get user badges
     $badges = $profile->getBadges();
     // @rule: Clear up any notifications that are visible for the user.
     $notifications = DiscussHelper::getModel('Notification');
     $notifications->markRead($profile->id, false, array(DISCUSS_NOTIFICATIONS_PROFILE, DISCUSS_NOTIFICATIONS_BADGE));
     $tpl = new DiscussThemes();
     // EasyBlog integrations
     $easyblogExists = $this->easyblogExists();
     $blogCount = 0;
     if ($easyblogExists && $config->get('integrations_easyblog_profile')) {
         $blogModel = EasyBlogHelper::getModel('Blog');
         $blogCount = $blogModel->getBlogPostsCount($profile->id, false);
     }
     $komentoExists = $this->komentoExists();
     $commentCount = 0;
     if ($komentoExists && $config->get('integrations_komento_profile')) {
         $commentsModel = Komento::getModel('comments');
         $commentCount = $commentsModel->getTotalComment($profile->id);
     }
     $posts = Discusshelper::getPostStatusAndTypes($posts);
     $favPosts = $postsModel->getData('true', 'latest', 'null', 'favourites');
     $favPosts = DiscussHelper::formatPost($favPosts);
//.........这里部分代码省略.........
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:view.html.php


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