public function onGetInfo(OW_Event $event) { $params = $event->getParams(); if ($params["entityType"] != self::ENTITY_TYPE && $params["entityType"] != self::POST_ENTITY_TYPE) { return; } if ($params["entityType"] == self::ENTITY_TYPE) { $topics = $this->service->findTopicListByIds($params["entityIds"]); $out = array(); /** * @var FORUM_BOL_Post $post */ foreach ($topics as $topic) { $info = array(); $topicPost = $this->service->findTopicFirstPost($topic->id); $info["id"] = $topic->id; $info["userId"] = $topic->userId; $info["url"] = OW::getRouter()->urlForRoute('topic-default', array('topicId' => $topic->id)); $info["label"] = OW::getLanguage()->text('forum', 'content_forum_topic', array('topicUrl' => $info["url"], 'title' => $topic->title)); $info["title"] = $topic->title; $info["description"] = $topicPost->text; $info["timeStamp"] = $topicPost->createStamp; $out[$topic->id] = $info; } } elseif ($params["entityType"] == self::POST_ENTITY_TYPE) { $posts = $this->service->findPostListByIds($params["entityIds"]); $out = array(); /** * @var FORUM_BOL_Post $post */ foreach ($posts as $post) { $info = array(); $topicInfo = $this->service->getTopicInfo($post->topicId); $info["id"] = $post->id; $info["userId"] = $post->userId; $info["url"] = $this->service->getPostUrl($post->topicId, $post->id); $info["label"] = OW::getLanguage()->text('forum', 'content_forum_post_in_topic', array('topicUrl' => $info["url"], 'title' => UTIL_String::truncate($topicInfo['title'], 20))); $info["text"] = $post->text; $info["timeStamp"] = $post->createStamp; $out[$post->id] = $info; } } $event->setData($out); return $out; }