本文整理汇总了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);
}
}
}
}
}