本文整理汇总了PHP中SocialAppItem::display方法的典型用法代码示例。如果您正苦于以下问题:PHP SocialAppItem::display方法的具体用法?PHP SocialAppItem::display怎么用?PHP SocialAppItem::display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocialAppItem
的用法示例。
在下文中一共展示了SocialAppItem::display方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPrepareStream
public function onPrepareStream(SocialStreamItem &$stream, $includePrivacy = true)
{
if ($stream->context != 'relationship') {
return;
}
$params = $this->getParams();
if (!$params->get('stream_approve', true)) {
return;
}
$my = FD::user();
$privacy = FD::privacy($my->id);
if ($includePrivacy && !$privacy->validate('core.view', $stream->contextId, 'relationship', $stream->actor->id)) {
return;
}
$stream->color = '#DC554F';
$stream->fonticon = 'ies-heart';
$stream->label = JText::_('APP_USER_RELATIONSHIP_STREAM_TOOLTIP');
$stream->display = SOCIAL_STREAM_DISPLAY_FULL;
$registry = FD::registry($stream->params);
$this->set('type', $registry->get('type'));
$this->set('actor', $stream->actor);
$this->set('target', $stream->targets[0]);
$stream->title = parent::display('streams/' . $stream->verb . '.title');
if ($includePrivacy) {
$stream->privacy = $privacy->form($stream->contextId, 'relationship', $stream->actor->id, 'core.view', false, $stream->uid);
}
return true;
}
示例2: onPrepareStream
public function onPrepareStream(SocialStreamItem &$item, $includePrivacy = true)
{
// We only want to process related items
if ($item->cluster_type !== SOCIAL_TYPE_EVENT || empty($item->cluster_id)) {
return;
}
// Context are split into events and nodes
// "events" context are stream items that are related to event item
// "guests" context are stream items that are related to guests of the event
// Only process "events" context here
// "guests" context are processed in the app/event/guests app
if ($item->context !== 'events') {
return;
}
$event = FD::event($item->cluster_id);
// Only show Social sharing in public group
if (!$event->isOpen()) {
$item->sharing = false;
}
if (!$event->canViewItem()) {
return;
}
if (!$this->getParams()->get('stream_' . $item->verb, true)) {
return;
}
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
$item->color = '#f06050';
$item->fonticon = 'ies-calendar';
$item->label = FD::_('APP_EVENT_EVENTS_STREAM_TOOLTIP', true);
$actor = $item->actor;
$this->set('event', $event);
$this->set('actor', $actor);
// streams/create.title
// streams/feature.title
// streams/update.title
$item->title = parent::display('streams/' . $item->verb . '.title');
$item->content = '';
if ($event->isGroupEvent()) {
$this->set('group', $event->getGroup());
$item->content = parent::display('streams/content');
}
// APP_EVENT_EVENTS_STREAM_OPENGRAPH_UPDATE
// APP_EVENT_EVENTS_STREAM_OPENGRAPH_CREATE
// APP_EVENT_EVENTS_STREAM_OPENGRAPH_FEATURE
$item->opengraph->addDescription(JText::sprintf('APP_EVENT_EVENTS_STREAM_OPENGRAPH_' . strtoupper($item->verb), $actor->getName(), $event->getName()));
}
示例3: onPrepareStream
/**
* Prepares the stream items for mosets tree
*
* @since 1.3
* @access public
* @param string
* @return
*/
public function onPrepareStream(SocialStreamItem &$stream, $includePrivacy = true)
{
if (!$this->exists() || $stream->context != 'mtree') {
return;
}
// Decorate the stream
$stream->display = SOCIAL_STREAM_DISPLAY_FULL;
$stream->color = '#6f90b5';
$stream->fonticon = 'ies-comments-2';
$stream->label = JText::_('APP_USER_MTREE_STREAM_LABEL');
// Get the link object
$db = JFactory::getDbo();
$link = new mtLinks($db);
$link->load($stream->contextId);
$this->decorate($link);
$this->set('actor', $stream->actor);
$this->set('link', $link);
$stream->title = parent::display('streams/title');
$stream->content = parent::display('streams/content');
}
示例4: prepareUploadedStream
/**
* Prepares the stream item for new file uploads
*
* @since 1.0
* @access public
* @param SocialStreamItem The stream item.
* @return
*/
private function prepareUploadedStream(&$item)
{
$params = FD::registry($item->params);
// Load up the event object
$event = FD::event($params->get('event')->id);
// Do not allow user to repost files
$item->repost = false;
// Try to get the file object
$obj = $params->get('file');
// Default variables
$content = '';
$files = array();
if (is_object($obj)) {
// Get the file object
$file = FD::table('File');
$file->load($params->get('file')->id);
if (!$file->id) {
return;
}
$files[] = $file;
} else {
$params = FD::registry($item->contextParams[0]);
$fileItems = $params->get('file');
$content = $item->content;
foreach ($fileItems as $fileId) {
$file = FD::table('File');
$file->load((int) $fileId);
$files[] = $file;
}
}
// Apply likes on the stream
$likes = FD::likes();
$likes->get($item->uid, $item->context, $item->verb, SOCIAL_APPS_GROUP_EVENT, $item->uid);
$item->likes = $likes;
// Get the actor
$actor = $item->actor;
$this->set('content', $content);
$this->set('actor', $actor);
$this->set('files', $files);
$this->set('event', $event);
// Load up the contents now.
$item->title = parent::display('streams/uploaded.title');
$item->content = parent::display('streams/uploaded.content');
}
示例5: onPrepareActivityLog
/**
* Responsible to generate the activity logs.
*
* @since 1.0
* @access public
* @param object $params A standard object with key / value binding.
*
* @return none
*/
public function onPrepareActivityLog(SocialStreamItem &$item, $includePrivacy = true)
{
if ($item->context != 'links') {
return;
}
//get story object, in this case, is the stream_item
$tbl = FD::table('StreamItem');
$tbl->load($item->uid);
// item->uid is now streamitem.id
$uid = $tbl->uid;
//get story object, in this case, is the stream_item
$my = FD::user();
$privacy = FD::privacy($my->id);
$actor = $item->actor;
$target = count($item->targets) > 0 ? $item->targets[0] : '';
$assets = $item->getAssets($uid);
if (empty($assets)) {
return;
}
$assets = $assets[0];
$this->set('assets', $assets);
$this->set('actor', $actor);
$this->set('target', $target);
$this->set('stream', $item);
$item->display = SOCIAL_STREAM_DISPLAY_MINI;
$item->title = parent::display('logs/' . $item->verb);
return true;
}
示例6: prepareCreateMilestoneStream
public function prepareCreateMilestoneStream(SocialStreamItem $streamItem, $includePrivacy = true)
{
$params = FD::registry($streamItem->params);
$milestone = FD::table('Milestone');
$milestone->bind($params->get('milestone'));
// Get the group data
FD::load('event');
$event = new SocialEvent();
$event->bind($params->get('event'));
// Get the actor
$actor = $streamItem->actor;
$app = $this->getApp();
$permalink = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $app->getAlias(), 'milestoneId' => $milestone->id));
$this->set('permalink', $permalink);
$this->set('milestone', $milestone);
$this->set('actor', $actor);
$this->set('event', $event);
$streamItem->title = parent::display('streams/create.milestone.title');
$streamItem->content = parent::display('streams/create.milestone.content');
$streamItem->opengraph->addDescription(JText::sprintf('APP_EVENT_TASKS_STREAM_OPENGRAPH_CREATE_MILESTONE', $streamItem->actor->getName(), $event->getName()));
}
示例7: onPrepareStream
/**
* Prepares the stream item
*
* @since 1.0
* @access public
* @param SocialStreamItem The stream object.
* @param bool Determines if we should respect the privacy
*/
public function onPrepareStream(SocialStreamItem &$item, $includePrivacy = true)
{
if ($item->context !== 'feeds') {
return;
}
// Get app params
$params = $this->getParams();
if (!$params->get('stream_create', true)) {
return;
}
// Get the feed table
$obj = FD::makeObject($item->params);
$feed = $this->getTable('Feed');
$feed->bind($obj);
$actor = $item->actor;
$app = $this->getApp();
$this->set('app', $app);
$this->set('feed', $feed);
$this->set('actor', $actor);
$item->color = '#e67e22';
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
$item->fonticon = 'ies-feed';
$item->label = FD::_('APP_USER_FEED_STREAM_TOOLTIP', true);
$item->title = parent::display('streams/' . $item->verb . '.title');
$item->content = parent::display('streams/' . $item->verb . '.content');
}
示例8: onPrepareStream
/**
* Triggered to prepare the stream item
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function onPrepareStream(SocialStreamItem &$item)
{
// If this is not it's context, we don't want to do anything here.
if ($item->context != 'story') {
return;
}
// Get the event object
$group = $item->getCluster();
if (!$group) {
return;
}
if (!$group->canViewItem()) {
return;
}
// Allow editing of the stream item
$item->editable = $this->my->isSiteAdmin() || $group->isAdmin() || $item->actor->id == $this->my->id;
// Get the actor
$actor = $item->getActor();
// Decorate the stream
$item->fonticon = 'ies-pencil-2';
$item->color = '#6E9545';
$item->label = FD::_('APP_GROUP_STORY_STREAM_TOOLTIP', true);
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
$this->set('group', $group);
$this->set('actor', $actor);
$this->set('stream', $item);
$item->title = parent::display('streams/title.' . $item->verb);
$item->content = parent::display('streams/content.' . $item->verb);
// Apply likes on the stream
$likes = FD::likes();
$likes->get($item->uid, $item->context, $item->verb, SOCIAL_APPS_GROUP_GROUP, $item->uid);
$item->likes = $likes;
// If this update is posted in a group, the comments should be linked to the group item
$comments = FD::comments($item->uid, $item->context, $item->verb, SOCIAL_APPS_GROUP_GROUP, array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item->uid))), $item->uid);
$item->comments = $comments;
return true;
}
示例9: onPrepareStream
/**
* Responsible to generate the stream contents.
*
* @since 1.0
* @access public
* @param object $params A standard object with key / value binding.
*
* @return none
*/
public function onPrepareStream(SocialStreamItem &$item, $includePrivacy = true)
{
if ($item->context != 'friends') {
return;
}
// Determines if the stream should be generated
$params = $this->getParams();
if (!$params->get('stream_friends', true)) {
return;
}
// Get the actor
$actor = $item->actor;
// check if the actor is ESAD profile or not, if yes, we skip the rendering.
if (!$actor->hasCommunityAccess()) {
$item->title = '';
return;
}
$my = FD::user();
$privacy = FD::privacy($my->id);
if ($includePrivacy) {
if (!$privacy->validate('core.view', $item->contextId, 'friends', $item->actor->id)) {
return;
}
}
// Get the context id.
$id = $item->contextId;
// no target. this could be data error. ignore this item.
if (!$item->targets) {
return;
}
// Receiving actor.
$target = $item->targets[0];
// Get the current id.
$id = JRequest::getInt('id');
// Decorate the stream
$item->display = SOCIAL_STREAM_DISPLAY_MINI;
$item->color = '#7AD7EE';
$item->fonticon = 'ies-user';
$item->label = FD::_('APP_USER_FRIENDS_STREAM_TOOLTIP', true);
// Apply likes on the stream
$likes = FD::likes();
$likes->get($item->contextId, $item->context, $item->verb, SOCIAL_APPS_GROUP_USER, $item->uid);
$item->likes = $likes;
$this->set('actor', $actor);
$this->set('target', $target);
$item->title = parent::display('streams/' . $item->verb . '.title');
if ($includePrivacy) {
$item->privacy = $privacy->form($item->contextId, 'friends', $item->actor->id, 'core.view', false, $item->uid);
}
return true;
}
示例10: prepareReadArticleStream
/**
* Prepares the stream item when an article is being read
*
* @since 1.0
* @access public
* @param SocialStreamItem The stream item.
* @return
*/
private function prepareReadArticleStream(&$item)
{
// Load up the article dataset
$article = JTable::getInstance('Content');
$article->load($item->contextId);
// Load up the category dataset
$category = JTable::getInstance('Category');
$category->load($article->catid);
// Get the actor
$actor = $item->actor;
// Get the permalink
$permalink = ContentHelperRoute::getArticleRoute($article->id . ':' . $article->alias, $article->catid . ':' . $category->alias);
// Get the creation date
$date = FD::date($article->created);
// Get the category permalink
$categoryPermalink = ContentHelperRoute::getCategoryRoute($category->id . ':' . $category->alias);
// Get the content
$content = $article->introtext;
if (empty($content)) {
$content = $article->fulltext;
}
$this->set('content', $content);
$this->set('categoryPermalink', $categoryPermalink);
$this->set('date', $date);
$this->set('permalink', $permalink);
$this->set('article', $article);
$this->set('category', $category);
$this->set('actor', $actor);
// Load up the contents now.
$item->title = parent::display('streams/read.title');
$item->content = parent::display('streams/read.content');
}
示例11: onPrepareStream
/**
* Prepares the stream item
*
* @since 1.0
* @access public
* @param SocialStreamItem The stream object.
* @param bool Determines if we should respect the privacy
*/
public function onPrepareStream(SocialStreamItem &$item, $includePrivacy = true)
{
if ($item->context !== 'feeds') {
return;
}
// Get app params
$params = $this->getParams();
if (!$params->get('stream_create', true)) {
return;
}
// Get the feed table
$rss = FD::table('Rss');
$rss->load($item->contextId);
if (!$rss->id || !$item->contextId) {
return;
}
$group = FD::group($item->cluster_id);
$actor = $item->actor;
$app = $this->getApp();
$this->set('app', $app);
$this->set('rss', $rss);
$this->set('actor', $actor);
$this->set('group', $group);
$item->color = '#e67e22';
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
$item->fonticon = 'ies-feed';
$item->label = JText::_('APP_USER_FEED_STREAM_TOOLTIP');
$item->title = parent::display('streams/' . $item->verb . '.title');
$item->content = parent::display('streams/' . $item->verb . '.content');
}
示例12: prepareCreateMilestoneStream
public function prepareCreateMilestoneStream(SocialStreamItem $item, $includePrivacy = true)
{
$params = FD::registry($item->params);
$milestone = FD::table('Milestone');
$milestone->bind($params->get('milestone'));
// Get the group data
FD::load('group');
$group = new SocialGroup();
$group->bind($params->get('group'));
// Get the actor
$actor = $item->actor;
$app = $this->getApp();
$permalink = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias(), 'milestoneId' => $milestone->id));
$this->set('permalink', $permalink);
$this->set('milestone', $milestone);
$this->set('actor', $actor);
$this->set('group', $group);
$item->title = parent::display('streams/create.milestone.title');
$item->content = parent::display('streams/create.milestone.content');
}
示例13: prepareUploadedStream
/**
* Prepares the stream item for new file uploads
*
* @since 1.0
* @access public
* @param SocialStreamItem The stream item.
* @return
*/
private function prepareUploadedStream(&$item)
{
$params = FD::registry($item->params);
// Get the file object
$file = FD::table('File');
$exists = $file->load($params->get('file')->id);
if (!$exists) {
return;
}
// Get the actor
$actor = $item->actor;
$this->set('actor', $actor);
$this->set('file', $file);
$clusterType = '';
if ($item->cluster_id && $item->cluster_type) {
$cluster = FD::cluster($item->cluster_type, $item->cluster_id);
$this->set('cluster', $cluster);
$clusterType = '.' . $item->cluster_type;
}
// Load up the contents now.
$item->title = parent::display('streams/uploaded.title' . $clusterType);
$item->content = parent::display('streams/uploaded.content');
}
示例14: onPrepareStream
/**
* Responsible to generate the stream contents.
*
* @since 1.0
* @access public
* @param object $params A standard object with key / value binding.
*
* @return none
*/
public function onPrepareStream(SocialStreamItem &$item)
{
// Load up the config object
$config = FD::config();
if ($item->context != 'badges' || !$config->get('badges.enabled')) {
return;
}
// Check if the app should be able to generate the stream.
$params = $this->getParams();
if (!$params->get('stream_achieved', true)) {
return;
}
// Get the actor
$actor = $item->actor;
// check if the actor is ESAD profile or not, if yes, we skip the rendering.
if (!$actor->hasCommunityAccess()) {
$item->title = '';
return;
}
// Test if stream item is allowed
if (!$this->onStreamValidatePrivacy($item)) {
return;
}
// Try to get the badge object from the params
$raw = $item->params;
$badge = FD::table('Badge');
$badge->load($item->contextId);
// lets load 3rd party component's language file if this is not a core badge
if ($badge->extension && $badge->extension != 'com_easysocial') {
Foundry::language()->load($badge->extension, JPATH_ROOT);
}
// Set the display mode to be full.
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
$item->color = '#FEBC9D';
$item->fonticon = 'ies-crown';
$item->label = FD::_('APP_USER_BADGES_STREAM_TOOLTIP', true);
// Format the likes for the stream
$likes = FD::likes();
$likes->get($item->contextId, $item->context, $item->verb . '.' . $item->actor->id, SOCIAL_APPS_GROUP_USER, $item->uid);
$item->likes = $likes;
// Apply comments on the stream
$comments = FD::comments($item->contextId, $item->context, $item->verb . '.' . $item->actor->id, SOCIAL_APPS_GROUP_USER, array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item->uid))), $item->uid);
$item->comments = $comments;
$this->set('badge', $badge);
$this->set('actor', $actor);
$item->title = parent::display('streams/' . $item->verb . '.title');
$item->content = parent::display('streams/' . $item->verb . '.content');
return true;
}
示例15: prepareCreateStream
private function prepareCreateStream(SocialStreamItem &$item, SocialGroup $group)
{
// We want a full display for group creation.
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
// Get the actor.
$actor = $item->actor;
$this->set('group', $group);
$this->set('actor', $actor);
$item->title = parent::display('streams/create.title');
$item->content = parent::display('streams/content');
$item->opengraph->addDescription(JText::sprintf('APP_USER_GROUPS_STREAM_CREATED_GROUP', $actor->getName(), $group->getName()));
}