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


PHP FD::notify方法代码示例

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


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

示例1: onAfterCommentSave

 /**
  * Triggered before comments notify subscribers
  *
  * @since	1.0
  * @access	public
  * @param	SocialTableComments	The comment object
  * @return
  */
 public function onAfterCommentSave(&$comment)
 {
     $allowed = array('files.user.create');
     if (!in_array($comment->element, $allowed)) {
         return;
     }
     // For likes on albums when user uploads multiple photos within an album
     if ($comment->element == 'files.user.create') {
         // Since the uid is tied to the album we can get the album object
         $stream = FD::table('Stream');
         $stream->load($comment->uid);
         // Get the actor of the likes
         $actor = FD::user($comment->created_by);
         $owner = FD::user($stream->actor_id);
         // Set the email options
         $emailOptions = array('title' => 'APP_USER_FILES_EMAILS_COMMENT_STREAM_SUBJECT', 'template' => 'apps/user/files/comment.status.item', 'permalink' => $stream->getPermalink(true, true), 'comment' => $comment->comment, 'actor' => $actor->getName(), 'actorAvatar' => $actor->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $actor->getPermalink(true, true), 'target' => $owner->getName(), 'targetLink' => $owner->getPermalink(true, true));
         $systemOptions = array('context_type' => $comment->element, 'context_ids' => $comment->id, 'url' => $stream->getPermalink(false, false, false), 'actor_id' => $comment->created_by, 'uid' => $comment->uid, 'aggregate' => true);
         // Notify the owner of the photo first
         if ($stream->actor_id != $comment->created_by) {
             FD::notify('comments.item', array($stream->actor_id), $emailOptions, $systemOptions);
         }
         // Get a list of recipients to be notified for this stream item
         // We exclude the owner of the note and the actor of the like here
         $recipients = $this->getStreamNotificationTargets($comment->uid, 'files', 'user', 'create', array(), array($stream->actor_id, $comment->created_by));
         $emailOptions['title'] = 'APP_USER_FILES_EMAILS_COMMENT_STREAM_INVOLVED_SUBJECT';
         $emailOptions['template'] = 'apps/user/files/comment.status.involved';
         // Notify other participating users
         FD::notify('comments.involved', $recipients, $emailOptions, $systemOptions);
         return;
     }
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:39,代码来源:files.php

示例2: onAfterReply

 /**
  * After a person replies a topic
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return
  */
 public function onAfterReply($message)
 {
     $length = JString::strlen($message->message);
     // Assign points for replying a thread
     if ($length > $this->params->get('activity_points_limit', 0)) {
         $this->assignPoints('thread.reply');
     }
     // Assign badge for replying to a thread
     if ($length > $this->params->get('activity_badge_limit', 0)) {
         $this->assignBadge('thread.reply', JText::_('PLG_KUNENA_EASYSOCIAL_BADGE_REPLY_TITLE'));
     }
     $stream = FD::stream();
     $tmpl = $stream->getTemplate();
     $tmpl->setActor($message->userid, SOCIAL_TYPE_USER);
     $tmpl->setContext($message->id, 'kunena');
     $tmpl->setVerb('reply');
     $tmpl->setAccess('core.view');
     // Add into stream
     $stream->add($tmpl);
     // Get a list of subscribers
     $recipients = $this->getSubscribers($message);
     if (!$recipients) {
         return;
     }
     $permalink = JUri::getInstance()->toString(array('scheme', 'host', 'port')) . $message->getPermaUrl(null);
     $options = array('uid' => $message->id, 'actor_id' => $message->userid, 'title' => '', 'type' => 'post', 'url' => $permalink, 'image' => '');
     // Add notifications in EasySocial
     FD::notify('post.reply', $recipients, array(), $options);
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:37,代码来源:activity.php

示例3: onAfterLikeSave

 public function onAfterLikeSave($likes)
 {
     if ($likes->type != 'relationship.user.approve') {
         return;
     }
     $table = $this->getTableObject($likes->uid);
     if (!$table) {
         return;
     }
     $recipients = $this->getStreamNotificationTargets($likes->uid, 'relationship', 'user', 'approve', array($table->actor, $table->target), array($likes->created_by));
     $streamItem = FD::table('streamitem');
     $streamItem->load(array('context_type' => 'relationship', 'context_id' => $likes->uid, 'verb' => 'approve'));
     FD::notify('likes.item', $recipients, array('link' => $streamItem->getPermalink(true, true)), array('type' => 'likes', 'uid' => $likes->uid, 'context_type' => $likes->type, 'url' => $streamItem->getPermalink(false, false, false)));
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:14,代码来源:relationship.php

示例4: onAfterLikeSave

 /**
  * Processes after someone likes an announcement
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function onAfterLikeSave(&$likes)
 {
     $allowed = array('news.group.create');
     if (!in_array($likes->type, $allowed)) {
         return;
     }
     if ($likes->type == 'news.group.create') {
         // Get the stream object
         $news = FD::table('ClusterNews');
         $news->load($likes->uid);
         // Get the likes actor
         $actor = FD::user($likes->created_by);
         $emailOptions = array('title' => 'APP_GROUP_NEWS_EMAILS_LIKE_ITEM_SUBJECT', 'template' => 'apps/group/news/like.news.item', 'permalink' => $news->getPermalink(true, true), 'actor' => $actor->getName(), 'actorAvatar' => $actor->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $actor->getPermalink(true, true));
         $systemOptions = array('context_type' => $likes->type, 'context_ids' => $news->cluster_id, 'url' => $news->getPermalink(false, false, false), 'actor_id' => $likes->created_by, 'uid' => $likes->uid, 'aggregate' => true);
         // Notify the owner first
         if ($news->created_by != $likes->created_by) {
             FD::notify('likes.item', array($news->created_by), $emailOptions, $systemOptions);
         }
         // Get a list of recipients to be notified for this stream item
         // We exclude the owner of the note and the actor of the like here
         $recipients = $this->getStreamNotificationTargets($likes->uid, 'news', 'group', 'create', array(), array($news->created_by, $likes->created_by));
         $emailOptions['title'] = 'APP_GROUP_NEWS_EMAILS_LIKE_INVOLVED_SUBJECT';
         $emailOptions['template'] = 'apps/group/news/like.news.involved';
         // Notify other participating users
         FD::notify('likes.involved', $recipients, $emailOptions, $systemOptions);
         return;
     }
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:36,代码来源:news.php

示例5: onAfterLikeSave

 /**
  * Processes when someone likes the stream of a milestone
  *
  * @since    1.2
  * @access    public
  * @param    string
  * @return
  */
 public function onAfterLikeSave(&$likes)
 {
     $allowed = array('tasks.event.createMilestone', 'tasks.event.createTask');
     if (!in_array($likes->type, $allowed)) {
         return;
     }
     // Get the verb
     list($element, $group, $verb) = explode('.', $likes->type);
     $identifier = $verb == 'createMilestone' ? 'milestone' : 'task';
     // Get the milestone/task table
     $table = FD::table($identifier);
     $table->load($likes->uid);
     // Get the actor
     $actor = FD::user($likes->created_by);
     // Get the owner
     $owner = FD::user($table->owner_id);
     // Get the event
     $event = FD::event($table->uid);
     $recipients = $this->getStreamNotificationTargets($likes->uid, $element, $group, $verb, array(), array($owner->id, $likes->created_by));
     // APP_EVENT_TASKS_EMAILS_LIKE_YOUR_MILESTONE_SUBJECT
     // APP_EVENT_TASKS_EMAILS_LIKE_YOUR_TASK_SUBJECT
     // APP_EVENT_TASKS_EMAILS_LIKE_A_MILESTONE_SUBJECT
     // APP_EVENT_TASKS_EMAILS_LIKE_A_TASK_SUBJECT
     // apps/event/tasks/like.milestone
     // apps/event/tasks/like.task
     // apps/event/tasks/like.milestone.involved
     // apps/event/tasks/like.task.involved
     $emailOptions = array('title' => 'APP_EVENT_TASKS_EMAILS_LIKE_YOUR_' . strtoupper($identifier) . '_SUBJECT', 'template' => 'apps/event/tasks/like.' . $identifier, 'permalink' => FRoute::stream(array('layout' => 'item', 'id' => $likes->stream_id, 'external' => true)), 'actor' => $actor->getName(), 'actorAvatar' => $actor->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $actor->getPermalink(true, true));
     $systemOptions = array('context_type' => $likes->type, 'url' => FRoute::stream(array('layout' => 'item', 'id' => $likes->stream_id, 'sef' => false)), 'actor_id' => $likes->created_by, 'uid' => $likes->uid, 'aggregate' => true);
     // Notify the owner first
     if ($likes->created_by != $owner->id) {
         FD::notify('likes.item', array($owner->id), $emailOptions, $systemOptions);
     }
     // Get a list of recipients to be notified for this stream item
     // We exclude the owner of the note and the actor of the like here
     $recipients = $this->getStreamNotificationTargets($likes->uid, $element, $group, $verb, array(), array($owner->id, $likes->created_by));
     $emailOptions['title'] = 'APP_EVENT_TASKS_EMAILS_LIKE_A_' . strtoupper($identifier) . '_SUBJECT';
     $emailOptions['template'] = 'apps/event/tasks/like.' . $identifier . '.involved';
     // Notify other participating users
     FD::notify('likes.involved', $recipients, $emailOptions, $systemOptions);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:49,代码来源:tasks.php

示例6: follow

 /**
  * Allows a user to follow another user.
  *
  * @since	1.0
  * @access	public
  */
 public function follow()
 {
     // Check for request forgeries.
     FD::checkToken();
     // Ensure that the user needs to be logged in.
     FD::requireLogin();
     // Get the current view.
     $view = $this->getCurrentView();
     // Get the object identifier.
     $id = JRequest::getInt('id');
     // Get the user that is being followed
     $user = FD::user($id);
     $type = JRequest::getVar('type');
     $group = JRequest::getVar('group', SOCIAL_APPS_GROUP_USER);
     // Get the current logged in user.
     $my = FD::user();
     // Load subscription table.
     $subscription = FD::table('Subscription');
     // Get subscription library
     $subscriptionLib = FD::get('Subscriptions');
     // User should never be allowed to follow themselves.
     if ($my->id == $id) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_FOLLOWERS_NOT_ALLOWED_TO_FOLLOW_SELF'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__, $subscription);
     }
     // Determine if the current user is already a follower
     $isFollowing = $subscriptionLib->isFollowing($id, $type, $group, $my->id);
     // If it's already following, throw proper message
     if ($isFollowing) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_SUBSCRIPTIONS_ERROR_ALREADY_FOLLOWING_USER'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__, $subscription);
     }
     // If the user isn't alreayd following, create a new subscription record.
     $subscription->uid = $id;
     $subscription->type = $type . '.' . $group;
     $subscription->user_id = $my->id;
     $state = $subscription->store();
     if (!$state) {
         $view->setMessage($subscription->getError(), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__, $subscription);
     }
     // @badge: followers.follow
     $badge = FD::badges();
     $badge->log('com_easysocial', 'followers.follow', $my->id, JText::_('COM_EASYSOCIAL_FOLLOWERS_BADGE_FOLLOWING_USER'));
     // @badge: followers.followed
     $badge->log('com_easysocial', 'followers.followed', $user->id, JText::_('COM_EASYSOCIAL_FOLLOWERS_BADGE_FOLLOWED'));
     // @points: profile.follow
     // Assign points when user follows another person
     $points = FD::points();
     $points->assign('profile.follow', 'com_easysocial', $my->id);
     // @points: profile.followed
     // Assign points when user is being followed by another person
     $points->assign('profile.followed', 'com_easysocial', $user->id);
     // check if admin want to add stream on following a user or not.
     $config = FD::config();
     if ($config->get('users.stream.following')) {
         // Share this on the stream.
         $stream = FD::stream();
         $streamTemplate = $stream->getTemplate();
         // Set the actor.
         $streamTemplate->setActor($my->id, SOCIAL_TYPE_USER);
         // Set the context.
         $streamTemplate->setContext($subscription->id, SOCIAL_TYPE_FOLLOWERS);
         // Set the verb.
         $streamTemplate->setVerb('follow');
         $streamTemplate->setAccess('followers.view');
         // Create the stream data.
         $stream->add($streamTemplate);
     }
     // Set the email options
     $emailOptions = array('title' => 'COM_EASYSOCIAL_EMAILS_NEW_FOLLOWER_SUBJECT', 'template' => 'site/followers/new.followers', 'actor' => $my->getName(), 'actorAvatar' => $my->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $my->getPermalink(true, true), 'target' => $user->getName(), 'targetLink' => $user->getPermalink(true, true), 'totalFriends' => $my->getTotalFriends(), 'totalFollowing' => $my->getTotalFollowing(), 'totalFollowers' => $my->getTotalFollowers());
     $state = FD::notify('profile.followed', array($user->id), $emailOptions, array('url' => $my->getPermalink(false, false, false), 'actor_id' => $my->id, 'uid' => $id));
     return $view->call(__FUNCTION__, $subscription);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:80,代码来源:profile.php

示例7: onAfterCommentSave

 /**
  * Notifies the owner when user likes their feed
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function onAfterCommentSave(&$comment)
 {
     // @legacy
     // photos.user.add should just be photos.user.upload since they are pretty much the same
     $allowed = array('feeds.user.create');
     if (!in_array($comment->element, $allowed)) {
         return;
     }
     // For new feed items
     if ($comment->element == 'feeds.user.create') {
         // Get the RSS feed
         $feed = $this->getTable('Feed');
         $feed->load($comment->uid);
         // Get the stream since we want to link it to the stream
         $stream = FD::table('Stream');
         $stream->load($comment->stream_id);
         // Get the actor of the likes
         $actor = FD::user($comment->created_by);
         // Get the owner of the item
         $owner = FD::user($feed->user_id);
         // Set the email options
         $emailOptions = array('title' => 'APP_USER_FEEDS_EMAILS_COMMENT_RSS_FEED_ITEM_SUBJECT', 'template' => 'apps/user/feeds/comment.feed.item', 'permalink' => $stream->getPermalink(true, true), 'actor' => $actor->getName(), 'actorAvatar' => $actor->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $actor->getPermalink(true, true), 'target' => $owner->getName(), 'comment' => $comment->comment);
         $systemOptions = array('context_type' => $comment->element, 'context_ids' => $stream->id, 'url' => $stream->getPermalink(false, false, false), 'actor_id' => $comment->created_by, 'uid' => $comment->uid, 'aggregate' => true);
         // Notify the owner of the photo first
         if ($feed->user_id != $comment->created_by) {
             FD::notify('comments.item', array($feed->user_id), $emailOptions, $systemOptions);
         }
         // Get a list of recipients to be notified for this stream item
         // We exclude the owner of the note and the actor of the like here
         $recipients = $this->getStreamNotificationTargets($comment->uid, 'feeds', 'user', 'create', array(), array($feed->user_id, $comment->created_by));
         $emailOptions['title'] = 'APP_USER_FEEDS_EMAILS_COMMENT_RSS_FEED_INVOLVED_SUBJECT';
         $emailOptions['template'] = 'apps/user/feeds/comment.feed.involved';
         // Notify other participating users
         FD::notify('comments.involved', $recipients, $emailOptions, $systemOptions);
         return;
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:45,代码来源:feeds.php

示例8: notify

 /**
  * Shorthand function to send notification for various actions.
  *
  * @author Jason Rey <jasonrey@stackideas.com>
  * @since  1.2
  * @access private
  * @param  string    $verb   The action string.
  * @param  integer   $actor  The acting user id.
  * @param  integer   $target The targeted user id.
  */
 private function notify($verb, $actor, $target)
 {
     $actor = FD::user($actor);
     $target = FD::user($target);
     $emailOptions = array('title' => 'PLG_FIELDS_RELATIONSHIP_EMAIL_TITLE_' . strtoupper($verb), 'template' => 'fields/user/relationship/' . $verb, 'actor' => $actor->getName(), 'posterName' => $actor->getName(), 'posterAvatar' => $actor->getAvatar(), 'posterLink' => $actor->getPermalink(true, true), 'recipientName' => $target->getName(), 'type' => $this->type, 'link' => FRoute::profile(array('layout' => 'edit', 'external' => true), true));
     $systemOptions = array('uid' => $this->id, 'actor_id' => $actor->id, 'type' => 'relationship', 'title' => 'APP_USER_RELATIONSHIP_NOTIFICATION_TITLE_' . strtoupper($verb), 'url' => FRoute::profile(array('layout' => 'edit', 'sef' => false)), 'image' => $actor->getAvatar(SOCIAL_AVATAR_LARGE), 'context_type' => 'apps.user.relationship.' . $verb);
     // relationship.request
     // relationship.approve
     // relationship.reject
     FD::notify('relationship.' . $verb, array($target->id), $emailOptions, $systemOptions);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:21,代码来源:relations.php

示例9: sendNotification

 /**
  * Responsible to send notification to the user when they achieved a badge
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function sendNotification(SocialTableBadge $badge, $userId)
 {
     // Load the language file from the front end too since badge titles are loaded from the back end language
     FD::language()->loadAdmin();
     // We need the language file from the front end
     FD::language()->loadSite();
     // We want to send a notification to the user who earned the badge
     $recipient = array($userId);
     // Add notification to the requester that the user accepted his friend request.
     $systemOptions = array('uid' => $badge->id, 'type' => SOCIAL_TYPE_BADGES, 'url' => FRoute::badges(array('id' => $badge->getAlias(), 'layout' => 'item', 'sef' => false)), 'image' => $badge->getAvatar());
     $params = array('badgeTitle' => $badge->get('title'), 'badgePermalink' => $badge->getPermalink(false, true), 'badgeAvatar' => $badge->getAvatar(), 'badgeDescription' => $badge->get('description'));
     // Email template
     $emailOptions = array('title' => 'COM_EASYSOCIAL_EMAILS_UNLOCKED_NEW_BADGE_SUBJECT', 'badge' => $badge->get('title'), 'template' => 'site/badges/unlocked', 'params' => $params);
     // Send notifications to the receivers when they unlock the badge
     FD::notify('badges.unlocked', $recipient, $emailOptions, $systemOptions);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:24,代码来源:badges.php

示例10: invite

 /**
  * Invites a user to the event and does the appropriate follow actions.
  *
  * @author Jason Rey <jasonrey@stackideas.com>
  * @since  1.3
  * @access public
  * @param  integer    $target The invited user id.
  * @param  integer    $actor  The actor user id.
  * @return boolean            True if successful.
  */
 public function invite($target, $actor = null)
 {
     $actor = FD::user($actor);
     $target = FD::user($target);
     $guest = FD::table('EventGuest');
     $guest->cluster_id = $this->id;
     $guest->uid = $target->id;
     $guest->type = SOCIAL_TYPE_USER;
     $guest->state = SOCIAL_EVENT_GUEST_INVITED;
     $guest->invited_by = $actor->id;
     $guest->store();
     FD::points()->assign('events.guest.invite', 'com_easysocial', $actor->id);
     $emailOptions = (object) array('title' => 'COM_EASYSOCIAL_EMAILS_EVENT_GUEST_INVITED_SUBJECT', 'template' => 'site/event/guest.invited', 'event' => $this->getName(), 'eventName' => $this->getName(), 'eventAvatar' => $this->getAvatar(), 'eventLink' => $this->getPermalink(false, true), 'invitorName' => $actor->getName(), 'invitorLink' => $actor->getPermalink(false, true), 'invitorAvatar' => $actor->getAvatar());
     $systemOptions = (object) array('uid' => $this->id, 'actor_id' => $actor->id, 'target_id' => $target->id, 'context_type' => 'events', 'type' => 'events', 'url' => $this->getPermalink(true, false, 'item', false), 'eventId' => $this->id);
     FD::notify('events.guest.invited', array($target->id), $emailOptions, $systemOptions);
     return true;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:27,代码来源:event.php

示例11: request

 /**
  * Allows caller to make a friend request from source to target
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return
  */
 public function request($sourceId, $targetId, $state = SOCIAL_FRIENDS_STATE_PENDING)
 {
     // Do not allow user to create a friend request to himself
     if ($sourceId == $targetId) {
         $this->setError(JText::_('COM_EASYSOCIAL_FRIENDS_UNABLE_TO_ADD_YOURSELF'));
         return false;
     }
     // If they are already friends, ignore this.
     if ($this->isFriends($sourceId, $targetId)) {
         $this->setError(JText::_('COM_EASYSOCIAL_FRIENDS_ERROR_ALREADY_FRIENDS'));
         return false;
     }
     // Check if user has already previously requested this.
     if ($this->isFriends($sourceId, $targetId, SOCIAL_FRIENDS_STATE_PENDING)) {
         $this->setError(JText::_('COM_EASYSOCIAL_FRIENDS_ERROR_ALREADY_REQUESTED'));
         return false;
     }
     // If everything is okay, we proceed to add this request to the friend table.
     $table = FD::table('Friend');
     $table->setActorId($sourceId);
     $table->setTargetId($targetId);
     $table->setState($state);
     // Save the request
     $state = $table->store();
     $my = FD::user($sourceId);
     $user = FD::user($targetId);
     // Prepare the dispatcher
     FD::apps()->load(SOCIAL_TYPE_USER);
     $dispatcher = FD::dispatcher();
     $args = array(&$table, $my, $user);
     // @trigger: onFriendRequest
     $dispatcher->trigger(SOCIAL_TYPE_USER, 'onFriendRequest', $args);
     // Send notification to the target when a user requests to be his / her friend.
     $params = array('requesterId' => $my->id, 'requesterAvatar' => $my->getAvatar(SOCIAL_AVATAR_LARGE), 'requesterName' => $my->getName(), 'requesterLink' => $my->getPermalink(true, true), 'requestDate' => FD::date()->toMySQL(), 'totalFriends' => $my->getTotalFriends(), 'totalMutualFriends' => $my->getTotalMutualFriends($user->id));
     // Email template
     $emailOptions = array('actor' => $my->getName(), 'title' => 'COM_EASYSOCIAL_EMAILS_FRIENDS_NEW_REQUEST_SUBJECT', 'template' => 'site/friends/request', 'params' => $params);
     FD::notify('friends.request', array($user->id), $emailOptions, false);
     // @badge: friends.create
     // Assign badge for the person that initiated the friend request.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'friends.create', $my->id, JText::_('COM_EASYSOCIAL_FRIENDS_BADGE_REQUEST_TO_BE_FRIEND'));
     return $table;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:51,代码来源:friends.php

示例12: onAfterLikeSave

 /**
  * Processes when someone likes the stream of a milestone
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function onAfterLikeSave(&$likes)
 {
     $allowed = array('tasks.group.createMilestone');
     if (!in_array($likes->type, $allowed)) {
         return;
     }
     // Get the verb
     $segments = explode('.', $likes->type);
     $verb = $segments[2];
     if ($likes->type == 'tasks.group.createMilestone') {
         // Get the milestone
         $milestone = FD::table('Milestone');
         $milestone->load($likes->uid);
         // Get the group
         $group = FD::group($milestone->uid);
         // Get a list of recipients
         $recipients = $this->getStreamNotificationTargets($likes->uid, 'tasks', 'group', $verb, array(), array($milestone->owner_id, $likes->created_by));
         // okay since likes on group task can be made to 'task.group.createmilestones' and can only be liked via stream item,
         // also, currently milestone page do not display any likes, thus the link have to go to stream item page to see the likes.
         // @2014-07-02, Sam
         $emailOptions = array('title' => 'APP_GROUP_TASKS_EMAILS_LIKE_YOUR_MILESTONE_TITLE', 'template' => 'apps/group/tasks/like.milestone', 'permalink' => FRoute::stream(array('layout' => 'item', 'id' => $likes->stream_id, 'external' => true, 'xhtml' => true)));
         $systemOptions = array('title' => '', 'context_type' => $likes->type, 'url' => FRoute::stream(array('layout' => 'item', 'id' => $likes->stream_id)), 'actor_id' => $likes->created_by, 'uid' => $likes->uid, 'aggregate' => true);
         // Notify the owner first
         if ($likes->created_by != $milestone->owner_id) {
             Foundry::notify('likes.item', array($milestone->owner_id), $emailOptions, $systemOptions);
         }
         // Get a list of recipients to be notified for this stream item
         // We exclude the owner of the note and the actor of the like here
         $recipients = $this->getStreamNotificationTargets($likes->uid, 'tasks', 'group', $verb, array(), array($milestone->owner_id, $likes->created_by));
         $emailOptions['title'] = 'APP_GROUP_TASKS_EMAILS_LIKE_USERS_MILESTONE_TITLE';
         $emailOptions['template'] = 'apps/group/tasks/like.milestone.involved';
         // Notify other participating users
         FD::notify('likes.involved', $recipients, $emailOptions, $systemOptions);
     }
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:43,代码来源:tasks.php

示例13: onAfterLikeSave

 public function onAfterLikeSave($likes)
 {
     $segments = explode('.', $likes->type);
     if (count($segments) !== 3 || $segments[1] !== SOCIAL_TYPE_EVENT) {
         return;
     }
     list($element, $group, $verb) = explode('.', $likes->type);
     if ($element !== 'events') {
         return;
     }
     // Get the actor
     $actor = FD::user($likes->created_by);
     // Verbs
     // feature
     // create
     // update
     $event = FD::event($likes->uid);
     $stream = FD::table('Stream');
     $stream->load($likes->stream_id);
     $owner = FD::user($stream->actor_id);
     // APP_USER_EVENTS_EMAILS_FEATURE_LIKE_ITEM_SUBJECT
     // APP_USER_EVENTS_EMAILS_CREATE_LIKE_ITEM_SUBJECT
     // APP_USER_EVENTS_EMAILS_UPDATE_LIKE_ITEM_SUBJECT
     // APP_USER_EVENTS_EMAILS_FEATURE_LIKE_INVOLVED_SUBJECT
     // APP_USER_EVENTS_EMAILS_CREATE_LIKE_INVOLVED_SUBJECT
     // APP_USER_EVENTS_EMAILS_UPDATE_LIKE_INVOLVED_SUBJECT
     // apps/user/events/feature.like.item
     // apps/user/events/create.like.item
     // apps/user/events/update.like.item
     // apps/user/events/feature.like.involved
     // apps/user/events/create.like.involved
     // apps/user/events/update.like.involved
     $emailOptions = array('title' => 'APP_USER_EVENTS_EMAILS_' . strtoupper($verb) . '_LIKE_ITEM_SUBJECT', 'template' => 'apps/user/events/' . $verb . '.like.item', 'permalink' => FRoute::stream(array('layout' => 'item', 'id' => $likes->stream_id, 'external' => true)), 'actor' => $actor->getName(), 'actorAvatar' => $actor->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $actor->getPermalink(true, true));
     $systemOptions = array('context_type' => $likes->type, 'url' => FRoute::stream(array('layout' => 'item', 'id' => $likes->stream_id, 'sef' => false)), 'actor_id' => $likes->created_by, 'uid' => $likes->uid, 'aggregate' => true);
     // Notify the owner first
     if ($likes->created_by != $owner->id) {
         FD::notify('likes.item', array($owner->id), $emailOptions, $systemOptions);
     }
     // Get a list of recipients to be notified for this stream item
     // We exclude the guest and the actor of the like here
     $recipients = $this->getStreamNotificationTargets($likes->uid, $element, $group, $verb, array(), array($owner->id, $likes->created_by));
     $emailOptions['title'] = 'APP_USER_EVENTS_EMAILS_' . strtoupper($verb) . '_LIKE_INVOLVED_SUBJECT';
     $emailOptions['template'] = 'apps/user/events/' . $verb . '.like.involved';
     // Notify other participating users
     FD::notify('likes.involved', $recipients, $emailOptions, $systemOptions);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:46,代码来源:events.php

示例14: promoteMembers

 public function promoteMembers()
 {
     FD::checkToken();
     $view = $this->getCurrentView();
     $groupid = JRequest::getInt('id');
     $cids = JRequest::getVar('cid');
     if (empty($cids)) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_PROMOTE_MEMBERS_FAILED'), SOCIAL_MSG_ERROR);
         $view->call(__FUNCTION__);
     }
     FD::language()->loadSite();
     $my = FD::user();
     $group = FD::group($groupid);
     $user = FD::table('GroupMember');
     $user->load(array('cluster_id' => $group->id, 'uid' => $my->id, 'type' => SOCIAL_TYPE_USER));
     if (!$my->isSiteAdmin() && !$user->isAdmin() && !$user->isOwner()) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_PROMOTE_MEMBERS_FAILED'), SOCIAL_MSG_ERROR);
         $view->call(__FUNCTION__);
     }
     $count = 0;
     foreach ($cids as $id) {
         $member = FD::table('GroupMember');
         $member->load($id);
         $member->makeAdmin();
         $group->createStream($member->uid, 'makeadmin');
         // Notify the person that they are now a group admin
         $emailOptions = array('title' => 'COM_EASYSOCIAL_GROUPS_EMAILS_PROMOTED_AS_GROUP_ADMIN_SUBJECT', 'template' => 'site/group/promoted', 'permalink' => $group->getPermalink(true, true), 'actor' => $my->getName(), 'actorAvatar' => $my->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $my->getPermalink(true, true), 'group' => $group->getName(), 'groupLink' => $group->getPermalink(true, true));
         $systemOptions = array('context_type' => 'groups.group.promoted', 'url' => $group->getPermalink(false, false, 'item', false), 'actor_id' => $my->id, 'uid' => $group->id);
         // Notify the owner first
         FD::notify('groups.promoted', array($member->uid), $emailOptions, $systemOptions);
         $count++;
     }
     if ($count > 0) {
         $view->setMessage(JText::sprintf('COM_EASYSOCIAL_GROUPS_PROMOTE_MEMBERS_SUCCESS', $count), SOCIAL_MSG_SUCCESS);
     }
     $view->call(__FUNCTION__);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:37,代码来源:groups.php

示例15: onAfterCommentSave

 /**
  * Processes notifications when a comment is stored on the site
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function onAfterCommentSave(&$comment)
 {
     // We need to split it because the type now stores as badges.user.unlocked.[9999]
     $namespace = explode('.', $comment->element);
     array_shift($namespace);
     $context = implode('.', $namespace);
     if (count($namespace) < 4 || $context != 'badges.user.unlocked') {
         return;
     }
     list($element, $group, $verb, $owner) = $namespace;
     // Get the permalink of the achievement item which is the stream item
     $streamItem = FD::table('StreamItem');
     $state = $streamItem->load(array('context_type' => $element, 'verb' => $verb, 'actor_id' => $owner, 'actor_type' => $group));
     if (!$state) {
         return;
     }
     $emailOptions = array('title' => 'APP_USER_BADGES_EMAILS_COMMENT_ITEM_TITLE', 'template' => 'apps/user/badges/comment.item', 'permalink' => $streamItem->getPermalink(true, true));
     $systemOptions = array('context_type' => $comment->element, 'content' => $comment->comment, 'url' => $streamItem->getPermalink(false, false, false), 'actor_id' => $comment->created_by, 'uid' => $comment->uid, 'aggregate' => true);
     if ($comment->created_by != $owner) {
         FD::notify('comments.item', array($owner), $emailOptions, $systemOptions);
     }
     // Get a list of recipients to be notified for this stream item.
     $recipients = $this->getStreamNotificationTargets($comment->uid, $element, $group, $verb . '.' . $owner, array(), array($owner, $comment->created_by));
     $emailOptions['title'] = 'APP_USER_BADGES_EMAILS_COMMENT_INVOLVED_TITLE';
     $emailOptions['template'] = 'apps/user/badges/comment.involved';
     FD::notify('comments.involved', $recipients, $emailOptions, $systemOptions);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:badges.php


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