當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Notify::notifyEventCommentAnswer方法代碼示例

本文整理匯總了PHP中Notify::notifyEventCommentAnswer方法的典型用法代碼示例。如果您正苦於以下問題:PHP Notify::notifyEventCommentAnswer方法的具體用法?PHP Notify::notifyEventCommentAnswer怎麽用?PHP Notify::notifyEventCommentAnswer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Notify的用法示例。


在下文中一共展示了Notify::notifyEventCommentAnswer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addComment

 function addComment()
 {
     global $current_user;
     $subscribe = false;
     if (isset(Request::$post['subscribe'])) {
         if (Request::$post['subscribe']) {
             $subscribe = true;
         }
     }
     if (!$current_user->id) {
         return;
     }
     $comment = isset(Request::$post['comment']) ? Request::$post['comment'] : false;
     $comment = trim(prepare_review($comment, '<em><i><strong><b><u><s>'));
     if (!$comment) {
         throw new Exception('comment body expected');
     }
     $post_id = Request::$post['id'];
     $data = array();
     if ($post_id) {
         if (isset(Request::$post['comment_id']) && ($comment_id = Request::$post['comment_id'])) {
             $data = MongoDatabase::addEventComment($post_id, $current_user->id, $comment, $comment_id);
             if ($data) {
                 Notify::notifyEventCommentAnswer($data['commenter_id'], $post_id, $data['comment_id']);
             }
         } else {
             $data = MongoDatabase::addEventComment($post_id, $current_user->id, $comment);
             if ($data) {
                 Notify::notifyEventComment($data['user_id'], $post_id, $data['comment_id']);
             }
         }
     }
     if ($data) {
         if ($subscribe) {
             // на своё и так и так подписаны
             if ($data['post']['user_id'] != $current_user->id) {
                 $query = 'SELECT `id` FROM `events` WHERE `mongoid`=' . Database::escape($post_id);
                 $intid = Database::sql2single($query);
                 if ($intid) {
                     /* @var $current_user User */
                     $current_user->setNotifyRule(UserNotify::UN_COMMENT_ANSWER, UserNotify::UNT_NOTIFY);
                     $current_user->save();
                     Notify::notifySubscribe($current_user->id, $intid);
                 }
             }
         }
     }
 }
開發者ID:rasstroen,項目名稱:metro,代碼行數:48,代碼來源:EventsWriteModule.php


注:本文中的Notify::notifyEventCommentAnswer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。