Ejemplo n.º 1
0
 private function prepareCreateStream(SocialStreamItem &$item, SocialGroup $group)
 {
     if (!$group->canViewItem()) {
         return;
     }
     $params = FD::registry($item->params);
     $data = $params->get('news');
     // Load the group
     $group = FD::group($data->cluster_id);
     $news = FD::table('GroupNews');
     $news->load($data->id);
     // Get the permalink
     $permalink = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $this->getApp()->getAlias(), 'newsId' => $news->id), false);
     // Get the app params
     $appParams = $this->getApp()->getParams();
     // Format the content
     $this->format($news, $appParams->get('stream_length'));
     // Attach actions to the stream
     $this->attachActions($item, $news, $permalink, $appParams);
     $this->set('group', $group);
     $this->set('appParams', $appParams);
     $this->set('permalink', $permalink);
     $this->set('news', $news);
     $this->set('actor', $item->actor);
     // Load up the contents now.
     $item->title = parent::display('streams/create.title');
     $item->content = parent::display('streams/create.content');
 }