public function postPersist(Chapter $chapter, LifecycleEventArgs $event)
 {
     $userPicker = $chapter->getUserPicker();
     $lesson = $chapter->getLesson();
     if ($userPicker !== null && count($userPicker->getUserIds()) > 0 && $lesson->getResourceNode() !== null) {
         $details = array('chapter' => array('lesson' => $lesson->getId(), 'chapter' => $chapter->getId(), 'title' => $chapter->getTitle()), 'resource' => array('id' => $lesson->getId(), 'name' => $lesson->getResourceNode()->getName(), 'type' => $lesson->getResourceNode()->getResourceType()->getName()));
         $notification = $this->notificationManager->createNotification('resource-icap_lesson-user_tagged', 'lesson', $lesson->getResourceNode()->getId(), $details);
         $this->notificationManager->notifyUsers($notification, $userPicker->getUserIds());
     }
 }
Example #2
0
 public function postPersist(Post $post, LifecycleEventArgs $event)
 {
     $userPicker = $post->getUserPicker();
     $blog = $post->getBlog();
     if ($post->isPublished() && $userPicker !== null && count($userPicker->getUserIds()) > 0 && $blog->getResourceNode() !== null) {
         $details = array('post' => array('blog' => $blog->getId(), 'title' => $post->getTitle(), 'slug' => $post->getSlug(), 'published' => $post->isPublished(), 'author' => $post->getAuthor()->getFirstName() . ' ' . $post->getAuthor()->getLastName(), 'authorId' => $post->getAuthor()->getId()), 'resource' => array('id' => $blog->getId(), 'name' => $blog->getResourceNode()->getName(), 'type' => $blog->getResourceNode()->getResourceType()->getName()));
         $notification = $this->notificationManager->createNotification('resource-icap_blog-post-user_tagged', 'blog', $blog->getResourceNode()->getId(), $details);
         $this->notificationManager->notifyUsers($notification, $userPicker->getUserIds());
     }
 }
 public function postPersist(Contribution $contribution, LifecycleEventArgs $event)
 {
     $userPicker = $contribution->getUserPicker();
     $section = $contribution->getSection();
     $wiki = $section->getWiki();
     if ($userPicker !== null && count($userPicker->getUserIds()) > 0 && $wiki->getResourceNode() !== null) {
         $details = array('contribution' => array('wiki' => $wiki->getId(), 'section' => $section->getId(), 'id' => $contribution->getId(), 'title' => $contribution->getTitle(), 'text' => $contribution->getText(), 'contributor' => $contribution->getContributor()->getFirstName() . ' ' . $contribution->getContributor()->getLastName()), 'resource' => array('id' => $wiki->getId(), 'name' => $wiki->getResourceNode()->getName(), 'type' => $wiki->getResourceNode()->getResourceType()->getName()));
         $notification = $this->notificationManager->createNotification('resource-icap_wiki-user_tagged', 'wiki', $wiki->getResourceNode()->getId(), $details, $contribution->getContributor());
         $this->notificationManager->notifyUsers($notification, $userPicker->getUserIds());
     }
 }