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


PHP DiscussHelper::formatConversations方法代码示例

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


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

示例1: load

 /**
  * Loads a list of new messages via ajax.
  *
  * @since	3.0
  * @access	public
  * @param	null
  */
 public function load()
 {
     $my = JFactory::getUser();
     $ajax = DiscussHelper::getHelper('Ajax');
     $config = DiscussHelper::getConfig();
     if ($my->id <= 0 || !$config->get('main_conversations_notification') || !$config->get('main_conversations')) {
         $ajax->fail(JText::_('COM_EASYDISCUSS_NOT_ALLOWED'));
         return;
     }
     // @TODO: Show only x amount of items
     // Get a list of conversations to be displayed in the drop down.
     $model = DiscussHelper::getModel('Conversation');
     $conversations = $model->getConversations($my->id, array('limit' => $config->get('main_conversations_notification_items')));
     // Format messages
     DiscussHelper::formatConversations($conversations);
     $theme = new DiscussThemes();
     $theme->set('conversations', $conversations);
     $output = $theme->fetch('toolbar.conversation.item.php');
     $ajax->success($output);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:27,代码来源:view.ajax.php

示例2: read

 /**
  * Displays the conversation.
  *
  * @since	3.0
  * @access	public
  */
 public function read()
 {
     $id = JRequest::getInt('id');
     $app = JFactory::getApplication();
     $my = JFactory::getUser();
     // Do not allow non logged in users to view anything in conversation.
     if (!$my->id) {
         $returnURL = base64_encode(JRequest::getURI());
         //DiscussHelper::setMessageQueue( JText::_( 'COM_EASYDISCUSS_NOT_ALLOWED' ) , DISCUSS_QUEUE_ERROR );
         //$app->redirect( DiscussRouter::_( 'index.php?option=com_easydiscuss&view=index' , false ) );
         $app->redirect(DiscussHelper::getLoginLink($returnURL));
         $app->close();
     }
     // Try to load the conversation
     $conversation = DiscussHelper::getTable('Conversation');
     $state = $conversation->load($id);
     // The conversation id needs to be valid.
     if (!$state) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CONVERSATION_INVALID'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false));
         $app->close();
     }
     // Check if the current logged in user has access to this conversation.
     $model = DiscussHelper::getModel('Conversation');
     if (!$model->hasAccess($conversation->id, $my->id)) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NOT_ALLOWED'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false));
         $app->close();
     }
     $doc = JFactory::getDocument();
     $result = $conversation->getParticipants($my->id);
     $user = DiscussHelper::getTable('Profile');
     $user->load($result[0]);
     DiscussHelper::setPageTitle(JText::sprintf('COM_EASYDISCUSS_VIEW_CONVERSATION_TITLE', $this->escape($user->getName())));
     // Mark this message as read for the current logged in user.
     $conversation->markAsRead($my->id);
     // Check if it is view all messages
     $viewAll = JRequest::getVar('show');
     $count = JRequest::getInt('count');
     if ($viewAll == 'all') {
         // For future use
         $count = '';
     }
     if ($viewAll == 'previous') {
         $count = JRequest::getInt('count');
         // Check if the value is integer, we do no want any weird values
         if (isset($count) && is_int($count)) {
             // Convert to absolute number
             $count = abs($count);
         }
     }
     // Get replies in the conversation
     $replies = $model->getMessages($conversation->id, $my->id, $viewAll, $count);
     // Format conversation replies.
     DiscussHelper::formatConversationReplies($replies);
     // Format the conversation object.
     $data = array($conversation);
     DiscussHelper::formatConversations($data);
     $theme = new DiscussThemes();
     $theme->set('replies', $replies);
     $theme->set('conversation', $data[0]);
     echo $theme->fetch('conversation.read.php');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:69,代码来源:view.html.php


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