本文整理汇总了PHP中FRoute::stream方法的典型用法代码示例。如果您正苦于以下问题:PHP FRoute::stream方法的具体用法?PHP FRoute::stream怎么用?PHP FRoute::stream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FRoute
的用法示例。
在下文中一共展示了FRoute::stream方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTitle
/**
* Retrieve the title of the stream
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function getTitle()
{
// Get the actors
$actors = $this->item->actors;
// Get the source id
$sourceId = $this->share->uid;
// Load the stream
$stream = FD::table('Stream');
$stream->load($sourceId);
// If stream cannot be loaded, skip this altogether
if (!$stream->id) {
return;
}
// Build the permalink to the stream item
$link = FRoute::stream(array('layout' => 'item', 'id' => $sourceId));
// Get the target user.
$target = FD::user($stream->actor_id);
$actor = $actors[0];
$theme = FD::get('Themes');
$theme->set('actor', $actor);
$theme->set('link', $link);
$theme->set('target', $target);
$title = $theme->output('apps/group/shares/streams/stream/title');
return $title;
}
示例2: display
public function display()
{
// Get the configuration objects
$config = FD::config();
$jConfig = FD::config('joomla');
// Get the stream library
$stream = FD::stream();
$stream->get();
// Get the result in an array form
$result = $stream->toArray();
// Set the document properties
$doc = JFactory::getDocument();
$doc->link = FRoute::dashboard();
FD::page()->title(JText::_('COM_EASYSOCIAL_STREAM_FEED_TITLE'));
$doc->setDescription(JText::sprintf('COM_EASYSOCIAL_STREAM_FEED_DESC', $jConfig->getValue('sitename')));
if ($result) {
$useEmail = $jConfig->getValue('feed_email');
foreach ($result as $row) {
$item = new JFeedItem();
$item->title = $row->title;
$item->link = FRoute::stream(array('id' => $row->uid));
$item->description = $row->content;
$item->date = $row->created->toMySQL();
$item->author = $row->actor->getName();
if ($useEmail != 'none') {
$item->authorEmail = $jConfig->getValue('mailfrom');
if ($useEmail == 'author') {
$item->authorEmail = $row->actor->email;
}
}
$doc->addItem($item);
}
}
}
示例3: create_report
public function create_report()
{
$app = JFactory::getApplication();
$msg = $app->input->get('message', '', 'STRING');
$title = $app->input->get('user_title', '', 'STRING');
$item_id = $app->input->get('itemId', 0, 'INT');
$log_user = $this->plugin->get('user')->id;
$data = array();
$data['message'] = $msg;
$data['uid'] = $item_id;
$data['type'] = 'stream';
$data['title'] = $title;
$data['extension'] = 'com_easysocial';
//build share url use for share post through app
$sharing = FD::get('Sharing', array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item_id, 'external' => true, 'xhtml' => true)), 'display' => 'dialog', 'text' => JText::_('COM_EASYSOCIAL_STREAM_SOCIAL'), 'css' => 'fd-small'));
$url = $sharing->url;
$data['url'] = $url;
// Get the reports model
$model = FD::model('Reports');
// Determine if this user has the permissions to submit reports.
$access = FD::access();
// Determine if this user has exceeded the number of reports that they can submit
$total = $model->getCount(array('created_by' => $log_user));
if ($access->exceeded('reports.limit', $total)) {
$final_result['message'] = "Limit exceeds";
$final_result['status'] = true;
return $final_result;
}
// Create the report
$report = FD::table('Report');
$report->bind($data);
// Set the creator id.
$report->created_by = $log_user;
// Set the default state of the report to new
$report->state = 0;
// Try to store the report.
$state = $report->store();
// If there's an error, throw it
if (!$state) {
$final_result['message'] = "Can't save report";
$final_result['status'] = true;
return $final_result;
}
// @badge: reports.create
// Add badge for the author when a report is created.
$badge = FD::badges();
$badge->log('com_easysocial', 'reports.create', $log_user, JText::_('COM_EASYSOCIAL_REPORTS_BADGE_CREATED_REPORT'));
// @points: reports.create
// Add points for the author when a report is created.
$points = FD::points();
$points->assign('reports.create', 'com_easysocial', $log_user);
// Determine if we should send an email
$config = FD::config();
if ($config->get('reports.notifications.moderators')) {
$report->notify();
}
$final_result['message'] = "Report logged successfully!";
$final_result['status'] = true;
return $final_result;
}
示例4: item
/**
* Responsible to output a single stream item.
*
* @access public
* @return null
*
*/
public function item()
{
// Check for user profile completeness
FD::checkCompleteProfile();
// Get the stream id from the request
$id = JRequest::getInt('id');
if (!$id) {
return JError::raiseError(404, JText::_('COM_EASYSOCIAL_STREAM_INVALID_STREAM_ID'));
}
// Get the current logged in user.
$user = FD::user();
// Retrieve stream
$streamLib = FD::stream();
$stream = $streamLib->getItem($id);
if ($stream === false) {
return JError::raiseError(404, JText::_('COM_EASYSOCIAL_STREAM_CONTENT_NOT_AVAILABLE'));
}
// If the user is not allowed to view this stream, display the appropriate message
if ($stream === true || count($stream) <= 0) {
$streamTable = FD::table('Stream');
$streamTable->load($id);
$type = $streamTable->cluster_type ? $streamTable->cluster_type : SOCIAL_TYPE_USER;
$template = 'site/stream/restricted.' . $type;
$this->set('streamTable', $streamTable);
parent::display($template);
return;
}
// Get the first stream item
$stream = $stream[0];
// Strip off any html tags from the title
$title = strip_tags($stream->title);
// Set the page title
FD::page()->title($title);
// Append opengraph tags
$image = $streamLib->getContentImage($stream);
if ($image) {
$stream->opengraph->addImage($image);
}
// Get the permalink of this stream
$permalink = FRoute::stream(array('id' => $stream->uid, 'layout' => 'item', 'external' => 1));
// Append additional opengraph details
$stream->opengraph->addUrl($permalink);
$stream->opengraph->addType('article');
$stream->opengraph->addTitle(trim($title));
// render the meta tags here.
$stream->opengraph->render();
// Get stream actions
$actions = '';
if ($stream->display == SOCIAL_STREAM_DISPLAY_FULL) {
$actions = $streamLib->getActions($stream);
}
$this->set('actions', $actions);
$this->set('user', $user);
$this->set('stream', $stream);
parent::display('site/stream/item');
return;
}
示例5: onAfterCommentSave
public function onAfterCommentSave($comment)
{
$segments = explode('.', $comment->element);
if (count($segments) !== 3 || $segments[1] !== SOCIAL_TYPE_EVENT) {
return;
}
list($element, $group, $verb) = explode('.', $comment->element);
// Get the actor
$actor = FD::user($comment->created_by);
if ($element === 'events') {
$event = FD::event($comment->uid);
$stream = FD::table('Stream');
$stream->load($comment->stream_id);
$owner = FD::user($stream->actor_id);
// APP_USER_EVENTS_EMAILS_FEATURE_COMMENT_ITEM_SUBJECT
// APP_USER_EVENTS_EMAILS_CREATE_COMMENT_ITEM_SUBJECT
// APP_USER_EVENTS_EMAILS_UPDATE_COMMENT_ITEM_SUBJECT
// APP_USER_EVENTS_EMAILS_FEATURE_COMMENT_INVOLVED_SUBJECT
// APP_USER_EVENTS_EMAILS_CREATE_COMMENT_INVOLVED_SUBJECT
// APP_USER_EVENTS_EMAILS_UPDATE_COMMENT_INVOLVED_SUBJECT
// apps/user/events/feature.comment.item
// apps/user/events/create.comment.item
// apps/user/events/update.comment.item
// apps/user/events/feature.comment.involved
// apps/user/events/create.comment.involved
// apps/user/events/update.comment.involved
$emailOptions = array('title' => 'APP_USER_EVENTS_EMAILS_' . strtoupper($verb) . '_COMMENT_ITEM_SUBJECT', 'template' => 'apps/user/events/' . $verb . '.comment.item', 'permalink' => $stream->getPermalink(true, true), 'actor' => $actor->getName(), 'actorAvatar' => $actor->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $actor->getPermalink(true, true), 'comment' => $comment->comment);
$systemOptions = array('context_type' => $comment->element, 'content' => $comment->comment, 'url' => $stream->getPermalink(false, false, false), 'actor_id' => $comment->created_by, 'uid' => $comment->uid, 'aggregate' => true);
// Notify the owner first
if ($comment->created_by != $owner->id) {
FD::notify('comments.item', array($owner->id), $emailOptions, $systemOptions);
}
// Get a list of recipients to be notified for this stream item
// We exclude the owner of the discussion and the actor of the comment here
$recipients = $this->getStreamNotificationTargets($comment->uid, $element, $group, $verb, array(), array($owner->id, $comment->created_by));
$emailOptions['title'] = 'APP_USER_EVENTS_EMAILS_' . strtoupper($verb) . '_COMMENT_INVOLVED_SUBJECT';
$emailOptions['template'] = 'apps/user/events/' . $verb . '.comment.involved';
// Notify other participating users
FD::notify('comments.involved', $recipients, $emailOptions, $systemOptions);
}
if ($element === 'guests') {
$guest = FD::table('EventGuest');
$guest->load($comment->uid);
$event = FD::event($guest->cluster_id);
$stream = FD::table('Stream');
$stream->load($comment->stream_id);
$owner = FD::user($stream->actor_id);
// APP_USER_EVENTS_GUESTS_EMAILS_MAKEADMIN_COMMENT_ITEM_SUBJECT
// APP_USER_EVENTS_GUESTS_EMAILS_GOING_COMMENT_ITEM_SUBJECT
// APP_USER_EVENTS_GUESTS_EMAILS_NOTGOING_COMMENT_ITEM_SUBJECT
// APP_USER_EVENTS_GUESTS_EMAILS_MAKEADMIN_COMMENT_INVOLVED_SUBJECT
// APP_USER_EVENTS_GUESTS_EMAILS_GOING_COMMENT_INVOLVED_SUBJECT
// APP_USER_EVENTS_GUESTS_EMAILS_NOTGOING_COMMENT_INVOLVED_SUBJECT
// apps/user/events/guest.makeadmin.comment.item
// apps/user/events/guest.going.comment.item
// apps/user/events/guest.notgoing.comment.item
// apps/user/events/guest.makeadmin.comment.involved
// apps/user/events/guest.going.comment.involved
// apps/user/events/guest.notgoing.comment.involved
$emailOptions = array('title' => 'APP_USER_EVENTS_GUESTS_EMAILS_' . strtoupper($verb) . '_COMMENT_ITEM_SUBJECT', 'template' => 'apps/user/events/guest.' . $verb . '.comment.item', 'permalink' => $stream->getPermalink(true, true), 'actor' => $actor->getName(), 'actorAvatar' => $actor->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $actor->getPermalink(true, true), 'comment' => $comment->comment);
$systemOptions = array('context_type' => $comment->element, 'content' => $comment->comment, 'url' => $stream->getPermalink(false, false, false), 'actor_id' => $comment->created_by, 'uid' => $comment->uid, 'aggregate' => true);
// Notify the owner first
if ($comment->created_by != $owner->id) {
FD::notify('comments.item', array($owner->id), $emailOptions, $systemOptions);
}
// Get a list of recipients to be notified for this stream item
// We exclude the owner of the discussion and the actor of the comment here
$recipients = $this->getStreamNotificationTargets($comment->uid, $element, $group, $verb, array(), array($owner->id, $comment->created_by));
$emailOptions['title'] = 'APP_USER_EVENTS_GUESTS_EMAILS_' . strtoupper($verb) . '_COMMENT_INVOLVED_SUBJECT';
$emailOptions['template'] = 'apps/user/events/guest.' . $verb . '.comment.involved';
// Notify other participating users
FD::notify('comments.involved', $recipients, $emailOptions, $systemOptions);
}
if ($element === 'discussions') {
// Uses app/event/discussions onAfterCommentSave logic and language strings since it is the same
$stream = FD::table('Stream');
$stream->load($comment->stream_id);
// Get the discussion object since it's tied to the stream
$discussion = FD::table('Discussion');
$discussion->load($comment->uid);
// APP_EVENT_DISCUSSIONS_EMAILS_CREATE_COMMENT_ITEM_SUBJECT
// APP_EVENT_DISCUSSIONS_EMAILS_CREATE_COMMENT_INVOLVED_SUBJECT
// APP_EVENT_DISCUSSIONS_EMAILS_REPLY_COMMENT_ITEM_SUBJECT
// APP_EVENT_DISCUSSIONS_EMAILS_REPLY_COMMENT_INVOLVED_SUBJECT
// apps/event/discussions/create.comment.item
// apps/event/discussions/create.comment.involved
// apps/event/discussions/reply.comment.item
// apps/event/discussions/reply.comment.involved
$emailOptions = array('title' => 'APP_EVENT_DISCUSSIONS_EMAILS_' . strtoupper($verb) . '_COMMENT_ITEM_SUBJECT', 'template' => 'apps/event/discussions/' . $verb . '.comment.item', 'permalink' => $stream->getPermalink(true, true), 'actor' => $actor->getName(), 'actorAvatar' => $actor->getAvatar(SOCIAL_AVATAR_SQUARE), 'actorLink' => $actor->getPermalink(true, true), 'comment' => $comment->comment);
$systemOptions = array('context_type' => $comment->element, 'content' => $comment->comment, 'url' => $stream->getPermalink(false, false, false), 'actor_id' => $comment->created_by, 'uid' => $comment->uid, 'aggregate' => true);
// Notify the owner first
if ($comment->created_by != $discussion->created_by) {
FD::notify('comments.item', array($discussion->created_by), $emailOptions, $systemOptions);
}
// Get a list of recipients to be notified for this stream item
// We exclude the owner of the discussion and the actor of the comment here
$recipients = $this->getStreamNotificationTargets($comment->uid, $element, $group, $verb, array(), array($discussion->created_by, $comment->created_by));
$emailOptions['title'] = 'APP_EVENT_DISCUSSIONS_EMAILS_' . strtoupper($verb) . '_COMMENT_INVOLVED_SUBJECT';
$emailOptions['template'] = 'apps/event/discussions/' . $verb . '.comment.involved';
// Notify other participating users
//.........这里部分代码省略.........
示例6: 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;
}
示例7: put_data
public function put_data()
{
$app = JFactory::getApplication();
$recep = $app->input->get('recipient', '', 'STRING');
$stream_id = $app->input->get('stream_uid', 0, 'INT');
$msg = $app->input->get('message', '', 'STRING');
$res = new stdClass();
if (!$stream_id) {
$res->success = 0;
$res->message = "Empty stream id not allowed";
}
//create sharing url
$sharing = FD::get('Sharing', array('url' => FRoute::stream(array('layout' => 'item', 'id' => $stream_id, 'external' => true, 'xhtml' => true)), 'display' => 'dialog', 'text' => JText::_('COM_EASYSOCIAL_STREAM_SOCIAL'), 'css' => 'fd-small'));
$tok = base64_encode($sharing->url);
if (is_string($recep)) {
$recep = explode(',', FD::string()->escape($recep));
}
if (is_array($recep)) {
foreach ($recep as &$recipient) {
$recipient = FD::string()->escape($recipient);
if (!JMailHelper::isEmailAddress($recipient)) {
return false;
}
}
}
$msg = FD::string()->escape($msg);
// Check for valid data
if (empty($recep)) {
return false;
}
if (empty($tok)) {
return false;
}
$session = JFactory::getSession();
$config = FD::config();
$limit = $config->get('sharing.email.limit', 0);
$now = FD::date()->toUnix();
$time = $session->get('easysocial.sharing.email.time');
$count = $session->get('easysocial.sharing.email.count');
if (is_null($time)) {
$session->set('easysocial.sharing.email.time', $now);
$time = $now;
}
if (is_null($count)) {
$session->set('easysocial.sharing.email.count', 0);
}
$diff = $now - $time;
if ($diff <= 3600) {
if ($limit > 0 && $count >= $limit) {
return false;
}
$count++;
$session->set('easysocial.sharing.email.count', $count);
} else {
$session->set('easysocial.sharing.email.time', $now);
$session->set('easysocial.sharing.email.count', 1);
}
$library = FD::get('Sharing');
$result = $library->sendLink($recep, $tok, $msg);
$res->success = 1;
$res->message = "share successful";
$res->result = $result;
return $res;
}
示例8: 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 != 'discussions') {
return;
}
// group access checking
$group = FD::group($item->cluster_id);
if (!$group) {
return;
}
if (!$group->canViewItem()) {
return;
}
// Ensure that announcements are enabled for this group
$registry = $group->getParams();
if (!$registry->get('discussions', true)) {
return;
}
// Define standard stream looks
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
$item->color = '#69b598';
$item->fonticon = 'ies-comments';
$item->label = FD::_('COM_EASYSOCIAL_STREAM_CONTEXT_TITLE_DISCUSSIONS_TOOLTIP', true);
$params = $this->getApp()->getParams();
if ($params->get('stream_' . $item->verb, true) == false) {
return;
}
// Do not allow user to repost discussions
$item->repost = false;
// Process likes and comments differently.
$likes = FD::likes();
$likes->get($item->contextId, $item->context, $item->verb, SOCIAL_APPS_GROUP_GROUP, $item->uid);
$item->likes = $likes;
// Apply comments on the stream
$comments = FD::comments($item->contextId, $item->context, $item->verb, SOCIAL_APPS_GROUP_GROUP, array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item->uid))), $item->uid);
$item->comments = $comments;
if ($item->verb == 'create') {
$this->prepareCreateDiscussionStream($item);
}
if ($item->verb == 'reply') {
$this->prepareReplyStream($item);
}
if ($item->verb == 'answered') {
$this->prepareAnsweredStream($item);
}
if ($item->verb == 'lock') {
$this->prepareLockedStream($item);
}
}
示例9: onPrepareStream
/**
* Generates the stream title of event.
*
* @since 1.0
* @access public
* @param object $params A standard object with key / value binding.
*
* @return none
*/
public function onPrepareStream(SocialStreamItem &$stream, $includePrivacy = true)
{
if ($stream->context != 'links') {
return;
}
// event access checking
$event = FD::event($stream->cluster_id);
if (!$event || !$event->canViewItem()) {
return;
}
//get links object, in this case, is the stream_item
$uid = $stream->uid;
$stream->color = '#5580BE';
$stream->fonticon = 'ies-link';
$stream->label = FD::_('APP_EVENT_LINKS_STREAM_TOOLTIP', true);
// Apply likes on the stream
$likes = FD::likes();
$likes->get($stream->uid, $stream->context, $stream->verb, SOCIAL_APPS_GROUP_EVENT, $stream->uid);
$stream->likes = $likes;
// Apply comments on the stream
$comments = FD::comments($stream->uid, $stream->context, $stream->verb, SOCIAL_APPS_GROUP_EVENT, array('url' => FRoute::stream(array('layout' => 'item', 'id' => $stream->uid))), $stream->uid);
$stream->comments = $comments;
// Apply repost on the stream
$stream->repost = FD::get('Repost', $stream->uid, SOCIAL_TYPE_STREAM, SOCIAL_APPS_GROUP_EVENT);
$my = FD::user();
$privacy = FD::privacy($my->id);
if ($includePrivacy && !$privacy->validate('story.view', $uid, SOCIAL_TYPE_LINKS, $stream->actor->id)) {
return;
}
$actor = $stream->actor;
$target = count($stream->targets) > 0 ? $stream->targets[0] : '';
$stream->display = SOCIAL_STREAM_DISPLAY_FULL;
$assets = $stream->getAssets();
if (empty($assets)) {
return;
}
$assets = $assets[0];
$videoHtml = '';
// Retrieve the link that is stored.
$hash = md5($assets->get('link'));
$link = FD::table('Link');
$link->load(array('hash' => $hash));
$linkObj = FD::json()->decode($link->data);
// Determine if there's any embedded object
$oembed = isset($linkObj->oembed) ? $linkObj->oembed : '';
// Get app params
$params = $this->getParams();
$this->set('event', $event);
$this->set('params', $params);
$this->set('oembed', $oembed);
$this->set('assets', $assets);
$this->set('actor', $actor);
$this->set('target', $target);
$this->set('stream', $stream);
$stream->title = parent::display('streams/title.' . $stream->verb);
$stream->preview = parent::display('streams/preview.' . $stream->verb);
return true;
}
示例10: getPermalink
/**
* Returns the stream's permalink
*
* @since 1.0
* @access public
* @param bool Determines if the output should be xhtml encoded.
* @return string The url
*/
public function getPermalink($xhtml = true, $external = false, $sef = true)
{
return FRoute::stream(array('id' => $this->uid, 'layout' => 'item', 'external' => $external, 'sef' => $sef), $xhtml);
}
示例11: prepareCreatedTaskStream
public function prepareCreatedTaskStream(SocialStreamItem $streamItem, $includePrivacy = true)
{
$params = FD::registry($streamItem->params);
// Get the tasks available from the cached data
$items = $params->get('tasks');
$tasks = array();
$taskId = '';
foreach ($items as $item) {
$task = FD::table('Task');
$task->load($item->id);
$tasks[] = $task;
$taskId = $task->id;
}
// Get the milestone
$milestone = FD::table('Milestone');
$milestone->bind($params->get('milestone'));
// Get the group data
FD::load('group');
$group = new SocialGroup();
$group->bind($params->get('group'));
// We need to get the task app for the group
$app = Foundry::table('App');
$app->load(array('element' => 'tasks', 'group' => 'group'));
$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('stream', $streamItem);
$this->set('milestone', $milestone);
$this->set('total', count($tasks));
$this->set('actor', $streamItem->actor);
$this->set('group', $group);
$this->set('tasks', $tasks);
$streamItem->title = parent::display('streams/tasks/create.task.title');
$streamItem->content = parent::display('streams/tasks/create.task.content');
// Append the likes action on the stream
if (!$streamItem->contextIds[0]) {
$likes = Foundry::likes();
$likes->get($taskId, $streamItem->context, $streamItem->verb, SOCIAL_TYPE_GROUP, $streamItem->uid);
$streamItem->likes = $likes;
// Append the comment action on the stream
$comments = Foundry::comments($taskId, $streamItem->context, $streamItem->verb, SOCIAL_TYPE_GROUP, array('url' => FRoute::stream(array('layout' => 'item', 'id' => $streamItem->uid))), $streamItem->uid);
$streamItem->comments = $comments;
}
}
示例12: addFile
/**
* Override parent's implementation as we need to generate the stream
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function addFile($title = null)
{
// Run the parent's logics first
$result = parent::addFile($title);
if ($result instanceof SocialException) {
return $result;
}
// Create a stream item for the groups now
$stream = FD::stream();
$tpl = $stream->getTemplate();
$actor = FD::user();
// this is a cluster stream and it should be viewable in both cluster and user page.
$tpl->setCluster($this->group->id, SOCIAL_TYPE_GROUP, $this->group->type);
// Set the actor
$tpl->setActor($actor->id, SOCIAL_TYPE_USER);
// Set the context
$tpl->setContext($result->id, SOCIAL_TYPE_FILES);
// Set the verb
$tpl->setVerb('uploaded');
$file = FD::table('File');
$file->load($result->id);
// Set the params to cache the group data
$registry = FD::registry();
$registry->set('group', $this->group);
$registry->set('file', $file);
// Set the params to cache the group data
$tpl->setParams($registry);
// since this is a cluster and user stream, we need to call setPublicStream
// so that this stream will display in unity page as well
// This stream should be visible to the public
$tpl->setAccess('core.view');
$streamItem = $stream->add($tpl);
// Prepare the stream permalink
$permalink = FRoute::stream(array('layout' => 'item', 'id' => $streamItem->uid));
// Notify group members when a new file is uploaded
$this->group->notifyMembers('file.uploaded', array('fileId' => $file->id, 'fileName' => $file->name, 'fileSize' => $file->getSize(), 'permalink' => $permalink, 'userId' => $file->user_id));
return $result;
}
示例13: foreach
if (count($items) > 0) {
?>
<?php
foreach ($items as $item) {
?>
<li class="<?php
echo $filter->id == $item->id ? 'active' : '';
?>
"
data-sidebar-item
data-id="<?php
echo $item->id;
?>
"
data-url="<?php
echo FRoute::stream(array('layout' => 'form', 'id' => $item->id));
?>
"
data-title="<?php
echo $this->html('string.escape', $item->title) . ' - ' . JText::_('Filter', true);
?>
"
>
<a href="javascript:void(0);">
<i class="icon-es-aircon-document mr-5"></i> <?php
echo $this->html('string.escape', $item->title);
?>
</a>
</li>
<?php
}
示例14: streamSchema
public function streamSchema($rows, $userid)
{
$result = array();
foreach ($rows as $ky => $row) {
if (isset($row->uid)) {
$item = new streamSimpleSchema();
//new code
// Set the stream title
$item->id = $row->uid;
//$item->title = strip_tags($row->title);
//code changed as request not right way
$item->title = $row->title;
if ($row->type != 'links') {
$item->title = str_replace('href="', 'href="' . JURI::root(), $item->title);
}
$item->type = $row->type;
$item->group = $row->cluster_type;
$item->element_id = $row->contextId;
//
$item->content = $row->content;
//$item->preview = $row->preview;
//hari - code for build video iframe
//check code optimisation
$frame_match = preg_match('/;iframe.*?>/', $row->preview);
if ($frame_match) {
$dom = new DOMDocument();
$dom->loadHTML($row->preview);
foreach ($dom->getElementsByTagName('a') as $node) {
$first = $node->getAttribute('href');
break;
}
if (strstr($first, "youtu.be")) {
$first = preg_replace("/\\s+/", '', $first);
$first = preg_replace("/youtu.be/", "youtube.com/embed", $first);
$abc = $first . "?feature=oembed";
$item->preview = '<div class="video-container"><iframe src="' . $abc . '" frameborder="0" allowfullscreen=""></iframe></div>';
} else {
$df = preg_replace("/\\s+/", '', $first);
$df = preg_replace("/watch\\?v=([a-zA-Z0-9\\]+)([a-zA-Z0-9\\/\\\\?\\&\\;\\%\\=\\.])/i", "embed/\$1 ", $first);
$abc = $df . "?feature=oembed";
$df = preg_replace("/\\s+/", '', $abc);
$item->preview = '<div class="video-container"><iframe src="' . $df . '" frameborder="0" allowfullscreen=""></iframe></div>';
}
} else {
$item->preview = $row->preview;
}
//end
// Set the stream content
if (!empty($item->preview)) {
$item->raw_content_url = $row->preview;
} elseif (!empty($item->content)) {
$item->raw_content_url = $row->content;
}
//code for easyblog / easydisucss share , img path not proper
if (strpos($item->raw_content_url, 'src="//')) {
$item->raw_content_url = str_replace('src="//', 'src="' . 'http://', $item->raw_content_url);
}
if (strpos($item->content, 'src="//')) {
$item->content = str_replace('src="//', 'src="' . 'http://', $item->content);
}
if ($row->type != 'links') {
$item->raw_content_url = str_replace('href="', 'href="' . JURI::root(), $item->raw_content_url);
}
// Set the publish date
$item->published = $row->created->toMySQL();
/*
// Set the generator
$item->generator = new stdClass();
$item->generator->url = JURI::root();
// Set the generator
$item->provider = new stdClass();
$item->provider->url = JURI::root();
*/
// Set the verb
$item->verb = $row->verb;
//create users object
$actors = array();
$user_url = array();
foreach ($row->actors as $actor) {
$user_url[$actor->id] = JURI::root() . FRoute::profile(array('id' => $actor->id, 'layout' => 'item', 'sef' => false));
$actors[] = $this->createUserObj($actor->id);
}
//with share obj users object
//$with_usr = array();
$with_user_url = array();
foreach ($row->with as $actor) {
$withurl = JURI::root() . FRoute::profile(array('id' => $actor->id, 'layout' => 'item', 'sef' => false));
$with_user_url[] = "<a href='" . $withurl . "'>" . $actor->username . "</a>";
//$with_url = $with_url." and ".
//$with_user_url[] = $this->createUserObj($actor->id);
}
$item->with = null;
//to maintain site view for with url
if (!empty($with_user_url)) {
$cnt = sizeof($with_user_url);
$item->with = 'with ' . $with_user_url[0];
for ($i = 0; $i < $cnt - 2; $i++) {
$item->with = $item->with . ', ' . $with_user_url[$i + 1];
}
//.........这里部分代码省略.........
示例15: 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 != SOCIAL_TYPE_FILES) {
return;
}
// if this is a cluster stream, let check if user can view this stream or not.
if ($item->cluster_id && $item->cluster_type) {
$cluster = FD::cluster($item->cluster_type, $item->cluster_id);
if (!$cluster) {
return;
}
if (!$cluster->canViewItem()) {
return;
}
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
if ($item->cluster_type == SOCIAL_TYPE_GROUP) {
$item->color = '#303229';
$item->fonticon = 'ies-users';
$item->label = JText::_('APP_USER_FILES_GROUPS_STREAM_TOOLTIP');
}
if ($item->cluster_type == SOCIAL_TYPE_EVENT) {
$item->color = '#f06050';
$item->fonticon = 'ies-calendar';
$item->label = JText::_('APP_USER_EVENTS_STREAM_TOOLTIP');
}
if ($item->verb == 'uploaded') {
$this->prepareUploadedStream($item);
}
return;
}
// File uploads by user
if (isset($item->contextParams[0])) {
$params = FD::registry($item->contextParams[0]);
$items = $params->get('files');
$total = count($items);
$files = array();
if (!$items) {
return;
}
foreach ($items as $id) {
$file = FD::table('File');
$file->load($id);
$files[] = $file;
}
$plurality = $total > 1 ? '_PLURAL' : '_SINGULAR';
$targets = $item->targets ? $item->targets[0] : false;
$this->set('target', $targets);
$this->set('content', $item->content);
$this->set('plurality', $plurality);
$this->set('total', $total);
$this->set('files', $files);
$this->set('actor', $item->actor);
$item->display = SOCIAL_STREAM_DISPLAY_FULL;
$item->color = '#00B6AD';
$item->fonticon = 'ies-file';
$item->label = JText::_('APP_USER_FILES_STREAM_TOOLTIP');
// Apply likes on the stream
$likes = FD::likes();
$likes->get($item->uid, $item->context, $item->verb, SOCIAL_APPS_GROUP_USER, $item->uid);
$item->likes = $likes;
// Apply comments on the stream
$comments = FD::comments($item->uid, $item->context, $item->verb, SOCIAL_APPS_GROUP_USER, array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item->uid))), $item->uid);
$item->comments = $comments;
$item->title = parent::display('streams/uploaded.title.user');
$item->content = parent::display('streams/uploaded.content.user');
}
}