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


PHP DiscussHelper::sendNotification方法代码示例

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


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

示例1: submit


//.........这里部分代码省略.........
         }
         // @trigger: onAfterSave
         DiscussEventsHelper::onContentAfterSave('post', $post, $isNew);
         // The category_id for the replies should change too
         $postTable->moveChilds($postTable->id, $postTable->category_id);
         $lastId = $postTable->id;
         // Bind file attachments
         $postTable->bindAttachments();
         $message = JText::_('COM_EASYDISCUSS_POST_SAVED');
         $date = DiscussHelper::getDate();
         //@task: Save tags
         $tags = JRequest::getVar('tags', '', 'POST');
         if (!empty($tags)) {
             $tagModel = $this->getModel('Tags');
             foreach ($tags as $tag) {
                 if (!empty($tag)) {
                     $tagTable = JTable::getInstance('Tags', 'Discuss');
                     //@task: Only add tags if it doesn't exist.
                     if (!$tagTable->exists($tag)) {
                         $tagInfo['title'] = JString::trim($tag);
                         $tagInfo['alias'] = DiscussHelper::getAlias($tag, 'tag');
                         $tagInfo['created'] = $date->toMySQL();
                         $tagInfo['published'] = 1;
                         $tagInfo['user_id'] = $user->id;
                         $tagTable->bind($tagInfo);
                         $tagTable->store();
                     } else {
                         $tagTable->load($tag, true);
                     }
                     $postTagInfo = array();
                     //@task: Store in the post tag
                     $postTagTable = JTable::getInstance('PostsTags', 'Discuss');
                     $postTagInfo['post_id'] = $postTable->id;
                     $postTagInfo['tag_id'] = $tagTable->id;
                     $postTagTable->bind($postTagInfo);
                     $postTagTable->store();
                 }
             }
         }
         $isNew = empty($id) ? true : false;
         if (($isNew || $prevPostStatus == DISCUSS_ID_PENDING) && $postTable->published == DISCUSS_ID_PUBLISHED) {
             $owner = $isNew ? $user->id : $postTable->user_id;
             DiscussHelper::sendNotification($postTable, $parent, $isNew, $owner, $prevPostStatus);
             // auto subscription
             if ($config->get('main_autopostsubscription') && $config->get('main_postsubscription') && $postTable->user_type != 'twitter' && !empty($postTable->parent_id)) {
                 // process only if this is a reply
                 //automatically subscribe this user into this reply
                 $replier = JFactory::getUser($postTable->user_id);
                 $subscription_info = array();
                 $subscription_info['type'] = 'post';
                 $subscription_info['userid'] = !empty($postTable->user_id) ? $postTable->user_id : '0';
                 $subscription_info['email'] = !empty($postTable->user_id) ? $replier->email : $postTable->poster_email;
                 $subscription_info['cid'] = $postTable->parent_id;
                 $subscription_info['member'] = !empty($postTable->user_id) ? '1' : '0';
                 $subscription_info['name'] = !empty($postTable->user_id) ? $replier->name : $postTable->poster_name;
                 $subscription_info['interval'] = 'instant';
                 //get frontend subscribe table
                 $susbcribeModel = DiscussHelper::getModel('Subscribe');
                 $sid = '';
                 if ($subscription_info['userid'] == 0) {
                     $sid = $susbcribeModel->isPostSubscribedEmail($subscription_info);
                     if (empty($sid)) {
                         $susbcribeModel->addSubscription($subscription_info);
                     }
                 } else {
                     $sid = $susbcribeModel->isPostSubscribedUser($subscription_info);
                     if (empty($sid['id'])) {
                         //add new subscription.
                         $susbcribeModel->addSubscription($subscription_info);
                     }
                 }
             }
             // only if the post is a discussion
             if ($config->get('integration_pingomatic') && empty($postTable->parent_id)) {
                 $pingo = DiscussHelper::getHelper('Pingomatic');
                 $urls = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $postTable->id, true, true);
                 $pingo->ping($postTable->title, $urls);
             }
         }
         $pid = '';
         if (!empty($parent)) {
             $pid = '&pid=' . $parent;
         }
         $task = $this->getTask();
         switch ($task) {
             case 'apply':
                 $redirect = 'index.php?option=com_easydiscuss&view=post&id=' . $postTable->id;
                 break;
             case 'save':
                 $redirect = 'index.php?option=com_easydiscuss&view=posts';
                 break;
             case 'savePublishNew':
             default:
                 $redirect = 'index.php?option=com_easydiscuss&view=post';
                 break;
         }
         DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_DISCUSSION_SAVED'), DISCUSS_QUEUE_SUCCESS);
         $this->setRedirect($redirect);
     }
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:101,代码来源:posts.php

示例2: approvePost

 public function approvePost()
 {
     $mainframe = JFactory::getApplication();
     $key = JRequest::getVar('key', '');
     $redirect = DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false);
     if (empty($key)) {
         $mainframe->redirect($redirect, JText::_('COM_EASYDISCUSS_NOT_ALLOWED_HERE'), 'error');
         $mainframe->close();
     }
     $hashkey = DiscussHelper::getTable('HashKeys');
     if (!$hashkey->loadByKey($key)) {
         $mainframe->redirect($redirect, JText::_('COM_EASYDISCUSS_NOT_ALLOWED_HERE'), 'error');
         $mainframe->close();
     }
     $post = DiscussHelper::getTable('Post');
     $post->load($hashkey->uid);
     $post->published = DISCUSS_ID_PUBLISHED;
     // @trigger: onBeforeSave
     $isNew = (bool) $post->id;
     DiscussEventsHelper::importPlugin('content');
     DiscussEventsHelper::onContentBeforeSave('post', $post, $isNew);
     if (!$post->store()) {
         JError::raiseError(500, $post->getError());
     }
     // @rule: Send out notifications when the pending moderation items are being published.
     DiscussHelper::sendNotification($post, $post->parent_id, true, $post->user_id, DISCUSS_ID_PENDING);
     // @trigger: onAfterSave
     DiscussEventsHelper::onContentAfterSave('post', $post, $isNew);
     // Add to jomsocial stream
     if (!empty($post->parent_id)) {
         DiscussHelper::getHelper('jomsocial')->addActivityReply($post);
         DiscussHelper::getHelper('easysocial')->replyDiscussionStream($post);
     } else {
         DiscussHelper::getHelper('jomsocial')->addActivityQuestion($post);
         DiscussHelper::getHelper('easysocial')->createDiscussionStream($post);
     }
     // Delete the unused hashkey now.
     $hashkey->delete();
     $message = $hashkey->type == DISCUSS_REPLY_TYPE ? JText::_('COM_EASYDISCUSS_MODERATE_REPLY_PUBLISHED') : JText::_('COM_EASYDISCUSS_MODERATE_POST_PUBLISHED');
     $pid = $hashkey->type == DISCUSS_REPLY_TYPE ? $post->parent_id : $post->id;
     $mainframe->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $pid, false), $message, 'success');
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:42,代码来源:posts.php


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