public function onUpdateInfo(OW_Event $event)
 {
     $params = $event->getParams();
     $data = $event->getData();
     if ($params["entityType"] != self::ENTITY_TYPE) {
         return;
     }
     foreach ($data as $postId => $info) {
         $status = $info["status"] == BOL_ContentService::STATUS_APPROVAL ? PostService::POST_STATUS_APPROVAL : PostService::POST_STATUS_PUBLISHED;
         $entityDto = $this->service->findById($postId);
         $entityDto->isDraft = $status;
         $this->service->save($entityDto);
         // Set tags status
         $tagActive = $info["status"] == BOL_ContentService::STATUS_APPROVAL ? false : true;
         BOL_TagService::getInstance()->setEntityStatus(self::ENTITY_TYPE, $postId, $tagActive);
     }
 }
Example #2
0
 public function onFeedAddLike(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params['entityType'] != 'blog-post') {
         return;
     }
     $post = $this->service->findById($params['entityId']);
     $userId = $post->getAuthorId();
     $userName = BOL_UserService::getInstance()->getDisplayName($userId);
     $userUrl = BOL_UserService::getInstance()->getUserUrl($userId);
     $userEmbed = '<a href="' . $userUrl . '">' . $userName . '</a>';
     if ($userId == $params['userId']) {
         $string = OW::getLanguage()->text('blogs', 'feed_activity_owner_post_string_like');
     } else {
         $string = OW::getLanguage()->text('blogs', 'feed_activity_post_string_like', array('user' => $userEmbed));
     }
     OW::getEventManager()->trigger(new OW_Event('feed.activity', array('activityType' => 'like', 'activityId' => $params['userId'], 'entityId' => $params['entityId'], 'entityType' => $params['entityType'], 'userId' => $params['userId'], 'pluginKey' => 'blogs'), array('string' => $string)));
 }