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


PHP DiscussRouter::getMessageRoute方法代码示例

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


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

示例1: save

 /**
  * Stores a private message composed by the user.
  *
  * @since	3.0
  * @access	public
  * @param	null
  */
 public function save()
 {
     JRequest::checkToken('request') or jexit('Invalid Token');
     $config = DiscussHelper::getConfig();
     $recipientId = JRequest::getInt('recipient', 0);
     $app = JFactory::getApplication();
     $my = JFactory::getUser();
     // Test for valid recipients.
     if (!$recipientId) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_MESSAGING_INVALID_RECIPIENT'));
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation&layout=compose', false));
         $app->close();
     }
     // Do not allow user to send a message to himself, it's crazy.
     if ($recipientId == $my->id) {
         DiscussHelper::setMessageQueue(JText::_('You should not start a conversation with your self.'));
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=conversation&layout=compose', false));
         $app->close();
     }
     // Initialize conversation table.
     $conversation = DiscussHelper::getTable('Conversation');
     // Check if this conversation already exist in the system.
     $state = $conversation->loadByRelation($my->id, $recipientId);
     if (!$state) {
         $date = DiscussHelper::getDate()->toMySQL();
         $conversation->created = $date;
         $conversation->created_by = $my->id;
         $conversation->lastreplied = $date;
         $conversation->store();
     }
     // Get message from query.
     $content = JRequest::getVar('message');
     // Initialize message table.
     $message = DiscussHelper::getTable('ConversationMessage');
     $message->message = $content;
     $message->conversation_id = $conversation->id;
     $message->created = DiscussHelper::getDate()->toMySQL();
     $message->created_by = $my->id;
     $message->store();
     // Add participant to this conversation.
     $model = DiscussHelper::getModel('Conversation');
     $model->addParticipant($conversation->id, $recipientId, $my->id);
     // Add message map so that recipient can view the message.
     $model->addMessageMap($conversation->id, $message->id, $recipientId, $my->id);
     // @TODO: Add notification for recipient to let them know they received a message.
     // @TODO: Add points for user.
     // @TODO: Add badge for user.
     // Set message queue.
     DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_MESSAGE_SENT'));
     $app->redirect(DiscussRouter::getMessageRoute($conversation->id, false));
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:58,代码来源:conversation.php

示例2: save

 /**
  * Stores a private message composed by the user.
  *
  * @since	3.0
  * @access	public
  * @param	null
  */
 public function save()
 {
     JRequest::checkToken('request') or jexit('Invalid Token');
     $config = DiscussHelper::getConfig();
     $recipientId = JRequest::getInt('recipient', 0);
     $app = JFactory::getApplication();
     // Test for valid recipients.
     if (!$recipientId) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_MESSAGING_INVALID_RECIPIENT'));
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=messaging&layout=compose', false));
         $app->close();
     }
     // Get message meta here.
     $title = JRequest::getVar('title');
     $content = JRequest::getVar('message');
     // Store the new message.
     $message = DiscussHelper::getTable('Message');
     $message->created_by = JFactory::getUser()->id;
     $message->recipient = $recipientId;
     $message->created = DiscussHelper::getDate()->toMySQL();
     $message->lastreplied = DiscussHelper::getDate()->toMySQL();
     $message->store();
     // Store the message meta.
     $meta = DiscussHelper::getTable('MessageMeta');
     $meta->message_id = $message->id;
     $meta->title = $title;
     $meta->message = $content;
     $meta->created = DiscussHelper::getDate()->toMySQL();
     $meta->created_by = JFactory::getUser()->id;
     $meta->isparent = true;
     $meta->store();
     $app = JFactory::getApplication();
     // @TODO: Add notification for recipient to let them know they received a message.
     // @TODO: Add points for user.
     // @TODO: Add badge for user.
     // Set message queue.
     DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_MESSAGE_SENT'));
     $app->redirect(DiscussRouter::getMessageRoute($message->id, false));
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:46,代码来源:messaging.php

示例3: defined

 * See COPYRIGHT.php for copyright notices and details.
 */
defined('_JEXEC') or die('Restricted access');
if ($conversations) {
    ?>
	<?php 
    foreach ($conversations as $conversation) {
        ?>
	<li class="item new messageItem pa-10<?php 
        echo $conversation->isNew($system->my->id) ? ' is-unread' : ' is-read';
        ?>
">

		<div class="media notice-message">
			<a href="<?php 
        echo DiscussRouter::getMessageRoute($conversation->id);
        ?>
">
				<div class="media-object pull-left">
					<div class="discuss-avatar avatar-small">
						<?php 
        if ($system->config->get('layout_avatar')) {
            ?>
						<img alt="<?php 
            echo $this->escape($conversation->creator->getName());
            ?>
" src="<?php 
            echo $conversation->creator->getAvatar();
            ?>
" />
						<?php 
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:31,代码来源:toolbar.conversation.item.php

示例4: compose

 /**
  * Responsible to display the conversation form.
  *
  * @since	3.0
  * @access	public
  */
 public function compose()
 {
     // Get recipient id from request.
     $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) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NOT_ALLOWED'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false));
         $app->close();
     }
     if (!$id) {
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_CONVERSATION_INVALID'), DISCUSS_QUEUE_ERROR);
         $app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false));
         $app->close();
     }
     $recipient = DiscussHelper::getTable('Profile');
     $recipient->load($id);
     // Initialize conversation table.
     $conversation = DiscussHelper::getTable('Conversation');
     // Check if this conversation already exist in the system.
     $state = $conversation->loadByRelation($my->id, $recipient->id);
     // If conversation already exists between both parties, just redirect to the reply in an existing conversation.
     if ($state) {
         $app->redirect(DiscussRouter::getMessageRoute($conversation->id, false) . '#reply');
         $app->close();
     }
     $theme = new DiscussThemes();
     $theme->set('recipient', $recipient);
     echo $theme->fetch('conversation.compose.php');
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:38,代码来源:view.html.php


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