本文整理汇总了PHP中FD::event方法的典型用法代码示例。如果您正苦于以下问题:PHP FD::event方法的具体用法?PHP FD::event怎么用?PHP FD::event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FD
的用法示例。
在下文中一共展示了FD::event方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($item)
{
// Get comment participants
$model = FD::model('Likes');
$users = $model->getLikerIds($item->uid, $item->context_type);
// Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
$users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
list($element, $group, $verb) = explode('.', $item->context_type);
$event = FD::event($item->uid);
$owner = FD::user($item->getParams()->get('owner_id'));
// Verbs
// makeadmin
// going
// notgoing
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_NOTGOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_NOTGOING_PLURAL
if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner->id) {
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_LIKES_YOUR_UPDATE_' . strtoupper($verb), count($users)), $names);
return $item;
}
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_LIKES_USERS_UPDATE_' . strtoupper($verb), count($users)), $names, $owner->getName());
return $item;
}
示例2: isValid
/**
* Validates the permalink.
*
* @author Jason Rey <jasonrey@stackideas.com>
* @since 1.3
* @access public
* @return JSON A jsong encoded string.
*/
public function isValid()
{
// Render the ajax lib.
$ajax = FD::ajax();
// Get the cluster id.
$clusterId = JRequest::getInt('clusterid', 0);
// Init the current alias.
$current = '';
if (!empty($clusterId)) {
$event = FD::event($clusterId);
$current = $event->alias;
}
// Get the provided permalink
$permalink = JRequest::getVar('permalink', '');
// Check if the field is required
if (!$this->field->isRequired() && empty($permalink)) {
return true;
}
// Check if the permalink provided is valid
if (!SocialFieldsEventPermalinkHelper::valid($permalink, $this->params)) {
return $ajax->reject(JText::_('FIELDS_EVENT_PERMALINK_INVALID_PERMALINK'));
}
// Test if permalink exists
if (SocialFieldsEventPermalinkHelper::exists($permalink) && $permalink != $current) {
return $ajax->reject(JText::_('FIELDS_EVENT_PERMALINK_NOT_AVAILABLE'));
}
$text = JText::_('FIELDS_EVENT_PERMALINK_AVAILABLE');
return $ajax->resolve($text);
}
示例3: execute
public function execute(&$item)
{
// Get comment participants
$model = FD::model('Comments');
$users = $model->getParticipants($item->uid, $item->context_type);
// Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
$users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
// When someone likes on the photo that you have uploaded in a event
if ($item->context_type == 'files.event.uploaded') {
$file = FD::table('File');
$file->load($item->uid);
// Get the event
$event = FD::event($file->uid);
// Set the content
if ($file->hasPreview()) {
$item->image = $file->getPreviewURI();
}
// We need to generate the notification message differently for the author of the item and the recipients of the item.
if ($file->user_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$item->title = JText::sprintf(FD::string()->computeNoun('APP_EVENT_FILES_USER_COMMENTED_ON_YOUR_FILE', count($users)), $names);
return $item;
}
// This is for 3rd party viewers
$item->title = JText::sprintf(FD::string()->computeNoun('APP_EVENT_FILES_USER_COMMENTED_ON_USERS_FILE', count($users)), $names, FD::user($file->user_id)->getName());
return;
}
return;
}
示例4: createStream
public function createStream($verb)
{
// Create a new stream item for this discussion
$stream = FD::stream();
// Get the stream template
$tpl = $stream->getTemplate();
// Someone just joined the event
$tpl->setActor($this->created_by, SOCIAL_TYPE_USER);
// Set the params to cache the event data
$registry = FD::registry();
$registry->set('news', $this);
// Set the context
$tpl->setContext($this->id, 'news');
$event = FD::event($this->cluster_id);
// Set the cluster
$tpl->setCluster($this->cluster_id, SOCIAL_TYPE_EVENT, $event->type);
// Set the verb
$tpl->setVerb($verb);
// Set the params
$tpl->setParams($registry);
if ($this->_stream_date) {
$tpl->setDate($this->_stream_date);
}
$tpl->setAccess('core.view');
// Add the stream
$stream->add($tpl);
}
示例5: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($eventId = null, $docType = null)
{
$event = FD::event($eventId);
// Check if the viewer is allowed here.
if (!$event->canViewItem()) {
return $this->redirect($event->getPermalink(false));
}
// Get app params
$params = $this->app->getParams();
$model = FD::model('Discussions');
$options = array('limit' => $params->get('total', 10));
$discussions = $model->getDiscussions($event->id, SOCIAL_TYPE_EVENT, $options);
$pagination = $model->getPagination();
$pagination->setVar('option', 'com_easysocial');
$pagination->setVar('view', 'events');
$pagination->setVar('layout', 'item');
$pagination->setVar('id', $event->getAlias());
$pagination->setVar('appId', $this->app->getAlias());
$this->set('app', $this->app);
$this->set('params', $params);
$this->set('pagination', $pagination);
$this->set('event', $event);
$this->set('discussions', $discussions);
echo parent::display('events/default');
}
示例6: execute
/**
* Processes likes notifications
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function execute(&$item)
{
// Get likes participants
$model = FD::model('Likes');
$users = $model->getLikerIds($item->uid, $item->context_type);
// Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
$users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
// When someone likes on the photo that you have uploaded in a event
if ($item->context_type == 'news.event.create') {
// We do not want to display any content if the person likes a event announcement
$item->content = '';
// Get the news object
$news = FD::table('EventNews');
$news->load($item->uid);
// Get the event from the stream
$event = FD::event($news->cluster_id);
// Set the content
if ($event) {
$item->image = $event->getAvatar();
}
// We need to generate the notification message differently for the author of the item and the recipients of the item.
if ($news->created_by == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
$langString = FD::string()->computeNoun('APP_EVENT_NEWS_USER_LIKES_YOUR_ANNOUNCEMENT', count($users));
$item->title = JText::sprintf($langString, $names, $event->getName());
return $item;
}
// This is for 3rd party viewers
$langString = FD::string()->computeNoun('APP_EVENT_NEWS_USER_LIKES_USER_ANNOUNCEMENT', count($users));
$item->title = JText::sprintf($langString, $names, FD::user($news->created_by)->getName(), $event->getName());
return;
}
return;
}
示例7: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
$event = FD::event($uid);
// Get the article item
$news = FD::table('EventNews');
$news->load($this->input->get('newsId', 0, 'int'));
// Check if the user is really allowed to view this item
if (!$event->canViewItem()) {
return $this->redirect($event->getPermalink(false));
}
// Get the author of the article
$author = FD::user($news->created_by);
// Get the url for the article
$url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $this->app->getAlias(), 'articleId' => $news->id), false);
// Apply comments for the article
$comments = FD::comments($news->id, 'news', 'create', SOCIAL_APPS_GROUP_EVENT, array('url' => $url));
// Apply likes for the article
$likes = FD::likes()->get($news->id, 'news', 'create', SOCIAL_APPS_GROUP_EVENT);
// Set the page title
FD::page()->title($news->get('title'));
// Retrieve the params
$params = $this->app->getParams();
$this->set('app', $this->app);
$this->set('params', $params);
$this->set('event', $event);
$this->set('likes', $likes);
$this->set('comments', $comments);
$this->set('author', $author);
$this->set('news', $news);
echo parent::display('canvas/item');
}
示例8: invite
public function invite()
{
//init variable
$app = JFactory::getApplication();
$log_user = JFactory::getUser($this->plugin->get('user')->id);
$result = new stdClass();
$event_id = $app->input->get('event_id', 0, 'INT');
$target_users = $app->input->get('target_users', null, 'ARRAY');
$user = FD::user($log_user->id);
$event = FD::event($event_id);
$guest = $event->getGuest($log_user);
if (empty($event) || empty($event->id)) {
$result->message = "Event not found";
$result->status = $state;
return $result;
}
if ($event_id) {
foreach ($target_users as $id) {
$guest = $event->getGuest($id);
if (!$guest->isGuest()) {
//invite friend to event
$state = $event->invite($id, $log_user->id);
$result->message = "Invited";
$result->status = $state;
} else {
$result->message = "Guests can not be invited";
$result->status = $state;
}
}
}
return $result;
}
示例9: __construct
public function __construct($id, $type)
{
parent::__construct($id, 'event');
if (!EB::easysocial()->exists()) {
return;
}
$this->event = FD::event($id);
}
示例10: 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;
}
示例11: getValue
/**
* Support for generic getFieldValue('TITLE')
*
* @author Jason Rey <jasonrey@stackideas.com>
* @since 1.3.9
* @access public
* @return SocialFieldValue The value container
*/
public function getValue()
{
$container = $this->getValueContainer();
if ($this->field->type == SOCIAL_TYPE_EVENT && !empty($this->field->uid)) {
$event = FD::event($this->field->uid);
$container->value = $event->getName();
$container->data = $event->title;
}
return $container;
}
示例12: sidebarBottom
/**
* Display user photos on the side bar
*
* @since 1.2
* @access public
* @return
*/
public function sidebarBottom($eventId, $event)
{
$event = FD::event($eventId);
$category = $event->getCategory();
if (!$category->getAcl()->get('photos.enabled', true) || !$event->getParams()->get('photo.albums', true)) {
return;
}
// Get recent albums
$albumsHTML = $this->getAlbums($event);
echo $albumsHTML;
}
示例13: miniEventStatsEnd
/**
* Displays the attendees in mini header
*
* @since 1.3
* @access public
* @param string
* @return
*/
public function miniEventStatsEnd($eventId)
{
$theme = FD::themes();
// Get the event object
$event = FD::event($eventId);
$permalink = FRoute::events(array('layout' => 'item', 'id' => $event->getAlias(), 'appId' => $this->app->getAlias()));
$theme->set('miniheader', true);
$theme->set('permalink', $permalink);
$theme->set('event', $event);
echo $theme->output('themes:/apps/event/guests/widgets/widget.header');
}
示例14: get_event
public function get_event()
{
$app = JFactory::getApplication();
$log_user = $this->plugin->get('user')->id;
$event_id = $app->input->get('event_id', 0, 'INT');
$mapp = new EasySocialApiMappingHelper();
//getting all detail of particular event.
$data = null;
if ($event_id) {
$event[] = FD::event($event_id);
$data = $mapp->mapItem($event, 'event', $log_user);
}
return $data;
}
示例15: execute
public function execute($item)
{
// Get comment participants
$model = FD::model('Comments');
$users = $model->getParticipants($item->uid, $item->context_type);
// Merge to include actor, diff to exclude self, unique to remove dups, and values to reset the index
$users = array_values(array_unique(array_diff(array_merge($users, array($item->actor_id)), array(FD::user()->id))));
// Convert the names to stream-ish
$names = FD::string()->namesToNotifications($users);
// By default content is always empty;
$content = '';
// Only show the content when there is only 1 item
if (count($users) == 1) {
// Legacy fix for prior to 1.2 as there is no content stored.
if (!empty($item->content)) {
$content = JString::substr(strip_tags($item->content), 0, 30);
if (JString::strlen($item->content) > 30) {
$content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
}
}
}
list($element, $group, $verb) = explode('.', $item->context_type);
$item->content = $content;
$guest = FD::table('EventGuest');
$guest->load($item->uid);
$event = FD::event($guest->cluster_id);
$owner = FD::user($item->getParams()->get('owner_id'));
// Verbs
// makeadmin
// going
// notgoing
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_NOTGOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_MAKEADMIN_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_MAKEADMIN_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_GOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_GOING_PLURAL
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_NOTGOING_SINGULAR
// APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_NOTGOING_PLURAL
if ($item->target_type === SOCIAL_TYPE_USER && $item->target_id == $owner->id) {
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_YOUR_UPDATE_' . strtoupper($verb), count($users)), $names);
return $item;
}
$item->title = JText::sprintf(FD::string()->computeNoun('APP_USER_EVENTS_GUESTS_USER_COMMENTED_ON_USERS_UPDATE_' . strtoupper($verb), count($users)), $names, $owner->getName());
return $item;
}